Commit b90d9398 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Mark Brown

ASoC: codecs: wcd938x: remove incorrect module interdependency

For some reason we ended up with cyclic dependency between snd_soc_wcd938x
and snd_soc_wcd938x_sdw modules.

Remove this cyclic dependency by handling them in respective modules.
Without this below error is reported during make modules_install

depmod: ERROR: Cycle detected: snd_soc_wcd938x -> snd_soc_wcd938x_sdw -> snd_soc_wcd938x
depmod: ERROR: Found 2 modules in dependency cycles!

Fixes: 04544222 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210615132829.23067-1-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 355af6c0
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/component.h> #include <linux/component.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/irq.h>
#include <linux/irqdomain.h> #include <linux/irqdomain.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
...@@ -176,8 +177,19 @@ static int wcd9380_interrupt_callback(struct sdw_slave *slave, ...@@ -176,8 +177,19 @@ static int wcd9380_interrupt_callback(struct sdw_slave *slave,
struct sdw_slave_intr_status *status) struct sdw_slave_intr_status *status)
{ {
struct wcd938x_sdw_priv *wcd = dev_get_drvdata(&slave->dev); struct wcd938x_sdw_priv *wcd = dev_get_drvdata(&slave->dev);
struct irq_domain *slave_irq = wcd->slave_irq;
struct regmap *regmap = dev_get_regmap(&slave->dev, NULL);
u32 sts1, sts2, sts3;
return wcd938x_handle_sdw_irq(wcd); do {
handle_nested_irq(irq_find_mapping(slave_irq, 0));
regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_0, &sts1);
regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_1, &sts2);
regmap_read(regmap, WCD938X_DIGITAL_INTR_STATUS_2, &sts3);
} while (sts1 || sts2 || sts3);
return IRQ_HANDLED;
} }
static struct sdw_slave_ops wcd9380_slave_ops = { static struct sdw_slave_ops wcd9380_slave_ops = {
...@@ -239,16 +251,10 @@ static int wcd9380_probe(struct sdw_slave *pdev, ...@@ -239,16 +251,10 @@ static int wcd9380_probe(struct sdw_slave *pdev,
SDW_SCP_INT1_PARITY; SDW_SCP_INT1_PARITY;
pdev->prop.lane_control_support = true; pdev->prop.lane_control_support = true;
if (wcd->is_tx) { if (wcd->is_tx) {
struct regmap *rm;
pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); pdev->prop.source_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0);
pdev->prop.src_dpn_prop = wcd938x_dpn_prop; pdev->prop.src_dpn_prop = wcd938x_dpn_prop;
wcd->ch_info = &wcd938x_sdw_tx_ch_info[0]; wcd->ch_info = &wcd938x_sdw_tx_ch_info[0];
pdev->prop.wake_capable = true; pdev->prop.wake_capable = true;
rm = devm_regmap_init_sdw(pdev, &wcd938x_regmap_config);
if (IS_ERR(rm))
return PTR_ERR(rm);
} else { } else {
pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0); pdev->prop.sink_ports = GENMASK(WCD938X_MAX_SWR_PORTS, 0);
pdev->prop.sink_dpn_prop = wcd938x_dpn_prop; pdev->prop.sink_dpn_prop = wcd938x_dpn_prop;
......
...@@ -1198,7 +1198,7 @@ static bool wcd938x_volatile_register(struct device *dev, unsigned int reg) ...@@ -1198,7 +1198,7 @@ static bool wcd938x_volatile_register(struct device *dev, unsigned int reg)
return false; return false;
} }
struct regmap_config wcd938x_regmap_config = { static struct regmap_config wcd938x_regmap_config = {
.name = "wcd938x_csr", .name = "wcd938x_csr",
.reg_bits = 32, .reg_bits = 32,
.val_bits = 8, .val_bits = 8,
...@@ -1211,7 +1211,6 @@ struct regmap_config wcd938x_regmap_config = { ...@@ -1211,7 +1211,6 @@ struct regmap_config wcd938x_regmap_config = {
.volatile_reg = wcd938x_volatile_register, .volatile_reg = wcd938x_volatile_register,
.can_multi_write = true, .can_multi_write = true,
}; };
EXPORT_SYMBOL_GPL(wcd938x_regmap_config);
static const struct regmap_irq wcd938x_irqs[WCD938X_NUM_IRQS] = { static const struct regmap_irq wcd938x_irqs[WCD938X_NUM_IRQS] = {
REGMAP_IRQ_REG(WCD938X_IRQ_MBHC_BUTTON_PRESS_DET, 0, 0x01), REGMAP_IRQ_REG(WCD938X_IRQ_MBHC_BUTTON_PRESS_DET, 0, 0x01),
...@@ -3472,24 +3471,6 @@ static int wcd938x_reset(struct wcd938x_priv *wcd938x) ...@@ -3472,24 +3471,6 @@ static int wcd938x_reset(struct wcd938x_priv *wcd938x)
return 0; return 0;
} }
int wcd938x_handle_sdw_irq(struct wcd938x_sdw_priv *wcd)
{
struct wcd938x_priv *wcd938x = wcd->wcd938x;
struct irq_domain *slave_irq = wcd938x->virq;
u32 sts1, sts2, sts3;
do {
handle_nested_irq(irq_find_mapping(slave_irq, 0));
regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_0, &sts1);
regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_1, &sts2);
regmap_read(wcd938x->regmap, WCD938X_DIGITAL_INTR_STATUS_2, &sts3);
} while (sts1 || sts2 || sts3);
return IRQ_HANDLED;
}
EXPORT_SYMBOL_GPL(wcd938x_handle_sdw_irq);
static int wcd938x_codec_hw_params(struct snd_pcm_substream *substream, static int wcd938x_codec_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
...@@ -3573,6 +3554,7 @@ static int wcd938x_bind(struct device *dev) ...@@ -3573,6 +3554,7 @@ static int wcd938x_bind(struct device *dev)
} }
wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev); wcd938x->sdw_priv[AIF1_PB] = dev_get_drvdata(wcd938x->rxdev);
wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x; wcd938x->sdw_priv[AIF1_PB]->wcd938x = wcd938x;
wcd938x->sdw_priv[AIF1_PB]->slave_irq = wcd938x->virq;
wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode); wcd938x->txdev = wcd938x_sdw_device_get(wcd938x->txnode);
if (!wcd938x->txdev) { if (!wcd938x->txdev) {
...@@ -3581,6 +3563,7 @@ static int wcd938x_bind(struct device *dev) ...@@ -3581,6 +3563,7 @@ static int wcd938x_bind(struct device *dev)
} }
wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev); wcd938x->sdw_priv[AIF1_CAP] = dev_get_drvdata(wcd938x->txdev);
wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x; wcd938x->sdw_priv[AIF1_CAP]->wcd938x = wcd938x;
wcd938x->sdw_priv[AIF1_CAP]->slave_irq = wcd938x->virq;
wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev); wcd938x->tx_sdw_dev = dev_to_sdw_dev(wcd938x->txdev);
if (!wcd938x->tx_sdw_dev) { if (!wcd938x->tx_sdw_dev) {
dev_err(dev, "could not get txslave with matching of dev\n"); dev_err(dev, "could not get txslave with matching of dev\n");
...@@ -3607,8 +3590,8 @@ static int wcd938x_bind(struct device *dev) ...@@ -3607,8 +3590,8 @@ static int wcd938x_bind(struct device *dev)
return -EINVAL; return -EINVAL;
} }
wcd938x->regmap = dev_get_regmap(wcd938x->txdev, NULL); wcd938x->regmap = devm_regmap_init_sdw(wcd938x->tx_sdw_dev, &wcd938x_regmap_config);
if (!wcd938x->regmap) { if (IS_ERR(wcd938x->regmap)) {
dev_err(dev, "%s: tx csr regmap not found\n", __func__); dev_err(dev, "%s: tx csr regmap not found\n", __func__);
return PTR_ERR(wcd938x->regmap); return PTR_ERR(wcd938x->regmap);
} }
......
...@@ -663,11 +663,9 @@ struct wcd938x_sdw_priv { ...@@ -663,11 +663,9 @@ struct wcd938x_sdw_priv {
int num_ports; int num_ports;
bool is_tx; bool is_tx;
struct wcd938x_priv *wcd938x; struct wcd938x_priv *wcd938x;
struct irq_domain *slave_irq;
}; };
extern struct regmap_config wcd938x_regmap_config;
int wcd938x_handle_sdw_irq(struct wcd938x_sdw_priv *priv);
#if IS_ENABLED(CONFIG_SND_SOC_WCD938X_SDW) #if IS_ENABLED(CONFIG_SND_SOC_WCD938X_SDW)
int wcd938x_sdw_free(struct wcd938x_sdw_priv *wcd, int wcd938x_sdw_free(struct wcd938x_sdw_priv *wcd,
struct snd_pcm_substream *substream, struct snd_pcm_substream *substream,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment