1
0
Fork 0
Commit Graph

721743 Commits (683461ccfa42d408ec924abafa1ac397bd2c4796)

Author SHA1 Message Date
Steinar Bakkemo f7da2a0c99 dtc: fix issue caused by GCC 10.x defaulting to -fno-common
After changing from -fcommon which was the default in earlier gcc
releases, the dtc native build failed due to multiple declarations
of the form 'YYLTYPE yylloc'. Two of the declarations were removed,
which fixed the problem.
2020-10-08 20:41:28 +02:00
Lars Ivar Miljeteig 6d5938be1f otgcontrol: Fix race condition at OTG enable
Quickfix.

The ci_hdrc crashes if the DR mode is set to HOST while
it is interpreting the "set MODE bits to 0xf" state.

Possible chip errata, where the ci_hdrc has to be
powered on and off to work again.

Fixed by adding a delay of 300-400ms between enabling
OTG power out and setting USB mode to HOST mode.

NOTE: This should be further investigated, as a
delay of 300-400ms in kernel code is A LOT.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 4fdb9ac163 max77818-battery: do initial max current adj. during boot (after other init)
Due to the normal FG driver init configuring FGCC to be enabled during its normal
run, where all custom params configured in DT are verified and restored to the
original value if changed since last boot, charger driver sync has to be done
after completion of normal init.

This is now done in a separate worker which waits for the other init to complete
using a simple completion obj.

Also, unlock mutex at early return errors.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo d5cc3519ad max77818-battery: fix initial status_ex read bug
The status_ex is read during driver initiation, but the local shadow
variable was not updated, causing the status_ex to be "not connected"
even if the device was powered on with USB-C charger connected.max77818-battery: fix initial status_ex read bug
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 9a2e04baae max77818-charger: remove warnings due to failed read from device
Failed read from device is likely to occur when the charger driver
properties are read directly from the charger driver and not via
the FG driver which makes sure the FGCC mode is turned off before
trying to access the charger device.

The warnings generated clutters the journal, and cause suspicion that
the driver or device is not working properly.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 78e41b3c97 zero-sugar dtb: remove pogo one-wire internal PU 2020-10-08 20:41:27 +02:00
Steinar Bakkemo 64a4289cf6 usbotg-bsp: improve vbus glitch detection/primary charger detection
Due to the USB-C connector introducing a slight delay between the detection of
a stable VBUS and the data lines making contact, the delay after setting the
USB PHY into charger detection mode before reading the detection status had to
be increased from 1 ms to 500 ms, enabling the user to use 500 ms to insert the
USB-C connector fully into the device and still get a positive CDP/DCP port
detection, enabling higher charge current where this is offered.
2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig 6c59ac3a8d thermal: sy7636a: Wait longer for thermistor power 2020-10-08 20:41:27 +02:00
Lars Ivar Miljeteig c7044600e8 thermal: sy7636a: Wait for thermistor power 2020-10-08 20:41:27 +02:00
Steinar Bakkemo ddbca62a46 max77818-battery-utils: add output of op_descr in START_FGCC_OP/FINISH_FGCC_OP 2020-10-08 20:41:27 +02:00
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