From 625753df875366d897b1abb4aa9d8d906b3b33bc Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Mon, 24 Aug 2020 10:06:05 +0530 Subject: [PATCH] ASoC: codec: Change name for enum defined for callback between wcd and bolero Add enum names defined for callback between wcd and bolero in separate file and include that file in order to have same enum across wcd and bolero. Change-Id: I808c2ad3de37655c1ba2b8e096def60703ced7f2 Signed-off-by: Vatsal Bucha --- asoc/codecs/bolero/bolero-cdc.c | 29 ++++++++++--------- asoc/codecs/bolero/internal.h | 22 -------------- asoc/codecs/rouleur/internal.h | 18 ------------ asoc/codecs/rouleur/rouleur.c | 43 ++++++++++++++-------------- asoc/codecs/wcd937x/internal.h | 15 ---------- asoc/codecs/wcd937x/wcd937x.c | 29 ++++++++++--------- asoc/codecs/wcd938x/internal.h | 16 ----------- asoc/codecs/wcd938x/wcd938x.c | 43 ++++++++++++++-------------- asoc/codecs/wsa881x.c | 17 +++-------- asoc/codecs/wsa883x/internal.h | 9 ------ asoc/codecs/wsa883x/wsa883x.c | 9 +++--- include/asoc/bolero-slave-internal.h | 27 +++++++++++++++++ 12 files changed, 110 insertions(+), 167 deletions(-) create mode 100644 include/asoc/bolero-slave-internal.h diff --git a/asoc/codecs/bolero/bolero-cdc.c b/asoc/codecs/bolero/bolero-cdc.c index 4f73007027..dcc65452b0 100644 --- a/asoc/codecs/bolero/bolero-cdc.c +++ b/asoc/codecs/bolero/bolero-cdc.c @@ -18,6 +18,7 @@ #include "bolero-cdc.h" #include "internal.h" #include "bolero-clk-rsc.h" +#include "asoc/bolero-slave-internal.h" #define DRV_NAME "bolero_codec" @@ -202,37 +203,37 @@ static int bolero_cdc_update_wcd_event(void *handle, u16 event, u32 data) } switch (event) { - case WCD_BOLERO_EVT_RX_MUTE: + case SLV_BOLERO_EVT_RX_MUTE: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_RX_MUTE, data); break; - case WCD_BOLERO_EVT_IMPED_TRUE: + case SLV_BOLERO_EVT_IMPED_TRUE: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_IMPED_TRUE, data); break; - case WCD_BOLERO_EVT_IMPED_FALSE: + case SLV_BOLERO_EVT_IMPED_FALSE: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_IMPED_FALSE, data); break; - case WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST: + case SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_RX_COMPANDER_SOFT_RST, data); break; - case WCD_BOLERO_EVT_BCS_CLK_OFF: + case SLV_BOLERO_EVT_BCS_CLK_OFF: if (priv->macro_params[TX_MACRO].event_handler) priv->macro_params[TX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_BCS_CLK_OFF, data); break; - case WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE: + case SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE: /* Update PA Gain only for bolero version 2.1 */ if (priv->version == BOLERO_VERSION_2_1) if (priv->macro_params[RX_MACRO].event_handler) @@ -241,13 +242,13 @@ static int bolero_cdc_update_wcd_event(void *handle, u16 event, u32 data) BOLERO_MACRO_EVT_RX_PA_GAIN_UPDATE, data); break; - case WCD_BOLERO_EVT_HPHL_HD2_ENABLE: + case SLV_BOLERO_EVT_HPHL_HD2_ENABLE: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, BOLERO_MACRO_EVT_HPHL_HD2_ENABLE, data); break; - case WCD_BOLERO_EVT_HPHR_HD2_ENABLE: + case SLV_BOLERO_EVT_HPHR_HD2_ENABLE: if (priv->macro_params[RX_MACRO].event_handler) priv->macro_params[RX_MACRO].event_handler( priv->component, @@ -329,7 +330,7 @@ void bolero_clear_amic_tx_hold(struct device *dev, u16 adc_n) dev_err(dev, "%s: priv is null\n", __func__); return; } - event = BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR; + event = BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR; if (adc_n == BOLERO_ADC0) amic = 0x1; else if (adc_n == BOLERO_ADC1) @@ -796,10 +797,10 @@ void bolero_wsa_pa_on(struct device *dev, bool adie_lb) } if (adie_lb) bolero_cdc_notifier_call(priv, - BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB); + BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB); else bolero_cdc_notifier_call(priv, - BOLERO_WCD_EVT_PA_ON_POST_FSCLK); + BOLERO_SLV_EVT_PA_ON_POST_FSCLK); } EXPORT_SYMBOL(bolero_wsa_pa_on); @@ -916,7 +917,7 @@ static int bolero_ssr_enable(struct device *dev, void *data) BOLERO_MACRO_EVT_SSR_UP, 0x0); } trace_printk("%s: SSR up events processed by all macros\n", __func__); - bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_UP); + bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_SSR_UP); return 0; } @@ -931,7 +932,7 @@ static void bolero_ssr_disable(struct device *dev, void *data) return; } - bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_OFF_PRE_SSR); + bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_PA_OFF_PRE_SSR); regcache_cache_only(priv->regmap, true); mutex_lock(&priv->clk_lock); @@ -947,7 +948,7 @@ static void bolero_ssr_disable(struct device *dev, void *data) priv->component, BOLERO_MACRO_EVT_SSR_DOWN, 0x0); } - bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_SSR_DOWN); + bolero_cdc_notifier_call(priv, BOLERO_SLV_EVT_SSR_DOWN); } static struct snd_info_entry_ops bolero_info_ops = { diff --git a/asoc/codecs/bolero/internal.h b/asoc/codecs/bolero/internal.h index cf132bdd2c..69e7dd458e 100644 --- a/asoc/codecs/bolero/internal.h +++ b/asoc/codecs/bolero/internal.h @@ -9,16 +9,6 @@ #define BOLERO_CDC_CHILD_DEVICES_MAX 6 -/* from bolero to WCD events */ -enum { - BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WCD_EVT_PA_OFF_PRE_SSR, - BOLERO_WCD_EVT_SSR_DOWN, - BOLERO_WCD_EVT_SSR_UP, - BOLERO_WCD_EVT_PA_ON_POST_FSCLK, - BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB, -}; - enum { REG_NO_ACCESS, RD_REG, @@ -26,18 +16,6 @@ enum { RD_WR_REG }; -/* from WCD to bolero events */ -enum { - WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */ - WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */ - WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */ - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, - WCD_BOLERO_EVT_BCS_CLK_OFF, - WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE, - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */ - WCD_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */ -}; - struct wcd_ctrl_platform_data { void *handle; int (*update_wcd_event)(void *handle, u16 event, u32 data); diff --git a/asoc/codecs/rouleur/internal.h b/asoc/codecs/rouleur/internal.h index 3e560ebd75..20b10c2a8d 100644 --- a/asoc/codecs/rouleur/internal.h +++ b/asoc/codecs/rouleur/internal.h @@ -125,24 +125,6 @@ enum { WCD_RX3 }; -enum { - BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WCD_EVT_PA_OFF_PRE_SSR, - BOLERO_WCD_EVT_SSR_DOWN, - BOLERO_WCD_EVT_SSR_UP, -}; - -enum { - WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */ - WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */ - WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */ - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, - WCD_BOLERO_EVT_BCS_CLK_OFF, - WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE, /* To reduce PA gain for low SoC */ - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */ - WCD_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */ -}; - enum { /* INTR_CTRL_INT_MASK_0 */ ROULEUR_IRQ_MBHC_BUTTON_PRESS_DET = 0, diff --git a/asoc/codecs/rouleur/rouleur.c b/asoc/codecs/rouleur/rouleur.c index 4fd94d2b68..cc20db28e2 100644 --- a/asoc/codecs/rouleur/rouleur.c +++ b/asoc/codecs/rouleur/rouleur.c @@ -27,6 +27,7 @@ #include #include #include +#include "asoc/bolero-slave-internal.h" #define DRV_NAME "rouleur_codec" @@ -646,7 +647,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, /* Enable HD2 Config for HPHR if foundry id is SEC */ if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHR_HD2_ENABLE, + SLV_BOLERO_EVT_HPHR_HD2_ENABLE, 0x04); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL1, @@ -664,7 +665,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10)); wcd_enable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHR_PDM_WD_INT); @@ -674,7 +675,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, ROULEUR_IRQ_HPHR_PDM_WD_INT); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10 | 0x1)); blocking_notifier_call_chain(&rouleur->mbhc->notifier, WCD_EVENT_PRE_HPHR_PA_OFF, @@ -694,7 +695,7 @@ static int rouleur_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHR_HD2_ENABLE, + SLV_BOLERO_EVT_HPHR_HD2_ENABLE, 0x00); blocking_notifier_call_chain(&rouleur->mbhc->notifier, WCD_EVENT_POST_HPHR_PA_OFF, @@ -728,7 +729,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, usleep_range(200, 210); if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, + SLV_BOLERO_EVT_HPHL_HD2_ENABLE, 0x04); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, @@ -746,7 +747,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHL_PDM_WD_INT); @@ -756,7 +757,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, ROULEUR_IRQ_HPHL_PDM_WD_INT); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); blocking_notifier_call_chain(&rouleur->mbhc->notifier, WCD_EVENT_PRE_HPHL_PA_OFF, @@ -775,7 +776,7 @@ static int rouleur_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, + SLV_BOLERO_EVT_HPHL_HD2_ENABLE, 0x00); blocking_notifier_call_chain(&rouleur->mbhc->notifier, WCD_EVENT_POST_HPHL_PA_OFF, @@ -819,7 +820,7 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, 0x40, 0x00); if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, + SLV_BOLERO_EVT_HPHL_HD2_ENABLE, 0x04); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, @@ -832,7 +833,7 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, 0x0F, 0x04); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHL_PDM_WD_INT); @@ -842,14 +843,14 @@ static int rouleur_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, ROULEUR_IRQ_HPHL_PDM_WD_INT); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); break; case SND_SOC_DAPM_POST_PMD: usleep_range(5000, 5100); if (rouleur->foundry_id == FOUNDRY_ID_SEC) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_HPHL_HD2_ENABLE, + SLV_BOLERO_EVT_HPHL_HD2_ENABLE, 0x00); snd_soc_component_update_bits(component, ROULEUR_DIG_SWR_PDM_WD_CTL0, @@ -897,7 +898,7 @@ static int rouleur_codec_enable_lo_pa(struct snd_soc_dapm_widget *w, 0x0F, 0x04); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&rouleur->irq_info, ROULEUR_IRQ_HPHL_PDM_WD_INT); @@ -907,7 +908,7 @@ static int rouleur_codec_enable_lo_pa(struct snd_soc_dapm_widget *w, ROULEUR_IRQ_HPHL_PDM_WD_INT); if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); break; case SND_SOC_DAPM_POST_PMD: @@ -1371,10 +1372,10 @@ void rouleur_disable_bcs_before_slow_insert(struct snd_soc_component *component, if (rouleur->update_wcd_event) { if (bcs_disable) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 0); + SLV_BOLERO_EVT_BCS_CLK_OFF, 0); else rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 1); + SLV_BOLERO_EVT_BCS_CLK_OFF, 1); } } @@ -1420,7 +1421,7 @@ static int rouleur_event_notify(struct notifier_block *block, struct wcd_mbhc *mbhc; switch (event) { - case BOLERO_WCD_EVT_PA_OFF_PRE_SSR: + case BOLERO_SLV_EVT_PA_OFF_PRE_SSR: snd_soc_component_update_bits(component, ROULEUR_ANA_HPHPA_CNP_CTL_2, 0xC0, 0x00); @@ -1437,7 +1438,7 @@ static int rouleur_event_notify(struct notifier_block *block, ROULEUR_ANA_COMBOPA_CTL, 0x80, 0x00); break; - case BOLERO_WCD_EVT_SSR_DOWN: + case BOLERO_SLV_EVT_SSR_DOWN: rouleur->dev_up = false; rouleur->mbhc->wcd_mbhc.deinit_in_progress = true; mbhc = &rouleur->mbhc->wcd_mbhc; @@ -1446,7 +1447,7 @@ static int rouleur_event_notify(struct notifier_block *block, rouleur_mbhc_ssr_down(rouleur->mbhc, component); rouleur_reset(rouleur->dev, 0x01); break; - case BOLERO_WCD_EVT_SSR_UP: + case BOLERO_SLV_EVT_SSR_UP: rouleur_reset(rouleur->dev, 0x00); /* allow reset to take effect */ usleep_range(10000, 10010); @@ -2094,7 +2095,7 @@ static void rouleur_evaluate_soc(struct work_struct *work) /* Reduce PA Gain by 6DB for low SoC */ if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE, + SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE, true); rouleur->low_soc = true; ret = msm_cdc_set_supply_min_voltage(rouleur->dev, @@ -2113,7 +2114,7 @@ static void rouleur_evaluate_soc(struct work_struct *work) /* Reset PA Gain to default for normal SoC */ if (rouleur->update_wcd_event) rouleur->update_wcd_event(rouleur->handle, - WCD_BOLERO_EVT_RX_PA_GAIN_UPDATE, + SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE, false); ret = msm_cdc_set_supply_min_voltage(rouleur->dev, rouleur->supplies, diff --git a/asoc/codecs/wcd937x/internal.h b/asoc/codecs/wcd937x/internal.h index e7cf9eb75d..92a69770e8 100644 --- a/asoc/codecs/wcd937x/internal.h +++ b/asoc/codecs/wcd937x/internal.h @@ -128,21 +128,6 @@ enum { WCD_RX3 }; -enum { - BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WCD_EVT_PA_OFF_PRE_SSR, - BOLERO_WCD_EVT_SSR_DOWN, - BOLERO_WCD_EVT_SSR_UP, -}; - -enum { - WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */ - WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */ - WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */ - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, - WCD_BOLERO_EVT_BCS_CLK_OFF, -}; - enum { /* INTR_CTRL_INT_MASK_0 */ WCD937X_IRQ_MBHC_BUTTON_PRESS_DET = 0, diff --git a/asoc/codecs/wcd937x/wcd937x.c b/asoc/codecs/wcd937x/wcd937x.c index 4538f71bcb..7967dff74c 100644 --- a/asoc/codecs/wcd937x/wcd937x.c +++ b/asoc/codecs/wcd937x/wcd937x.c @@ -25,6 +25,7 @@ #include "wcd937x-registers.h" #include "wcd937x.h" #include "internal.h" +#include "asoc/bolero-slave-internal.h" #define WCD9370_VARIANT 0 #define WCD9375_VARIANT 5 @@ -745,7 +746,7 @@ static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, 0x02, 0x02); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10)); wcd_enable_irq(&wcd937x->irq_info, WCD937X_IRQ_HPHR_PDM_WD_INT); @@ -755,7 +756,7 @@ static int wcd937x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, WCD937X_IRQ_HPHR_PDM_WD_INT); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10 | 0x1)); blocking_notifier_call_chain(&wcd937x->mbhc->notifier, WCD_EVENT_PRE_HPHR_PA_OFF, @@ -844,7 +845,7 @@ static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, 0x02, 0x02); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&wcd937x->irq_info, WCD937X_IRQ_HPHL_PDM_WD_INT); @@ -854,7 +855,7 @@ static int wcd937x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, WCD937X_IRQ_HPHL_PDM_WD_INT); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); blocking_notifier_call_chain(&wcd937x->mbhc->notifier, WCD_EVENT_PRE_HPHL_PA_OFF, @@ -920,7 +921,7 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w, 0x02, 0x02); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10)); wcd_enable_irq(&wcd937x->irq_info, WCD937X_IRQ_AUX_PDM_WD_INT); break; @@ -928,7 +929,7 @@ static int wcd937x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w, wcd_disable_irq(&wcd937x->irq_info, WCD937X_IRQ_AUX_PDM_WD_INT); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10 | 0x1)); break; case SND_SOC_DAPM_POST_PMD: @@ -990,7 +991,7 @@ static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, 0x02, 0x02); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); if (wcd937x->ear_rx_path & EAR_RX_PATH_AUX) wcd_enable_irq(&wcd937x->irq_info, @@ -1008,7 +1009,7 @@ static int wcd937x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, WCD937X_IRQ_HPHL_PDM_WD_INT); if (wcd937x->update_wcd_event) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); break; case SND_SOC_DAPM_POST_PMD: @@ -1589,10 +1590,10 @@ void wcd937x_disable_bcs_before_slow_insert(struct snd_soc_component *component, if (wcd937x->update_wcd_event) { if (bcs_disable) wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 0); + SLV_BOLERO_EVT_BCS_CLK_OFF, 0); else wcd937x->update_wcd_event(wcd937x->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 1); + SLV_BOLERO_EVT_BCS_CLK_OFF, 1); } } @@ -1640,7 +1641,7 @@ static int wcd937x_event_notify(struct notifier_block *block, struct wcd_mbhc *mbhc; switch (event) { - case BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR: + case BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR: if (amic == 0x1 || amic == 0x2) reg = WCD937X_ANA_TX_CH2; else if (amic == 0x3) @@ -1651,7 +1652,7 @@ static int wcd937x_event_notify(struct notifier_block *block, mask = 0x20; snd_soc_component_update_bits(component, reg, mask, 0x00); break; - case BOLERO_WCD_EVT_PA_OFF_PRE_SSR: + case BOLERO_SLV_EVT_PA_OFF_PRE_SSR: snd_soc_component_update_bits(component, WCD937X_ANA_HPH, 0xC0, 0x00); snd_soc_component_update_bits(component, WCD937X_ANA_EAR, @@ -1659,7 +1660,7 @@ static int wcd937x_event_notify(struct notifier_block *block, snd_soc_component_update_bits(component, WCD937X_AUX_AUXPA, 0x80, 0x00); break; - case BOLERO_WCD_EVT_SSR_DOWN: + case BOLERO_SLV_EVT_SSR_DOWN: wcd937x->mbhc->wcd_mbhc.deinit_in_progress = true; mbhc = &wcd937x->mbhc->wcd_mbhc; wcd937x->usbc_hs_status = get_usbc_hs_status(component, @@ -1667,7 +1668,7 @@ static int wcd937x_event_notify(struct notifier_block *block, wcd937x_mbhc_ssr_down(wcd937x->mbhc, component); wcd937x_reset_low(wcd937x->dev); break; - case BOLERO_WCD_EVT_SSR_UP: + case BOLERO_SLV_EVT_SSR_UP: wcd937x_reset(wcd937x->dev); /* allow reset to take effect */ usleep_range(10000, 10010); diff --git a/asoc/codecs/wcd938x/internal.h b/asoc/codecs/wcd938x/internal.h index db5d33da17..7da5b36875 100644 --- a/asoc/codecs/wcd938x/internal.h +++ b/asoc/codecs/wcd938x/internal.h @@ -146,22 +146,6 @@ enum { WCD_RX3 }; -enum { - BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WCD_EVT_PA_OFF_PRE_SSR, - BOLERO_WCD_EVT_SSR_DOWN, - BOLERO_WCD_EVT_SSR_UP, - BOLERO_WCD_EVT_CLK_NOTIFY, -}; - -enum { - WCD_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */ - WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */ - WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */ - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, - WCD_BOLERO_EVT_BCS_CLK_OFF, -}; - enum { /* INTR_CTRL_INT_MASK_0 */ WCD938X_IRQ_MBHC_BUTTON_PRESS_DET = 0, diff --git a/asoc/codecs/wcd938x/wcd938x.c b/asoc/codecs/wcd938x/wcd938x.c index 5880ecff29..2497980953 100644 --- a/asoc/codecs/wcd938x/wcd938x.c +++ b/asoc/codecs/wcd938x/wcd938x.c @@ -24,6 +24,7 @@ #include "wcd938x-registers.h" #include "wcd938x.h" #include "internal.h" +#include "asoc/bolero-slave-internal.h" #define NUM_SWRS_DT_PARAMS 5 #define WCD938X_VARIANT_ENTRY_SIZE 32 @@ -789,7 +790,7 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, 0x80, 0x80); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10 | 0x1)); ret = swr_slvdev_datapath_control(wcd938x->rx_swr_dev, wcd938x->rx_swr_dev->dev_num, @@ -840,7 +841,7 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10)); wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHR_PDM_WD_INT); @@ -848,13 +849,13 @@ static int wcd938x_codec_enable_hphr_pa(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMD: if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX2 << 0x10 | 0x1)); wcd_disable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHR_PDM_WD_INT); if (wcd938x->update_wcd_event && wcd938x->comp2_enable) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, + SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST, (WCD_RX2 << 0x10)); /* * 7ms sleep is required if compander is enabled as per @@ -925,7 +926,7 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, 0x80, 0x80); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x01)); ret = swr_slvdev_datapath_control(wcd938x->rx_swr_dev, wcd938x->rx_swr_dev->dev_num, @@ -976,7 +977,7 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, WCD938X_ANA_RX_SUPPLIES, 0x02, 0x02); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHL_PDM_WD_INT); @@ -984,13 +985,13 @@ static int wcd938x_codec_enable_hphl_pa(struct snd_soc_dapm_widget *w, case SND_SOC_DAPM_PRE_PMD: if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); wcd_disable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHL_PDM_WD_INT); if (wcd938x->update_wcd_event && wcd938x->comp1_enable) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST, + SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST, (WCD_RX1 << 0x10)); /* * 7ms sleep is required if compander is enabled as per @@ -1072,7 +1073,7 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w, 0x02, 0x02); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10)); wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_AUX_PDM_WD_INT); break; @@ -1081,7 +1082,7 @@ static int wcd938x_codec_enable_aux_pa(struct snd_soc_dapm_widget *w, WCD938X_IRQ_AUX_PDM_WD_INT); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10 | 0x1)); break; case SND_SOC_DAPM_POST_PMD: @@ -1152,14 +1153,14 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, if (wcd938x->ear_rx_path & EAR_RX_PATH_AUX) { if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10)); wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_AUX_PDM_WD_INT); } else { if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10)); wcd_enable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHL_PDM_WD_INT); @@ -1171,14 +1172,14 @@ static int wcd938x_codec_enable_ear_pa(struct snd_soc_dapm_widget *w, WCD938X_IRQ_AUX_PDM_WD_INT); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX3 << 0x10 | 0x1)); } else { wcd_disable_irq(&wcd938x->irq_info, WCD938X_IRQ_HPHL_PDM_WD_INT); if (wcd938x->update_wcd_event) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_RX_MUTE, + SLV_BOLERO_EVT_RX_MUTE, (WCD_RX1 << 0x10 | 0x1)); } break; @@ -1775,10 +1776,10 @@ void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component, if (wcd938x->update_wcd_event) { if (bcs_disable) wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 0); + SLV_BOLERO_EVT_BCS_CLK_OFF, 0); else wcd938x->update_wcd_event(wcd938x->handle, - WCD_BOLERO_EVT_BCS_CLK_OFF, 1); + SLV_BOLERO_EVT_BCS_CLK_OFF, 1); } } @@ -2114,7 +2115,7 @@ static int wcd938x_event_notify(struct notifier_block *block, struct wcd_mbhc *mbhc; switch (event) { - case BOLERO_WCD_EVT_TX_CH_HOLD_CLEAR: + case BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR: if (test_bit(WCD_ADC1, &wcd938x->status_mask)) { snd_soc_component_update_bits(component, WCD938X_ANA_TX_CH2, 0x40, 0x00); @@ -2140,7 +2141,7 @@ static int wcd938x_event_notify(struct notifier_block *block, clear_bit(WCD_ADC4, &wcd938x->status_mask); } break; - case BOLERO_WCD_EVT_PA_OFF_PRE_SSR: + case BOLERO_SLV_EVT_PA_OFF_PRE_SSR: snd_soc_component_update_bits(component, WCD938X_ANA_HPH, 0xC0, 0x00); snd_soc_component_update_bits(component, WCD938X_ANA_EAR, @@ -2148,7 +2149,7 @@ static int wcd938x_event_notify(struct notifier_block *block, snd_soc_component_update_bits(component, WCD938X_AUX_AUXPA, 0x80, 0x00); break; - case BOLERO_WCD_EVT_SSR_DOWN: + case BOLERO_SLV_EVT_SSR_DOWN: wcd938x->dev_up = false; if(wcd938x->notify_swr_dmic) blocking_notifier_call_chain(&wcd938x->notifier, @@ -2163,7 +2164,7 @@ static int wcd938x_event_notify(struct notifier_block *block, wcd938x_mbhc_ssr_down(wcd938x->mbhc, component); wcd938x_reset_low(wcd938x->dev); break; - case BOLERO_WCD_EVT_SSR_UP: + case BOLERO_SLV_EVT_SSR_UP: wcd938x_reset(wcd938x->dev); /* allow reset to take effect */ usleep_range(10000, 10010); @@ -2192,7 +2193,7 @@ static int wcd938x_event_notify(struct notifier_block *block, WCD938X_EVT_SSR_UP, NULL); break; - case BOLERO_WCD_EVT_CLK_NOTIFY: + case BOLERO_SLV_EVT_CLK_NOTIFY: snd_soc_component_update_bits(component, WCD938X_DIGITAL_TOP_CLK_CFG, 0x06, ((val >> 0x10) << 0x01)); diff --git a/asoc/codecs/wsa881x.c b/asoc/codecs/wsa881x.c index d9330719aa..075333c666 100644 --- a/asoc/codecs/wsa881x.c +++ b/asoc/codecs/wsa881x.c @@ -28,6 +28,7 @@ #include #include "wsa881x.h" #include "wsa881x-temp-sensor.h" +#include "asoc/bolero-slave-internal.h" #define DRV_NAME "wsa-codec" #define WSA881X_NUM_RETRY 5 @@ -111,16 +112,6 @@ struct wsa881x_priv { bool enable); }; -/* from bolero to WSA events */ -enum { - BOLERO_WSA_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WSA_EVT_PA_OFF_PRE_SSR, - BOLERO_WSA_EVT_SSR_DOWN, - BOLERO_WSA_EVT_SSR_UP, - BOLERO_WSA_EVT_PA_ON_POST_FSCLK, - BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB, -}; - struct wsa_ctrl_platform_data { void *handle; int (*update_wsa_event)(void *handle, u16 event, u32 data); @@ -1395,7 +1386,7 @@ static int wsa881x_event_notify(struct notifier_block *nb, return -EINVAL; switch (event) { - case BOLERO_WSA_EVT_PA_OFF_PRE_SSR: + case BOLERO_SLV_EVT_PA_OFF_PRE_SSR: snd_soc_component_update_bits(wsa881x->component, WSA881X_SPKR_DRV_GAIN, 0xF0, 0xC0); @@ -1403,8 +1394,8 @@ static int wsa881x_event_notify(struct notifier_block *nb, WSA881X_SPKR_DRV_EN, 0x80, 0x00); break; - case BOLERO_WSA_EVT_PA_ON_POST_FSCLK: - case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB: + case BOLERO_SLV_EVT_PA_ON_POST_FSCLK: + case BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB: if ((snd_soc_component_read32(wsa881x->component, WSA881X_SPKR_DAC_CTL) & 0x80) == 0x80) snd_soc_component_update_bits(wsa881x->component, diff --git a/asoc/codecs/wsa883x/internal.h b/asoc/codecs/wsa883x/internal.h index 2be12f7171..cd4c57ef0a 100644 --- a/asoc/codecs/wsa883x/internal.h +++ b/asoc/codecs/wsa883x/internal.h @@ -60,15 +60,6 @@ enum { SWR_VISENSE_PORT, }; -enum { - BOLERO_WSA_EVT_TX_CH_HOLD_CLEAR = 1, - BOLERO_WSA_EVT_PA_OFF_PRE_SSR, - BOLERO_WSA_EVT_SSR_DOWN, - BOLERO_WSA_EVT_SSR_UP, - BOLERO_WSA_EVT_PA_ON_POST_FSCLK, - BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB, -}; - struct wsa_ctrl_platform_data { void *handle; int (*update_wsa_event)(void *handle, u16 event, u32 data); diff --git a/asoc/codecs/wsa883x/wsa883x.c b/asoc/codecs/wsa883x/wsa883x.c index 0d31b338fb..6f81fbaf45 100644 --- a/asoc/codecs/wsa883x/wsa883x.c +++ b/asoc/codecs/wsa883x/wsa883x.c @@ -29,6 +29,7 @@ #include #include "wsa883x.h" #include "internal.h" +#include "asoc/bolero-slave-internal.h" #define T1_TEMP -10 #define T2_TEMP 150 @@ -1436,7 +1437,7 @@ static int wsa883x_event_notify(struct notifier_block *nb, return -EINVAL; switch (event) { - case BOLERO_WSA_EVT_PA_OFF_PRE_SSR: + case BOLERO_SLV_EVT_PA_OFF_PRE_SSR: if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) snd_soc_component_update_bits(wsa883x->component, WSA883X_PA_FSM_CTL, @@ -1444,14 +1445,14 @@ static int wsa883x_event_notify(struct notifier_block *nb, wsa883x_swr_down(wsa883x); break; - case BOLERO_WSA_EVT_SSR_UP: + case BOLERO_SLV_EVT_SSR_UP: wsa883x_swr_up(wsa883x); /* Add delay to allow enumerate */ usleep_range(20000, 20010); wsa883x_swr_reset(wsa883x); break; - case BOLERO_WSA_EVT_PA_ON_POST_FSCLK: + case BOLERO_SLV_EVT_PA_ON_POST_FSCLK: if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) { snd_soc_component_update_bits(wsa883x->component, WSA883X_PDM_WD_CTL, @@ -1470,7 +1471,7 @@ static int wsa883x_event_notify(struct notifier_block *nb, usleep_range(5000, 5050); } break; - case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB: + case BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB: if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) set_bit(SPKR_ADIE_LB, &wsa883x->status_mask); break; diff --git a/include/asoc/bolero-slave-internal.h b/include/asoc/bolero-slave-internal.h new file mode 100644 index 0000000000..af06c201d1 --- /dev/null +++ b/include/asoc/bolero-slave-internal.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2020, The Linux Foundation. All rights reserved. + */ + +/* from Slave to bolero events */ +enum { + SLV_BOLERO_EVT_RX_MUTE = 1, /* for RX mute/unmute */ + SLV_BOLERO_EVT_IMPED_TRUE, /* for imped true */ + SLV_BOLERO_EVT_IMPED_FALSE, /* for imped false */ + SLV_BOLERO_EVT_RX_COMPANDER_SOFT_RST, + SLV_BOLERO_EVT_BCS_CLK_OFF, + SLV_BOLERO_EVT_RX_PA_GAIN_UPDATE, + SLV_BOLERO_EVT_HPHL_HD2_ENABLE, /* to enable hd2 config for hphl */ + SLV_BOLERO_EVT_HPHR_HD2_ENABLE, /* to enable hd2 config for hphr */ +}; + +/* from bolero to SLV events */ +enum { + BOLERO_SLV_EVT_TX_CH_HOLD_CLEAR = 1, + BOLERO_SLV_EVT_PA_OFF_PRE_SSR, + BOLERO_SLV_EVT_SSR_DOWN, + BOLERO_SLV_EVT_SSR_UP, + BOLERO_SLV_EVT_PA_ON_POST_FSCLK, + BOLERO_SLV_EVT_PA_ON_POST_FSCLK_ADIE_LB, + BOLERO_SLV_EVT_CLK_NOTIFY, +};