mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
Merge commit '5c00aa86ffaaae4f97d8e9fa50a7fbd0195b9b85' into sheesh
* commit '5c00aa86ffaaae4f97d8e9fa50a7fbd0195b9b85': ASoC: wcd937x_slave: Add retry while getting logical addr for wcd937x slave
This commit is contained in:
commit
b21ab57e39
@ -9,6 +9,8 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@ -18,6 +20,8 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/component.h>
|
||||
#include <soc/soundwire.h>
|
||||
#include <linux/delay.h>
|
||||
#define SWR_MAX_RETRY 5
|
||||
|
||||
struct wcd937x_slave_priv {
|
||||
struct swr_device *swr_slave;
|
||||
@ -30,6 +34,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__);
|
||||
@ -45,7 +50,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…
x
Reference in New Issue
Block a user