Skip to content

Commit 45a3295

Browse files
Srinivas Kandagatlabroonie
authored andcommitted
ASoC: codecs: wcdxxxx: use sdw_slave_get_current_bank helper
use sdw_slave_get_current_bank() helper function, rather than duplicating this function in every codec driver. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Acked-by: Vinod Koul <vkoul@kernel.org> Link: https://patch.msgid.link/20250909121954.225833-7-srinivas.kandagatla@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 772ed12 commit 45a3295

6 files changed

Lines changed: 2 additions & 34 deletions

File tree

sound/soc/codecs/wcd938x-sdw.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,6 @@ static struct sdw_dpn_prop wcd938x_dpn_prop[WCD938X_MAX_SWR_PORTS] = {
8282
}
8383
};
8484

85-
int wcd938x_swr_get_current_bank(struct sdw_slave *sdev)
86-
{
87-
int bank;
88-
89-
bank = sdw_read(sdev, SDW_SCP_CTRL);
90-
91-
return ((bank & 0x40) ? 1 : 0);
92-
}
93-
EXPORT_SYMBOL_GPL(wcd938x_swr_get_current_bank);
94-
9585
int wcd938x_sdw_hw_params(struct wcd938x_sdw_priv *wcd,
9686
struct snd_pcm_substream *substream,
9787
struct snd_pcm_hw_params *params,

sound/soc/codecs/wcd938x.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,7 @@ static int wcd938x_tx_swr_ctrl(struct snd_soc_dapm_widget *w,
10941094
int bank;
10951095
int rate;
10961096

1097-
bank = (wcd938x_swr_get_current_bank(wcd938x->sdw_priv[AIF1_CAP]->sdev)) ? 0 : 1;
1098-
bank = bank ? 0 : 1;
1097+
bank = sdw_slave_get_current_bank(wcd938x->sdw_priv[AIF1_CAP]->sdev);
10991098

11001099
switch (event) {
11011100
case SND_SOC_DAPM_PRE_PMU:

sound/soc/codecs/wcd938x.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -669,9 +669,6 @@ int wcd938x_sdw_hw_params(struct wcd938x_sdw_priv *wcd,
669669
struct snd_pcm_substream *substream,
670670
struct snd_pcm_hw_params *params,
671671
struct snd_soc_dai *dai);
672-
673-
int wcd938x_swr_get_current_bank(struct sdw_slave *sdev);
674-
675672
#else
676673

677674
static inline int wcd938x_sdw_free(struct wcd938x_sdw_priv *wcd,
@@ -696,9 +693,5 @@ static inline int wcd938x_sdw_hw_params(struct wcd938x_sdw_priv *wcd,
696693
return -EOPNOTSUPP;
697694
}
698695

699-
static inline int wcd938x_swr_get_current_bank(struct sdw_slave *sdev)
700-
{
701-
return 0;
702-
}
703696
#endif /* CONFIG_SND_SOC_WCD938X_SDW */
704697
#endif /* __WCD938X_H__ */

sound/soc/codecs/wcd939x-sdw.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,6 @@ static struct sdw_dpn_prop wcd939x_tx_dpn_prop[WCD939X_MAX_TX_SWR_PORTS] = {
128128
}
129129
};
130130

131-
unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev)
132-
{
133-
return FIELD_GET(SDW_SCP_STAT_CURR_BANK,
134-
sdw_read(sdev, SDW_SCP_CTRL));
135-
}
136-
EXPORT_SYMBOL_GPL(wcd939x_swr_get_current_bank);
137-
138131
int wcd939x_sdw_hw_params(struct wcd939x_sdw_priv *wcd,
139132
struct snd_pcm_substream *substream,
140133
struct snd_pcm_hw_params *params,

sound/soc/codecs/wcd939x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ static int wcd939x_tx_swr_ctrl(struct snd_soc_dapm_widget *w,
10171017
int bank;
10181018
int rate;
10191019

1020-
bank = wcd939x_swr_get_current_bank(wcd939x->sdw_priv[AIF1_CAP]->sdev);
1020+
bank = sdw_slave_get_current_bank(wcd939x->sdw_priv[AIF1_CAP]->sdev);
10211021

10221022
switch (event) {
10231023
case SND_SOC_DAPM_PRE_PMU:

sound/soc/codecs/wcd939x.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -930,8 +930,6 @@ int wcd939x_sdw_hw_params(struct wcd939x_sdw_priv *wcd,
930930
struct snd_pcm_hw_params *params,
931931
struct snd_soc_dai *dai);
932932

933-
unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev);
934-
935933
struct regmap *wcd939x_swr_get_regmap(struct wcd939x_sdw_priv *wcd);
936934
#else
937935

@@ -957,11 +955,6 @@ static inline int wcd939x_sdw_hw_params(struct wcd939x_sdw_priv *wcd,
957955
return -EOPNOTSUPP;
958956
}
959957

960-
static inline unsigned int wcd939x_swr_get_current_bank(struct sdw_slave *sdev)
961-
{
962-
return 0;
963-
}
964-
965958
struct regmap *wcd939x_swr_get_regmap(struct wcd939x_sdw_priv *wcd)
966959
{
967960
return PTR_ERR(-EINVAL);

0 commit comments

Comments
 (0)