Commit 38ddfb26 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

Merge tag 'asoc-fix-v5.16-rc4' of...

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.
parents fb1af5be 3fc27e9a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ properties:
  clocks:
    maxItems: 1

  interrupts:
    maxItems: 1

  "#sound-dai-cells":
    const: 0

+2 −1
Original line number Diff line number Diff line
@@ -146,10 +146,11 @@ static int snd_acp6x_probe(struct pci_dev *pci,
{
	struct acp6x_dev_data *adata;
	struct platform_device_info pdevinfo[ACP6x_DEVS];
	int ret, index;
	int index = 0;
	int val = 0x00;
	u32 addr;
	unsigned int irqflags;
	int ret;

	irqflags = IRQF_SHARED;
	/* Yellow Carp device check */
+6 −4
Original line number Diff line number Diff line
@@ -2858,6 +2858,8 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682)

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

		dai_clk_hw = &rt5682->dai_clks_hw[i];

@@ -2865,17 +2867,17 @@ int rt5682_register_dai_clks(struct rt5682_priv *rt5682)
		case RT5682_DAI_WCLK_IDX:
			/* Make MCLK the parent of WCLK */
			if (rt5682->mclk) {
				init.parent_data = &(struct clk_parent_data){
				parent_data = (struct clk_parent_data){
					.fw_name = "mclk",
				};
				init.parent_data = &parent_data;
				init.num_parents = 1;
			}
			break;
		case RT5682_DAI_BCLK_IDX:
			/* Make WCLK the parent of BCLK */
			init.parent_hws = &(const struct clk_hw *){
				&rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX]
			};
			parent = &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX];
			init.parent_hws = &parent;
			init.num_parents = 1;
			break;
		default:
+6 −4
Original line number Diff line number Diff line
@@ -2693,6 +2693,8 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component)

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

		dai_clk_hw = &rt5682s->dai_clks_hw[i];

@@ -2700,17 +2702,17 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component)
		case RT5682S_DAI_WCLK_IDX:
			/* Make MCLK the parent of WCLK */
			if (rt5682s->mclk) {
				init.parent_data = &(struct clk_parent_data){
				parent_data = (struct clk_parent_data){
					.fw_name = "mclk",
				};
				init.parent_data = &parent_data;
				init.num_parents = 1;
			}
			break;
		case RT5682S_DAI_BCLK_IDX:
			/* Make WCLK the parent of BCLK */
			init.parent_hws = &(const struct clk_hw *){
				&rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX]
			};
			parent = &rt5682s->dai_clks_hw[RT5682S_DAI_WCLK_IDX];
			init.parent_hws = &parent;
			init.num_parents = 1;
			break;
		default:
+93 −33
Original line number Diff line number Diff line
@@ -3256,6 +3256,9 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc,
	int value = ucontrol->value.integer.value[0];
	int sel;

	if (wcd->comp_enabled[comp] == value)
		return 0;

	wcd->comp_enabled[comp] = value;
	sel = value ? WCD934X_HPH_GAIN_SRC_SEL_COMPANDER :
		WCD934X_HPH_GAIN_SRC_SEL_REGISTER;
@@ -3279,10 +3282,10 @@ static int wcd934x_compander_set(struct snd_kcontrol *kc,
	case COMPANDER_8:
		break;
	default:
		break;
		return 0;
	}

	return 0;
	return 1;
}

