diff --git a/drivers/mfd/da9063.c b/drivers/mfd/da9063.c index 7099c48..e1343ba 100644 --- a/drivers/mfd/da9063.c +++ b/drivers/mfd/da9063.c @@ -14,6 +14,7 @@ */ #include +#include #include #include #include @@ -33,6 +34,7 @@ struct i2c_client *client1; struct device_d *dev; unsigned int timeout; + uint64_t last_ping; }; /* forbidden/impossible value; timeout will be set to this value initially to @@ -237,6 +239,14 @@ int ret; u8 val; + /* + * The watchdog has a cool down phase of 200ms and if we ping to fast + * the da9062/3 resets the system. Reject those requests has a maximum + * failure of 10% if the watchdog timeout is set to 2.048s. + */ + if (!is_timeout(priv->last_ping, 200 * MSECOND)) + return 0; + dev_dbg(priv->dev, "ping\n"); /* reset watchdog timer; register is self clearing */ @@ -245,6 +255,8 @@ if (ret < 0) return ret; + priv->last_ping = get_time_ns(); + return 0; }