I have found that I can control them by bypassing the driver and directly writing to the chip registers. The RK805 is connected to i2c-1 with address 0x18 and the two GPIOs can be controlled by the two lowest bits in register 0x52.
They are low-active, so to turn them both off write 3 to the register (binary 0b00000011):
and to turn them on set the corresponding bit to 0, so by writing any of the numbers 0, 1, 2, 3 to that register both LEDs can be controlled.
But this is not the proper way to do it!
I had to use -f because the rk808 driver is already using that bus address! I'm interfering with its function in a very dangerous way by issuing commands directly to the chip behind the driver's back. And it is the power supply chip, I guess I could wreak havok by accidentally changing one of the output voltages, I would rather not mess around on the i2c of this chip directly.
Is here somebody who knows enough about the rk808 driver to tell me the proper way to control these two bits in the out register of the chip or whether they are already registered in the sysfs as a gpio under some other obscure name that I did not find? Where should I look next?
there is also /sys/bus/platform/devices/rk8xx-gpio which belongs to this driver but I have no idea how it works and how to use it.
writing 0b11 to this register to turn them off will even survive a warm reboot! The LEDs are still off!
So neither the rk808 driver nor anything else will even try to initialize them, they don't seem to be controlled by anything at the moment, despite the entries in the device tree.
They are low-active, so to turn them both off write 3 to the register (binary 0b00000011):
Code:
i2cset -f -y 1 0x18 0x52 3
and to turn them on set the corresponding bit to 0, so by writing any of the numbers 0, 1, 2, 3 to that register both LEDs can be controlled.
But this is not the proper way to do it!
I had to use -f because the rk808 driver is already using that bus address! I'm interfering with its function in a very dangerous way by issuing commands directly to the chip behind the driver's back. And it is the power supply chip, I guess I could wreak havok by accidentally changing one of the output voltages, I would rather not mess around on the i2c of this chip directly.
Is here somebody who knows enough about the rk808 driver to tell me the proper way to control these two bits in the out register of the chip or whether they are already registered in the sysfs as a gpio under some other obscure name that I did not find? Where should I look next?
there is also /sys/bus/platform/devices/rk8xx-gpio which belongs to this driver but I have no idea how it works and how to use it.
writing 0b11 to this register to turn them off will even survive a warm reboot! The LEDs are still off!
So neither the rk808 driver nor anything else will even try to initialize them, they don't seem to be controlled by anything at the moment, despite the entries in the device tree.