手册: https://www.dialog-semiconductor.com/sites/default/files/da9061-a_datasheet_2v3.pdf
Documentation/devicetree/bindings/watchdog/da9062-wdt.txt
* Dialog Semiconductor DA9062/61 Watchdog Timer
Required properties:
- compatible: should be one of the following valid compatible string lines:
"dlg,da9061-watchdog", "dlg,da9062-watchdog"
"dlg,da9062-watchdog"
Optional properties:
- dlg,use-sw-pm: Add this property to disable the watchdog during suspend.
Only use this option if you can't use the watchdog automatic suspend
function during a suspend (see register CONTROL_B).
Example: DA9062
pmic0: da9062@58 {
watchdog {
compatible = "dlg,da9062-watchdog";
};
};
Example: DA9061 using a fall-back compatible for the DA9062 watchdog driver
pmic0: da9061@58 {
watchdog {
compatible = "dlg,da9061-watchdog", "dlg,da9062-watchdog";
};
};
include/linux/mfd/da9062/registers.h
/* DA9062AA_CONTROL_F = 0x013 */
#define DA9062AA_WATCHDOG_SHIFT 0
#define DA9062AA_WATCHDOG_MASK 0x01
#define DA9062AA_SHUTDOWN_SHIFT 1
#define DA9062AA_SHUTDOWN_MASK BIT(1)
#define DA9062AA_WAKE_UP_SHIFT 2
#define DA9062AA_WAKE_UP_MASK BIT(2)
static int da9062_wdt_restart(struct watchdog_device *wdd, unsigned long action,
void *data)
{
struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
struct i2c_client *client = to_i2c_client(wdt->hw->dev);
int ret;
/* Don't use regmap because it is not atomic safe */
ret = i2c_smbus_write_byte_data(client, DA9062AA_CONTROL_F,
DA9062AA_SHUTDOWN_MASK);
if (ret < 0)
dev_alert(wdt->hw->dev, "Failed to shutdown (err = %d)\n",
ret);
/* wait for reset to assert... */
mdelay(500);
return ret;
}
离线
watchdog: watchdog {
compatible="linux,wdt-gpio";
gpios=<&gpio3 17 GPIO_ACTIVE_LOW>;
hw_algo=”toggle”;
hw_margin_ms=<1600>;
};
这个GPIO的看门狗也不错噢
离线