1
0
Fork 0
Commit Graph

721638 Commits (460927241136e46ffe80df30347dfc1adbc87b94)

Author SHA1 Message Date
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
Steinar Bakkemo 3e7f312291 max77818-battery: improve FGCC enable/disable (configurable delay)
Add post_fgcc_change_delay_us module parameter with default value
100000 us.

Move delay into FGCC enable/disable function.
Add delay both after FGCC enable and disable.
2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig d1d18f2cd4 Revert "bd7181x: Leave LDO1_3V3 enabled in LPSR sleep"
This reverts commit 84432a0dacd9d97390b24ed6426ef0ec0fcaa430.
2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig 5b723bf8ae bd7181x: Leave LDO1_3V3 enabled in LPSR sleep 2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig ee94fa5883 bd71815: Enable 32k out in cmos mode 2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig b888700e21 pm-imx7: LPSR: Button ON_TIME & GPIO wakeup tweaks
Differentiate SNVS button click time for LPSR sleep
and power on:
Power off -> On - 500ms
LPSR Sleep -> Wake-up - 50ms

Turn off GPIO wake-up hack when not in LPSR sleep
2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig 6e3da14a60 Revert "snvs_pwrkey: shorten ON_TIME to get a faster reaction on wake-up"
This reverts commit cc7fffa6e20c6b90568f745c51e6f33e0b91c694.

Code is moved to pm-imx7.

We want to have 500ms ON_TIME for power on, and
50ms ON_TIME from LPSR sleep
2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig 0f5a981ae8 Revert "poweroff: fix issue of poweroff turning into reset"
This reverts commit 297b2161b23d9c2f2a573674d217bca1d9cd33df.

Made long click reboot the device. Code is moved to pm-imx7
2020-10-08 20:41:23 +02:00
Lars Ivar Miljeteig a6387eca21 Revert "touchscreen: cyttsp5: Do FW update as delayed work"
This reverts commit a5410575ebbde14b55f66af5782779f31e14efe7.

Caused some partial updates, and touch didn't work for a couple of
seconds after boot when waiting for firmware update.
2020-10-08 20:41:23 +02:00
Steinar Bakkemo 03c05f6d75 max77818-battery: fix mixed up lock/write/unlock => unlock/write/lock 2020-10-08 20:41:23 +02:00
Steinar Bakkemo 15bc7fa6cd max77818-battery: set 'is_learn_value' for iavg-min register 2020-10-08 20:41:23 +02:00
Thomas Ingebretsen 6118256eba wacom_i2c: use BARREL_SWITCH_2 as BTN_STYLUS2 instead of INVERT. 2020-10-08 20:41:23 +02:00
Steinar Bakkemo adb89d3867 max77818-battery: set 'is_learn_value' flag for dpacc and dqacc registers
As the dpacc and dqacc registers change over time, these are skipped in addition
to other learned values to prevent them from being overwritten on every boot.
2020-10-08 20:41:22 +02:00
Steinar Bakkemo 889eb9a32b max77818-battery: add unlocking of extra config registers in verify_custom_patems
Unlock and re-lock of extra config registers were separated into common
functions to be used both in initial write_custom_params and new verify/write
routine.

Verification of the RelaxCfg register was also added to the new verify/write routine.
2020-10-08 20:41:22 +02:00
Steinar Bakkemo 96de964264 max77818-battery: enable default config-update mode (verify)
- Set 'verify' as the default config-update mode
- Add flag in max77818_of_property (is_learned_value) in order to prevent config
  values given in DT as initial values that is expected to change from being
  reset when device reboots and params are synced to curent DT.
2020-10-08 20:41:22 +02:00
Steinar Bakkemo 390c586d4e max77818-battery: add synchronized access to init_done flag
The power_supply get_property handler is protected by a flag indicating
when the config init/update thread is complete, but this flag was not
synchronized.

In addition to this, the flag is now cleared before the driver is registered
as a power_supply device to properly tell the power_supply initiation to wait.
2020-10-08 20:41:22 +02:00
Steinar Bakkemo 2334273c25 max77818-battery: add config_update type 'verify'
If max77818.config_update=verify, and POR is not set, all custom params will
be verified against current DT configuration and updated if required.
2020-10-08 20:41:22 +02:00
Steinar Bakkemo 4b6c4e8daa max77818-battery: add FG config update params
Add module parameter enabling complete FG config rewrite from DT or
only custom params update from DT depending on what is required.

