Loading asoc/codecs/bolero/bolero-cdc.c +6 −5 Original line number Diff line number Diff line Loading @@ -614,11 +614,12 @@ static int bolero_ssr_enable(struct device *dev, void *data) if (priv->rsc_clk_cb) priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_UP); if (priv->macro_params[VA_MACRO].event_handler) priv->macro_params[VA_MACRO].event_handler( for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) { if (priv->macro_params[macro_idx].event_handler) priv->macro_params[macro_idx].event_handler( priv->component, BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, 0x0); BOLERO_MACRO_EVT_CLK_RESET, 0x0); } regcache_cache_only(priv->regmap, false); mutex_lock(&priv->clk_lock); priv->dev_up = true; Loading asoc/codecs/bolero/bolero-cdc.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ enum { BOLERO_MACRO_EVT_SSR_DOWN, BOLERO_MACRO_EVT_SSR_UP, BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, BOLERO_MACRO_EVT_CLK_RESET, BOLERO_MACRO_EVT_REG_WAKE_IRQ }; Loading asoc/codecs/bolero/bolero-clk-rsc.c +46 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ #include <linux/platform_device.h> #include <linux/kernel.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include "bolero-cdc.h" #include "bolero-clk-rsc.h" Loading Loading @@ -91,6 +92,51 @@ static char __iomem *bolero_clk_rsc_get_clk_muxsel(struct bolero_clk_rsc *priv, return NULL; } int bolero_rsc_clk_reset(struct device *dev, int clk_id) { struct device *clk_dev = NULL; struct bolero_clk_rsc *priv = NULL; int count = 0; if (!dev) { pr_err("%s: dev is null %d\n", __func__); return -EINVAL; } if (clk_id < 0 || clk_id >= MAX_CLK - NPL_CLK_OFFSET) { pr_err("%s: Invalid clk_id: %d\n", __func__, clk_id); return -EINVAL; } clk_dev = bolero_get_rsc_clk_device_ptr(dev->parent); if (!clk_dev) { pr_err("%s: Invalid rsc clk device\n", __func__); return -EINVAL; } priv = dev_get_drvdata(clk_dev); if (!priv) { pr_err("%s: Invalid rsc clk priviate data\n", __func__); return -EINVAL; } mutex_lock(&priv->rsc_clk_lock); while (__clk_is_enabled(priv->clk[clk_id])) { clk_disable_unprepare(priv->clk[clk_id + NPL_CLK_OFFSET]); clk_disable_unprepare(priv->clk[clk_id]); count++; } dev_dbg(priv->dev, "%s: clock reset after ssr, count %d\n", __func__, count); while (count--) { clk_prepare_enable(priv->clk[clk_id]); clk_prepare_enable(priv->clk[clk_id + NPL_CLK_OFFSET]); } mutex_unlock(&priv->rsc_clk_lock); return 0; } EXPORT_SYMBOL(bolero_rsc_clk_reset); static int bolero_clk_rsc_mux0_clk_request(struct bolero_clk_rsc *priv, int clk_id, bool enable) Loading asoc/codecs/bolero/bolero-clk-rsc.h +5 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ int bolero_clk_rsc_request_clock(struct device *dev, int default_clk_id, int clk_id_req, bool enable); int bolero_rsc_clk_reset(struct device *dev, int clk_id); #else static inline void bolero_clk_rsc_fs_gen_request(struct device *dev, bool enable) Loading @@ -37,6 +38,9 @@ static inline int bolero_clk_rsc_request_clock(struct device *dev, { return 0; } static inline int bolero_rsc_clk_reset(struct device *dev, int clk_id) { return 0; } #endif /* CONFIG_SND_SOC_BOLERO */ #endif /* BOLERO_CLK_RSC_H */ asoc/codecs/bolero/rx-macro.c +3 −0 Original line number Diff line number Diff line Loading @@ -1247,6 +1247,9 @@ static int rx_macro_event_handler(struct snd_soc_component *component, rx_priv->swr_ctrl_data[0].rx_swr_pdev, SWR_DEVICE_SSR_UP, NULL); break; case BOLERO_MACRO_EVT_CLK_RESET: bolero_rsc_clk_reset(rx_dev, RX_CORE_CLK); break; } return ret; } Loading Loading
asoc/codecs/bolero/bolero-cdc.c +6 −5 Original line number Diff line number Diff line Loading @@ -614,11 +614,12 @@ static int bolero_ssr_enable(struct device *dev, void *data) if (priv->rsc_clk_cb) priv->rsc_clk_cb(priv->clk_dev, BOLERO_MACRO_EVT_SSR_UP); if (priv->macro_params[VA_MACRO].event_handler) priv->macro_params[VA_MACRO].event_handler( for (macro_idx = START_MACRO; macro_idx < MAX_MACRO; macro_idx++) { if (priv->macro_params[macro_idx].event_handler) priv->macro_params[macro_idx].event_handler( priv->component, BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, 0x0); BOLERO_MACRO_EVT_CLK_RESET, 0x0); } regcache_cache_only(priv->regmap, false); mutex_lock(&priv->clk_lock); priv->dev_up = true; Loading
asoc/codecs/bolero/bolero-cdc.h +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ enum { BOLERO_MACRO_EVT_SSR_DOWN, BOLERO_MACRO_EVT_SSR_UP, BOLERO_MACRO_EVT_WAIT_VA_CLK_RESET, BOLERO_MACRO_EVT_CLK_RESET, BOLERO_MACRO_EVT_REG_WAKE_IRQ }; Loading
asoc/codecs/bolero/bolero-clk-rsc.c +46 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ #include <linux/platform_device.h> #include <linux/kernel.h> #include <linux/clk.h> #include <linux/clk-provider.h> #include "bolero-cdc.h" #include "bolero-clk-rsc.h" Loading Loading @@ -91,6 +92,51 @@ static char __iomem *bolero_clk_rsc_get_clk_muxsel(struct bolero_clk_rsc *priv, return NULL; } int bolero_rsc_clk_reset(struct device *dev, int clk_id) { struct device *clk_dev = NULL; struct bolero_clk_rsc *priv = NULL; int count = 0; if (!dev) { pr_err("%s: dev is null %d\n", __func__); return -EINVAL; } if (clk_id < 0 || clk_id >= MAX_CLK - NPL_CLK_OFFSET) { pr_err("%s: Invalid clk_id: %d\n", __func__, clk_id); return -EINVAL; } clk_dev = bolero_get_rsc_clk_device_ptr(dev->parent); if (!clk_dev) { pr_err("%s: Invalid rsc clk device\n", __func__); return -EINVAL; } priv = dev_get_drvdata(clk_dev); if (!priv) { pr_err("%s: Invalid rsc clk priviate data\n", __func__); return -EINVAL; } mutex_lock(&priv->rsc_clk_lock); while (__clk_is_enabled(priv->clk[clk_id])) { clk_disable_unprepare(priv->clk[clk_id + NPL_CLK_OFFSET]); clk_disable_unprepare(priv->clk[clk_id]); count++; } dev_dbg(priv->dev, "%s: clock reset after ssr, count %d\n", __func__, count); while (count--) { clk_prepare_enable(priv->clk[clk_id]); clk_prepare_enable(priv->clk[clk_id + NPL_CLK_OFFSET]); } mutex_unlock(&priv->rsc_clk_lock); return 0; } EXPORT_SYMBOL(bolero_rsc_clk_reset); static int bolero_clk_rsc_mux0_clk_request(struct bolero_clk_rsc *priv, int clk_id, bool enable) Loading
asoc/codecs/bolero/bolero-clk-rsc.h +5 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ int bolero_clk_rsc_request_clock(struct device *dev, int default_clk_id, int clk_id_req, bool enable); int bolero_rsc_clk_reset(struct device *dev, int clk_id); #else static inline void bolero_clk_rsc_fs_gen_request(struct device *dev, bool enable) Loading @@ -37,6 +38,9 @@ static inline int bolero_clk_rsc_request_clock(struct device *dev, { return 0; } static inline int bolero_rsc_clk_reset(struct device *dev, int clk_id) { return 0; } #endif /* CONFIG_SND_SOC_BOLERO */ #endif /* BOLERO_CLK_RSC_H */
asoc/codecs/bolero/rx-macro.c +3 −0 Original line number Diff line number Diff line Loading @@ -1247,6 +1247,9 @@ static int rx_macro_event_handler(struct snd_soc_component *component, rx_priv->swr_ctrl_data[0].rx_swr_pdev, SWR_DEVICE_SSR_UP, NULL); break; case BOLERO_MACRO_EVT_CLK_RESET: bolero_rsc_clk_reset(rx_dev, RX_CORE_CLK); break; } return ret; } Loading