linux/drivers
Douglas Anderson 18eeef46d3 HID: i2c-hid: goodix: Tie the reset line to true state of the regulator
The regulator for the touchscreen could be:
* A dedicated regulator just for the touchscreen.
* A regulator shared with something else in the system.
* An always-on regulator.

How we want the "reset" line to behave depends a bit on which of those
three cases we're in. Currently the code is written with the
assumption that it has a dedicated regulator, but that's not really
guaranteed to be the case.

The problem we run into is that if we leave the touchscreen powered on
(because someone else is requesting the regulator or it's an always-on
regulator) and we assert reset then we apparently burn an extra 67 mW
of power. That's not great.

Let's instead tie the control of the reset line to the true state of
the regulator as reported by regulator notifiers. If we have an
always-on regulator our notifier will never be called. If we have a
shared regulator then our notifier will be called when the touchscreen
is truly turned on or truly turned off.

Using notifiers like this nicely handles all the cases without
resorting to hacks like pretending that there is no "reset" GPIO if we
have an always-on regulator.

NOTE: if the regulator is on a shared line it's still possible that
things could be a little off. Specifically, this case is not handled
even after this patch:
1. Suspend goodix (send "sleep", goodix stops requesting regulator on)
2. Other regulator user turns off (regulator fully turns off).
3. Goodix driver gets notified and asserts reset.
4. Other regulator user turns on.
5. Goodix driver gets notified and deasserts reset.
6. Nobody resumes goodix.

