Revert "ASoC: bolero: check clock source before clock switch"
This reverts commit93bc6299f3
and6cc7f52a6d
. Change-Id: I614b650d6e071b9d1867988ebc88246b9fdc8f91 Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
This commit is contained in:
@@ -644,7 +644,6 @@ int bolero_register_macro(struct device *dev, u16 macro_id,
|
|||||||
bolero_mclk_mux_tbl[macro_id][MCLK_MUX0];
|
bolero_mclk_mux_tbl[macro_id][MCLK_MUX0];
|
||||||
if (macro_id == TX_MACRO) {
|
if (macro_id == TX_MACRO) {
|
||||||
priv->macro_params[macro_id].reg_wake_irq = ops->reg_wake_irq;
|
priv->macro_params[macro_id].reg_wake_irq = ops->reg_wake_irq;
|
||||||
priv->macro_params[macro_id].clk_switch = ops->clk_switch;
|
|
||||||
priv->macro_params[macro_id].reg_evt_listener =
|
priv->macro_params[macro_id].reg_evt_listener =
|
||||||
ops->reg_evt_listener;
|
ops->reg_evt_listener;
|
||||||
priv->macro_params[macro_id].clk_enable = ops->clk_enable;
|
priv->macro_params[macro_id].clk_enable = ops->clk_enable;
|
||||||
@@ -719,7 +718,6 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id)
|
|||||||
priv->macro_params[macro_id].dev = NULL;
|
priv->macro_params[macro_id].dev = NULL;
|
||||||
if (macro_id == TX_MACRO) {
|
if (macro_id == TX_MACRO) {
|
||||||
priv->macro_params[macro_id].reg_wake_irq = NULL;
|
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].reg_evt_listener = NULL;
|
||||||
priv->macro_params[macro_id].clk_enable = NULL;
|
priv->macro_params[macro_id].clk_enable = NULL;
|
||||||
}
|
}
|
||||||
@@ -1016,40 +1014,6 @@ int bolero_register_wake_irq(struct snd_soc_component *component,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(bolero_register_wake_irq);
|
EXPORT_SYMBOL(bolero_register_wake_irq);
|
||||||
|
|
||||||
/**
|
|
||||||
* bolero_tx_clk_switch - Switch tx macro clock
|
|
||||||
*
|
|
||||||
* @component: pointer to codec component instance.
|
|
||||||
*
|
|
||||||
* @clk_src: 0 for TX_RCG and 1 for VA_RCG
|
|
||||||
*
|
|
||||||
* Returns 0 on success or -EINVAL on error.
|
|
||||||
*/
|
|
||||||
int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src)
|
|
||||||
{
|
|
||||||
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_switch)
|
|
||||||
ret = priv->macro_params[TX_MACRO].clk_switch(component,
|
|
||||||
clk_src);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(bolero_tx_clk_switch);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bolero_tx_mclk_enable - Enable/Disable TX Macro mclk
|
* bolero_tx_mclk_enable - Enable/Disable TX Macro mclk
|
||||||
*
|
*
|
||||||
|
@@ -37,11 +37,6 @@ enum {
|
|||||||
BOLERO_ADC_MAX
|
BOLERO_ADC_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
CLK_SRC_TX_RCG = 0,
|
|
||||||
CLK_SRC_VA_RCG,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BOLERO_MACRO_EVT_RX_MUTE = 1, /* for RX mute/unmute */
|
BOLERO_MACRO_EVT_RX_MUTE = 1, /* for RX mute/unmute */
|
||||||
BOLERO_MACRO_EVT_IMPED_TRUE, /* for imped true */
|
BOLERO_MACRO_EVT_IMPED_TRUE, /* for imped true */
|
||||||
@@ -76,7 +71,6 @@ struct macro_ops {
|
|||||||
int (*set_port_map)(struct snd_soc_component *component, u32 uc,
|
int (*set_port_map)(struct snd_soc_component *component, u32 uc,
|
||||||
u32 size, void *data);
|
u32 size, void *data);
|
||||||
int (*clk_div_get)(struct snd_soc_component *component);
|
int (*clk_div_get)(struct snd_soc_component *component);
|
||||||
int (*clk_switch)(struct snd_soc_component *component, int clk_src);
|
|
||||||
int (*reg_evt_listener)(struct snd_soc_component *component, bool en);
|
int (*reg_evt_listener)(struct snd_soc_component *component, bool en);
|
||||||
int (*clk_enable)(struct snd_soc_component *c, bool en);
|
int (*clk_enable)(struct snd_soc_component *c, bool en);
|
||||||
char __iomem *io_base;
|
char __iomem *io_base;
|
||||||
@@ -102,7 +96,6 @@ void bolero_clear_amic_tx_hold(struct device *dev, u16 adc_n);
|
|||||||
int bolero_runtime_resume(struct device *dev);
|
int bolero_runtime_resume(struct device *dev);
|
||||||
int bolero_runtime_suspend(struct device *dev);
|
int bolero_runtime_suspend(struct device *dev);
|
||||||
int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *data);
|
int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *data);
|
||||||
int bolero_tx_clk_switch(struct snd_soc_component *component, int clk_src);
|
|
||||||
int bolero_register_event_listener(struct snd_soc_component *component,
|
int bolero_register_event_listener(struct snd_soc_component *component,
|
||||||
bool enable);
|
bool enable);
|
||||||
void bolero_wsa_pa_on(struct device *dev);
|
void bolero_wsa_pa_on(struct device *dev);
|
||||||
@@ -170,12 +163,6 @@ static inline int bolero_set_port_map(struct snd_soc_component *component,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int bolero_tx_clk_switch(struct snd_soc_component *component,
|
|
||||||
int clk_src)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int bolero_register_event_listener(
|
static inline int bolero_register_event_listener(
|
||||||
struct snd_soc_component *component,
|
struct snd_soc_component *component,
|
||||||
bool enable)
|
bool enable)
|
||||||
|
@@ -2725,36 +2725,6 @@ static int tx_macro_clk_div_get(struct snd_soc_component *component)
|
|||||||
return tx_priv->dmic_clk_div;
|
return tx_priv->dmic_clk_div;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tx_macro_clk_switch(struct snd_soc_component *component, int clk_src)
|
|
||||||
{
|
|
||||||
struct device *tx_dev = NULL;
|
|
||||||
struct tx_macro_priv *tx_priv = NULL;
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (!component)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
tx_dev = bolero_get_device_ptr(component->dev, TX_MACRO);
|
|
||||||
if (!tx_dev) {
|
|
||||||
dev_err(component->dev,
|
|
||||||
"%s: null device for macro!\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
tx_priv = dev_get_drvdata(tx_dev);
|
|
||||||
if (!tx_priv) {
|
|
||||||
dev_err(component->dev,
|
|
||||||
"%s: priv is null for macro!\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
if (tx_priv->swr_ctrl_data) {
|
|
||||||
ret = swrm_wcd_notify(
|
|
||||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
|
||||||
SWR_REQ_CLK_SWITCH, &clk_src);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tx_macro_core_vote(void *handle, bool enable)
|
static int tx_macro_core_vote(void *handle, bool enable)
|
||||||
{
|
{
|
||||||
struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle;
|
struct tx_macro_priv *tx_priv = (struct tx_macro_priv *) handle;
|
||||||
@@ -3236,7 +3206,6 @@ static void tx_macro_init_ops(struct macro_ops *ops,
|
|||||||
ops->reg_wake_irq = tx_macro_reg_wake_irq;
|
ops->reg_wake_irq = tx_macro_reg_wake_irq;
|
||||||
ops->set_port_map = tx_macro_set_port_map;
|
ops->set_port_map = tx_macro_set_port_map;
|
||||||
ops->clk_div_get = tx_macro_clk_div_get;
|
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->reg_evt_listener = tx_macro_register_event_listener;
|
||||||
ops->clk_enable = __tx_macro_mclk_enable;
|
ops->clk_enable = __tx_macro_mclk_enable;
|
||||||
}
|
}
|
||||||
|
@@ -380,7 +380,6 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct device *va_dev = NULL;
|
struct device *va_dev = NULL;
|
||||||
struct va_macro_priv *va_priv = NULL;
|
struct va_macro_priv *va_priv = NULL;
|
||||||
int clk_src = 0;
|
|
||||||
|
|
||||||
if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
|
if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -393,30 +392,12 @@ static int va_macro_swr_pwr_event_v2(struct snd_soc_dapm_widget *w,
|
|||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case SND_SOC_DAPM_PRE_PMU:
|
case SND_SOC_DAPM_PRE_PMU:
|
||||||
if (va_priv->swr_ctrl_data) {
|
|
||||||
clk_src = CLK_SRC_VA_RCG;
|
|
||||||
ret = swrm_wcd_notify(
|
|
||||||
va_priv->swr_ctrl_data[0].va_swr_pdev,
|
|
||||||
SWR_REQ_CLK_SWITCH, &clk_src);
|
|
||||||
if (ret)
|
|
||||||
dev_dbg(va_dev, "%s: clock switch failed\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
msm_cdc_pinctrl_set_wakeup_capable(
|
msm_cdc_pinctrl_set_wakeup_capable(
|
||||||
va_priv->va_swr_gpio_p, false);
|
va_priv->va_swr_gpio_p, false);
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
msm_cdc_pinctrl_set_wakeup_capable(
|
msm_cdc_pinctrl_set_wakeup_capable(
|
||||||
va_priv->va_swr_gpio_p, true);
|
va_priv->va_swr_gpio_p, true);
|
||||||
if (va_priv->swr_ctrl_data) {
|
|
||||||
clk_src = CLK_SRC_TX_RCG;
|
|
||||||
ret = swrm_wcd_notify(
|
|
||||||
va_priv->swr_ctrl_data[0].va_swr_pdev,
|
|
||||||
SWR_REQ_CLK_SWITCH, &clk_src);
|
|
||||||
if (ret)
|
|
||||||
dev_dbg(va_dev, "%s: clock switch failed\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dev_err(va_priv->dev,
|
dev_err(va_priv->dev,
|
||||||
@@ -454,10 +435,6 @@ static int va_macro_swr_pwr_event(struct snd_soc_dapm_widget *w,
|
|||||||
"%s: lpass audio hw enable failed\n",
|
"%s: lpass audio hw enable failed\n",
|
||||||
__func__);
|
__func__);
|
||||||
}
|
}
|
||||||
if (!ret)
|
|
||||||
if (bolero_tx_clk_switch(component, CLK_SRC_VA_RCG))
|
|
||||||
dev_dbg(va_dev, "%s: clock switch failed\n",
|
|
||||||
__func__);
|
|
||||||
if (va_priv->lpi_enable) {
|
if (va_priv->lpi_enable) {
|
||||||
bolero_register_event_listener(component, true);
|
bolero_register_event_listener(component, true);
|
||||||
va_priv->register_event_listener = true;
|
va_priv->register_event_listener = true;
|
||||||
@@ -468,8 +445,6 @@ static int va_macro_swr_pwr_event(struct snd_soc_dapm_widget *w,
|
|||||||
va_priv->register_event_listener = false;
|
va_priv->register_event_listener = false;
|
||||||
bolero_register_event_listener(component, false);
|
bolero_register_event_listener(component, false);
|
||||||
}
|
}
|
||||||
if (bolero_tx_clk_switch(component, CLK_SRC_TX_RCG))
|
|
||||||
dev_dbg(va_dev, "%s: clock switch failed\n",__func__);
|
|
||||||
if (va_priv->lpass_audio_hw_vote)
|
if (va_priv->lpass_audio_hw_vote)
|
||||||
digital_cdc_rsc_mgr_hw_vote_disable(
|
digital_cdc_rsc_mgr_hw_vote_disable(
|
||||||
va_priv->lpass_audio_hw_vote);
|
va_priv->lpass_audio_hw_vote);
|
||||||
@@ -509,7 +484,6 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct device *va_dev = NULL;
|
struct device *va_dev = NULL;
|
||||||
struct va_macro_priv *va_priv = NULL;
|
struct va_macro_priv *va_priv = NULL;
|
||||||
int clk_src = 0;
|
|
||||||
|
|
||||||
if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
|
if (!va_macro_get_data(component, &va_dev, &va_priv, __func__))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -530,27 +504,10 @@ static int va_macro_mclk_event(struct snd_soc_dapm_widget *w,
|
|||||||
ret = bolero_tx_mclk_enable(component, 1);
|
ret = bolero_tx_mclk_enable(component, 1);
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAPM_POST_PMD:
|
case SND_SOC_DAPM_POST_PMD:
|
||||||
if (va_priv->lpi_enable) {
|
if (va_priv->lpi_enable)
|
||||||
if (va_priv->version == BOLERO_VERSION_2_1) {
|
|
||||||
if (va_priv->swr_ctrl_data) {
|
|
||||||
clk_src = CLK_SRC_TX_RCG;
|
|
||||||
ret = swrm_wcd_notify(
|
|
||||||
va_priv->swr_ctrl_data[0].va_swr_pdev,
|
|
||||||
SWR_REQ_CLK_SWITCH, &clk_src);
|
|
||||||
if (ret)
|
|
||||||
dev_dbg(va_dev,
|
|
||||||
"%s: clock switch failed\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
} else if (bolero_tx_clk_switch(component,
|
|
||||||
CLK_SRC_TX_RCG)) {
|
|
||||||
dev_dbg(va_dev, "%s: clock switch failed\n",
|
|
||||||
__func__);
|
|
||||||
}
|
|
||||||
va_macro_mclk_enable(va_priv, 0, true);
|
va_macro_mclk_enable(va_priv, 0, true);
|
||||||
} else {
|
else
|
||||||
bolero_tx_mclk_enable(component, 0);
|
bolero_tx_mclk_enable(component, 0);
|
||||||
}
|
|
||||||
|
|
||||||
if (va_priv->tx_clk_status > 0) {
|
if (va_priv->tx_clk_status > 0) {
|
||||||
bolero_clk_rsc_request_clock(va_priv->dev,
|
bolero_clk_rsc_request_clock(va_priv->dev,
|
||||||
|
Reference in New Issue
Block a user