Loading asoc/codecs/bolero/rx-macro.c +37 −2 Original line number Diff line number Diff line Loading @@ -372,6 +372,7 @@ struct rx_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -3462,6 +3463,23 @@ static const struct snd_soc_dapm_route rx_audio_map[] = { {"RX INT2 MIX2 INP", "SRC1", "SRC1"}, }; static int rx_macro_core_vote(void *handle, bool enable) { struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle; if (rx_priv == NULL) { pr_err("%s: rx priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); pm_runtime_mark_last_busy(rx_priv->dev); } return 0; } static int rx_swrm_clock(void *handle, bool enable) { struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle; Loading @@ -3480,8 +3498,16 @@ static int rx_swrm_clock(void *handle, bool enable) if (enable) { pm_runtime_get_sync(rx_priv->dev); if (rx_priv->swr_clk_users == 0) { msm_cdc_pinctrl_select_active_state( ret = msm_cdc_pinctrl_select_active_state( rx_priv->rx_swr_gpio_p); if (ret < 0) { dev_err(rx_priv->dev, "%s: rx swr pinctrl enable failed\n", __func__); pm_runtime_mark_last_busy(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); goto exit; } ret = rx_macro_mclk_enable(rx_priv, 1, true); if (ret < 0) { msm_cdc_pinctrl_select_sleep_state( Loading @@ -3489,6 +3515,8 @@ static int rx_swrm_clock(void *handle, bool enable) dev_err(rx_priv->dev, "%s: rx request clock enable failed\n", __func__); pm_runtime_mark_last_busy(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); goto exit; } if (rx_priv->reset_swr) Loading Loading @@ -3521,8 +3549,14 @@ static int rx_swrm_clock(void *handle, bool enable) BOLERO_CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); rx_macro_mclk_enable(rx_priv, 0, true); msm_cdc_pinctrl_select_sleep_state( ret = msm_cdc_pinctrl_select_sleep_state( rx_priv->rx_swr_gpio_p); if (ret < 0) { dev_err(rx_priv->dev, "%s: rx swr pinctrl disable failed\n", __func__); goto exit; } } } dev_dbg(rx_priv->dev, "%s: swrm clock users %d\n", Loading Loading @@ -3873,6 +3907,7 @@ static int rx_macro_probe(struct platform_device *pdev) rx_priv->swr_plat_data.write = NULL; rx_priv->swr_plat_data.bulk_write = NULL; rx_priv->swr_plat_data.clk = rx_swrm_clock; rx_priv->swr_plat_data.core_vote = rx_macro_core_vote; rx_priv->swr_plat_data.handle_irq = NULL; ret = of_property_read_u8_array(pdev->dev.of_node, Loading asoc/codecs/bolero/tx-macro.c +47 −6 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ struct tx_macro_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -1726,9 +1727,16 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, (enable ? "enable" : "disable"), tx_priv->tx_mclk_users); if (enable) { if (tx_priv->swr_clk_users == 0) msm_cdc_pinctrl_select_active_state( if (tx_priv->swr_clk_users == 0) { ret = msm_cdc_pinctrl_select_active_state( tx_priv->tx_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(tx_priv->dev, "%s: tx swr pinctrl enable failed\n", __func__); goto exit; } } clk_tx_ret = bolero_clk_rsc_request_clock(tx_priv->dev, TX_CORE_CLK, Loading Loading @@ -1841,9 +1849,16 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, TX_CORE_CLK, TX_CORE_CLK, false); if (tx_priv->swr_clk_users == 0) msm_cdc_pinctrl_select_sleep_state( if (tx_priv->swr_clk_users == 0) { ret = msm_cdc_pinctrl_select_sleep_state( tx_priv->tx_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(tx_priv->dev, "%s: tx swr pinctrl disable failed\n", __func__); goto exit; } } } return 0; Loading @@ -1853,6 +1868,7 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, TX_CORE_CLK, TX_CORE_CLK, false); exit: return ret; } Loading Loading @@ -1886,6 +1902,24 @@ static int tx_macro_clk_switch(struct snd_soc_component *component) return ret; } static int tx_macro_core_vote(void *handle, bool enable) { struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle; int ret = 0; if (tx_priv == NULL) { pr_err("%s: tx priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); pm_runtime_mark_last_busy(tx_priv->dev); } return ret; } static int tx_macro_swrm_clock(void *handle, bool enable) { struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle; Loading @@ -1908,14 +1942,20 @@ static int tx_macro_swrm_clock(void *handle, bool enable) if (tx_priv->va_swr_clk_cnt && !tx_priv->tx_swr_clk_cnt) { ret = tx_macro_tx_va_mclk_enable(tx_priv, regmap, VA_MCLK, enable); if (ret) if (ret) { pm_runtime_mark_last_busy(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); goto done; } tx_priv->va_clk_status++; } else { ret = tx_macro_tx_va_mclk_enable(tx_priv, regmap, TX_MCLK, enable); if (ret) if (ret) { pm_runtime_mark_last_busy(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); goto done; } tx_priv->tx_clk_status++; } pm_runtime_mark_last_busy(tx_priv->dev); Loading Loading @@ -2332,6 +2372,7 @@ static int tx_macro_probe(struct platform_device *pdev) tx_priv->swr_plat_data.write = NULL; tx_priv->swr_plat_data.bulk_write = NULL; tx_priv->swr_plat_data.clk = tx_macro_swrm_clock; tx_priv->swr_plat_data.core_vote = tx_macro_core_vote; tx_priv->swr_plat_data.handle_irq = NULL; mutex_init(&tx_priv->mclk_lock); Loading asoc/codecs/bolero/wsa-macro.c +39 −3 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ struct wsa_macro_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -2770,6 +2771,24 @@ static void wsa_macro_init_reg(struct snd_soc_component *component) wsa_macro_init_bcl_pmic_reg(component); } static int wsa_macro_core_vote(void *handle, bool enable) { struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle; int ret = 0; if (wsa_priv == NULL) { pr_err("%s: wsa priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); pm_runtime_mark_last_busy(wsa_priv->dev); } return ret; } static int wsa_swrm_clock(void *handle, bool enable) { struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle; Loading @@ -2788,8 +2807,16 @@ static int wsa_swrm_clock(void *handle, bool enable) if (enable) { pm_runtime_get_sync(wsa_priv->dev); if (wsa_priv->swr_clk_users == 0) { msm_cdc_pinctrl_select_active_state( ret = msm_cdc_pinctrl_select_active_state( wsa_priv->wsa_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(wsa_priv->dev, "%s: wsa swr pinctrl enable failed\n", __func__); pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); goto exit; } ret = wsa_macro_mclk_enable(wsa_priv, 1, true); if (ret < 0) { msm_cdc_pinctrl_select_sleep_state( Loading @@ -2797,6 +2824,8 @@ static int wsa_swrm_clock(void *handle, bool enable) dev_err_ratelimited(wsa_priv->dev, "%s: wsa request clock enable failed\n", __func__); pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); goto exit; } if (wsa_priv->reset_swr) Loading @@ -2812,9 +2841,9 @@ static int wsa_swrm_clock(void *handle, bool enable) 0x02, 0x00); wsa_priv->reset_swr = false; } wsa_priv->swr_clk_users++; pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); wsa_priv->swr_clk_users++; } else { if (wsa_priv->swr_clk_users <= 0) { dev_err(wsa_priv->dev, "%s: clock already disabled\n", Loading @@ -2828,8 +2857,14 @@ static int wsa_swrm_clock(void *handle, bool enable) BOLERO_CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); wsa_macro_mclk_enable(wsa_priv, 0, true); msm_cdc_pinctrl_select_sleep_state( ret = msm_cdc_pinctrl_select_sleep_state( wsa_priv->wsa_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(wsa_priv->dev, "%s: wsa swr pinctrl disable failed\n", __func__); goto exit; } } } dev_dbg(wsa_priv->dev, "%s: swrm clock users %d\n", Loading Loading @@ -3096,6 +3131,7 @@ static int wsa_macro_probe(struct platform_device *pdev) wsa_priv->swr_plat_data.write = NULL; wsa_priv->swr_plat_data.bulk_write = NULL; wsa_priv->swr_plat_data.clk = wsa_swrm_clock; wsa_priv->swr_plat_data.core_vote = wsa_macro_core_vote; wsa_priv->swr_plat_data.handle_irq = NULL; ret = of_property_read_u32(pdev->dev.of_node, "qcom,default-clk-id", Loading Loading
asoc/codecs/bolero/rx-macro.c +37 −2 Original line number Diff line number Diff line Loading @@ -372,6 +372,7 @@ struct rx_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -3462,6 +3463,23 @@ static const struct snd_soc_dapm_route rx_audio_map[] = { {"RX INT2 MIX2 INP", "SRC1", "SRC1"}, }; static int rx_macro_core_vote(void *handle, bool enable) { struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle; if (rx_priv == NULL) { pr_err("%s: rx priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); pm_runtime_mark_last_busy(rx_priv->dev); } return 0; } static int rx_swrm_clock(void *handle, bool enable) { struct rx_macro_priv *rx_priv = (struct rx_macro_priv *) handle; Loading @@ -3480,8 +3498,16 @@ static int rx_swrm_clock(void *handle, bool enable) if (enable) { pm_runtime_get_sync(rx_priv->dev); if (rx_priv->swr_clk_users == 0) { msm_cdc_pinctrl_select_active_state( ret = msm_cdc_pinctrl_select_active_state( rx_priv->rx_swr_gpio_p); if (ret < 0) { dev_err(rx_priv->dev, "%s: rx swr pinctrl enable failed\n", __func__); pm_runtime_mark_last_busy(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); goto exit; } ret = rx_macro_mclk_enable(rx_priv, 1, true); if (ret < 0) { msm_cdc_pinctrl_select_sleep_state( Loading @@ -3489,6 +3515,8 @@ static int rx_swrm_clock(void *handle, bool enable) dev_err(rx_priv->dev, "%s: rx request clock enable failed\n", __func__); pm_runtime_mark_last_busy(rx_priv->dev); pm_runtime_put_autosuspend(rx_priv->dev); goto exit; } if (rx_priv->reset_swr) Loading Loading @@ -3521,8 +3549,14 @@ static int rx_swrm_clock(void *handle, bool enable) BOLERO_CDC_RX_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); rx_macro_mclk_enable(rx_priv, 0, true); msm_cdc_pinctrl_select_sleep_state( ret = msm_cdc_pinctrl_select_sleep_state( rx_priv->rx_swr_gpio_p); if (ret < 0) { dev_err(rx_priv->dev, "%s: rx swr pinctrl disable failed\n", __func__); goto exit; } } } dev_dbg(rx_priv->dev, "%s: swrm clock users %d\n", Loading Loading @@ -3873,6 +3907,7 @@ static int rx_macro_probe(struct platform_device *pdev) rx_priv->swr_plat_data.write = NULL; rx_priv->swr_plat_data.bulk_write = NULL; rx_priv->swr_plat_data.clk = rx_swrm_clock; rx_priv->swr_plat_data.core_vote = rx_macro_core_vote; rx_priv->swr_plat_data.handle_irq = NULL; ret = of_property_read_u8_array(pdev->dev.of_node, Loading
asoc/codecs/bolero/tx-macro.c +47 −6 Original line number Diff line number Diff line Loading @@ -72,6 +72,7 @@ struct tx_macro_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -1726,9 +1727,16 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, (enable ? "enable" : "disable"), tx_priv->tx_mclk_users); if (enable) { if (tx_priv->swr_clk_users == 0) msm_cdc_pinctrl_select_active_state( if (tx_priv->swr_clk_users == 0) { ret = msm_cdc_pinctrl_select_active_state( tx_priv->tx_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(tx_priv->dev, "%s: tx swr pinctrl enable failed\n", __func__); goto exit; } } clk_tx_ret = bolero_clk_rsc_request_clock(tx_priv->dev, TX_CORE_CLK, Loading Loading @@ -1841,9 +1849,16 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, TX_CORE_CLK, TX_CORE_CLK, false); if (tx_priv->swr_clk_users == 0) msm_cdc_pinctrl_select_sleep_state( if (tx_priv->swr_clk_users == 0) { ret = msm_cdc_pinctrl_select_sleep_state( tx_priv->tx_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(tx_priv->dev, "%s: tx swr pinctrl disable failed\n", __func__); goto exit; } } } return 0; Loading @@ -1853,6 +1868,7 @@ static int tx_macro_tx_va_mclk_enable(struct tx_macro_priv *tx_priv, TX_CORE_CLK, TX_CORE_CLK, false); exit: return ret; } Loading Loading @@ -1886,6 +1902,24 @@ static int tx_macro_clk_switch(struct snd_soc_component *component) return ret; } static int tx_macro_core_vote(void *handle, bool enable) { struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle; int ret = 0; if (tx_priv == NULL) { pr_err("%s: tx priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); pm_runtime_mark_last_busy(tx_priv->dev); } return ret; } static int tx_macro_swrm_clock(void *handle, bool enable) { struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle; Loading @@ -1908,14 +1942,20 @@ static int tx_macro_swrm_clock(void *handle, bool enable) if (tx_priv->va_swr_clk_cnt && !tx_priv->tx_swr_clk_cnt) { ret = tx_macro_tx_va_mclk_enable(tx_priv, regmap, VA_MCLK, enable); if (ret) if (ret) { pm_runtime_mark_last_busy(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); goto done; } tx_priv->va_clk_status++; } else { ret = tx_macro_tx_va_mclk_enable(tx_priv, regmap, TX_MCLK, enable); if (ret) if (ret) { pm_runtime_mark_last_busy(tx_priv->dev); pm_runtime_put_autosuspend(tx_priv->dev); goto done; } tx_priv->tx_clk_status++; } pm_runtime_mark_last_busy(tx_priv->dev); Loading Loading @@ -2332,6 +2372,7 @@ static int tx_macro_probe(struct platform_device *pdev) tx_priv->swr_plat_data.write = NULL; tx_priv->swr_plat_data.bulk_write = NULL; tx_priv->swr_plat_data.clk = tx_macro_swrm_clock; tx_priv->swr_plat_data.core_vote = tx_macro_core_vote; tx_priv->swr_plat_data.handle_irq = NULL; mutex_init(&tx_priv->mclk_lock); Loading
asoc/codecs/bolero/wsa-macro.c +39 −3 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ struct wsa_macro_swr_ctrl_platform_data { int (*write)(void *handle, int reg, int val); int (*bulk_write)(void *handle, u32 *reg, u32 *val, size_t len); int (*clk)(void *handle, bool enable); int (*core_vote)(void *handle, bool enable); int (*handle_irq)(void *handle, irqreturn_t (*swrm_irq_handler)(int irq, void *data), Loading Loading @@ -2770,6 +2771,24 @@ static void wsa_macro_init_reg(struct snd_soc_component *component) wsa_macro_init_bcl_pmic_reg(component); } static int wsa_macro_core_vote(void *handle, bool enable) { struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle; int ret = 0; if (wsa_priv == NULL) { pr_err("%s: wsa priv data is NULL\n", __func__); return -EINVAL; } if (enable) { pm_runtime_get_sync(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); pm_runtime_mark_last_busy(wsa_priv->dev); } return ret; } static int wsa_swrm_clock(void *handle, bool enable) { struct wsa_macro_priv *wsa_priv = (struct wsa_macro_priv *) handle; Loading @@ -2788,8 +2807,16 @@ static int wsa_swrm_clock(void *handle, bool enable) if (enable) { pm_runtime_get_sync(wsa_priv->dev); if (wsa_priv->swr_clk_users == 0) { msm_cdc_pinctrl_select_active_state( ret = msm_cdc_pinctrl_select_active_state( wsa_priv->wsa_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(wsa_priv->dev, "%s: wsa swr pinctrl enable failed\n", __func__); pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); goto exit; } ret = wsa_macro_mclk_enable(wsa_priv, 1, true); if (ret < 0) { msm_cdc_pinctrl_select_sleep_state( Loading @@ -2797,6 +2824,8 @@ static int wsa_swrm_clock(void *handle, bool enable) dev_err_ratelimited(wsa_priv->dev, "%s: wsa request clock enable failed\n", __func__); pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); goto exit; } if (wsa_priv->reset_swr) Loading @@ -2812,9 +2841,9 @@ static int wsa_swrm_clock(void *handle, bool enable) 0x02, 0x00); wsa_priv->reset_swr = false; } wsa_priv->swr_clk_users++; pm_runtime_mark_last_busy(wsa_priv->dev); pm_runtime_put_autosuspend(wsa_priv->dev); wsa_priv->swr_clk_users++; } else { if (wsa_priv->swr_clk_users <= 0) { dev_err(wsa_priv->dev, "%s: clock already disabled\n", Loading @@ -2828,8 +2857,14 @@ static int wsa_swrm_clock(void *handle, bool enable) BOLERO_CDC_WSA_CLK_RST_CTRL_SWR_CONTROL, 0x01, 0x00); wsa_macro_mclk_enable(wsa_priv, 0, true); msm_cdc_pinctrl_select_sleep_state( ret = msm_cdc_pinctrl_select_sleep_state( wsa_priv->wsa_swr_gpio_p); if (ret < 0) { dev_err_ratelimited(wsa_priv->dev, "%s: wsa swr pinctrl disable failed\n", __func__); goto exit; } } } dev_dbg(wsa_priv->dev, "%s: swrm clock users %d\n", Loading Loading @@ -3096,6 +3131,7 @@ static int wsa_macro_probe(struct platform_device *pdev) wsa_priv->swr_plat_data.write = NULL; wsa_priv->swr_plat_data.bulk_write = NULL; wsa_priv->swr_plat_data.clk = wsa_swrm_clock; wsa_priv->swr_plat_data.core_vote = wsa_macro_core_vote; wsa_priv->swr_plat_data.handle_irq = NULL; ret = of_property_read_u32(pdev->dev.of_node, "qcom,default-clk-id", Loading