Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f0e291a authored by Fred Oh's avatar Fred Oh Committed by Gerrit - the friendly Code Review server
Browse files

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: default avatarFred Oh <fred@codeaurora.org>
parent df8e3c86
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -1673,10 +1673,8 @@ static int wcd9xxx_device_up(struct wcd9xxx *wcd9xxx)
		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 @@ static int wcd9xxx_device_up(struct wcd9xxx *wcd9xxx)
	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 @@ static int wcd9xxx_slim_device_up(struct slim_device *sldev)
		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 @@ static int wcd9xxx_slim_device_down(struct slim_device *sldev)
{
	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 @@ static struct slim_driver taiko_slim_driver = {
	.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 @@ static struct slim_driver tapan_slim_driver = {
	.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,
};