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

Commit 823f0f01 authored by Vignesh Kulothungan's avatar Vignesh Kulothungan Committed by Sudheer Papothi
Browse files

ASoC: add config check for QGKI



Add CONFIG_AUDIO_QGKI check for variables and functions
in audio drivers, so they are used only during a QGKI build.

Change-Id: Ia04232566367f196f298a49cf3962bb7927bec6a
Signed-off-by: default avatarVignesh Kulothungan <vigneshk@codeaurora.org>
parent bde9a111
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 */
#include <linux/module.h>
#include <linux/init.h>
@@ -1024,8 +1024,10 @@ static irqreturn_t wcd_mbhc_adc_hs_rem_irq(int irq, void *data)
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_HEADSET);
		else if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADPHONE)
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_HEADPHONE);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		else if (mbhc->current_plug == MBHC_PLUG_TYPE_GND_MIC_SWAP)
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_UNSUPPORTED);
#endif /* CONFIG_AUDIO_QGKI */
		else if (mbhc->current_plug == MBHC_PLUG_TYPE_HIGH_HPH)
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_LINEOUT);
	} else {
+3 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2018, 2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */
#include <linux/module.h>
#include <linux/init.h>
@@ -868,10 +868,12 @@ static irqreturn_t wcd_mbhc_hs_rem_irq(int irq, void *data)
					MBHC_PLUG_TYPE_HEADPHONE)
				wcd_mbhc_report_plug(
					mbhc, 0, SND_JACK_HEADPHONE);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
			else if (mbhc->current_plug ==
					MBHC_PLUG_TYPE_GND_MIC_SWAP)
				wcd_mbhc_report_plug(
					mbhc, 0, SND_JACK_UNSUPPORTED);
#endif /* CONFIG_AUDIO_QGKI */
			else if (mbhc->current_plug ==
					MBHC_PLUG_TYPE_HIGH_HPH)
				wcd_mbhc_report_plug(
+45 −2
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ void wcd_mbhc_jack_report(struct wcd_mbhc *mbhc,
}
EXPORT_SYMBOL(wcd_mbhc_jack_report);

#if IS_ENABLED(CONFIG_AUDIO_QGKI)
static void __hphocp_off_report(struct wcd_mbhc *mbhc, u32 jack_status,
				int irq)
{
@@ -70,6 +71,7 @@ static void hphlocp_off_report(struct wcd_mbhc *mbhc, u32 jack_status)
	__hphocp_off_report(mbhc, SND_JACK_OC_HPHL,
			    mbhc->intr_ids->hph_left_ocp);
}
#endif /* CONFIG_AUDIO_QGKI */

static void wcd_program_hs_vref(struct wcd_mbhc *mbhc)
{
@@ -311,8 +313,10 @@ static int wcd_event_notify(struct notifier_block *self, unsigned long val,
		break;
	case WCD_EVENT_POST_HPHL_PA_OFF:
		clear_bit(WCD_MBHC_HPHL_PA_OFF_ACK, &mbhc->hph_pa_dac_state);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		if (mbhc->hph_status & SND_JACK_OC_HPHL)
			hphlocp_off_report(mbhc, SND_JACK_OC_HPHL);
#endif /* CONFIG_AUDIO_QGKI */
		clear_bit(WCD_MBHC_EVENT_PA_HPHL, &mbhc->event_state);
		/* check if micbias is enabled */
		if (micbias2)
@@ -329,8 +333,10 @@ static int wcd_event_notify(struct notifier_block *self, unsigned long val,
		break;
	case WCD_EVENT_POST_HPHR_PA_OFF:
		clear_bit(WCD_MBHC_HPHR_PA_OFF_ACK, &mbhc->hph_pa_dac_state);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		if (mbhc->hph_status & SND_JACK_OC_HPHR)
			hphrocp_off_report(mbhc, SND_JACK_OC_HPHR);
#endif /* CONFIG_AUDIO_QGKI */
		clear_bit(WCD_MBHC_EVENT_PA_HPHR, &mbhc->event_state);
		/* check if micbias is enabled */
		if (micbias2)
@@ -599,8 +605,10 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
		wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
				mbhc->hph_status, WCD_MBHC_JACK_MASK);
		wcd_mbhc_set_and_turnoff_hph_padac(mbhc);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		hphrocp_off_report(mbhc, SND_JACK_OC_HPHR);
		hphlocp_off_report(mbhc, SND_JACK_OC_HPHL);
#endif /* CONFIG_AUDIO_QGKI */
		mbhc->current_plug = MBHC_PLUG_TYPE_NONE;
		mbhc->force_linein = false;
	} else {
@@ -651,10 +659,15 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
						     WCD_MBHC_ELEC_HS_REM,
						     true);
			}
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
			mbhc->hph_status &= ~(SND_JACK_HEADSET |
						SND_JACK_LINEOUT |
						SND_JACK_ANC_HEADPHONE |
						SND_JACK_UNSUPPORTED);
#else
			mbhc->hph_status &= ~(SND_JACK_HEADSET |
						SND_JACK_LINEOUT);
#endif /* CONFIG_AUDIO_QGKI */
		}

		if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADSET &&
