1
0
Fork 0
Commit Graph

721756 Commits (redonkable)

Author SHA1 Message Date
Lars Ivar Miljeteig 1e8212c029 net: brcm80211: Remove debug info 2020-10-08 20:41:29 +02:00
Lars Ivar Miljeteig d157e849b7 reset: gpio: Remove debug info 2020-10-08 20:41:29 +02:00
Lars Ivar Miljeteig 9b7a56e594 touch: cyttsp5: Write debug when trk_id is bad
The parade touch controller support people want a
debug dump when the bad trk_id error occurs.
2020-10-08 20:41:29 +02:00
Lars Ivar Miljeteig a357ab051e power: max77818_battery: Handle errors
- Handle return code for regmap_write & regmap_read
- Rename some functions with misleading names
  i.e "verify" when it actually writes, differentiate
  between reading params from chip or device tree, etc
- Don't clear POR bit if writing data failed
- Set init complete even if "write custom params" fail,
  as it will eventually time out and continue init anyhow
2020-10-08 20:41:29 +02:00
Steinar Bakkemo ba81965560 max77818-battery: add boot-time verification for critical FG params 2020-10-08 20:41:29 +02:00
bigbay 82e4a06372 sy7636a: Fix possible out of bounds access to array (#110)
Use ARRAY_SIZE macro in out of bounds check
2020-10-08 20:41:29 +02:00
Lars Ivar Miljeteig b4cce203e0 zero-sugar config: Add thermal gov user space support 2020-10-08 20:41:28 +02:00
Lars Ivar Miljeteig 2c8b8ef501 sy7636a regulator: Add mutex lock for is_enabled
This prevents a screen freeze bug.

If the regulator checks the on-off bit at the same
time as the thermal driver, the regulator_enable
call will conclude that the regulator is already
active.

Then, when the thermal driver is done checking the
temperature, it will set the PMIC back to the state
it was when it started, which is off.

In this state, the regulator driver believes the
PMIC is on, and the thermal has turned it off.

This can be considered a bit of a quick fix, to make
minimal changes to the kernel at this point. The
correct way to solve this would be to make the
sy7636a_thermal driver use the regulator network, or
moving all register access code into the sy7636a mfd
and use a mutex from there.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 430a418051 max77818-charger: force false chgin connection status
The max77818 charger device reports a valid connection status for
the chgin interface, regardless of whether it has been disabled or not
with chgin_sel.

The charging status is thus not reported correct, as the device is not
charging from the pogo interface even if the connection state indicates
otherweiz.

In order to report a correct state to userspace, the charger connection
state is now always reported to be false for the chgin interface (as
this is always turned off as soon as the connection state changes)
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 618b6d5751 max77818-battery: add locking option for all custom params
In order to be able to synchronize initial register write with other
drivers possibly accessing the same registers during init, an option
to apply a mutex lock (defined at the mfd level) is introduced.

The config register is also given a requirement to be locked, as this
register holds the FGCC bit which is the main cause of this option.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 31b0d48e3e otgcontrol: disable initial device connection procedure
Make initial sensing of device connection valid only for authenticated deviced.
Disable authenticated device connection precedure until finally implemented (TBD)
2020-10-08 20:41:28 +02:00
Steinar Bakkemo ea9cb1b6b8 max77818-battery: skip default verify/write for all custom params
Due to uncertainty related to how safe it is to verify each custom
param during every boot, set the skip_verify flag for every custom param except
for the config register which is verified against current DT and reset if changed
for some reason since last boot.

This ensures that if an operation performed through the max77818 charger driver
was aborted by a reboot for instance, and the FGCC bit remained 0, it will be
restored to 1 after a reboot.
2020-10-08 20:41:28 +02:00
Steinar Bakkemo 19d33b0ba8 max77818-battery: add skip flag to learn-cfg custom param 2020-10-08 20:41:28 +02:00
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