With that set of steps we'll have reset deasserted but we will have
lost the results of the I2C_HID_PWR_SLEEP from the suspend path. That
means we might be in higher power than we could be even if the goodix
driver thinks things are suspended. Presumably, however, we're still
in better shape than if we were asserting "reset" the whole time. If
somehow the above situation is actually affecting someone and we want
to do better we can deal with it when we have a real use case.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2021-07-15 21:49:32 +02:00
..
accessibility braille_console: Fix fall-through warnings for Clang 2021-05-17 19:38:01 -05:00
acpi platform-drivers-x86 for v5.14-1 2021-06-30 11:15:39 -07:00
amba
android binder: Return EFAULT if we fail BINDER_ENABLE_ONEWAY_SPAM_DETECTION 2021-05-13 20:35:26 +02:00
ata ata: rb532_cf: remove redundant codes 2021-06-24 18:49:01 -06:00
atm atm: fore200e: Fix fall-through warnings for Clang 2021-05-17 18:50:49 -05:00
auxdisplay treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
base Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
bcma bcma: remove unused function 2021-04-18 09:36:56 +03:00
block loop: charge i/o to mem and blk cg 2021-06-29 10:53:50 -07:00
bluetooth Networking fixes for 5.13-rc5, including fixes from bpf, wireless, 2021-06-04 18:25:39 -07:00
bus Char/Misc driver fixes for 5.13-rc6 2021-06-12 12:13:55 -07:00
cdrom cdrom: gdrom: initialize global variable at init time 2021-05-13 18:58:44 +02:00
char Merge tag 'tpmdd-next-v5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd 2021-06-30 11:23:33 -07:00
clk clk: Skip clk provider registration when np is NULL 2021-05-11 08:47:25 +02:00
clocksource clocksource/drivers/timer-ti-dm: Drop unnecessary restore 2021-06-16 17:33:04 +02:00
comedi staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
connector
counter
cpufreq cpufreq: Make cpufreq_online() call driver->offline() on errors 2021-06-23 19:40:56 +02:00
cpuidle Power management updates for 5.14-rc1 2021-06-29 13:36:06 -07:00
crypto crypto: sl3516 - depends on HAS_IOMEM 2021-06-24 14:57:28 +08:00
cxl cxl/mem: Fix memory device capacity probing 2021-04-16 18:21:56 -07:00
dax fs: remove noop_set_page_dirty() 2021-06-29 10:53:48 -07:00
dca
devfreq PM / devfreq: passive: Fix get_target_freq when not using required-opp 2021-06-24 10:37:35 +09:00
dio
dma dmaengine fixes for v5.13 2021-06-16 09:03:52 -07:00
dma-buf dma-buf: fix unintended pin/unpin warnings 2021-05-20 14:02:27 +02:00
edac Various fixes and support for new CPUS 2021-06-30 11:27:49 -07:00
eisa
extcon extcon: extcon-max8997: Simplify driver using devm 2021-06-17 13:22:27 +02:00
firewire firewire: core: Fix fall-through warnings for Clang 2021-05-17 19:40:32 -05:00
firmware arm64 updates for 5.14 2021-06-28 14:04:24 -07:00
fpga ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
fsi
gnss
gpio platform-drivers-x86 for v5.14-1 2021-06-30 11:15:39 -07:00
gpu Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
greybus greybus: es2: fix kernel-doc warnings 2021-04-16 07:26:50 +02:00
hid HID: i2c-hid: goodix: Tie the reset line to true state of the regulator 2021-07-15 21:49:32 +02:00
hsi HSI: core: fix resource leaks in hsi_add_client_from_dt() 2021-04-16 00:14:49 +02:00
hv hyperv-next for 5.14 2021-06-29 11:21:35 -07:00
hwmon fallthrough fixes for Clang for 5.14-rc1 2021-06-28 20:03:38 -07:00
hwspinlock
hwtracing ARM: 2021-05-01 10:14:08 -07:00
i2c ACPI updates for 5.14-rc1 2021-06-29 13:39:41 -07:00
i3c Revert "i3c master: fix missing destroy_workqueue() on error in i3c_master_register" 2021-04-24 22:21:01 +02:00
idle intel_idle: Adjust the SKX C6 parameters if PC6 is disabled 2021-06-09 17:51:07 +02:00
iio iio: adc: ad7793: Add missing error code in ad7793_setup() 2021-05-22 08:32:36 +01:00
infiniband IB/mlx5: Fix initializing CQ fragments buffer 2021-06-10 08:59:34 -03:00
input platform-drivers-x86 for v5.14-1 2021-06-30 11:15:39 -07:00
interconnect interconnect: qcom: Add missing MODULE_DEVICE_TABLE 2021-05-11 07:26:31 +03:00
iommu iommu/vt-d: Fix sysfs leak in alloc_iommu() 2021-05-27 16:07:08 +02:00
ipack
irqchip Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
isdn Networking fixes for 5.13-rc4, including fixes from bpf, netfilter, 2021-05-26 17:44:49 -10:00
leds leds: lp5523: check return value of lp5xx_read and jump to cleanup code 2021-05-13 17:30:15 +02:00
lightnvm lightnvm: deprecated OCSSD support and schedule it for removal in Linux 5.15 2021-04-13 09:16:12 -06:00
macintosh macintosh/via-pmu: Fix build warning 2021-04-16 23:57:51 +10:00
mailbox mbox: add polarfire soc system controller mailbox 2021-06-26 12:06:48 -05:00
mcb
md sched: Change task_struct::state 2021-06-18 11:43:09 +02:00
media Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
memory .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
memstick memstick: rtsx_usb_ms: fix UAF 2021-06-14 13:57:39 +02:00
message scsi: message: fusion: Remove unused local variable 'vtarget' 2021-04-13 01:39:12 -04:00
mfd platform-drivers-x86 for v5.14-1 2021-06-30 11:15:39 -07:00
misc Merge branch 'akpm' (patches from Andrew) 2021-06-29 17:29:11 -07:00
mmc mmc: sdhci-iproc: Add support for the legacy sdhci controller on the BCM7211 2021-06-15 17:27:48 +02:00
most Staging/IIO driver updates for 5.13-rc1 2021-04-26 11:14:21 -07:00
mtd pstore updates for v5.14-rc1 2021-06-28 19:57:00 -07:00
mux mux: gpio: Simplify code by using dev_err_probe() 2021-04-02 16:28:53 +02:00
net hyperv-next for 5.14 2021-06-29 11:21:35 -07:00
nfc NFC: nfcmrvl: fix kernel-doc syntax in file headers 2021-05-23 17:26:38 -07:00
ntb
nubus
nvdimm include: remove pagemap.h from blkdev.h 2021-05-06 19:24:11 -07:00
nvme nvmet: fix freeing unallocated p2pmem 2021-06-02 10:10:38 +03:00
nvmem nvmem: qfprom: Add support for fuse blowing on sc7280 2021-04-02 16:28:10 +02:00
of of: overlay: Remove redundant assignment to ret 2021-05-03 13:57:56 -05:00
opp opp: Allow required-opps to be used for non genpd use cases 2021-06-18 09:00:55 +05:30
parisc
parport treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
pci hyperv-next for 5.14 2021-06-29 11:21:35 -07:00
pcmcia
perf drivers/perf: fix the missed ida_simple_remove() in ddr_perf_probe() 2021-06-17 19:45:24 +01:00
phy phy: Sparx5 Eth SerDes: check return value after calling platform_get_resource() 2021-06-03 11:18:19 +05:30
pinctrl pinctrl: stm32: fix the reported number of GPIO lines per bank 2021-06-18 14:56:54 +02:00
platform Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2021-06-30 11:31:32 -07:00
pnp PNP: pnpbios: Use list_for_each_entry() instead of list_for_each() 2021-06-09 15:04:30 +02:00
power power supply and reset changes for the v5.13 series 2021-04-28 15:43:58 -07:00
powercap
pps TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
ps3
ptp ptp: improve max_adj check against unreasonable values 2021-06-15 10:59:46 -07:00
pwm pwm: Changes for v5.13-rc1 2021-05-05 12:53:16 -07:00
rapidio rapidio: handle create_workqueue() failure 2021-05-13 18:32:19 +02:00
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-07 11:52:26 +02:00
regulator Merge remote-tracking branch 'regulator/for-5.14' into regulator-next 2021-06-23 16:56:31 +01:00
remoteproc remoteproc updates for v5.13 2021-05-04 11:13:33 -07:00
reset pci-v5.13-changes 2021-05-05 13:24:11 -07:00
rpmsg rpmsg: qcom_glink_native: fix error return code of qcom_glink_rx_data() 2021-04-09 11:08:42 -05:00
rtc rtc: mt6397: refine RTC_TC_MTH 2021-06-01 16:44:09 +01:00
s390 s390/vfio-ap: clean up mdev resources when remove callback invoked 2021-06-21 11:19:18 +02:00
sbus
scsi Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
sh The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
siox
slimbus
soc Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-06-28 16:04:56 -07:00
soundwire soundwire: qcom: fix handling of qcom,ports-block-pack-mode 2021-05-13 11:14:13 +05:30
spi Merge remote-tracking branch 'spi/for-5.14' into spi-next 2021-06-25 14:08:26 +01:00
spmi
ssb
staging Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
target scsi: target: core: Fix warning on realtime kernels 2021-05-31 22:59:13 -04:00
tc
tee fallthrough fixes for Clang for 5.14-rc1 2021-06-28 20:03:38 -07:00
thermal Scheduler udpates for this cycle: 2021-06-28 12:14:19 -07:00
thunderbolt thunderbolt: usb4: Fix NVM read buffer bounds and offset issue 2021-05-20 11:52:58 +03:00
tty serial: 8250_exar: Avoid NULL pointer dereference at ->exit() 2021-06-09 14:40:48 +02:00
uio uio_hv_generic: Fix another memory leak in error handling paths 2021-05-14 13:26:04 +02:00
usb printk changes for 5.14 2021-06-29 12:07:18 -07:00
vdpa {net,vdpa}/mlx5: Configure interface MAC into mpfs L2 table 2021-05-18 23:01:48 -07:00
vfio vfio: use vma_lookup() instead of find_vma_intersection() 2021-06-29 10:53:51 -07:00
vhost virtio,vhost,vdpa: features, fixes 2021-05-05 13:31:39 -07:00
video Revert "fb_defio: Remove custom address_space_operations" 2021-06-01 17:38:40 +02:00
virt nitro_enclaves: Fix stale file descriptors on failed usercopy 2021-04-29 19:06:49 +02:00
virtio virtio_balloon: specify page reporting order if needed 2021-06-29 10:53:47 -07:00
visorbus
vlynq
vme
w1 w1: ds28e17: Use module_w1_family to simplify the code 2021-04-10 10:58:21 +02:00
watchdog Updates for the interrupt subsystem: 2021-06-29 12:25:04 -07:00
xen xen/events: reset active flag for lateeoi events later 2021-06-24 12:52:36 +02:00
zorro
Kconfig ide: remove the legacy ide driver 2021-06-16 08:53:58 -06:00
Makefile hyperv-next for 5.14 2021-06-29 11:21:35 -07:00