I am experimenting with linux device drivers. I'm attempting to build an OV2680 driver for my laptop, a Lenovo Miix 510. On that platform the sensor sits behind an INT3472 PMIC, and accessing the driver requires controlling the GPIO pins of the INT3472. The INT3472 has a driver, and a corresponding MFD Driver which didn't work out of the box but which I have altered to work (my laptop's ACPI tables don't define an I2cSerialBus2 for the INT3472, so I just had to add an ic2_device_id
table and create the i2c device with echo INT3472 0x48 | sudo tee /sys/bus/i2c/devices/i2c-7/new_device
- this creates a gpiochip1
with the 10 GPIO lanes defined in the GPIO driver, so it seems to be working.
I can set and get values for those pins in a terminal using the tools libgpiod provides. For example sudo gpioset gpiochip1 1 1
sets lane 1 high.
My question is; what is the correct way to control the 10 GPIO pins provided by the INT3472 in my camera driver? I need, for example, to be able to pull a pin low/high to trigger the camera's software standby. I guess the obvious answer is "use libgpiod", but if that's the case, how do I identify the correct "gpiochipN" file in /dev
to open, given there's two INT3470's plus the main gpiochip0 in my laptop.
gpiod_get_index()
inside elixir.bootlin.com/linux/latest/source/drivers/mfd/…tps68470_probe()
. This is how to get this right. In some (rare or broken) cases it might be that current way is plausible. – 0andriytps68470_probe()
function to get those GPIOs and turn them on when the function's called (i.e. at boot I think) – Dan Scally