From: Olliver Schinagl <oliver@schinagl.nl>
This patch adds a bit-banging gpio PWM driver. It makes use of hrtimers,
to allow nano-second resolution, though it obviously strongly depends on
the switching speed of the gpio pins, hrtimer and system load.
Each pwm node can have 1 or more "pwm-gpio" entries, which will be
treated as pwm's as part of a pwm chip.
Change-Id: Idd42bf6d79f8ce52275a15965b02af470f28da7c
Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
If the nvram variable is corrupted in a way that multiplying it by 1000 causes an integer overflow and wraps around to a number within or below the sanity check bounds, the check fails and capacity is reported incorrectly.
Change the sanity check calculation to not multiply the variable read from the rk817 nvram, preventing the overflow and resulting in all corrupt capacity values being detected.
Signed-off-by: Alexander Warnecke <awarnecke002@hotmail.com>
Just raise the interrupt. This avoids undervoltage shutdowns when
unplugging the USB PSU from USB keyboard. IP5209 stop supplying power
to VOUT during transition from pass-through mode until VOUT boost
is enabled. (about 30ms on the oscilloscope)
Somehow RK818 doesn't like this when EN_VABT_LOW_SHUT_DOWN is enabled
and PMIC shuts down. Emergency shutdown is implemented in keyboard
power manager driver.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
When the phone boots for the first time, we only want to react to
changes in charger power supply max current after the USB power supply
type detection finishes. This allows us to keep the limit set by
the bootloader, until we know better.
This is part of the workaround for Pinephone Pro boot loops on low battery.
The other part is bootloader raising the input current limit to 2A.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
PMIC does averaging, driver does averaging on top of that averaging,
and it's just too much averaging, and the speed suffers.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
The BSP driver is still used, but there is now a one device handling
the battery/charger properties, which should confuse the userspace
less. This also makes writing a power manager for the keyboard easier.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
It was bizarre anyway. Framebuffer is barely used on Linux anyway,
so this is not a great way to check for system inactivity.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
For now this driver is just meant to watch Type-C power supply
and apply current limits to RK818, to not overload the Type-C
partner.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
No longer use flexfb, fbtft_device that is deprecated since kernel 5.4.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Iebd014360f90eab5210722102d54c6169be5e28e
No longer use flexfb, fbtft_device that is deprecated since kernel 5.4.
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
Change-Id: Iae252c64b91b2eabe97eb3aace12d7c4b98801c5