summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/da9062_wdt.c
Commit message (Collapse)AuthorAgeFilesLines
* watchdog: da9062: fix power management opsMarco Felsch2020-02-171-0/+12
| | | | | | | | | | | | | | | | | This fixes commit f6c98b08381c ("watchdog: da9062: add power management ops"). During discussion [1] we agreed that this should be configurable because it is a device quirk if we can't use the hw watchdog auto suspend function. [1] https://lore.kernel.org/linux-watchdog/20191128171931.22563-1-m.felsch@pengutronix.de/ Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Fixes: f6c98b08381c ("watchdog: da9062: add power management ops") Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/20200207071518.5559-1-m.felsch@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062: do not ping the hw during stop()Marco Felsch2020-02-171-7/+0
| | | | | | | | | | | | | | | | | | | The da9062 hw has a minimum ping cool down phase of at least 200ms. The driver takes that into account by setting the min_hw_heartbeat_ms to 300ms and the core guarantees that the hw limit is observed for the ping() calls. But the core can't guarantee the required minimum ping cool down phase if a stop() command is send immediately after the ping() command. So it is not allowed to ping the watchdog within the stop() command as the driver does. Remove the ping can be done without doubts because the watchdog gets disabled anyway and a (re)start resets the watchdog counter too. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20200120091729.16256-1-m.felsch@pengutronix.de [groeck: Updated description] Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062: make restart handler atomic safeMarco Felsch2020-01-271-4/+6
| | | | | | | | | | | | | | | | | | | | | | The restart handler is executed during the shutdown phase which is atomic/irq-less. The i2c framework supports atomic transfers since commit 63b96983a5dd ("i2c: core: introduce callbacks for atomic transfers") to address this use case. Using regmap within an atomic context is allowed only if the regmap type is MMIO and the cache type 'flat' or no cache is used. Using the i2c_smbus_write_byte_data() function can be done without additional tests because: 1) the DA9062 is an i2c-only device and 2) the i2c framework emulates the smbus protocol if the host adapter does not support smbus_xfer by using the master_xfer. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Stefan Lengfeld <contact@stefanchrist.eu> Tested-by: Stefan Lengfeld <contact@stefanchrist.eu> Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Link: https://lore.kernel.org/r/20200115162307.7336-1-m.felsch@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062: add power management opsMarco Felsch2020-01-271-0/+25
| | | | | | | | | | | Disable the watchdog during suspend if it is enabled and re-enable it on resume. So we can sleep without the interruptions. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20191128171931.22563-1-m.felsch@pengutronix.de Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062_wdt: drop warning after registering deviceWolfram Sang2019-07-081-4/+1
| | | | | | | | The core will print out details now. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062_wdt: Use 'dev' instead of dereferencing it repeatedlyGuenter Roeck2019-05-051-12/+8
| | | | | | | | | | | | | | | | Introduce local variable 'struct device *dev' and use it instead of dereferencing it repeatedly. Also replace 'ret = func(); return ret;' with 'return func();'. 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 Cc: Support Opensource <support.opensource@diasemi.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
* watchdog: da9062: remove unused codeMichael Grzeschik2018-06-061-10/+0
| | | | | | | | | | | The patch "watchdog: da9062: use protection delay mechanism from core" (fb484262) removed the only user of j_time_stamp. This turned into some leftover functions that are removed with this patch. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> 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>
* watchdog: add SPDX identifiers for watchdog subsystemMarcus Folkesson2018-03-241-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add SPDX identifier - Remove boiler plate license text - If MODULE_LICENSE and boiler plate does not match, go for boiler plate license Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Acked-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Acked-by: Keiji Hayashibara <hayashibara.keiji@socionext.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Mans Rullgard <mans@mansr.com> Acked-by: Matthias Brugger <matthias.bgg@gmail.com> Acked-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
* watchdog: da9062: use protection delay mechanism from coreMichael Grzeschik2017-12-281-18/+1
| | | | | | | | | | This patch removes the windows protection routine that got now covered by the wdt core. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
* watchdog: da9062: Disable and wait before changing timeoutMichael Grzeschik2017-12-281-0/+7
| | | | | | | | | | | | | The DA9062 watchdog occasionally enters error condition and resets the system if the timeout is changed quickly after the timer was enabled. The method of disabling and waiting for > 150 µs before setting the new timeout is taken from the DA9052 driver. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
* watchdog: da9062: Add restart handler supportMichael Grzeschik2017-12-281-0/+22
| | | | | | | | | | | | Register a restart handler for the da9062 watchdog. System restart is triggered by sending the shutdown command to the PMIC. As more-suitable restart handlers may exist, the priority of the watchdog restart handler is set to 128. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
* watchdog: da9062_wdt: Convert to use device managed functionsGuenter Roeck2017-02-241-16/+2
| | | | | | | | | | | | | | | | | | | Use device managed functions to simplify error handling, reduce source code size, improve readability, and reduce the likelyhood of bugs. 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 - Replace 'val = e; return val;' with 'return e;' - Drop assignments to otherwise unused variables - Drop remove function - Drop dev_set_drvdata() - Use devm_watchdog_register_driver() to register watchdog device Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* watchdog: da9062/61: watchdog driverSteve Twiss2016-12-161-2/+10
| | | | | | | | | | | | | | | | | | The of_device_id match array is added to support "dlg,da9062-watchdog" as a valid .compatible string. A MODULE_DEVICE_TABLE() macro is added. This patch assumes the use of a DA9062 fallback compatible string for the DTS to pick up the DA9062 device driver for use with the DA9061 watchdog hardware Copyright header is updated to add DA9061 in its description and the module description macro is extended to include DA9061. Kconfig is updated to reflect support for DA9061/62. Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Watchdog: Fix parent of watchdog_devicesPratyush Anand2015-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | /sys/class/watchdog/watchdogn/device/modalias can help to identify the driver/module for a given watchdog node. However, many wdt devices do not set their parent and so, we do not see an entry for device in sysfs for such devices. This patch fixes parent of watchdog_device so that /sys/class/watchdog/watchdogn/device is populated. Exceptions: booke, diag288, octeon, softdog and w83627hf -- They do not have any parent. Not sure, how we can identify driver for these devices. Signed-off-by: Pratyush Anand <panand@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Lubomir Rintel <lkundrak@v3.sk> Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
* watchdog: da9062: DA9062 watchdog driverS Twiss2015-06-221-0/+253
Add watchdog driver support for DA9062 Signed-off-by: Steve Twiss <stwiss.opensource@diasemi.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>