How to use Max14830 as I2c with Dragonboard820c

Hi, I am trying to do similar to this post but on the 820c and with i2c:

I can get to probe the device, but I’m not sure what to put in for values in the device tree properties for:
interrupt-parent = <&gpio12>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;

Where does 7 for an IRQ come from? I’ve got one Gpio 21 connected to the IRQ pin on the MAX14380. Can anyone explain the above two properties to a device tree newbie?

Thanks,
Kim

interrupt-parent is actually the interrupt controller the IRQ is part of, in your case this is the main apq8016 gpio controller (msmgpio).

interrupt-parent = <&msmgpio>;

interrupts is a list of one or more interrupt indexes, int your case you are connected to the pin 21 of the gpio/interrupt controller.

interrupts = <21 IRQ_TYPE_EDGE_FALLING>;

Note: In apq8016 dtsi, gpio 21 is also used as a LED gpio, if you want to use it as IRQ, you need to disable this node (apq8016-sbc.dtsi - arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi - Linux source code (v4.19-rc7) - Bootlin)

Hi Loic,
I am using the apq8096-db820c.dtsi for dragonboard 820c and I don’t see gpio21 being used. Maybe your comment about the LED was for the 410? For the dragonboard 820c do I need to add a node for gpio21 so that msmgpio is still the interrupt-parent?

Thanks,
Kim

Yes you’re right, so GPIO_21 is avalable and you can use msmgpio as parent.

Hi Loic,
I got the driver working and can read/write all 4 uarts! Thanks for the help!
kim

The driver in the kernel only seems to have support for SPI.

Was your MAX14830 truly working over I2C?

Did you have to add driver code to do I2C?

Thanks!

Chris

Hi Chris,

Yes, we had to add driver code to get the MAX14380 chip to work over i2c. And it does work with a custom board using the snapdragon 820.

Thanks,
Kim

Did you publish that commit anywhere?

Hi Chris,

No, we did not create a patch anywhere. Our version of the driver code (max310x.c) is messy and probably a bit hacked up. I could send you a copy? If you have a better understanding of it, maybe you could help clean it up and sent it back? We had issues with the naming conventions of the serial ports. We have two max14380 chips and the ports on the second chip were named “ttyMAX10”, “ttyMAX11”…and we couldn’t get the second chips to have the names we wanted. We wanted the second chip to have names “ttyMAX04”, “ttyMAX05”… for the 4 serial ports.
Thanks,
Kim

@kimbo Hi! I am also trying to use the Linux driver for the MAX14830 over I2C on a custom board. Can you please send me the driver code and device tree binding so I can try to use this chip over I2C? I mention that I have found this patch that adds I2C support to the max310x driver, but I don’t know the device tree binding in order to use it.