I’m trying to get a Maxim 17048 fuel gauge working on Hikey960. Working back from the error to the question:
[ 7.004368] modelgauge 0-0036: IC production version 0x0012
[ 7.021556] genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq 289
[ 7.029534] modelgauge 0-0036: failed to request irq 289
The strange is, as far as I know, I’m not requesting irq 289. Looking at the spreadsheet that has been useful for me in getting other devices going:
We’re in Linux (Android) therefore irq 289 is SPI2_CS_N, so it makes sense that the request fails. But I wasn’t planning on using that pin (12) on the LS port for my fuel gauge interrupt. Instead I am using pin 24 (GPIO_209 aka GPIO_B). From this thread:
I learned that I can calculate the interrupt port like this:
parent = gpio / 8 ; 209 / 8 = 26
port = gpio % 8 ; 209 % 8 = 1
So I have this in my device tree node:
modelgauge@36 {
compatible = "maxim,max17048";
reg = <0x36>;
interrupt-parent = <&gpio26>;
interrupts = <1 0x2>;
Now the question is, why does this translate into Linux gpio 289? From the spreadsheet I assume it would be gpio 297? I have similar code in drivers and dts for a Himax touchscreen controller which works perfectly fine.
– edit –
hmm I changed the DT into interrupt-parent = <&gpio27>; and now it maps to Linux GPIO 297. Still not sure why the caluclation doesn apply. Anyway IRQ request still fails. I’m not going to spend too much time trying to fix this as I am not actually planning to use this part and driver, I just happened to have it on a breakout. Without the IRQ it looks to be doing something, which was the goal of this hack