Loading asoc/codecs/wcd938x/wcd938x-slave.c +11 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/platform_device.h> #include <linux/device.h> Loading @@ -24,6 +25,7 @@ #define SWR_SLV_MAX_DEVICES 2 #endif /* CONFIG_DEBUG_FS */ #define SWR_MAX_RETRY 5 struct wcd938x_slave_priv { struct swr_device *swr_slave; #ifdef CONFIG_DEBUG_FS Loading Loading @@ -278,17 +280,24 @@ static int wcd938x_slave_bind(struct device *dev, int ret = 0; uint8_t devnum = 0; struct swr_device *pdev = to_swr_device(dev); int retry = SWR_MAX_RETRY; if (!pdev) { pr_err("%s: invalid swr device handle\n", __func__); return -EINVAL; } 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 %llx failed\n", __func__, devnum, pdev->addr); ret = -EPROBE_DEFER; return ret; } pdev->dev_num = devnum; Loading asoc/codecs/wcd938x/wcd938x.c +7 −8 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -1976,15 +1976,14 @@ static int wcd938x_get_logical_addr(struct swr_device *swr_dev) int num_retry = NUM_ATTEMPTS; do { /* retry after 1ms */ usleep_range(1000, 1010); ret = swr_get_logical_dev_num(swr_dev, swr_dev->addr, &devnum); if (ret) { } while (ret && --num_retry); if (ret) dev_err(&swr_dev->dev, "%s get devnum %d for dev addr %llx failed\n", __func__, devnum, swr_dev->addr); /* retry after 1ms */ usleep_range(1000, 1010); } } while (ret && --num_retry); swr_dev->dev_num = devnum; return 0; } Loading Loading
asoc/codecs/wcd938x/wcd938x-slave.c +11 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/platform_device.h> #include <linux/device.h> Loading @@ -24,6 +25,7 @@ #define SWR_SLV_MAX_DEVICES 2 #endif /* CONFIG_DEBUG_FS */ #define SWR_MAX_RETRY 5 struct wcd938x_slave_priv { struct swr_device *swr_slave; #ifdef CONFIG_DEBUG_FS Loading Loading @@ -278,17 +280,24 @@ static int wcd938x_slave_bind(struct device *dev, int ret = 0; uint8_t devnum = 0; struct swr_device *pdev = to_swr_device(dev); int retry = SWR_MAX_RETRY; if (!pdev) { pr_err("%s: invalid swr device handle\n", __func__); return -EINVAL; } 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 %llx failed\n", __func__, devnum, pdev->addr); ret = -EPROBE_DEFER; return ret; } pdev->dev_num = devnum; Loading
asoc/codecs/wcd938x/wcd938x.c +7 −8 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -1976,15 +1976,14 @@ static int wcd938x_get_logical_addr(struct swr_device *swr_dev) int num_retry = NUM_ATTEMPTS; do { /* retry after 1ms */ usleep_range(1000, 1010); ret = swr_get_logical_dev_num(swr_dev, swr_dev->addr, &devnum); if (ret) { } while (ret && --num_retry); if (ret) dev_err(&swr_dev->dev, "%s get devnum %d for dev addr %llx failed\n", __func__, devnum, swr_dev->addr); /* retry after 1ms */ usleep_range(1000, 1010); } } while (ret && --num_retry); swr_dev->dev_num = devnum; return 0; } Loading