asoc: codec: Add surge reset routine for wcd939x
Enable wcd939x surge reset routine. Add callback for the event within mbhc and enable it for wcd939x. Change-Id: Iabc8c3367ae2eca5982db4526c6860e5eba63b76 Signed-off-by: Eric Rosas <quic_erosas@quicinc.com>
This commit is contained in:
@@ -1733,7 +1733,7 @@ static int wcd_mbhc_usbc_ana_event_handler(struct notifier_block *nb,
|
|||||||
mbhc->mbhc_cb->lock_sleep(mbhc, false);
|
mbhc->mbhc_cb->lock_sleep(mbhc, false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else if (mode < TYPEC_MAX_ACCESSORY) {
|
||||||
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
|
#if IS_ENABLED(CONFIG_QCOM_WCD_USBSS_I2C)
|
||||||
WCD_MBHC_REG_READ(WCD_MBHC_L_DET_EN, l_det_en);
|
WCD_MBHC_REG_READ(WCD_MBHC_L_DET_EN, l_det_en);
|
||||||
WCD_MBHC_REG_READ(WCD_MBHC_MECH_DETECTION_TYPE, detection_type);
|
WCD_MBHC_REG_READ(WCD_MBHC_MECH_DETECTION_TYPE, detection_type);
|
||||||
@@ -1748,6 +1748,9 @@ static int wcd_mbhc_usbc_ana_event_handler(struct notifier_block *nb,
|
|||||||
dev_dbg(mbhc->component->dev, "leave, %s: mode = %lu\n", __func__, mode);
|
dev_dbg(mbhc->component->dev, "leave, %s: mode = %lu\n", __func__, mode);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
} else if (mode == TYPEC_MAX_ACCESSORY) {
|
||||||
|
if (mbhc->mbhc_cb->surge_reset_routine)
|
||||||
|
mbhc->mbhc_cb->surge_reset_routine(mbhc);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
||||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
* Copyright (c) 2022-2023, Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
@@ -808,6 +808,14 @@ static void wcd939x_mbhc_bcs_enable(struct wcd_mbhc *mbhc,
|
|||||||
wcd939x_disable_bcs_before_slow_insert(mbhc->component, true);
|
wcd939x_disable_bcs_before_slow_insert(mbhc->component, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wcd939x_surge_reset_routine(struct wcd_mbhc *mbhc)
|
||||||
|
{
|
||||||
|
struct wcd939x_priv *wcd939x = snd_soc_component_get_drvdata(mbhc->component);
|
||||||
|
|
||||||
|
regcache_mark_dirty(wcd939x->regmap);
|
||||||
|
regcache_sync(wcd939x->regmap);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wcd_mbhc_cb mbhc_cb = {
|
static const struct wcd_mbhc_cb mbhc_cb = {
|
||||||
.request_irq = wcd939x_mbhc_request_irq,
|
.request_irq = wcd939x_mbhc_request_irq,
|
||||||
.irq_control = wcd939x_mbhc_irq_control,
|
.irq_control = wcd939x_mbhc_irq_control,
|
||||||
@@ -833,6 +841,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
|
|||||||
.mbhc_moisture_polling_ctrl = wcd939x_mbhc_moisture_polling_ctrl,
|
.mbhc_moisture_polling_ctrl = wcd939x_mbhc_moisture_polling_ctrl,
|
||||||
.mbhc_moisture_detect_en = wcd939x_mbhc_moisture_detect_en,
|
.mbhc_moisture_detect_en = wcd939x_mbhc_moisture_detect_en,
|
||||||
.bcs_enable = wcd939x_mbhc_bcs_enable,
|
.bcs_enable = wcd939x_mbhc_bcs_enable,
|
||||||
|
.surge_reset_routine = wcd939x_surge_reset_routine,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wcd939x_get_hph_type(struct snd_kcontrol *kcontrol,
|
static int wcd939x_get_hph_type(struct snd_kcontrol *kcontrol,
|
||||||
|
@@ -530,6 +530,7 @@ struct wcd_mbhc_cb {
|
|||||||
bool (*mbhc_get_moisture_status)(struct wcd_mbhc *mbhc);
|
bool (*mbhc_get_moisture_status)(struct wcd_mbhc *mbhc);
|
||||||
void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *mbhc, bool enable);
|
void (*mbhc_moisture_polling_ctrl)(struct wcd_mbhc *mbhc, bool enable);
|
||||||
void (*mbhc_moisture_detect_en)(struct wcd_mbhc *mbhc, bool enable);
|
void (*mbhc_moisture_detect_en)(struct wcd_mbhc *mbhc, bool enable);
|
||||||
|
void (*surge_reset_routine)(struct wcd_mbhc *mbhc);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wcd_mbhc_fn {
|
struct wcd_mbhc_fn {
|
||||||
|
Reference in New Issue
Block a user