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

Commit 495df114 authored by Sudheer Papothi's avatar Sudheer Papothi
Browse files

ASoC: wsa881x: Add delay after device reset



After soundwire slave device reset, wait for
slave device enumeration. If device gets
enumerated, initialize codec registers.
This will avoid command errors during
codec initialization.

Change-Id: Ibc2ac304c4be54fd31e6344d9690a44074f87b88
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
parent 13fe987c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@
#include "wsa881x.h"
#include "wsa881x-temp-sensor.h"

#define WSA881X_NUM_RETRY	5

enum {
	G_18DB = 0,
	G_16P5DB,
@@ -1278,6 +1280,8 @@ static int wsa881x_swr_down(struct swr_device *pdev)
static int wsa881x_swr_reset(struct swr_device *pdev)
{
	struct wsa881x_priv *wsa881x;
	u8 retry = WSA881X_NUM_RETRY;
	u8 devnum = 0;

	wsa881x = swr_get_dev_data(pdev);
	if (!wsa881x) {
@@ -1286,6 +1290,10 @@ static int wsa881x_swr_reset(struct swr_device *pdev)
	}
	wsa881x->bg_cnt = 0;
	wsa881x->clk_cnt = 0;
	while (swr_get_logical_dev_num(pdev, pdev->addr, &devnum) && retry--) {
		/* Retry after 1 msec delay */
		usleep_range(1000, 1100);
	}
	regcache_mark_dirty(wsa881x->regmap);
	regcache_sync(wsa881x->regmap);
	return 0;