@@ -664,15 +677,19 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
		/* Report insertion */
		if (jack_type == SND_JACK_HEADPHONE)
			mbhc->current_plug = MBHC_PLUG_TYPE_HEADPHONE;
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		else if (jack_type == SND_JACK_UNSUPPORTED)
			mbhc->current_plug = MBHC_PLUG_TYPE_GND_MIC_SWAP;
#endif /* CONFIG_AUDIO_QGKI */
		else if (jack_type == SND_JACK_HEADSET) {
			mbhc->current_plug = MBHC_PLUG_TYPE_HEADSET;
			mbhc->jiffies_atreport = jiffies;
		} else if (jack_type == SND_JACK_LINEOUT) {
		} else if (jack_type == SND_JACK_LINEOUT)
			mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH;
		} else if (jack_type == SND_JACK_ANC_HEADPHONE)
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		else if (jack_type == SND_JACK_ANC_HEADPHONE)
			mbhc->current_plug = MBHC_PLUG_TYPE_ANC_HEADPHONE;
#endif /* CONFIG_AUDIO_QGKI */

		if (mbhc->mbhc_cb->hph_pa_on_status)
			is_pa_on = mbhc->mbhc_cb->hph_pa_on_status(component);
@@ -698,9 +715,14 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
				mbhc->force_linein = true;
				mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH;
				if (mbhc->hph_status) {
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
					mbhc->hph_status &= ~(SND_JACK_HEADSET |
							SND_JACK_LINEOUT |
							SND_JACK_UNSUPPORTED);
#else
					mbhc->hph_status &= ~(SND_JACK_HEADSET |
							SND_JACK_LINEOUT);
#endif /* CONFIG_AUDIO_QGKI */
					wcd_mbhc_jack_report(mbhc,
							&mbhc->headset_jack,
							mbhc->hph_status,
@@ -720,9 +742,14 @@ void wcd_mbhc_report_plug(struct wcd_mbhc *mbhc, int insertion,
			jack_type = SND_JACK_LINEOUT;
			mbhc->current_plug = MBHC_PLUG_TYPE_HIGH_HPH;
			if (mbhc->hph_status) {
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
				mbhc->hph_status &= ~(SND_JACK_HEADSET |
						SND_JACK_LINEOUT |
						SND_JACK_UNSUPPORTED);
#else
				mbhc->hph_status &= ~(SND_JACK_HEADSET |
						SND_JACK_LINEOUT);
#endif /* CONFIG_AUDIO_QGKI */
				wcd_mbhc_jack_report(mbhc,
						&mbhc->headset_jack,
						mbhc->hph_status,
@@ -814,15 +841,19 @@ void wcd_mbhc_find_plug_and_report(struct wcd_mbhc *mbhc,
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_HEADPHONE);
		if (mbhc->current_plug == MBHC_PLUG_TYPE_HEADSET)
			wcd_mbhc_report_plug(mbhc, 0, SND_JACK_HEADSET);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		wcd_mbhc_report_plug(mbhc, 1, SND_JACK_UNSUPPORTED);
#endif /* CONFIG_AUDIO_QGKI */
	} else if (plug_type == MBHC_PLUG_TYPE_HEADSET) {
		if (mbhc->mbhc_cfg->enable_anc_mic_detect &&
		    mbhc->mbhc_fn->wcd_mbhc_detect_anc_plug_type)
			anc_mic_found =
			mbhc->mbhc_fn->wcd_mbhc_detect_anc_plug_type(mbhc);
		jack_type = SND_JACK_HEADSET;
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		if (anc_mic_found)
			jack_type = SND_JACK_ANC_HEADPHONE;
#endif /* CONFIG_AUDIO_QGKI */

		/*
		 * If Headphone was reported previously, this will
@@ -983,9 +1014,11 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
		case MBHC_PLUG_TYPE_HEADPHONE:
			jack_type = SND_JACK_HEADPHONE;
			break;
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		case MBHC_PLUG_TYPE_GND_MIC_SWAP:
			jack_type = SND_JACK_UNSUPPORTED;
			break;
#endif /* CONFIG_AUDIO_QGKI */
		case MBHC_PLUG_TYPE_HEADSET:
			/* make sure to turn off Rbias */
			if (mbhc->mbhc_cb->micb_internal)
@@ -1001,13 +1034,19 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
			mbhc->is_extn_cable = false;
			jack_type = SND_JACK_LINEOUT;
			break;
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		case MBHC_PLUG_TYPE_ANC_HEADPHONE:
			jack_type = SND_JACK_ANC_HEADPHONE;
			break;
#endif /* CONFIG_AUDIO_QGKI */
		default:
			pr_info("%s: Invalid current plug: %d\n",
				__func__, mbhc->current_plug);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
			jack_type = SND_JACK_UNSUPPORTED;
#else
			jack_type = SND_JACK_HEADPHONE;
#endif /* CONFIG_AUDIO_QGKI */
			break;
		}
		wcd_mbhc_hs_elec_irq(mbhc, WCD_MBHC_ELEC_HS_REM, false);
@@ -1295,7 +1334,9 @@ static irqreturn_t wcd_mbhc_hphl_ocp_irq(int irq, void *data)
			mbhc->mbhc_cb->irq_control(mbhc->component,
						   mbhc->intr_ids->hph_left_ocp,
						   false);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
			mbhc->hph_status |= SND_JACK_OC_HPHL;
#endif /* CONFIG_AUDIO_QGKI */
			wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
					    mbhc->hph_status,
					    WCD_MBHC_JACK_MASK);
@@ -1338,7 +1379,9 @@ static irqreturn_t wcd_mbhc_hphr_ocp_irq(int irq, void *data)
		mbhc->mbhc_cb->irq_control(mbhc->component,
					   mbhc->intr_ids->hph_right_ocp,
					   false);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
		mbhc->hph_status |= SND_JACK_OC_HPHR;
#endif /* CONFIG_AUDIO_QGKI */
		wcd_mbhc_jack_report(mbhc, &mbhc->headset_jack,
				    mbhc->hph_status, WCD_MBHC_JACK_MASK);
	}
+5 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */
#include <linux/module.h>
#include <linux/init.h>
@@ -13755,8 +13755,10 @@ static int tasha_device_down(struct wcd9xxx *wcd9xxx)
				SWR_DEVICE_DOWN, NULL);
	}

