asoc: wcd938x: stop mbhc during ssr down

Stop mbhc operations during ssr down to cancel
any pending detection sequences.

Change-Id: Iff054cf8b3099959a1be561bd937057258f57b81
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang
2019-04-01 18:12:06 +08:00
parent b1a49c6b67
commit 281bd20437
3 changed files with 35 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // 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/module.h>
#include <linux/init.h> #include <linux/init.h>
@@ -956,6 +956,31 @@ void wcd938x_mbhc_hs_detect_exit(struct snd_soc_component *component)
} }
EXPORT_SYMBOL(wcd938x_mbhc_hs_detect_exit); EXPORT_SYMBOL(wcd938x_mbhc_hs_detect_exit);
/*
* wcd938x_mbhc_ssr_down: stop mbhc during
* wcd938x subsystem restart
* mbhc: pointer to wcd937x_mbhc structure
* component: handle to snd_soc_component *
*/
void wcd938x_mbhc_ssr_down(struct wcd938x_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) {
dev_err(component->dev, "%s: wcd_mbhc is NULL\n", __func__);
return;
}
wcd938x_mbhc_hs_detect_exit(component);
wcd_mbhc_deinit(wcd_mbhc);
}
EXPORT_SYMBOL(wcd938x_mbhc_ssr_down);
/* /*
* wcd938x_mbhc_post_ssr_init: initialize mbhc for * wcd938x_mbhc_post_ssr_init: initialize mbhc for
* wcd938x post subsystem restart * wcd938x post subsystem restart
@@ -979,7 +1004,6 @@ int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
return -EINVAL; return -EINVAL;
} }
wcd_mbhc_deinit(wcd_mbhc);
ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids, ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
wcd_mbhc_registers, WCD938X_ZDET_SUPPORTED); wcd_mbhc_registers, WCD938X_ZDET_SUPPORTED);
if (ret) { if (ret) {

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */ /* 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 __WCD938X_MBHC_H__ #ifndef __WCD938X_MBHC_H__
#define __WCD938X_MBHC_H__ #define __WCD938X_MBHC_H__
@@ -20,6 +20,8 @@ extern void wcd938x_mbhc_hs_detect_exit(struct snd_soc_component *component);
extern int wcd938x_mbhc_hs_detect(struct snd_soc_component *component, extern int wcd938x_mbhc_hs_detect(struct snd_soc_component *component,
struct wcd_mbhc_config *mbhc_cfg); struct wcd_mbhc_config *mbhc_cfg);
extern void wcd938x_mbhc_deinit(struct snd_soc_component *component); extern void wcd938x_mbhc_deinit(struct snd_soc_component *component);
extern void wcd938x_mbhc_ssr_down(struct wcd938x_mbhc *mbhc,
struct snd_soc_component *component);
extern int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc, extern int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
struct snd_soc_component *component); struct snd_soc_component *component);
extern int wcd938x_mbhc_get_impedance(struct wcd938x_mbhc *wcd938x_mbhc, extern int wcd938x_mbhc_get_impedance(struct wcd938x_mbhc *wcd938x_mbhc,
@@ -43,6 +45,10 @@ static inline int wcd938x_mbhc_hs_detect(struct snd_soc_component *component,
static inline void wcd938x_mbhc_deinit(struct snd_soc_component *component) static inline void wcd938x_mbhc_deinit(struct snd_soc_component *component)
{ {
} }
static inline void wcd938x_mbhc_ssr_down(struct wcd938x_mbhc *mbhc,
struct snd_soc_component *component)
{
}
static inline int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc, static inline int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
struct snd_soc_component *component) struct snd_soc_component *component)
{ {

View File

@@ -1516,6 +1516,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
0x80, 0x00); 0x80, 0x00);
break; break;
case BOLERO_WCD_EVT_SSR_DOWN: case BOLERO_WCD_EVT_SSR_DOWN:
mbhc = &wcd938x->mbhc->wcd_mbhc;
wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
wcd938x_reset_low(wcd938x->dev); wcd938x_reset_low(wcd938x->dev);
break; break;
case BOLERO_WCD_EVT_SSR_UP: case BOLERO_WCD_EVT_SSR_UP: