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

Commit 4b17acc4 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "asoc: wcd938x: stop mbhc during ssr down"

parents 54d99a5c 281bd204
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
// 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>
@@ -956,6 +956,31 @@ void wcd938x_mbhc_hs_detect_exit(struct snd_soc_component *component)
}
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 post subsystem restart
@@ -979,7 +1004,6 @@ int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
		return -EINVAL;
	}

	wcd_mbhc_deinit(wcd_mbhc);
	ret = wcd_mbhc_init(wcd_mbhc, component, &mbhc_cb, &intr_ids,
			    wcd_mbhc_registers, WCD938X_ZDET_SUPPORTED);
	if (ret) {
+7 −1
Original line number Diff line number Diff line
/* 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__
#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,
				struct wcd_mbhc_config *mbhc_cfg);
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,
				    struct snd_soc_component *component);
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_ssr_down(struct wcd938x_mbhc *mbhc,
					struct snd_soc_component *component)
{
}
static inline int wcd938x_mbhc_post_ssr_init(struct wcd938x_mbhc *mbhc,
					   struct snd_soc_component *component)
{
+2 −0
Original line number Diff line number Diff line
@@ -1524,6 +1524,8 @@ static int wcd938x_event_notify(struct notifier_block *block,
					0x80, 0x00);
		break;
	case BOLERO_WCD_EVT_SSR_DOWN:
		mbhc = &wcd938x->mbhc->wcd_mbhc;
		wcd938x_mbhc_ssr_down(wcd938x->mbhc, component);
		wcd938x_reset_low(wcd938x->dev);
		break;
	case BOLERO_WCD_EVT_SSR_UP: