asoc: codecs: retry for soundwire slave enumeration

Retry for soundwire slave enumeration during bootup before
EPROBE_DEFER to avoid soundcard enumeration failures.

Change-Id: I083ec76fc84a2b367f93a2dc166a1419a75ff8b4
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
Sudheer Papothi
2020-06-03 11:46:05 +05:30
parent 700bd78ede
commit b3fa5a0dc5
4 changed files with 37 additions and 14 deletions

View File

@@ -314,6 +314,7 @@ static int swr_haptics_probe(struct swr_device *sdev)
struct swr_haptics_dev *swr_hap;
int rc;
u8 devnum;
int retry = 5;
swr_hap = devm_kzalloc(&sdev->dev,
sizeof(struct swr_haptics_dev), GFP_KERNEL);
@@ -346,8 +347,12 @@ static int swr_haptics_probe(struct swr_device *sdev)
__func__, rc);
goto clean;
}
do {
/* Add delay for soundwire enumeration */
usleep_range(500, 510);
rc = swr_get_logical_dev_num(sdev, sdev->addr, &devnum);
} while (rc && --retry);
rc = swr_get_logical_dev_num(sdev, sdev->addr, &devnum);
if (rc) {
dev_err(swr_hap->dev, "%s: failed to get devnum for swr-haptics, rc=%d\n",
__func__, rc);