#if IS_ENABLED(CONFIG_AUDIO_QGKI)
	if (!is_snd_event_fwk_enabled())
		snd_soc_card_change_online_state(component->card, 0);
#endif /* CONFIG_AUDIO_QGKI */
	for (count = 0; count < NUM_CODEC_DAIS; count++)
		priv->dai[count].bus_down_in_recovery = true;

@@ -13791,8 +13793,10 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx)
	if (tasha->machine_codec_event_cb)
		tasha->machine_codec_event_cb(component,
				WCD9335_CODEC_EVENT_CODEC_UP);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
	if (!is_snd_event_fwk_enabled())
		snd_soc_card_change_online_state(component->card, 1);
#endif /* CONFIG_AUDIO_QGKI */

	/* Class-H Init*/
	wcd_clsh_init(&tasha->clsh_d);
+5 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */
#include <linux/module.h>
#include <linux/init.h>
@@ -10334,8 +10334,10 @@ static int tavil_device_down(struct wcd9xxx *wcd9xxx)
				SWR_DEVICE_DOWN, NULL);
	}
	tavil_dsd_reset(priv->dsd_config);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
	if (!is_snd_event_fwk_enabled())
		snd_soc_card_change_online_state(component->card, 0);
#endif /* CONFIG_AUDIO_QGKI */
	wcd_dsp_ssr_event(priv->wdsp_cntl, WCD_CDC_DOWN_EVENT);
	wcd_resmgr_set_sido_input_src_locked(priv->resmgr,
					     SIDO_SOURCE_INTERNAL);
@@ -10373,8 +10375,10 @@ static int tavil_post_reset_cb(struct wcd9xxx *wcd9xxx)
	tavil_slimbus_slave_port_cfg.slave_dev_pgd_la =
					control->slim->laddr;
	tavil_init_slim_slave_cfg(component);
#if IS_ENABLED(CONFIG_AUDIO_QGKI)
	if (!is_snd_event_fwk_enabled())
		snd_soc_card_change_online_state(component->card, 1);
#endif /* CONFIG_AUDIO_QGKI */

	for (i = 0; i < TAVIL_MAX_MICBIAS; i++)
		tavil->micb_ref[i] = 0;
Loading