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

Commit ac4a799f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: wcd-mbhc: add wcd934x mbhc driver"

parents c190f578 5962d6e4
Loading
Loading
Loading
Loading

sound/soc/codecs/Kconfig

100755 → 100644
+6 −0
Original line number Diff line number Diff line
@@ -731,6 +731,12 @@ config SND_SOC_WCD934X
	select AUDIO_EXT_CLK
	select SND_SOC_WCD_DSP_MGR
	select SND_SOC_WCD_SPI
	select SND_SOC_WCD934X_MBHC

config SND_SOC_WCD934X_MBHC
        tristate
	depends on SND_SOC_WCD934X
	select SND_SOC_WCD_MBHC

config SND_SOC_WSA881X
        tristate
+7 −7
Original line number Diff line number Diff line
@@ -1525,14 +1525,14 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
			mbhc->mbhc_cb->trim_btn_reg(codec);
		/* Enable external voltage source to micbias if present */
		if (mbhc->mbhc_cb->enable_mb_source)
			mbhc->mbhc_cb->enable_mb_source(codec, true);
			mbhc->mbhc_cb->enable_mb_source(mbhc, true);
		mbhc->btn_press_intr = false;
		wcd_mbhc_detect_plug_type(mbhc);
	} else if ((mbhc->current_plug != MBHC_PLUG_TYPE_NONE)
			&& !detection_type) {
		/* Disable external voltage source to micbias if present */
		if (mbhc->mbhc_cb->enable_mb_source)
			mbhc->mbhc_cb->enable_mb_source(codec, false);
			mbhc->mbhc_cb->enable_mb_source(mbhc, false);
		/* Disable HW FSM */
		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 0);
@@ -1588,7 +1588,7 @@ static void wcd_mbhc_swch_irq_handler(struct wcd_mbhc *mbhc)
	} else if (!detection_type) {
		/* Disable external voltage source to micbias if present */
		if (mbhc->mbhc_cb->enable_mb_source)
			mbhc->mbhc_cb->enable_mb_source(codec, false);
			mbhc->mbhc_cb->enable_mb_source(mbhc, false);
		/* Disable HW FSM */
		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_FSM_EN, 0);
		WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_BTN_ISRC_CTL, 0);
