1
0
Fork 0
Commit Graph

721733 Commits (c799511f3faa004922fba5168a787ee8a75511b0)

Author SHA1 Message Date
Steinar Bakkemo 68e34eecb1 max77818-battery: add init routine for charger init ops and disable chgin by def
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.
2020-10-08 20:41:27 +02:00
Steinar Bakkemo 815f0aad7f max77818-battery/charger: disable chgin (CHGINSEL=0) when max current=0
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.
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig 9f4bdf62aa zero-sugar dts: Set up thermal driver for epd pmic
- Non-critical alert at 49 degrees Celcius
- Critical alert and shutdown at 50 degrees Celsius
- Kernel polling every 30 seconds
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig 89c9055094 zero-sugar config: Enable sy7636a thermal driver 2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig dd6695dbb6 thermal: sy7636a: Add thermal driver for sy7636a
Add thermal driver to enable kernel based polling
and shutdown of device for temperatures out of spec
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig d7cca55383 zero-sugar config: Kernel shutdown at high temperature
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.
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig 0601597e3c zero-sugar config: Remove more unused stuff 2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig edf194bbe9 sy7636a: Delay after disable regulator
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
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig b27c46d143 video: mxsfb: Don't set blank state if enable failed
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.
2020-10-08 20:41:27 +02:00
Steinar Bakkemo fb1f2acfc7 max77818-charger: add support for default_current_limit DT param
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.
2020-10-08 20:41:26 +02:00
Steinar Bakkemo 08c7c3b2eb zero-sugar dts: (max77818) add default current limit (safe value)
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.
2020-10-08 20:41:26 +02:00
Steinar Bakkemo 583e35efdf max77818-battery: fix usb1/usb2 references => chgin/wcin 2020-10-08 20:41:26 +02:00
Steinar Bakkemo a244fdca79 max77818-battery: limit max current to 100 mA for chgin interface
As a protection against pirate accessory charger equipment, the max
charge current is always limited to 100 mA for the chgin interface.
2020-10-08 20:41:26 +02:00
Steinar Bakkemo 6304416131 max77818-battery: add errorhandling/deallocation before exiting probe with error 2020-10-08 20:41:26 +02:00
Steinar Bakkemo bcfc06b15e max77818-battery: aplit up probe to clarify initiation process 2020-10-08 20:41:26 +02:00
Steinar Bakkemo d40f460a8d max77818-battery-utils: add dyn debug indicating lock/unlock during FGCC ops 2020-10-08 20:41:26 +02:00
Steinar Bakkemo 79237edd4e max77818-battery: add support for new usb_safe_max_current DT param
Use new usb_safe_max_current DT param to set default max current during init,
and not hard-coded value of 500 mA.
2020-10-08 20:41:26 +02:00
Steinar Bakkemo 3d7c5dec03 zero-sugar dts: (max77818) add usb_safe_max_current FG param 2020-10-08 20:41:26 +02:00
Steinar Bakkemo 20aabc4eb1 max77818-mfd/battery-utils: fix possible kernel panic on missing ptr 2020-10-08 20:41:26 +02:00
Steinar Bakkemo 89215a876d max77818-battery: minor debug comment fixup 2020-10-08 20:41:26 +02:00
Steinar Bakkemo 1af382239d max77818-battery: fix what seems to be a bug that might cause race during probe
Clear and not set the init_complete flag at the start of probe, before
power supply device is registered.
2020-10-08 20:41:26 +02:00
Steinar Bakkemo e6013dc800 max77818-mfd/battery/charger: move charger IRQ handling to battery driver
- 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)
2020-10-08 20:41:26 +02:00
Steinar Bakkemo f21c4b9ab3 power-supply: add changing and unknown to POWER_SUPPLY_PROP_STATUS_EX
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo de8a5c1952 max77818-utils: add MAX77818_START_NON_FGCC_OP/MAX77818_FINISH_NON_FGCC_OP
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo fa988b33eb max77818-battery/battery-utils: move FGCC handling to new max77818-utils module
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo c97f033c81 max77818-battery: add MAX77818_DO_NON_FGCC_OP macro to standardize FGCC flip ops
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
2020-10-08 20:41:25 +02:00
Steinar Bakkemo 36b8388b08 max77818-battery/charger: replace POGO/USB-C refs with chgin/wcin 2020-10-08 20:41:25 +02:00
Steinar Bakkemo 92bc07308a max77818-charger: add support for setting max current draw for CHGIN/WCIN
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo 8ab4975d96 power-supply: add support for setting max current for USB1/USB2 separately
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo f23dba4f13 max77818-battery: add usb-phy notification handling for dynamic max current adj.
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.
2020-10-08 20:41:25 +02:00
Steinar Bakkemo 8ae4524e0c chipidea-udc: disable static vbus max current defined in kernel gadget config 2020-10-08 20:41:25 +02:00
Steinar Bakkemo 46b4ee5f6b zero-sugar dts: (max77818) enable usb charger detection and add usb-phy refs to max77818 drv 2020-10-08 20:41:25 +02:00
Lars Ivar Miljeteig 15da38e5b2 sy7636a: VCOM sysfs attributes and fix vcom read
- 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)
2020-10-08 20:41:25 +02:00
Lars Ivar Miljeteig 21f6699e77 zero-sugar dts: Control SDOE and GDOE as gpios
- Set up fixed regulators for SDOE and GDOE
- MUX LCD1_DATA16 and LCD1_DATA22 as gpios
- Set up SDOE as lcd2-supply in LCDIF
- Set GDOE as always on
2020-10-08 20:41:25 +02:00
Lars Ivar Miljeteig b255585a90 video: mxsfb: Add support for second lcd supply
Searches device tree for lcd2-supply
2020-10-08 20:41:25 +02:00
Lars Ivar Miljeteig 95219396d6 sy7636a-regulator: Set on delay times 0ms 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 44d3feb048 zero-sugar dts: Setup pictrl for EPD PMIC 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 7876084d33 sy7636a-regulator: Add mutex, remove i2c-pgood, reduce timeout
- 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
2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 29e61876d2 sy7636-regulator: PGOOD gpio wait loop in regulator_enable
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.
2020-10-08 20:41:24 +02:00
Steinar Bakkemo d222246bc0 sy7636a regulator: add wait loop in enable op checking pwr_good before returning
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.
2020-10-08 20:41:24 +02:00
Steinar Bakkemo 5a7b2a5d2c zero-sugar dts: Fix misleading comments
WCIN and CHGIN swapped + typo
2020-10-08 20:41:24 +02:00
Eirik Schultz b287997c17 zero-sugar: dts: Remove prototype from model name 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 1cbd264407 max77818-charger: Fix warning on debug output 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 63408b013c input evdev: Fix ktime_t pointer confusion 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig c938cca235 zero-sugar config: Add Resleep lock 2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig 4609272411 PM: Don't sleep for 10 seconds after wakeup
Add a mutex lock that prevents returning to sleep within
10 seconds of wake up
2020-10-08 20:41:24 +02:00
Lars Ivar Miljeteig e753c5f29b Revert "touch: put touch into sleep when digitizer is in scanning"
This reverts commit 95f5a6b816857ad5b607a1be25cb41ce7c4ff4b2.

Caused a two second delay before the touch screen would
work after using the pen. Disturbed the gestures.
2020-10-08 20:41:24 +02:00
Steinar Bakkemo e0641b5c1d max77818-charger: add dynamic debug to output read raw charge state GPIOs 2020-10-08 20:41:24 +02:00
Steinar Bakkemo 61408e240c max77818-charger: add pm_ops in order to switch/reset pinctrl state after LPSR
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.
2020-10-08 20:41:23 +02:00
Steinar Bakkemo a105a67547 max77818-charger: fix related to reading charger_mode in FGCC mode
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".
2020-10-08 20:41:23 +02:00