mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
asoc: wcd937x: stop mbhc during ssr down
Stop mbhc operations during ssr down to cancel any pending detection sequences. Change-Id: I6aa8c61c2cc74fc08adf57c58673acaa753ac322 Signed-off-by: Ramprasad Katkam <katkam@codeaurora.org>
This commit is contained in:
parent
63f4815535
commit
a2958a6205
3 changed files with 37 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
|
|
@ -974,6 +974,31 @@ void wcd937x_mbhc_hs_detect_exit(struct snd_soc_component *component)
|
|||
}
|
||||
EXPORT_SYMBOL(wcd937x_mbhc_hs_detect_exit);
|
||||
|
||||
/*
|
||||
* wcd937x_mbhc_ssr_down: stop mbhc during
|
||||
* wcd937x subsystem restart
|
||||
* @mbhc: pointer to wcd937x_mbhc structure
|
||||
* @component: handle to snd_soc_component *
|
||||
*/
|
||||
void wcd937x_mbhc_ssr_down(struct wcd937x_mbhc *mbhc,
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
struct wcd_mbhc *wcd_mbhc = NULL;
|
||||
|
||||
if (!mbhc || !component)
|
||||
return;
|
||||
|
||||
wcd_mbhc = &mbhc->wcd_mbhc;
|
||||
if (wcd_mbhc == NULL) {
|
||||
dev_err(component->dev, "%s: wcd_mbhc is NULL\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
wcd937x_mbhc_hs_detect_exit(component);
|
||||
wcd_mbhc_deinit(wcd_mbhc);
|
||||
}
|
||||
EXPORT_SYMBOL(wcd937x_mbhc_ssr_down);
|
||||
|
||||
/*
|
||||
* wcd937x_mbhc_post_ssr_init: initialize mbhc for
|
||||
* wcd937x post subsystem restart
|
||||
|
|
@ -997,8 +1022,6 @@ int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
wcd937x_mbhc_hs_detect_exit(component);
|
||||
wcd_mbhc_deinit(wcd_mbhc);
|
||||
snd_soc_component_update_bits(component, WCD937X_ANA_MBHC_MECH,
|
||||
0x20, 0x20);
|
||||
ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
#ifndef __WCD937X_MBHC_H__
|
||||
#define __WCD937X_MBHC_H__
|
||||
|
|
@ -21,6 +21,8 @@ extern int wcd937x_mbhc_hs_detect(struct snd_soc_component *component,
|
|||
extern void wcd937x_mbhc_deinit(struct snd_soc_component *component);
|
||||
extern int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
|
||||
struct snd_soc_component *component);
|
||||
extern void wcd937x_mbhc_ssr_down(struct wcd937x_mbhc *mbhc,
|
||||
struct snd_soc_component *component);
|
||||
extern int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
|
||||
uint32_t *zl, uint32_t *zr);
|
||||
#else
|
||||
|
|
@ -47,7 +49,11 @@ static inline int wcd937x_mbhc_post_ssr_init(struct wcd937x_mbhc *mbhc,
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void wcd937x_mbhc_ssr_down(struct wcd937x_mbhc *mbhc,
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int wcd937x_mbhc_get_impedance(struct wcd937x_mbhc *wcd937x_mbhc,
|
||||
uint32_t *zl, uint32_t *zr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -1422,6 +1422,8 @@ static int wcd937x_event_notify(struct notifier_block *block,
|
|||
0x80, 0x00);
|
||||
break;
|
||||
case BOLERO_WCD_EVT_SSR_DOWN:
|
||||
mbhc = &wcd937x->mbhc->wcd_mbhc;
|
||||
wcd937x_mbhc_ssr_down(wcd937x->mbhc, component);
|
||||
wcd937x_reset_low(wcd937x->dev);
|
||||
break;
|
||||
case BOLERO_WCD_EVT_SSR_UP:
|
||||
|
|
|
|||
Loading…
Reference in a new issue