-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
I'm building a power management board for the RPI that controls the power to the RPI via software controls. Power on, power off, reboot, power on at a certain time, etc... The board is connected to the RPI via i2c.
During my tinkering, I've found a few issues with the i2c-bcm2708 driver. I've cleaned it up some and if I decide to publish it I was wondering if it would be better to publish it here or talk to Eric Anholt about sending it upstream. I saw very few differences between the downstream and upstream driver. I have absolutely no interest in trying to distribute a third i2c driver...
Here are the issues.
-
- In 4.8, the clocks are adjusted via cprman. It appears the clocks change a bit over time due to dynamic adjustment. Since the driver only computes the divider at boot time, it is often wrong.
The workaround I did was to recompute the driver on each bus transaction(not in the IRQ handler). This seems to fix things.
- If the driver is called through a power off handler very late in the shutdown sequence, the drive will hang do to the fact that the kernel completion mechanism and jiffies counter is shutdown.
I worked around this by switching to a polling mechanism of the i2c registers after the driver shutdown call is made. This seems to work even very late in the shutdown sequence.
- The tout register is computed incorrectly. Since it's integer arithmetic, it always computes to 0 which means no timeout.