summaryrefslogtreecommitdiff
path: root/drivers/watchdog/pm8916_wdt.c
AgeCommit message (Collapse)AuthorFilesLines
2022-07-23watchdog: pm8916_wdt: Handle watchdog enabled by bootloaderStephan Gerhold1-0/+10
The bootloader might already enable the watchdog to catch hangs during the boot process. In that case the kernel needs to ping the watchdog temporarily until userspace is fully started. Add a check for this in the probe() function and set the WDOG_HW_RUNNING flag to make the watchdog core handle this automatically. Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220629084816.125515-4-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2022-07-23watchdog: pm8916_wdt: Report reboot reasonStephan Gerhold1-1/+25
The PM8916 PMIC provides "power-off reason" (POFF_REASON) registers to allow detecting why the board was powered off or rebooted. This can be used to expose if a reset happened due to a watchdog timeout. The watchdog API also provides status bits for overtemperature and undervoltage which happen to be reported in the same PMIC register. Make this information available as part of the watchdog device so userspace can decide to handle the situation accordingly. Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220629084816.125515-3-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2022-07-23watchdog: pm8916_wdt: Avoid read of write-only PET registerStephan Gerhold1-3/+2
PMIC_WD_RESET_PET is a write-only register that is used to ping the watchdog. It does not make sense to use read-modify-write for it: a register read will never return anything but zero. (And actually even if it did we would still want to write again to ensure the watchdog is pinged.) Reduce the overhead for the watchdog ping slightly by using regmap_write() directly instead. Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20220629084816.125515-2-stephan.gerhold@kernkonzept.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2020-03-18watchdog: pm8916_wdt: Add system sleep callbacksLoic Poulain1-0/+25
Add suspend and resume pm operations. Tested on dragonboard-410c. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1581435483-6796-1-git-send-email-loic.poulain@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2019-11-05watchdog: pm8916_wdt: fix pretimeout registration flowJorge Ramirez-Ortiz1-4/+11
When an IRQ is present in the dts, the probe function shall fail if the interrupt can not be registered. The probe function shall also be retried if getting the irq is being deferred. Signed-off-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> Reviewed-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2019-05-05watchdog: pm8916_wdt: Use 'dev' instead of dereferencing it repeatedlyGuenter Roeck1-10/+11
Introduce local variable 'struct device *dev' and use it instead of dereferencing it repeatedly. The conversion was done automatically with coccinelle using the following semantic patches. The semantic patches and the scripts used to generate this commit log are available at https://github.com/groeck/coccinelle-patches Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
2018-12-22watchdog: Add pm8916 watchdog driverLoic Poulain1-0/+211
The PM816 module is a versatile PMIC with many diverse functions integrated, including, a watchdog. This watchdog is subcomponent of the PON (Power On) peripheral, in the same way as pwrkey/resin buttons. It works with two timers (2-stages), the first one generates an IRQ to the main SoC (APQ8016/MSM8916), the second one performs the reset. This driver expects the following device hierarchy: [pm8916]->[pm8916-pon]->[pm8916-wdt] It uses the pm8916 regmap to access PM8916 registers. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>