@@ -2142,7 +2142,7 @@ static void wcd_mbhc_fw_read(struct work_struct *work)
		pr_debug("%s:Attempt %d to request MBHC firmware\n",
			__func__, retry);
		if (mbhc->mbhc_cb->get_hwdep_fw_cal)
			fw_data = mbhc->mbhc_cb->get_hwdep_fw_cal(codec,
			fw_data = mbhc->mbhc_cb->get_hwdep_fw_cal(mbhc,
					WCD9XXX_MBHC_CAL);
		if (!fw_data)
			ret = request_firmware(&fw, "wcd9320/wcd9320_mbhc.bin",
@@ -2427,7 +2427,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec,
	/* Register event notifier */
	mbhc->nblock.notifier_call = wcd_event_notify;
	if (mbhc->mbhc_cb->register_notifier) {
		ret = mbhc->mbhc_cb->register_notifier(codec, &mbhc->nblock,
		ret = mbhc->mbhc_cb->register_notifier(mbhc, &mbhc->nblock,
						       true);
		if (ret) {
			pr_err("%s: Failed to register notifier %d\n",
@@ -2532,7 +2532,7 @@ err_btn_press_irq:
	mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->mbhc_sw_intr, mbhc);
err_mbhc_sw_irq:
	if (mbhc->mbhc_cb->register_notifier)
		mbhc->mbhc_cb->register_notifier(codec, &mbhc->nblock, false);
		mbhc->mbhc_cb->register_notifier(mbhc, &mbhc->nblock, false);
	mutex_destroy(&mbhc->codec_resource_lock);
err:
	pr_debug("%s: leave ret %d\n", __func__, ret);
@@ -2554,7 +2554,7 @@ void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
	mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->hph_left_ocp, mbhc);
	mbhc->mbhc_cb->free_irq(codec, mbhc->intr_ids->hph_right_ocp, mbhc);
	if (mbhc->mbhc_cb && mbhc->mbhc_cb->register_notifier)
		mbhc->mbhc_cb->register_notifier(codec, &mbhc->nblock, false);
		mbhc->mbhc_cb->register_notifier(mbhc, &mbhc->nblock, false);
	mutex_destroy(&mbhc->codec_resource_lock);
}
EXPORT_SYMBOL(wcd_mbhc_deinit);
+4 −4
Original line number Diff line number Diff line
/* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -325,15 +325,15 @@ do { \
} while (0)

struct wcd_mbhc_cb {
	int (*enable_mb_source)(struct snd_soc_codec *, bool);
	int (*enable_mb_source)(struct wcd_mbhc *, bool);
	void (*trim_btn_reg)(struct snd_soc_codec *);
	void (*compute_impedance)(struct wcd_mbhc *, uint32_t *, uint32_t *);
	void (*set_micbias_value)(struct snd_soc_codec *);
	void (*set_auto_zeroing)(struct snd_soc_codec *, bool);
	struct firmware_cal * (*get_hwdep_fw_cal)(struct snd_soc_codec *,
	struct firmware_cal * (*get_hwdep_fw_cal)(struct wcd_mbhc *,
			enum wcd_cal_type);
	void (*set_cap_mode)(struct snd_soc_codec *, bool, bool);
	int (*register_notifier)(struct snd_soc_codec *,
	int (*register_notifier)(struct wcd_mbhc *,
				 struct notifier_block *nblock,
				 bool enable);
	int (*request_irq)(struct snd_soc_codec *,
+6 −3
Original line number Diff line number Diff line
@@ -1460,10 +1460,11 @@ static bool tasha_mbhc_lock_sleep(struct wcd_mbhc *mbhc, bool lock)
	}
}

static int tasha_mbhc_register_notifier(struct snd_soc_codec *codec,
static int tasha_mbhc_register_notifier(struct wcd_mbhc *mbhc,
					struct notifier_block *nblock,
					bool enable)
{
	struct snd_soc_codec *codec = mbhc->codec;
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);

	if (enable)
@@ -1514,9 +1515,10 @@ static void tasha_mbhc_hph_l_pull_up_control(struct snd_soc_codec *codec,
			    0xC0, 0x40);
}

static int tasha_enable_ext_mb_source(struct snd_soc_codec *codec,
static int tasha_enable_ext_mb_source(struct wcd_mbhc *mbhc,
		bool turn_on)
{
	struct snd_soc_codec *codec = mbhc->codec;
	struct tasha_priv *tasha = snd_soc_codec_get_drvdata(codec);
	int ret = 0;
	struct on_demand_supply *supply;
@@ -1701,11 +1703,12 @@ static void tasha_mbhc_micb_ramp_control(struct snd_soc_codec *codec,
	}
}

static struct firmware_cal *tasha_get_hwdep_fw_cal(struct snd_soc_codec *codec,
static struct firmware_cal *tasha_get_hwdep_fw_cal(struct wcd_mbhc *mbhc,
						   enum wcd_cal_type type)
{
	struct tasha_priv *tasha;
	struct firmware_cal *hwdep_cal;
	struct snd_soc_codec *codec = mbhc->codec;

	if (!codec) {
		pr_err("%s: NULL codec pointer\n", __func__);
+2 −0
Original line number Diff line number Diff line
@@ -3,3 +3,5 @@
#
snd-soc-wcd934x-objs := wcd934x.o wcd934x-dsp-cntl.o
obj-$(CONFIG_SND_SOC_WCD934X) += snd-soc-wcd934x.o
snd-soc-wcd934x-mbhc-objs := wcd934x-mbhc.o
obj-$(CONFIG_SND_SOC_WCD934X_MBHC) += snd-soc-wcd934x-mbhc.o
Loading