ASoC: wcd9xxx: add device_reset functions for taiko and tapan
When slimbus is reset reset_device callback is called. In this event codec
driver should reset the codec so that codec can be enumulated again.
Change-Id: I14a2921b71dbe862cc52f7af1166c30fa4346a5a
Signed-off-by: Fred Oh <fred@codeaurora.org>
diff --git a/drivers/mfd/wcd9xxx-core.c b/drivers/mfd/wcd9xxx-core.c
index 907ce7c..64053de 100644
--- a/drivers/mfd/wcd9xxx-core.c
+++ b/drivers/mfd/wcd9xxx-core.c
@@ -1673,10 +1673,8 @@
wcd9xxx->slim_device_bootup = false;
return 0;
}
- ret = wcd9xxx_reset(wcd9xxx);
- if (ret)
- pr_err("%s: Resetting Codec failed\n", __func__);
+ dev_info(wcd9xxx->dev, "%s: codec bring up\n", __func__);
wcd9xxx_bring_up(wcd9xxx);
ret = wcd9xxx_irq_init(wcd9xxx_res);
if (ret) {
@@ -1688,6 +1686,25 @@
return ret;
}
+static int wcd9xxx_slim_device_reset(struct slim_device *sldev)
+{
+ int ret;
+ struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
+ if (!wcd9xxx) {
+ pr_err("%s: wcd9xxx is NULL\n", __func__);
+ return -EINVAL;
+ }
+
+ dev_info(wcd9xxx->dev, "%s: device reset\n", __func__);
+ if (wcd9xxx->slim_device_bootup)
+ return 0;
+ ret = wcd9xxx_reset(wcd9xxx);
+ if (ret)
+ dev_err(wcd9xxx->dev, "%s: Resetting Codec failed\n", __func__);
+
+ return ret;
+}
+
static int wcd9xxx_slim_device_up(struct slim_device *sldev)
{
struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
@@ -1695,7 +1712,7 @@
pr_err("%s: wcd9xxx is NULL\n", __func__);
return -EINVAL;
}
- dev_dbg(wcd9xxx->dev, "%s: device up\n", __func__);
+ dev_info(wcd9xxx->dev, "%s: slim device up\n", __func__);
return wcd9xxx_device_up(wcd9xxx);
}
@@ -1703,6 +1720,7 @@
{
struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
+ dev_info(wcd9xxx->dev, "%s: device down\n", __func__);
if (!wcd9xxx) {
pr_err("%s: wcd9xxx is NULL\n", __func__);
return -EINVAL;
@@ -1826,6 +1844,7 @@
.resume = wcd9xxx_slim_resume,
.suspend = wcd9xxx_slim_suspend,
.device_up = wcd9xxx_slim_device_up,
+ .reset_device = wcd9xxx_slim_device_reset,
.device_down = wcd9xxx_slim_device_down,
};
@@ -1845,6 +1864,7 @@
.resume = wcd9xxx_slim_resume,
.suspend = wcd9xxx_slim_suspend,
.device_up = wcd9xxx_slim_device_up,
+ .reset_device = wcd9xxx_slim_device_reset,
.device_down = wcd9xxx_slim_device_down,
};