LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 08-06-2020, 01:14 PM   #1
arktrin
LQ Newbie
 
Registered: Aug 2020
Posts: 2

Rep: Reputation: Disabled
ADS7846 linux driver with mediatek devices


Hello!
Trying to add touchscreen ( compatible = "ti,ads7846"; ) to my MT7621 based router through SPI, but it looks like OpenWrt (kernel 5.4.52) doesn't want to route interrupt to ads7846 driver (https://github.com/torvalds/linux/bl...reen/ads7846.c). I've got these lines in device tree:
Code:
....
#include "mt7621.dtsi"
....

    xpt2046reg: xpt2046_reg {
        compatible = "regulator-fixed";
        regulator-name = "xpt2046_vcc";
        regulator-min-microvolt = <3300000>;
        regulator-max-microvolt = <3300000>;
        regulator-always-on;
.....
&spi0 {
    status = "okay";

....

    spidev3@3 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "ralink,mt7621-spi";
        reg = <3>;
        spi-max-frequency = <250000>;
        status = "disabled";
    };
	
    xpt2046@4 {
        compatible = "ti,ads7846";
        reg = <3>;
        vcc-supply = <&xpt2046reg>;
        spi-max-frequency = <250000>;

        interrupt-parent = <&gpio>;
        interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
        pendown-gpio = <&gpio 18 GPIO_ACTIVE_LOW>;
        ti,x-min = /bits/ 16 <0x0>;
        ti,x-max = /bits/ 16 <0x0fff>;
        ti,y-min = /bits/ 16 <0x0>;
        ti,y-max = /bits/ 16 <0x0fff>;
        ti,x-plate-ohms = /bits/ 16 <180>;
        ti,pressure-max = /bits/ 16 <255>;
        ti,debounce-max = /bits/ 16 <10>;
        ti,debounce-tol = /bits/ 16 <5>;
        ti,debounce-rep = /bits/ 16 <1>;
        ti,keep-vref-on = <1>;
        ti,settle-delay-usec = /bits/ 16 <150>;

        wakeup-source;
        status = "okay";
    };
};
Interrupt is successfully registered in the system:
Code:
ads7846 spi0.3: touchscreen, irq 27
Driver is loaded:
Code:
input: ADS7846 Touchscreen as /devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi0/spi0.3/input/input0
Event is located in /dev/input/event0. MISO, MOSI, SCK and CS are working on spi0.3 and touchscreen driver is replying something meaningful during driver probe/initialization. There is corresponding line in /proc/interrupts:

Code:
27:          0          0          0          0  1e000600.gpio  18  ads7846
GPIO18 is pulled up externally through 10k resistor. But when touchscreen driver chip pulls down this gpio (pendown) nothing is happening in /proc/interrupts. ads7846_hard_irq() and ads7846_irq() functions from linux driver not even used.

If I remove any reference of GPIO18 in device tree - GPIO18 can be used freely as interrupt source through echo falling > /sys/class/gpio/gpio490/edge, that is clearly seen in /proc/interrupts.

Code:
# cat /proc/bus/input/devices 
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="ADS7846 Touchscreen"
P: Phys=spi0.3/input0
S: Sysfs=/devices/platform/1e000000.palmbus/1e000b00.spi/spi_master/spi0/spi0.3/input/input0
U: Uniq=
H: Handlers=event0 
B: PROP=0
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=1000003
How else can I debug this issue?
 
Old 08-07-2020, 06:39 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 15,996

Rep: Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275Reputation: 2275
I've just finished searching for drivers for the Ralink 5370 wifi chip, and found that Mediatek and Ralink are strongly linked. I very much doubt if any of their devices are in the kernel at all. Here'e the thread https://www.linuxquestions.org/quest...er-4175679811/

The one driver I found was 2012 vintage done for a 2.6 kernel. It's a compile outside source job. .No firmware. I don't like the bus/product/version all being 0000.

I'd try a 2k2 instead of a 10k pullup and see if the interrupt behaves better. That's the only idea I have for you.
 
Old 08-07-2020, 01:00 PM   #3
arktrin
LQ Newbie
 
Registered: Aug 2020
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Mediatek and Ralink are strongly linked
Well ... "On 5 May 2011, Ralink was acquired by MediaTek".

Quote:
2k2 instead of a 10k pullup
But I already said that GPIO can be used as interrupt through gpiolib - "GPIO18 can be used freely as interrupt source through echo falling > /sys/class/gpio/gpio490/edge, that is clearly seen in /proc/interrupts". Anyway, tried it, didn't help as expected .
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
0e8d:7115 MediaTek Inc driver Net_Spy Linux - Networking 2 12-09-2015 03:42 AM
LXer: MediaTek Announces Open-Source IoT Development Platform That Runs OpenWrt Linux LXer Syndicated Linux News 0 12-04-2015 03:42 AM
LXer: MediaTek fires up new ARM Cortex-A17 LXer Syndicated Linux News 0 02-12-2014 12:40 PM
LXer: MediaTek mints Big.Little quad-core SoC, octa-core coming LXer Syndicated Linux News 0 07-31-2013 12:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 09:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration