Skip to content

Commit 38ddfb2

Browse files
committed
Merge tag 'asoc-fix-v5.16-rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v5.16 A relatively large collection of updates, the size is increased quite a bit by there being some repetitive changes for similar issues that occur multiple times with both notifying control value changes and runtime PM. The Rockchip update looks at first glance like a cleanup but fixes instantiation of the hardware on some systems.
2 parents fb1af5b + 3fc27e9 commit 38ddfb2

File tree

14 files changed

+179
-87
lines changed

14 files changed

+179
-87
lines changed

Documentation/devicetree/bindings/sound/wlf,wm8962.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ properties:
1919
clocks:
2020
maxItems: 1
2121

22+
interrupts:
23+
maxItems: 1
24+
2225
"#sound-dai-cells":
2326
const: 0
2427

sound/soc/amd/yc/pci-acp6x.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ static int snd_acp6x_probe(struct pci_dev *pci,
146146
{
147147
struct acp6x_dev_data *adata;
148148
struct platform_device_info pdevinfo[ACP6x_DEVS];
149-
int ret, index;
149+
int index = 0;
150150
int val = 0x00;
151151
u32 addr;
152152
unsigned int irqflags;
153+
int ret;
153154

154155
irqflags = IRQF_SHARED;
155156
/* Yellow Carp device check */

sound/soc/codecs/rt5682.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2858,24 +2858,26 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682)
28582858

28592859
for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) {
28602860
struct clk_init_data init = { };
2861+
struct clk_parent_data parent_data;
2862+
const struct clk_hw *parent;
28612863

28622864
dai_clk_hw = &rt5682->dai_clks_hw[i];
28632865

28642866
switch (i) {
28652867
case RT5682_DAI_WCLK_IDX:
28662868
/* Make MCLK the parent of WCLK */
28672869
if (rt5682->mclk) {
2868-
init.parent_data = &(struct clk_parent_data){
2870+
parent_data = (struct clk_parent_data){
28692871
.fw_name = "mclk",
28702872
};
2873+
init.parent_data = &parent_data;
28712874
init.num_parents = 1;
28722875
}
28732876
break;
28742877
case RT5682_DAI_BCLK_IDX:
28752878
/* Make WCLK the parent of BCLK */
2876-
init.parent_hws = &(const struct clk_hw *){
2877-
&rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]
2878-
};
2879+
parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX];
2880+
init.parent_hws = &parent;
28792881
init.num_parents = 1;
28802882
break;
28812883
default:

sound/soc/codecs/rt5682s.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,24 +2693,26 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component)
26932693

26942694
for (i = 0; i < RT5682S_DAI_NUM_CLKS; ++i) {
26952695
struct clk_init_data init = { };
2696+
struct clk_parent_data parent_data;
2697+
const struct clk_hw *parent;
26962698

26972699
dai_clk_hw = &rt5682s->dai_clks_hw[i];
26982700

26992701
switch (i) {
27002702
case RT5682S_DAI_WCLK_IDX:
27012703
/* Make MCLK the parent of WCLK */
27022704
if (rt5682s->mclk) {
2703-
init.parent_data = &(struct clk_parent_data){
2705+
parent_data = (struct clk_parent_data){
27042706
.fw_name = "mclk",
27052707
};
2708+
init.parent_data = &parent_data;
27062709
init.num_parents = 1;
27072710
}
27082711
break;
27092712
case RT5682S_DAI_BCLK_IDX:
27102713
/* Make WCLK the parent of BCLK */
2711-
init.parent_hws = &(const struct clk_hw *){
2712-
&rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]
2713-
};
2714+
parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX];
2715+
init.parent_hws = &parent;
27142716
init.num_parents = 1;
27152717
break;
27162718
default:

sound/soc/codecs/wcd934x.c

Lines changed: 93 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3256,6 +3256,9 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc,
32563256
int value = ucontrol->value.integer.value[0];
32573257
int sel;
32583258

3259+
if (wcd->comp_enabled[comp] == value)
3260+
return 0;
3261+
32593262
wcd->comp_enabled[comp] = value;
32603263
sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER :
32613264
WCD934X_HPH_GAIN_SRC_SEL_REGISTER;
@@ -3279,10 +3282,10 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc,
32793282
case COMPANDER_8:
32803283
break;
32813284
default:
3282-
break;
3285+
return 0;
32833286
}
32843287