The driver may be given either "max77818_battery.config_update=complete" or
"max77818_battery.config_update=partial" respectively through the kernel commandline
from u-boot.

Versioning scheme may then be implemented outside of the kernel if required,
and which update to apply to a given device will then be chosen by update scripts.
2020-10-08 20:41:22 +02:00
Lars Ivar Miljeteig 6ec71e28f8 zero-sugar config: Remove BRCM_TRACING
This tracing is not useful at the moment,
and clutters our logs.
2020-10-08 20:41:22 +02:00
Shawn Guo f28a1381b4 Add a dts for wifi calibration
It adds a separate dts/dtb for wifi calibration, which works with BCMDHD
wifi driver instead of BRCMFMAC.  Comparing to mainstream zero-sugar.dts,
it adds 'wifi-host' property for SDIO slot and deletes bcrmf child node
from there, as the node is only required by BRCMFMAC driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Shawn Guo 32f0dd7a25 Switch wifi driver to BCMDHD for wifi-calibration defconfig
It switches wifi driver from BRCMFMAC to BCMDHD for wifi-calibration
defconfig.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Shawn Guo 152f66d4a0 Copy zero-sugar_defconfig as zero-sugar-wifi-cal_defconfig
To make the change history clear, let's copy zero-sugar_defconfig as
zero-sugar-wifi-cal_defconfig with zero change first, and make necessary
changes on top of it later.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Shawn Guo be845f8d23 Remove wifi callibration dts and defconfig
As the first step of syncing up with mainstream dts and defconfig, let's
remove the outdated versions and add updated ones back later.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Shawn Guo 91c7b32118 wacom: fix ghost power on VDD_3V3_DIGITIZER
It operates on GPIO DIGITIZER_PWR_EN via regulator API to turn off
VDD_3V3_DIGITIZER for 'mem' sleep.  While at it, let's call pinctrl
functions and wacom_setup_device() for 'mem' sleep only, as they are not
required for 'standby' sleep.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Shawn Guo cb78912da0 poweroff: fix issue of poweroff turning into reset
To get GPIO1/2 LPSR wakeup work, we have commit 57673afb8d27 ("zero-sugar:
init SNVS for LPSR GPIO wakeup") in U-Boot to set bit 7 of SNVS register
0x48.  Unfortunately, it brings us a side effect, that is setting TOP
(Turn off System Power) bit of SNVS LPCR register results in an immeidate
reset instead of poweroff.  To work around the issue, let's clear the bit
right before setting TOP bit for powering system off.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:41:22 +02:00
Patrick Hisni Brataas f1dfb46cc0 Revert "dts/zero-sugar: enable Wifi wake-up support"
This reverts commit ef2623787555bc6f076f90b17b4fc4ed78b3f80f.

Revert this until we receive WiFi firmware that supports WoWLAN
2020-10-08 20:41:21 +02:00
Steinar Bakkemo d30c2ef150 otgcontrol: change charger_mode property string to comply with power_supply_sysfs.c
OTG_supply -> OTG Supply
2020-10-08 20:41:21 +02:00
Steinar Bakkemo caeba76d7f otgcontrol: read current GPIO state directly from sysfs attribute_show method
In order to read the current GPIO state regardless of the current controller
mode, and thus regardless of whether the GPIO irq is enabled, a direct
read of the raw GPIO state is done directly from the sysfs attribute_show
method.

Required synchronization was added to the access method to prevent race
if the attribute is read at the same time the irq handler is running.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo a0d2974708 otgcontrol: adapt otg1_chargermode property to take both int/string as input
When reading the otg1_chargermode property, a list of valid strings are
returned.

Valid enum values may be given when writing to the otg1_chargermode
property, in addition to one of the strings returned when reading
the property (Charger, OTG_supply, Off).
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 6cd088d951 otgcontrol: change vbus-supply from charger to FG driver
Due to FGCC mode requiring charger control through FG driver,
otgcontrol now references the FG driver as vbus-supply.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo fbd41b2b95 max77818-battery: bugfix that was missed before merge (FGCC support) 2020-10-08 20:41:21 +02:00
Steinar Bakkemo bee9783e9d max77818-battery/charger: fix IRQ init issue (charger)
Fix flaw in probe causing IRQ init to be performed in FGCC mode and not when
FGCC is disabled (which is the intension).

Simplify FGCC re-enable code during FG driver init.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 98c52ea4e0 zero-sugar dts: (max77818) FG param cleanup
Remove confusing comments in FG params (DT)
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 8834246346 max77818-charger: added errorhandling to CURRENT_MAX property
The current_max property was not read correctly in FGCC mode,
due to missing errorhandling when charger device is not accessible
over the I2C bus.

An error message is now returned instead of a false value when FGCC
mode is active.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 3357a12e75 max77818-charger: do actual read from device when getting charger_mode
To make sure the actual charger_mode is returned, an actual read is
done refreshing the shadow value when charger_mode property is read.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 439c77cbae max77818-mfd/charger: add charger regmap ERR_OR_NULL check + 'property get' bugfix
The charger regmap should not be NULL, but to be sure that the regmap is never used
if NULL or ERR_PTR, a check for this has been introduced wherever this is used in
the charger driver.

A check is also done in the MFD driver before trying to initialize the charger irq.

In addition to this, a bug causing a stack dump during boot was found, causing
the powersupply subsystem's initial calls to get_property to fail due to the
mutex was created too late in the probe routine.
2020-10-08 20:41:21 +02:00
Steinar Bakkemo 064253197a max77818-battery: add missing mutex init 2020-10-08 20:41:21 +02:00
Steinar Bakkemo 9a79902db6 max77818-battery/charger: changes as requested in PR
MAX77818 MFD driver:
- Let drvdata->regmap_chg remain NULL if not initialized,
  for simple validity check
- Remove no longer used label

MAX77818 charger driver:
- Indicate error if chgin_stat_gpio state/wcin_stat_gpio states cannot be read
- Let chgin_stat_gpio/wcin_stat_gpio remain NULL if not initialized,
  for simple validity check
- Define MODE_ALL_OFF = 0x00 (POWER_SUPPLY_MODE_ALL_OFF)
- Add initial charger_mode read from device during initialization,
  and set to Charger if unknown mode is read
  (not corresponding to defined power supply charger modes)
- charger_update routine no longer returns a value

MAX77818 battery/FG driver:
- Define CONFIG_FGCC_BIT
- Add mutex to drvdata
- Improve variable naming
- Add mutex locking to charger_mode get/set functions
- Add proper FGCC mode restoration check in charger_mode get function
- Add warnings if regmap read/writes fails during custom param init
2020-10-08 20:41:20 +02:00
Steinar Bakkemo 1ee8bde61f max77818-battery/charger: add support for charger_mode readback through FG drv 2020-10-08 20:41:20 +02:00
Steinar Bakkemo 68b21489b5 max77818-battery: add charger_mode property to be forwarded to charger
charger_mode property was added to FG driver in order to disable
FGCC mode before forwarding the property change request to the charger driver,
before turning the FGCC mode back on after successfully changing the charger mode.
2020-10-08 20:41:20 +02:00
Steinar Bakkemo 636c297ace max77818-mfd/charger: add support for 'zombie' max77818 charger driver
Add support for "zombie" max77818-charger driver with GPIO based con-stat
- The max77818-battery and the max77818-charger drivers are now loaded regardless
of the failed communication with the charger device over I2C.

Adapt status_ex property to use GPIO based connection status when charger
device is offline from the I2C bus.
2020-10-08 20:41:20 +02:00
Steinar Bakkemo e0e5797ba1 zero-sugar dts: (max77818) en. FGCC/dis. SAFEOUT reg./en. GPIO based chg status
Tune JEITA configuration (mainly) and other settings, FGCC mode seems to work
as expected.

Disable regulator definition for SAFEOUT signals, thus leave the SAFEOUT
config as default, following CHGIN charger presence.

Add required pinctrl config for GPIO based connection status read from charger
device when this is offline from the I2C bus (100K PU).
2020-10-08 20:41:20 +02:00
Steinar Bakkemo bf1959d8ef max77818-battery: fix "comma+space" issue in custom_param_list (PR comment) 2020-10-08 20:41:20 +02:00
Steinar Bakkemo bff78ec9e3 zero-sugar dts: (max77818) fix DT property name errors
Remove double maxim prefix.
2020-10-08 20:41:20 +02:00
Steinar Bakkemo efb95553a4 max77818-battery: improve custom property retrieval from DT
Parameters are verified, and not-given parameters now results in
a warning and default values are kept instead of writing 0 for all
properties not found in DT.
2020-10-08 20:41:20 +02:00
Steinar Bakkemo 898a9919bf max77818-battery: fix ordering of new smart charge register definitions
Correct FG parameter ordering (by register offset)
2020-10-08 20:41:20 +02:00