Merge "asoc: mbhc: disable pa while measuring the adc values"

This commit is contained in:
qctecmdr
2022-08-04 09:00:21 -07:00
committad av Gerrit - the friendly Code Review server
förälder 6f16c80cc0 05a1b9bd4d
incheckning 6c35de32f9
3 ändrade filer med 28 tillägg och 0 borttagningar

Visa fil

@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/module.h>
#include <linux/init.h>
@@ -127,9 +128,18 @@ static int wcd_measure_adc_once(struct wcd_mbhc *mbhc, int mux_ctl)
int ret = 0;
int output_mv = 0;
u8 adc_en = 0;
bool is_pa_on = false;
pr_debug("%s: enter\n", __func__);
if (mbhc->mbhc_cb->hph_pa_on_status) {
if (mbhc->mbhc_cb->hph_pa_on_status(mbhc->component)) {
mbhc->mbhc_cb->hph_pa_enable(mbhc->component, 0);
is_pa_on = true;
pr_debug("%s: pa is on before detection,so disable pa and read adc \n", __func__);
}
}
WCD_MBHC_REG_UPDATE_BITS(WCD_MBHC_ADC_MODE, 0);
/* Read ADC Enable bit to restore after adc measurement */
WCD_MBHC_REG_READ(WCD_MBHC_ADC_EN, adc_en);
@@ -178,6 +188,11 @@ static int wcd_measure_adc_once(struct wcd_mbhc *mbhc, int mux_ctl)
ret = output_mv;
}
if (is_pa_on) {
mbhc->mbhc_cb->hph_pa_enable(mbhc->component, 1);
pr_debug("%s: restore pa \n", __func__);
}
pr_debug("%s: leave\n", __func__);
return ret;

Visa fil

@@ -804,6 +804,15 @@ static void wcd938x_mbhc_moisture_polling_ctrl(struct wcd_mbhc *mbhc,
0x04, (enable << 2));
}
static void wcd938x_mbhc_hph_pa_enable(struct snd_soc_component *component,
bool enable)
{
if (enable)
snd_soc_component_update_bits(component, WCD938X_ANA_HPH, 0xC0, 0xC0);
else
snd_soc_component_update_bits(component, WCD938X_ANA_HPH,0xC0, 00);
}
static void wcd938x_mbhc_bcs_enable(struct wcd_mbhc *mbhc,
bool bcs_enable)
{
@@ -838,6 +847,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
.mbhc_moisture_polling_ctrl = wcd938x_mbhc_moisture_polling_ctrl,
.mbhc_moisture_detect_en = wcd938x_mbhc_moisture_detect_en,
.bcs_enable = wcd938x_mbhc_bcs_enable,
.hph_pa_enable = wcd938x_mbhc_hph_pa_enable,
};
static int wcd938x_get_hph_type(struct snd_kcontrol *kcontrol,

Visa fil

@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __WCD_MBHC_V2_H__
#define __WCD_MBHC_V2_H__
@@ -528,6 +529,8 @@ struct wcd_mbhc_cb {
bool (*mbhc_get_moisture_status)(struct wcd_mbhc *mbhc);
void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *mbhc, bool enable);
void (*mbhc_moisture_detect_en)(struct wcd_mbhc *mbhc, bool enable);
void (*hph_pa_enable)(struct snd_soc_component *component, bool enable);
};
struct wcd_mbhc_fn {