3285-
return 0;
3288+
return 1;
32863289
}
32873290

32883291
static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc,
@@ -3326,50 +3329,91 @@ static int slim_rx_mux_get(struct snd_kcontrol *kc,
33263329
return 0;
33273330
}
33283331

3332+
static int slim_rx_mux_to_dai_id(int mux)
3333+
{
3334+
int aif_id;
3335+
3336+
switch (mux) {
3337+
case 1:
3338+
aif_id = AIF1_PB;
3339+
break;
3340+
case 2:
3341+
aif_id = AIF2_PB;
3342+
break;
3343+
case 3:
3344+
aif_id = AIF3_PB;
3345+
break;
3346+
case 4:
3347+
aif_id = AIF4_PB;
3348+
break;
3349+
default:
3350+
aif_id = -1;
3351+
break;
3352+
}
3353+
3354+
return aif_id;
3355+
}
3356+
33293357
static int slim_rx_mux_put(struct snd_kcontrol *kc,
33303358
struct snd_ctl_elem_value *ucontrol)
33313359
{
33323360
struct snd_soc_dapm_widget *w = snd_soc_dapm_kcontrol_widget(kc);
33333361
struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev);
33343362
struct soc_enum *e = (struct soc_enum *)kc->private_value;
33353363
struct snd_soc_dapm_update *update = NULL;
3364+
struct wcd934x_slim_ch *ch, *c;
33363365
u32 port_id = w->shift;
3366+
bool found = false;
3367+
int mux_idx;
3368+
int prev_mux_idx = wcd->rx_port_value[port_id];
3369+
int aif_id;
33373370

3338-
if (wcd->rx_port_value[port_id] == ucontrol->value.enumerated.item[0])
3339-
return 0;
3371+
mux_idx = ucontrol->value.enumerated.item[0];
33403372

3341-
wcd->rx_port_value[port_id] = ucontrol->value.enumerated.item[0];
3373+
if (mux_idx == prev_mux_idx)
3374+
return 0;
33423375

3343-
switch (wcd->rx_port_value[port_id]) {
3376+
switch(mux_idx) {
33443377
case 0:
3345-
list_del_init(&wcd->rx_chs[port_id].list);
3346-
break;
3347-
case 1:
3348-
list_add_tail(&wcd->rx_chs[port_id].list,
3349-
&wcd->dai[AIF1_PB].slim_ch_list);
3350-
break;
3351-
case 2:
3352-
list_add_tail(&wcd->rx_chs[port_id].list,
3353-
&wcd->dai[AIF2_PB].slim_ch_list);
3354-
break;
3355-
case 3:
3356-
list_add_tail(&wcd->rx_chs[port_id].list,
3357-
&wcd->dai[AIF3_PB].slim_ch_list);
3378+
aif_id = slim_rx_mux_to_dai_id(prev_mux_idx);
3379+
if (aif_id < 0)
3380+
return 0;
3381+
3382+
list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) {
3383+
if (ch->port == port_id + WCD934X_RX_START) {
3384+
found = true;
3385+
list_del_init(&ch->list);
3386+
break;
3387+
}
3388+
}
3389+
if (!found)
3390+
return 0;
3391+
33583392
break;
3359-
case 4:
3360-
list_add_tail(&wcd->rx_chs[port_id].list,
3361-
&wcd->dai[AIF4_PB].slim_ch_list);
3393+
case 1 ... 4:
3394+
aif_id = slim_rx_mux_to_dai_id(mux_idx);
3395+
if (aif_id < 0)
3396+
return 0;
3397+
3398+
if (list_empty(&wcd->rx_chs[port_id].list)) {
3399+
list_add_tail(&wcd->rx_chs[port_id].list,
3400+
&wcd->dai[aif_id].slim_ch_list);
3401+
} else {
3402+
dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id);
3403+
return 0;
3404+
}
33623405
break;
3406+
33633407
default:
3364-
dev_err(wcd->dev, "Unknown AIF %d\n",
3365-
wcd->rx_port_value[port_id]);
3408+
dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx);
33663409
goto err;
33673410
}
33683411

