mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
ASoC: wcd937x_slave: Add retry while getting logical addr for wcd937x slave
Add retry while getting logical addr for wcd937x slave. Change-Id: Iff3f6a071c13f8bdccc72da69e95432be2d4f90a Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
parent
258bb5db28
commit
c455f79f85
1 changed files with 10 additions and 2 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018, 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -11,6 +11,8 @@
|
|||
#include <linux/component.h>
|
||||
#include <soc/soundwire.h>
|
||||
|
||||
#define SWR_MAX_RETRY 5
|
||||
|
||||
struct wcd937x_slave_priv {
|
||||
struct swr_device *swr_slave;
|
||||
};
|
||||
|
|
@ -22,6 +24,7 @@ static int wcd937x_slave_bind(struct device *dev,
|
|||
struct wcd937x_slave_priv *wcd937x_slave = NULL;
|
||||
uint8_t devnum = 0;
|
||||
struct swr_device *pdev = to_swr_device(dev);
|
||||
int retry = SWR_MAX_RETRY;
|
||||
|
||||
if (pdev == NULL) {
|
||||
dev_err(dev, "%s: pdev is NULL\n", __func__);
|
||||
|
|
@ -37,7 +40,12 @@ static int wcd937x_slave_bind(struct device *dev,
|
|||
|
||||
wcd937x_slave->swr_slave = pdev;
|
||||
|
||||
ret = swr_get_logical_dev_num(pdev, pdev->addr, &devnum);
|
||||
do {
|
||||
/* Add delay for soundwire enumeration */
|
||||
usleep_range(100, 110);
|
||||
ret = swr_get_logical_dev_num(pdev, pdev->addr, &devnum);
|
||||
} while (ret && --retry);
|
||||
|
||||
if (ret) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"%s get devnum %d for dev addr %lx failed\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue