Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67e19082 authored by Xiaojun Sang's avatar Xiaojun Sang
Browse files

AsoC: lahaina: support right speaker as mono device



Current design assumes mono device uses left speaker.
Modify the logic to remove the limitation.

Change-Id: I6a7cd2b14ed5a4c10106593fe707a449d05efe48
Signed-off-by: default avatarXiaojun Sang <xsang@codeaurora.org>
parent 5fbd9fb1
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -7525,17 +7525,14 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)
	struct msm_asoc_mach_data *pdata =
				snd_soc_card_get_drvdata(rtd->card);
	int ret = 0;
	int wsa_active_devs = 0;

	if (codec_reg_done) {
		return 0;
	}
        if (pdata->wsa_max_devs > 0) {
		component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.1");
		if (!component) {
			pr_err("%s: wsa-codec.1 component is NULL\n", __func__);
			return -EINVAL;
		}

		if (component) {
			dapm = snd_soc_component_get_dapm(component);

			wsa883x_set_channel_map(component, &spkleft_ports[0],
@@ -7544,13 +7541,19 @@ static int msm_int_audrx_init(struct snd_soc_pcm_runtime *rtd)

			wsa883x_codec_info_create_codec_entry(pdata->codec_root,
								component);
			wsa_active_devs++;
		} else {
			pr_info("%s: wsa-codec.1 component is NULL\n", __func__);
		}
	}

        /* If current platform has more than one WSA */
        if (pdata->wsa_max_devs > 1) {
        if (pdata->wsa_max_devs > wsa_active_devs) {
		component = snd_soc_rtdcom_lookup(rtd, "wsa-codec.2");
		if (!component) {
			pr_err("%s: wsa-codec.2 component is NULL\n", __func__);
			pr_err("%s: %d WSA is found. Expect %d WSA.",
				__func__, wsa_active_devs, pdata->wsa_max_devs);
			return -EINVAL;
		}