static int wcd934x_rx_hph_mode_get(struct snd_kcontrol *kc,
@@ -3326,6 +3329,31 @@ static int slim_rx_mux_get(struct snd_kcontrol *kc,
	return 0;
}

static int slim_rx_mux_to_dai_id(int mux)
{
	int aif_id;

	switch (mux) {
	case 1:
		aif_id = AIF1_PB;
		break;
	case 2:
		aif_id = AIF2_PB;
		break;
	case 3:
		aif_id = AIF3_PB;
		break;
	case 4:
		aif_id = AIF4_PB;
		break;
	default:
		aif_id = -1;
		break;
	}

	return aif_id;
}

static int slim_rx_mux_put(struct snd_kcontrol *kc,
			   struct snd_ctl_elem_value *ucontrol)
{
@@ -3333,43 +3361,59 @@ static int slim_rx_mux_put(struct snd_kcontrol *kc,
	struct wcd934x_codec *wcd = dev_get_drvdata(w->dapm->dev);
	struct soc_enum *e = (struct soc_enum *)kc->private_value;
	struct snd_soc_dapm_update *update = NULL;
	struct wcd934x_slim_ch *ch, *c;
	u32 port_id = w->shift;
	bool found = false;
	int mux_idx;
	int prev_mux_idx = wcd->rx_port_value[port_id];
	int aif_id;

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

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

	switch (wcd->rx_port_value[port_id]) {
	switch(mux_idx) {
	case 0:
		list_del_init(&wcd->rx_chs[port_id].list);
		break;
	case 1:
		list_add_tail(&wcd->rx_chs[port_id].list,
			      &wcd->dai[AIF1_PB].slim_ch_list);
		break;
	case 2:
		list_add_tail(&wcd->rx_chs[port_id].list,
			      &wcd->dai[AIF2_PB].slim_ch_list);
		aif_id = slim_rx_mux_to_dai_id(prev_mux_idx);
		if (aif_id < 0)
			return 0;

		list_for_each_entry_safe(ch, c, &wcd->dai[aif_id].slim_ch_list, list) {
			if (ch->port == port_id + WCD934X_RX_START) {
				found = true;
				list_del_init(&ch->list);
				break;
	case 3:
		list_add_tail(&wcd->rx_chs[port_id].list,
			      &wcd->dai[AIF3_PB].slim_ch_list);
			}
		}
		if (!found)
			return 0;

		break;
	case 4:
	case 1 ... 4:
		aif_id = slim_rx_mux_to_dai_id(mux_idx);
		if (aif_id < 0)
			return 0;

		if (list_empty(&wcd->rx_chs[port_id].list)) {
			list_add_tail(&wcd->rx_chs[port_id].list,
			      &wcd->dai[AIF4_PB].slim_ch_list);
				      &wcd->dai[aif_id].slim_ch_list);
		} else {
			dev_err(wcd->dev ,"SLIM_RX%d PORT is busy\n", port_id);
			return 0;
		}
		break;

	default:
		dev_err(wcd->dev, "Unknown AIF %d\n",
			wcd->rx_port_value[port_id]);
		dev_err(wcd->dev, "Unknown AIF %d\n", mux_idx);
		goto err;
	}

	wcd->rx_port_value[port_id] = mux_idx;
	snd_soc_dapm_mux_update_power(w->dapm, kc, wcd->rx_port_value[port_id],
				      e, update);

	return 0;
	return 1;
err:
	return -EINVAL;
}
@@ -3815,6 +3859,7 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc,
	struct soc_mixer_control *mixer =
			(struct soc_mixer_control *)kc->private_value;
	int enable = ucontrol->value.integer.value[0];
	struct wcd934x_slim_ch *ch, *c;
	int dai_id = widget->shift;
	int port_id = mixer->shift;

@@ -3822,17 +3867,32 @@ static int slim_tx_mixer_put(struct snd_kcontrol *kc,
	if (enable == wcd->tx_port_value[port_id])
		return 0;

	wcd->tx_port_value[port_id] = enable;

	if (enable)
	if (enable) {
		if (list_empty(&wcd->tx_chs[port_id].list)) {
			list_add_tail(&wcd->tx_chs[port_id].list,
				      &wcd->dai[dai_id].slim_ch_list);
	else
		} else {
			dev_err(wcd->dev ,"SLIM_TX%d PORT is busy\n", port_id);
			return 0;
		}
	 } else {
		bool found = false;

		list_for_each_entry_safe(ch, c, &wcd->dai[dai_id].slim_ch_list, list) {
			if (ch->port == port_id) {
				found = true;
				list_del_init(&wcd->tx_chs[port_id].list);
				break;
			}
		}
		if (!found)
			return 0;
	 }

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

	return 0;
	return 1;
}

static const struct snd_kcontrol_new aif1_slim_cap_mixer[] = {
Loading