3412+
wcd->rx_port_value[port_id] = mux_idx;
33693413
snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
33703414
e, update);
33713415

3372-
return 0;
3416+
return 1;
33733417
err:
33743418
return -EINVAL;
33753419
}
@@ -3815,24 +3859,40 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc,
38153859
struct soc_mixer_control *mixer =
38163860
(struct soc_mixer_control *)kc->private_value;
38173861
int enable = ucontrol->value.integer.value[0];
3862+
struct wcd934x_slim_ch *ch, *c;
38183863
int dai_id = widget->shift;
38193864
int port_id = mixer->shift;
38203865

38213866
/* only add to the list if value not set */
38223867
if (enable == wcd->tx_port_value[port_id])
38233868
return 0;
38243869

3825-
wcd->tx_port_value[port_id] = enable;
3826-
3827-
if (enable)
3828-
list_add_tail(&wcd->tx_chs[port_id].list,
3829-
&wcd->dai[dai_id].slim_ch_list);
3830-
else
3831-
list_del_init(&wcd->tx_chs[port_id].list);
3870+
if (enable) {
3871+
if (list_empty(&wcd->tx_chs[port_id].list)) {
3872+
list_add_tail(&wcd->tx_chs[port_id].list,
3873+
&wcd->dai[dai_id].slim_ch_list);
3874+
} else {
3875+
dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id);
3876+
return 0;
3877+
}
3878+
} else {
3879+
bool found = false;
3880+
3881+
list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) {
3882+
if (ch->port == port_id) {
3883+
found = true;
3884+
list_del_init(&wcd->tx_chs[port_id].list);
3885+
break;
3886+
}
3887+
}
3888+
if (!found)
3889+
return 0;
3890+
}
38323891

3892+
wcd->tx_port_value[port_id] = enable;
38333893
snd_soc_dapm_mixer_update_power(widget->dapm, kc, enable, update);
38343894

3835-
return 0;
3895+
return 1;
38363896
}
38373897

38383898
static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = {

sound/soc/codecs/wsa881x.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,8 @@ static int wsa881x_put_pa_gain(struct snd_kcontrol *kc,
772772

773773
usleep_range(1000, 1010);
774774
}
775-
return 0;
775+
776+
return 1;
776777
}
777778

778779
static int wsa881x_get_port(struct snd_kcontrol *kcontrol,
@@ -816,15 +817,22 @@ static int wsa881x_set_port(struct snd_kcontrol *kcontrol,
816817
(struct soc_mixer_control *)kcontrol->private_value;
817818
int portidx = mixer->reg;
818819

819-
if (ucontrol->value.integer.value[0])
820+
if (ucontrol->value.integer.value[0]) {
821+
if (data->port_enable[portidx])
822+
return 0;
823+
820824
data->port_enable[portidx] = true;
821-
else
825+
} else {
826+
if (!data->port_enable[portidx])
827+
return 0;
828+
822829
data->port_enable[portidx] = false;
830+
}
823831

824832
if (portidx == WSA881X_PORT_BOOST) /* Boost Switch */
825833
wsa881x_boost_ctrl(comp, data->port_enable[portidx]);
826834

827-
return 0;
835+
return 1;
828836
}
829837

830838
static const char * const smart_boost_lvl_text[] = {

sound/soc/qcom/qdsp6/q6routing.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,14 +498,16 @@ static int msm_routing_put_audio_mixer(struct snd_kcontrol *kcontrol,
498498
struct session_data *session = &data->sessions[session_id];
499499

500500
if (ucontrol->value.integer.value[0]) {
501+
if (session->port_id == be_id)
502+
return 0;
503+
501504
session->port_id = be_id;
502505
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 1, update);
503506
} else {
504-
if (session->port_id == be_id) {
505-
session->port_id = -1;
507+
if (session->port_id == -1 || session->port_id != be_id)
506508
return 0;
507-
}
508509

510+
session->port_id = -1;
509511
snd_soc_dapm_mixer_update_power(dapm, kcontrol, 0, update);
510512
}
511513

0 commit comments

Comments
 (0)