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

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

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

parents a0b83379 a2958a62
Loading
Loading
Loading
Loading
+26 −3
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>
@@ -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,
+8 −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.
 */
#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)
{
+2 −0
Original line number Diff line number Diff line
@@ -1461,6 +1461,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: