Commit 10d5c884 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Andi Shyti

i2c: riic: Enable runtime PM autosuspend support

Enable runtime PM autosuspend support for the RIIC driver. With this, in
case there are consecutive xfer requests the device wouldn't be runtime
enabled/disabled after each consecutive xfer but after the
the delay configured by user. With this, we can avoid touching hardware
registers involved in runtime PM suspend/resume saving in this way some
cycles. The default chosen autosuspend delay is zero to keep the
previous driver behavior.
Reviewed-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@kernel.org>
parent 3149a9cf
...@@ -171,7 +171,8 @@ static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) ...@@ -171,7 +171,8 @@ static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
} }
out: out:
pm_runtime_put(dev); pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
return riic->err ?: num; return riic->err ?: num;
} }
...@@ -399,7 +400,8 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t) ...@@ -399,7 +400,8 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t)
riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1); riic_clear_set_bit(riic, ICCR1_IICRST, 0, RIIC_ICCR1);
pm_runtime_put(dev); pm_runtime_mark_last_busy(dev);
pm_runtime_put_autosuspend(dev);
return 0; return 0;
} }
...@@ -479,6 +481,9 @@ static int riic_i2c_probe(struct platform_device *pdev) ...@@ -479,6 +481,9 @@ static int riic_i2c_probe(struct platform_device *pdev)
i2c_parse_fw_timings(dev, &i2c_t, true); i2c_parse_fw_timings(dev, &i2c_t, true);
/* Default 0 to save power. Can be overridden via sysfs for lower latency. */
pm_runtime_set_autosuspend_delay(dev, 0);
pm_runtime_use_autosuspend(dev);
pm_runtime_enable(dev); pm_runtime_enable(dev);
ret = riic_init_hw(riic, &i2c_t); ret = riic_init_hw(riic, &i2c_t);
...@@ -496,6 +501,7 @@ static int riic_i2c_probe(struct platform_device *pdev) ...@@ -496,6 +501,7 @@ static int riic_i2c_probe(struct platform_device *pdev)
out: out:
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_dont_use_autosuspend(dev);
return ret; return ret;
} }
...@@ -512,6 +518,7 @@ static void riic_i2c_remove(struct platform_device *pdev) ...@@ -512,6 +518,7 @@ static void riic_i2c_remove(struct platform_device *pdev)
} }
i2c_del_adapter(&riic->adapter); i2c_del_adapter(&riic->adapter);
pm_runtime_disable(dev); pm_runtime_disable(dev);
pm_runtime_dont_use_autosuspend(dev);
} }
static const struct riic_of_data riic_rz_a_info = { static const struct riic_of_data riic_rz_a_info = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment