1
0
Fork 0
Commit Graph

721756 Commits (redonkable)

Author SHA1 Message Date
Steinar Bakkemo ef355be946 power-supply: add POWER_SUPPLY_PROP_STATUS_EX property with enumarated values 2020-10-08 20:41:17 +02:00
thomasing e5bbdbe1d5 video: maxsfb: Set LCDIF cur pointer in mxsfb_set_par. This is to be able to control which frame is run as the first frame after unblanking. (#41) 2020-10-08 20:41:17 +02:00
Steinar Bakkemo ad88355c92 otgcontrol: add device connection state check when entering unauthorized mode
In order to prevent need for disconnection and reconnection of the QR code
reader during typical test-runs in factory, a check for current connection
state is added when entering unauthorized mode.

In addition, the device disconnect procedure setting charger/USB OTG back
to charging/device mode is performed when entering authorized mode, in which
device connection/disconnection detection is currently disabled.
2020-10-08 20:41:13 +02:00
Steinar Bakkemo e27d817e3c otgcontrol: add debug hack disabling OTG detection in default state
Due to the authorized mode (default state) not being implemented
properly yet with filtering and such, a concern regarding short
while in a bag or such was discussed.

As a hot fix, the device connection (POGO ID pin) is deactivated
in default mode until this has been properly implemented, but
enabled when explicitly entering unauthorized mode from the
test-application in order to use the QR code reader.
2020-10-08 20:34:32 +02:00
Steinar Bakkemo 2edbefedce otgcontrol: fix init problem causing uninit. default sysfs controllermode shadow value
When reading the otg controller mode from sysfs before changing it, returns 0.
This is not correct, as the default mode is 1.

As the controllermode is changed, the sysfs attribute shadow value is also changed.
Now also during fsm init.
2020-10-08 20:07:16 +02:00
Shawn Guo 71ccb636fb max77818_battery: add SOC alert event support
The MAX77818 SOC max/min alert is being used to report 1% SOC change.
It's not such an useful event.  We need to use the alert to report low
battery event to user space.  This patch drops 1% SOC reporting and uses
the max/min alert to report battery SOC event to user space by calling
sysfs_notify() on corresponding sysfs entry.

It disables max SOC alert and set min SOC alert as 10% by default, but
the value can be updated by writing desired value into

 /sys/class/power_supply/max77818_battery/capacity_alert_min
 /sys/class/power_supply/max77818_battery/capacity_alert_max

Saying we have capacity_alert_min be 10, once SOC goes to 9, INTR_SOCMIN
will be triggered, and the user space program polling capacity_alert_min
sysfs entry will return successfully.

While dropping max77818_set_soc_threshold(), .suspend/.resume hooks are
removed altogether, as enable_irq_wake() has been handled by MAX77818
mfd driver, and disable_irq() has been handled by PM core anyway.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:16 +02:00
Shawn Guo ac13f89f6f max77818_battery: drop some unhelpful properties
Right now, max77818_battery driver already has 31 sysfs entries
(and thus uevents for power_supply class), which is reaching the
maximum number 32 (see UEVENT_NUM_ENVP in include/linux/kobject.h).
So when trying to add more properties, we will get the following
kernel WARNING in calling power_supply_uevent() -> add_uevent_var().

  WARNING: CPU: 1 PID: 93 at lib/kobject_uevent.c:568 add_uevent_var+0xa4/0xcc
  add_uevent_var: too many keys

Let's drop some unhelpful properties which do not reflect any hardware
states to leave room for other new useful properties.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:16 +02:00
Shawn Guo bd3f8efec8 mfd: bd7181x: set LPSR_MODE bit only when system sleeps
Bit LPSR_MODE should be cleared only when system is going to sleep in
LPSR state.  Other than that, the bit should be set for system to get
powered off in SNVS state.

All BUCKs and LDOs will be turned off in SNVS state, only except LDO3.
So we need to change the default setting to turn off LDO3 in SNVS state.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Lars Ivar Miljeteig 0542f9eae9 max77818: Don't disable charging when unplugged
Keep charging on at all times, to avoid brick faults

If a device has low battery, and you:
1. Unplugg chargers
2. Set mode to "Charger" in sysfs
3. Shutdown the device

It is bricked until the battery is plugged in and out.

This should fix that.
2020-10-08 20:07:15 +02:00
Shawn Guo cd93f18a0a max77818-charger: fix bug on CHG_CNFG registers setting
The ffs() is for finding the first set bit, not what we want - the last
set bit of a bit mask.  Actually, the whole ffs/fls can go wrong very
easily depending on what the bit mask is.  Let's explicitly define the
needed bit shift and kill ffs/fls use completely, so that we fix
incorrect setting on register CNFG_01, CNFG_03 and CNFG_04.

While at it, simply the writing to CNFG_04 by using regmap_write()
rather than regmap_update_bits(), since we need to update all fields
of the register, i.e. CHG_CV_PRM and MINVSYS.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Steinar Bakkemo 78a2099765 zero-sugar dts: (max77818) adapt CHARGER_INTB config according to HW change
Change pin mux from GPIO6.22 => GPIO1.7
Change internal PU => 100K, disable hysteresis, drivestrength and slewrate config
Change interrupt config accordingly for max77818 driver
2020-10-08 20:07:15 +02:00
Shawn Guo 4fdeebcb42 mfd: bd7181x: disable unused functions to save power
As suggested by Bent, it disables unused/unneeded BD71815 functions,
like RTC, charger, battery, LED and so on, to save a bit more power.

Since we are now doing more BD71815 hardware initialization than LPSR
related configuration, function bd7181x_lpsr_init() gets renamed to
bd7181x_hw_init().

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo e1f06de912 dts/zero-sugar: decrease delay of digitizer power control to 100 ms
As confirmed by Bent, 100 ms delay should be good enough for digitizer
power control.  So let's decrease it to 100 ms to avoid unnecessary
longer delay.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo 0d48c715fe dts/zero-sugar: add regulator for digitizer and touch
Rather than relying on U-Boot to turn on power to digitizer and touch,
let's add regulator for the devices to control power via GPIOs.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo 069e8a2682 touch: cyttsp5: use regulator to control power
VDD_3V3_TOUCH power to cyttsp5 touch is controlled by GPIO TOUCH_PWR_EN.
Rather than relying on U-Boot to initialize the power, let's use
regulator to control it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo 192cf86226 touch: wacom: use regulator to control power
VDD_3V3_DIGITIZER power to digitizer is controlled by GPIO
DIGITIZER_PWR_EN.  Rather than relying on U-Boot to initialize the
power, let's use regulator to control it.

While at it, fix the memory leak on wac_i2c allocation in failure of
wacom_query_device() and other calls.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Lars Ivar Miljeteig 2bafa4cefa zero-sugar dts: Disable touchscreen blanking 2020-10-08 20:07:15 +02:00
Lars Ivar Miljeteig bd16c306a1 cyttsp5: fb blanking configurable in devtree
Add an optional  device tree parameter
  cy,fb_blanking_disabled

This parameter controls the blanking notifier.
If the parameter is set in the device tree,
the cyttsp5 device will NOT change its state
according to the state of the framebuffer
device.
2020-10-08 20:07:15 +02:00
Shawn Guo 13e4384e40 dts/zero-sugar: add POWEROFF_ON_SLEEP flag for cyttsp5 core
With LPSR sleep support coming, cyttsp5 will lose power completely
during system sleeps.  To get cyttsp5 driver support the power state
better, we should add CY_CORE_FLAG_POWEROFF_ON_SLEEP flag for cyttsp5
core device.  See enum cyttsp5_core_platform_flags in
include/linux/platform_data/cyttsp5.h for full list of flags.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo e042fa35d7 dts/zero-sugar: add sleep pinctrl state for LPSR support
During LPSR sleep, all IOMUXC settings will be lost because of power
down of the block.  To restore the IOMUXC settings in LPSR wake-up,
drivers will select 'sleep' state pinctrl in suspend, and later select
'default' state pinctrl when system resumes.  To cope with that, we need
to have both pinctrl states in device tree.  A simple approach would be
have both states point to the 'default' pinctrl, since IOMUXC block will
be completely powered down in LPSR mode anyway.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:15 +02:00
Shawn Guo f23c92f91c touch: wacom: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo 42829d020a touch: cyttsp5: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo bc5893e9a1 otgcontrol: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo 3e76f5ee27 mfd: bd7181x: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo 30c876388c mmc: pwrseq_simple: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored from
power losing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo b1f2d89267 pm-imx7: disable watchdog powerdown when waking up from LPSR
In wake-up from LPSR, all watchdog powerdown gets enabled due to the
re-powering of SoC.  We need to temporarily enable root and CCGR clock
of each watchdog and clear powerdown bit.  Otherwise, system will reset
after 16 seconds.  This watchdog initialization has been done by U-Boot
for the first time boot, and needs to be done for LPSR resume as well.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo 3c43703aa1 watchdog: imx2_wdt: select pinctrl state during suspend/resume
To support suspend/resume from LPSR mode, we need to select default
pinctrl state in resume, so that IOMUXC settings can be restored.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo c65993b5e8 bd7181x: configure bd71815 for LPSR sleep support
It configures BD71815 to have BUCKs and LDOs on/off as needed in LPSR
mode.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Shawn Guo f0d9025c03 dts/zero-sugar: add pinctrl for bd71815 device
BD71815 device uses GPIO6_IO16 as the PMIC_INT_B interrupt line.  Even
though we are currently not using the interrupt from the device, there
should be a pinctrl for PMIC_INT_B to make the hardware description more
complete and correct.

While at it, rename the device node to bd71815 for an explicit naming.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:14 +02:00
Preben Thorød 8847267268 zero-sugar config: Enable memtest
Needed for production test application
2020-10-08 20:07:14 +02:00
Lars Ivar Miljeteig 3cdce72110 mxsfb: Defer probe when lcd-supply not ready
Also move code to fail early on this
2020-10-08 20:07:14 +02:00
Lars Ivar Miljeteig f09c2baffc zero-sugar dts: Fix vcom regulator of node
This makes the regulator searchable for
other device drivers
2020-10-08 20:07:14 +02:00
Lars Ivar Miljeteig 3926af7dca sy7636a-regulator: Make regulator searchable 2020-10-08 20:07:14 +02:00
Steinar Bakkemo d61c584367 max77818-charger: fix issue causing charging mode 0 (off) to be retained
If the charging mode 0 is retained during device reset,
this will possibly cause a "deadlock" requiring complete battery
drain before device may be re-charged.
2020-10-08 20:07:13 +02:00
Shawn Guo b0bc971bf3 dts/zero-sugar: add 150 us delay for WIFI_PWR_EN
There is a 2 cycles (32K clock) delay required between WIFI_PWR_EN and
WL_REG_ON assertion. Let's use 'startup-delay-us' of WIFI_PWR_EN
regulator to add that delay.  We increase the delay from required 61 us
to 150 us for some margin.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo 85ac0018dc dts/zero-sugar: drop unused pinctrl_usbotg2_pwr
The pinctrl_usbotg2_pwr_1 is unused/unneeded.  Remove it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo a491027095 pwrseq_simple: drop our custom changes
By using 'ext_clock' to handle 32K clock, we can drop our custom changes
to pwrseq_simple driver now.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo 8ccf9125f6 dts/zero-sugar: use fixed regulator to manage WIFI_PWR_EN
Besides WIFI_REG_ON handled by wifi_pwrseq, we need to deal with
WIFI_PWR_EN as well to get BCM43455 WiFi chip powered properly.  This
WIFI_PWR_EN is currently handled in U-Boot.  As we have fixed-regulator
infrastructure in kernel which can handle this nicely, let's use it, so
that we can drop the code from U-Boot.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo c2ab64fc4e dts/zero-sugar: move pinctrl_wifi into wifi_pwrseq node
The pinctrl_wifi is all about configuring pins used by wifi_pwrseq,
including the 32K clock and WIFI_PWR_EN.  So let's move the pinctrl
into wifi_pwrseq device.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo 0af630e869 dts/zero-sugar: drop wifi host-wake GPIO
We do not use wifi host-wake interrupt, so let's drop uneeded GPIO
pinctrl for it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Shawn Guo 4e9843f880 dts/zero-sugar: use standard 'ext_clock' to handle 32K clock
The standard pwrseq bindings (bindings/mmc/mmc-pwrseq-simple.txt) has
an 'ext_clock' which can be used to handle BCM43455 32K clock. Let's
use it.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig 749160388e zero-sugar dts: Enable sy7636a driver 2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig 4419273dad zero-sugar config: Add sy7636a driver 2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig 26f5dca610 sy7636a EPD PMIC driver initial commit
Add multi-function device to interface the
sy7636a EPD PMIC chip from Silergy.

- Regulator driver for VCOM
- Hwmon driver for thermistor temperature
- MFD driver for i2c regmap
2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig f732531df4 zero-sugar dts: Correct pinmux for i2c4 2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig 459200bbc4 zero-sugar dts: Flips tilt, position and distance
Enables flipping of the tilt_x, tilt_y, pos_x,
pos_y and distance in the device tree.
2020-10-08 20:07:13 +02:00
Lars Ivar Miljeteig 112de94c68 wacom_i2c: Add dev-tree support to invert values
Reads
 * flip-tilt-x
 * flip-tilt-y
 * flip-pos-x
 * flip-pos-y
 * flip-distance
 * flip-pressure
from the device tree, and acts accordingly.

Also cleans up memory management in probe, and stores
the features information for later usage.
2020-10-08 20:07:12 +02:00
Shawn Guo afb86f6783 dts/zero-sugar: drop imx7d-sdb container node from iomuxc
With recent kernel version, there is no need for a container node in
iomuxc nodes.  Let's drop them to save one level of indentation.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:12 +02:00
Shawn Guo 26882022c5 dts/zero-sugar: move omuxc_lpsr down to iomuxc place
It's a bit easier for checking pinctrl configurations to put omuxc_lpsr
together with iomuxc node.

While at it, drop the unneeded pinctrl-names from both nodes.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:12 +02:00
Shawn Guo ec7dab7f4b dts/zero-sugar: fix indentation for wifi_pwrseq and otgcontrol
There are some minor indentation issue with wifi_pwrseq and otgcontrol.
Fix them.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
2020-10-08 20:07:12 +02:00