Page 1 of 1

attach i2c addr & gpio input pin to ar1021_i2c driver

Posted: Sat Oct 31, 2015 1:56 am
by BobKruse
Hi,

I'm testing a carrier board that I designed for the Raspberry Pi 2. (okay, okay, I just pasted in some example circuits so the assembly will do what I need it to.) Along with some other stuff, I have a rtc circuit and a touchscreen circuit connected to the i2c bus. The i2c bus is working because the rtc is keeping time, but I'm having trouble configuring the touchscreen driver.

I searched and discovered that the ar1021_i2c driver is included with the kernel for Jesse. I managed to compile the OS and I can get the OS to admit that there is a driver. It just doesn't work. I can move my finger around on the touch screen and get the IC's irq output to toggle on and off. I can configure and read that irq pin from the command line.

I just can't find a way to enter the i2c address of the ar1021, the gpio pin the irq is connected to, nor the irq address of that gpio pin. I don't know if this is only thing wrong, but it's certainly the next one to work on.

Can anyone point me in the right direction. The kernel docs and device tree docs don't want to discuss specific distributions. I need to know how Raspbian/Jesse does it in the Raspberry Pi 2.

thank you
Bob

Re: attach i2c addr & gpio input pin to ar1021_i2c driver

Posted: Tue Dec 15, 2015 9:09 pm
by BobKruse
~/linux/arch/arm/boot/dts/bcm2709-rpi-2-b.dts now contains a section:
&i2c1 {
pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>;
clock-frequency = <100000>;
[email protected] {
compatible = "microchip,ar1021-i2c";
reg = <0x4d>;
interrupt-parent = <&gpio>;
interrupts = <23 0x8>;
gpios = <&gpio 23 2>;
};
};

compiled with:
sudo dtc -I dts -O dtb -o bcm2709-rpi-2-b.dtb bcm2709-rpi-2-b.dts
and then:
sudo cp bcm2709-rpi-2-b.dtb /boot

/boot/config.txt ends with:
dtoverlay=ar1021_i2c

The one remaining issue is that it isn't loading automatically.
For a work-around I added modprobe ar1021_i2c to the end of /etc/rc.local and that worked.