Lines Matching +full:stpmic1 +full:- +full:wdt

1 // SPDX-License-Identifier: GPL-2.0
6 #include <linux/mfd/stpmic1.h>
31 struct stpmic1 *pmic;
37 struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd); in pmic_wdt_start() local
39 return regmap_update_bits(wdt->pmic->regmap, in pmic_wdt_start()
45 struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd); in pmic_wdt_stop() local
47 return regmap_update_bits(wdt->pmic->regmap, in pmic_wdt_stop()
53 struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd); in pmic_wdt_ping() local
55 return regmap_update_bits(wdt->pmic->regmap, in pmic_wdt_ping()
62 struct stpmic1_wdt *wdt = watchdog_get_drvdata(wdd); in pmic_wdt_set_timeout() local
64 wdd->timeout = timeout; in pmic_wdt_set_timeout()
66 return regmap_write(wdt->pmic->regmap, WCHDG_TIMER_CR, timeout - 1); in pmic_wdt_set_timeout()
71 .identity = "STPMIC1 PMIC Watchdog",
84 struct device *dev = &pdev->dev; in pmic_wdt_probe()
86 struct stpmic1 *pmic; in pmic_wdt_probe()
87 struct stpmic1_wdt *wdt; in pmic_wdt_probe() local
89 if (!dev->parent) in pmic_wdt_probe()
90 return -EINVAL; in pmic_wdt_probe()
92 pmic = dev_get_drvdata(dev->parent); in pmic_wdt_probe()
94 return -EINVAL; in pmic_wdt_probe()
96 wdt = devm_kzalloc(dev, sizeof(struct stpmic1_wdt), GFP_KERNEL); in pmic_wdt_probe()
97 if (!wdt) in pmic_wdt_probe()
98 return -ENOMEM; in pmic_wdt_probe()
100 wdt->pmic = pmic; in pmic_wdt_probe()
102 wdt->wdtdev.info = &pmic_watchdog_info; in pmic_wdt_probe()
103 wdt->wdtdev.ops = &pmic_watchdog_ops; in pmic_wdt_probe()
104 wdt->wdtdev.min_timeout = PMIC_WDT_MIN_TIMEOUT; in pmic_wdt_probe()
105 wdt->wdtdev.max_timeout = PMIC_WDT_MAX_TIMEOUT; in pmic_wdt_probe()
106 wdt->wdtdev.parent = dev; in pmic_wdt_probe()
108 wdt->wdtdev.timeout = PMIC_WDT_DEFAULT_TIMEOUT; in pmic_wdt_probe()
109 watchdog_init_timeout(&wdt->wdtdev, 0, dev); in pmic_wdt_probe()
111 watchdog_set_nowayout(&wdt->wdtdev, nowayout); in pmic_wdt_probe()
112 watchdog_set_drvdata(&wdt->wdtdev, wdt); in pmic_wdt_probe()
114 ret = devm_watchdog_register_device(dev, &wdt->wdtdev); in pmic_wdt_probe()
118 dev_dbg(wdt->pmic->dev, "PMIC Watchdog driver probed\n"); in pmic_wdt_probe()
123 { .compatible = "st,stpmic1-wdt" },
132 .name = "stpmic1-wdt",
138 MODULE_DESCRIPTION("Watchdog driver for STPMIC1 device");