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).
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.
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.
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.
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
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.
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.
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).
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.
Fix devicetree bug (params not being written as expected)
- New JEITA config parameters were configured with incorrect DT property name,
and were thus reset to default or written as 0 depending on driver version.
Optional debug output when parameter is written.
Warning if parameter is not given.
Warning if paraeter is given, but value is not expected format (not u16).
Add support for required extra parameters in devicetree:
TAlrtTh
TAlrtTh2
JEITA_Curr
JEITA_Volt
ChargeState0..7
Set decent default parameters required for smart charge:
Enable FGCC (CONFIG register)
Set T1=disabled (TAlrtTh2 register)
Set T2=10 deg (TAlrtTh register)
Set T3=40 deg (TAlrtTh register)
Set T4=50 deg (TAlrtTh2 register)
Set JEITA_Curr = 50%/100%/81.25%
Set JEITA_Volt = 4.15V/4.2V/4.15V
Add ChargeState0..7 to be adjusted later if required (use default values)
The touchscreen firmware is not loaded when the
file system is not ready. This patch will make
the cyttsp5 driver wait 8 seconds before looking
for the firmware file.
When digitizer is in scanning (pen is on screen), touch can be put into
sleep state to save power, and then be waken up when pen leaves screen.
The implementation is to have digitizer interrupt handler actively
notifies touch driver that digitizer is in scanning. The notifier
callback in touch driver will detect the first call which indicates the
begin of digitizer scanning, and then it puts touch into sleep. And
every time the callback gets invoked, it resets a timer until notifier
stops calling. In that case, the timer will timeout, and it indicates
that digitizer stops scanning and touch will be woken up and back to
work.
As the procedure of putting touch device into sleep and waking-up
involves I2C data transfer which can sleep, it cannot be done in an
interrupt context, so a work is created for that.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
To support system wake-up from 'standby' sleep via single tapping with
sensed touch data, we need to distinguish suspend type between 'mem' and
'standby', and only puts touch device into sleep for 'mem' sleep. It's
basically a rewriting of suspend/resume hooks, including:
- Drop easy-wake gesture handling, as we do not support it.
- Deal with pinctrl state, touch sleep and IRQ disabling only in case
of 'mem' sleep.
- Enable touch as a system wake-up source in case of 'standby' sleep.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
In standby sleep, system PMIC BD71815 will go into SUSPEND mode. Let's
turn off those power rails unneeded in SUSPEND mode to save power.
Note: VDD_3V3, LDO1_3V3 and LDO5_1V8 need to be retained, as we want
to wake up system from standby via touch, digitizer and wifi.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
It enables WoWLAN support by adding WIFI_HOST_WAKE interrupt pin and
'wakeup-source' property for SDIO interface.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
For WoWLAN testing purpose, let's add keep-power-in-suspend for wifi
SDIO interface, so that WLAN power will be retained during 'standby'
sleep.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
To support system suspend during idle, we define 'standy' as sleep
without LPSR, while 'mem' as LPSR sleep. In this case, DT property
"fsl,enable-lpsr" is not needed any more, as lpsr_enabled should always
be true to support 'mem' sleep.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
To support system suspend during idle, we need to wake up system via
digitizer. With this change, we can disable/enable the wakeup at
run-time as below.
$ echo disabled >| /sys/bus/i2c/devices/0-0009/power/wakeup
$ echo enabled >| /sys/bus/i2c/devices/0-0009/power/wakeup
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
It enables option TOUCHSCREEN_CYPRESS_CYTTSP5_MANUAL_TTCONFIG_UPGRADE
to support CYTTSP5 firmware upgrade via sysfs. The command sequence
is like below.
$ echo 1 >| /sys/bus/i2c/devices/2-0024/manual_upgrade
$ echo 1 >| /sys/class/firmware/cyttsp5_fw_manual_upgrade/loading
$ cat xxx.bin >| /sys/class/firmware/cyttsp5_fw_manual_upgrade/data
$ echo 0 >| /sys/class/firmware/cyttsp5_fw_manual_upgrade/loading
The last command will take quite a few seconds to finish.
Note: The SY7636A and MEMTEST options are moved around as a result
of savedefconfig. They do not bring any effective changes.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The firmware upgrade testing discovers that 200ms CY_HID_OUTPUT_TIMEOUT
is not good enough, and causes suspend scanning call in
cyttsp5_get_ic_crc_() fail. Let's increase it to 1000ms as per vendor's
suggestion.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The default 500ms ON_TIME is too long, and thus causes a slow reaction
on power key wake-up. Let's change it to 50ms to get a faster reaction.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The following peripherals are not used on reMarkable device.
- Messaging Unit (MU)
- APBH-Bridge-DMA
- Cryptographic Acceleration and Assurance Module (CAAM)
Let's disable them, so that Linux kernel driver will not probe these
devices and turn on their clocks.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
MAX77818 battery presence STATUS bit is not working on our device for
some reason unknown yet. We are working around the issue here by reading
temperature register, in which a negative value indicates absence of
battery.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
The memory size should be 1G rather than 2G. It explodes after we have
DDRC configuration fixed in plugin, in case that we launch kernel image
with fastboot where the memory size in device tree gets passed to
kernel.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Read tGain/tOFF/tCurve from DT during driver init.
Note:
FG/battery driver has to re-init the device for changes to occur on
already configured devices, and this is normally only done right after
initial power-on with un-configured device.
A solution for this is however under development, which will make sure
that selected FG parameters are validated during each boot.
Aen bit of CONFIG register needs to be set for enabling alert on
fuel-gauge outputs like low SOC interrupt. This is a missing piece from
the original low battery alert commit.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
LDO_DVREF should be on during LPSR sleep, as it provides the reference
voltage to LPDDR3. So let's keep it on for LPSR state.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Suspend code will check this 'fsl,enable-lpsr' to determine if it needs
to go into LPSR mode for sleep.
Because WiFi driver doesn't support suspend with power shutdown, we need
to remove WiFi module in sleep and reinstall it when system wakes up.
In this case, property 'keep-power-in-suspend' needs to be dropped to
get MMC stack be aware of power losing in LPSR sleep. The command
sequence looks like:
$ rmmod brcmfmac
$ echo mem >| /sys/power/state
system suspends, and wakes up
$ insmod brcmfmac.ko
$ dhcpcd wlan0
WiFi should be back to work then.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>