Operations done during FG driver initiation which address the charger driver is
collected in new init routine, which now reads initial status information required
to be shadowed in the FG driver (status_ex) and disables the chgin interface by
default.
When charger driver receives a request to set max current for the chgin
interface to 0, the CHGINSEL bit is set to 0 to disable the interface.
When it receives a request to set a non-zero max current for the chgin
interface, the CHGINSEL bit is reset to 1 to re-enable the interface.
When the FG driver receives a notification about a connection change
for the chgin interface, it set the max current for the chgin interface
to 0 (i.e turning it off) through the charger driver.
Let the kernel trigger an emergency power off when
a thermal driver reports critical temperature.
Set the timeout to 10 seconds, so that user space
can try to shutdown cleanly.
Delay for ~35ms after disabling the regulator,
to allow power ramp down to go undisturbed
Also prolong timeout of enable function to
500ms, in an attempt to recover from a bad
state where the PMIC does not report pgood
Check if lcd interface enable was a success before
setting current blank state. This fixes a bug where
the pan function failes when waiting for an interrupt,
when the driver believes the display is unblanked when
in fact it is not.
Also user space applications that call ioctl to do
blanking will be notified when the blanking failed.
During driver init, the default safe value is set rather than the max possible
input current, which might draw too much from a normal USB host not capable of
supplying extended charge current.
Add new default_current_limit param in DT.
Formerly used input_current_limit_chgin and input_current_limit_wcin params
given in DT is now used as an absolute max input current limit, in the new
dynamic max current adjustment scheme.
- Do initiation of the charger irq regmap in the MFD driver while disabling FGCC
- Initiate charger interrupts in battery driver while disabling FGCC
- Add new charger irq handler in battery driver requesting status_ex
property from charger driver while disabling FGCC
(enabling separate status for chgin/wcin)
POWER_SUPPLY_PROP_STATUS_EX_CHANGING and POWER_SUPPLY_PROP_STATUS_EX_UNKNOWN
is added to the set of defined values for the power supply status_ex property.
This is required to indicate to userspace that an interrupt has occured,
and that the connection state is changing, and if the new connection state
could not be read, the status is unknown.
In order to do a set of operations in sequence while disabling FGCC,
two macros are defined to start by disabling FGCC mode end finish by
re-enabling FGCC mode, while ensuring that the operation is not interrupted
by another similar sequence by applying the same lock as used in the
MAX77818_DO_NON_FGCC_OP macro when starting the operation and releasing
the lock when finishin the opration.
In order for the FGCC flag to be flipped from modules/drivers external to the
max77818-battery driver, the FGCC enable/disable routine and corresponding
macro doing a non-FGCC operation by flipping the FGCC bit to disable FGCC,
do the operation and re-enable FGCC is moved to an external module max77818-utils.
All operations performed by charger driver which require FGCC mode to be disabled
in order for the driver to be able to communicate with the charger device
basically do the following which now are done with the MAX77818_DO_NON_FGCC_OP
macro:
Disable FGCC
Do required operation
Re-enable FGCC
The POWER_SUPPLY_PROP_CURRENT_MAX is used to set max current draw on CHGIN,
and the new POWER_SUPPLY_PROP_CURRENT_MAX2 (added to power-supply core for
this purpose) is used to set max current draw on WCIN.
In order for the MAX77818 driver to be able to set the max current separately
for the two VBUS lines, a new property was added (POWER_SUPPLY_PROP_CURRENT_MAX2),
enabling POWER_SUPPLY_PROP_CURRENT_MAX to configure USB1 max current draw and
POWER_SUPPLY_PROP_CURRENT_MAX2 to configure USB2 max current respectively.
The max77818-charger driver is used to set updated max current on given
interface, flipping the FGCC bit appropriately to enable charger device config
temporarily.
- Remove duplicate code for reading and writing vcom voltage
- Don't interrupt resume command if vcom not set
- Add sysfs attribute for setting vcom runtime (HACK)
- Make regulator microvolts return microvolts (was millivolts)
- Remove i2c based PGOOD usage to simplify code
- Reduce timeout value to 100ms
- Add mutex locking for enable/disable, so they don't confuse each other
- Register GPIO before regulator, to avoid race
In order to reduce the overhead as much as possible in the wait loop, the
PGOOD GPIO is used if given in devicetree. If not, the wait loop reads the
FAULT FLAG register to obtain the PGOOD status.
In order to make sure that all the rails are valid from the EPD PMIC when
sending new frames to the EPD, a wait loop has been introduced in the
regulator enable op waiting max 500 ms for PWR GOOD signal from EPD PMIC
before returning from the enable op.
The lcdif driver can then check the return code from the regulator_enable
call and if good, all the EPD power rails are ready.
This reverts commit 95f5a6b816857ad5b607a1be25cb41ce7c4ff4b2.
Caused a two second delay before the touch screen would
work after using the pen. Disturbed the gestures.
When going into LPSR sleep, the power is taken from the GPIO bank used for the
charge state GPIOs.
When returning from LPSR sleep, the GPIO pinctrl state has to be re-initialized
in order to enable the internal pull-up.
As the GPIOs are used as inputs and no other initialization is done during the
initial probe/init of the driver, no further action is required.
Add support for recognizing all expected read back charger_mode values.
Remove unwanted side-effect causing charger_mode to be written when
unrecognized value is read back.
When reading back charger_mode and the batery is (nearly) full,
the read back charger_mode from the charger device is not necessarily the same
as the written value due to internal states being triggered by current state
if charge. A mode 0x05 (Charger) written might yield a read back value of 0x04,
which is ok when the capacity is 100% but still an indication that the charger_mode
is set to "Charger".
Also when writing mode 0x00 (Off), the read back value might yield 0x01..0x03,
which has to be accepted as "Off".