Loading asoc/codecs/bolero/bolero-cdc.c +36 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,7 @@ int bolero_register_macro(struct device *dev, u16 macro_id, priv->macro_params[macro_id].clk_switch = ops->clk_switch; priv->macro_params[macro_id].reg_evt_listener = ops->reg_evt_listener; priv->macro_params[macro_id].clk_enable = ops->clk_enable; } if (macro_id == TX_MACRO || macro_id == VA_MACRO) priv->macro_params[macro_id].clk_div_get = ops->clk_div_get; Loading Loading @@ -713,6 +714,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id) priv->macro_params[macro_id].reg_wake_irq = NULL; priv->macro_params[macro_id].clk_switch = NULL; priv->macro_params[macro_id].reg_evt_listener = NULL; priv->macro_params[macro_id].clk_enable = NULL; } if (macro_id == TX_MACRO || macro_id == VA_MACRO) priv->macro_params[macro_id].clk_div_get = NULL; Loading Loading @@ -1015,6 +1017,40 @@ int bolero_tx_clk_switch(struct snd_soc_component *component) } EXPORT_SYMBOL(bolero_tx_clk_switch); /** * bolero_tx_mclk_enable - Enable/Disable TX Macro mclk * * @component: pointer to codec component instance. * @enable: set true to enable, otherwise false. * * Returns 0 on success or -EINVAL on error. */ int bolero_tx_mclk_enable(struct snd_soc_component *component, bool enable) { struct bolero_priv *priv = NULL; int ret = 0; if (!component) return -EINVAL; priv = snd_soc_component_get_drvdata(component); if (!priv) return -EINVAL; if (!bolero_is_valid_codec_dev(priv->dev)) { dev_err(component->dev, "%s: invalid codec\n", __func__); return -EINVAL; } if (priv->macro_params[TX_MACRO].clk_enable) ret = priv->macro_params[TX_MACRO].clk_enable(component, enable); return ret; } EXPORT_SYMBOL(bolero_tx_mclk_enable); /** * bolero_register_event_listener - Register/Deregister to event listener * Loading asoc/codecs/bolero/bolero-cdc.h +6 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ struct macro_ops { int (*clk_switch)(struct snd_soc_component *component); int (*clk_div_get)(struct snd_soc_component *component); int (*reg_evt_listener)(struct snd_soc_component *component, bool en); int (*clk_enable)(struct snd_soc_component *c, bool en); char __iomem *io_base; u16 clk_id_req; u16 default_clk_id; Loading Loading @@ -111,6 +112,7 @@ int bolero_register_event_listener(struct snd_soc_component *component, bool enable); void bolero_wsa_pa_on(struct device *dev); bool bolero_check_core_votes(struct device *dev); int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable); int bolero_get_version(struct device *dev); int bolero_dmic_clk_enable(struct snd_soc_component *component, u32 dmic, u32 tx_mode, bool enable); Loading Loading @@ -204,5 +206,9 @@ static int bolero_dmic_clk_enable(struct snd_soc_component *component, { return 0; } static int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable) { return 0; } #endif /* CONFIG_SND_SOC_BOLERO */ #endif /* BOLERO_CDC_H */ asoc/codecs/bolero/tx-macro.c +14 −1 Original line number Diff line number Diff line Loading @@ -278,6 +278,18 @@ static int tx_macro_mclk_enable(struct tx_macro_priv *tx_priv, return ret; } static int __tx_macro_mclk_enable(struct snd_soc_component *component, bool enable) { struct device *tx_dev = NULL; struct tx_macro_priv *tx_priv = NULL; if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__)) return -EINVAL; return tx_macro_mclk_enable(tx_priv, enable); } static int tx_macro_va_swr_clk_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { Loading Loading @@ -2300,7 +2312,7 @@ static int tx_macro_register_event_listener(struct snd_soc_component *component, "%s: priv is null for macro!\n", __func__); return -EINVAL; } if (tx_priv->swr_ctrl_data) { if (tx_priv->swr_ctrl_data && !tx_priv->tx_swr_clk_cnt) { if (enable) { ret = swrm_wcd_notify( tx_priv->swr_ctrl_data[0].tx_swr_pdev, Loading Loading @@ -3021,6 +3033,7 @@ static void tx_macro_init_ops(struct macro_ops *ops, ops->clk_div_get = tx_macro_clk_div_get; ops->clk_switch = tx_macro_clk_switch; ops->reg_evt_listener = tx_macro_register_event_listener; ops->clk_enable = __tx_macro_mclk_enable; } static int tx_macro_probe(struct platform_device *pdev) Loading asoc/codecs/bolero/va-macro.c +10 −2 Original line number Diff line number Diff line Loading @@ -477,12 +477,20 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w, true); if (!ret) va_priv->tx_clk_status++; if (va_priv->lpi_enable) ret = va_macro_mclk_enable(va_priv, 1, true); else ret = bolero_tx_mclk_enable(component, 1); break; case SND_SOC_DAPM_POST_PMD: if (bolero_tx_clk_switch(component)) dev_dbg(va_dev, "%s: clock switch failed\n",__func__); if (va_priv->lpi_enable) va_macro_mclk_enable(va_priv, 0, true); else bolero_tx_mclk_enable(component, 0); if (va_priv->tx_clk_status > 0) { bolero_clk_rsc_request_clock(va_priv->dev, va_priv->default_clk_id, Loading Loading
asoc/codecs/bolero/bolero-cdc.c +36 −0 Original line number Diff line number Diff line Loading @@ -640,6 +640,7 @@ int bolero_register_macro(struct device *dev, u16 macro_id, priv->macro_params[macro_id].clk_switch = ops->clk_switch; priv->macro_params[macro_id].reg_evt_listener = ops->reg_evt_listener; priv->macro_params[macro_id].clk_enable = ops->clk_enable; } if (macro_id == TX_MACRO || macro_id == VA_MACRO) priv->macro_params[macro_id].clk_div_get = ops->clk_div_get; Loading Loading @@ -713,6 +714,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id) priv->macro_params[macro_id].reg_wake_irq = NULL; priv->macro_params[macro_id].clk_switch = NULL; priv->macro_params[macro_id].reg_evt_listener = NULL; priv->macro_params[macro_id].clk_enable = NULL; } if (macro_id == TX_MACRO || macro_id == VA_MACRO) priv->macro_params[macro_id].clk_div_get = NULL; Loading Loading @@ -1015,6 +1017,40 @@ int bolero_tx_clk_switch(struct snd_soc_component *component) } EXPORT_SYMBOL(bolero_tx_clk_switch); /** * bolero_tx_mclk_enable - Enable/Disable TX Macro mclk * * @component: pointer to codec component instance. * @enable: set true to enable, otherwise false. * * Returns 0 on success or -EINVAL on error. */ int bolero_tx_mclk_enable(struct snd_soc_component *component, bool enable) { struct bolero_priv *priv = NULL; int ret = 0; if (!component) return -EINVAL; priv = snd_soc_component_get_drvdata(component); if (!priv) return -EINVAL; if (!bolero_is_valid_codec_dev(priv->dev)) { dev_err(component->dev, "%s: invalid codec\n", __func__); return -EINVAL; } if (priv->macro_params[TX_MACRO].clk_enable) ret = priv->macro_params[TX_MACRO].clk_enable(component, enable); return ret; } EXPORT_SYMBOL(bolero_tx_mclk_enable); /** * bolero_register_event_listener - Register/Deregister to event listener * Loading
asoc/codecs/bolero/bolero-cdc.h +6 −0 Original line number Diff line number Diff line Loading @@ -83,6 +83,7 @@ struct macro_ops { int (*clk_switch)(struct snd_soc_component *component); int (*clk_div_get)(struct snd_soc_component *component); int (*reg_evt_listener)(struct snd_soc_component *component, bool en); int (*clk_enable)(struct snd_soc_component *c, bool en); char __iomem *io_base; u16 clk_id_req; u16 default_clk_id; Loading Loading @@ -111,6 +112,7 @@ int bolero_register_event_listener(struct snd_soc_component *component, bool enable); void bolero_wsa_pa_on(struct device *dev); bool bolero_check_core_votes(struct device *dev); int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable); int bolero_get_version(struct device *dev); int bolero_dmic_clk_enable(struct snd_soc_component *component, u32 dmic, u32 tx_mode, bool enable); Loading Loading @@ -204,5 +206,9 @@ static int bolero_dmic_clk_enable(struct snd_soc_component *component, { return 0; } static int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable) { return 0; } #endif /* CONFIG_SND_SOC_BOLERO */ #endif /* BOLERO_CDC_H */
asoc/codecs/bolero/tx-macro.c +14 −1 Original line number Diff line number Diff line Loading @@ -278,6 +278,18 @@ static int tx_macro_mclk_enable(struct tx_macro_priv *tx_priv, return ret; } static int __tx_macro_mclk_enable(struct snd_soc_component *component, bool enable) { struct device *tx_dev = NULL; struct tx_macro_priv *tx_priv = NULL; if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__)) return -EINVAL; return tx_macro_mclk_enable(tx_priv, enable); } static int tx_macro_va_swr_clk_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { Loading Loading @@ -2300,7 +2312,7 @@ static int tx_macro_register_event_listener(struct snd_soc_component *component, "%s: priv is null for macro!\n", __func__); return -EINVAL; } if (tx_priv->swr_ctrl_data) { if (tx_priv->swr_ctrl_data && !tx_priv->tx_swr_clk_cnt) { if (enable) { ret = swrm_wcd_notify( tx_priv->swr_ctrl_data[0].tx_swr_pdev, Loading Loading @@ -3021,6 +3033,7 @@ static void tx_macro_init_ops(struct macro_ops *ops, ops->clk_div_get = tx_macro_clk_div_get; ops->clk_switch = tx_macro_clk_switch; ops->reg_evt_listener = tx_macro_register_event_listener; ops->clk_enable = __tx_macro_mclk_enable; } static int tx_macro_probe(struct platform_device *pdev) Loading
asoc/codecs/bolero/va-macro.c +10 −2 Original line number Diff line number Diff line Loading @@ -477,12 +477,20 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w, true); if (!ret) va_priv->tx_clk_status++; if (va_priv->lpi_enable) ret = va_macro_mclk_enable(va_priv, 1, true); else ret = bolero_tx_mclk_enable(component, 1); break; case SND_SOC_DAPM_POST_PMD: if (bolero_tx_clk_switch(component)) dev_dbg(va_dev, "%s: clock switch failed\n",__func__); if (va_priv->lpi_enable) va_macro_mclk_enable(va_priv, 0, true); else bolero_tx_mclk_enable(component, 0); if (va_priv->tx_clk_status > 0) { bolero_clk_rsc_request_clock(va_priv->dev, va_priv->default_clk_id, Loading