mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 07:37:31 -04:00
Merge "asoc: codecs: add support to disable soundwire devices"
This commit is contained in:
commit
57c8619aed
3 changed files with 116 additions and 58 deletions
|
|
@ -764,9 +764,10 @@ static int rx_macro_set_port_map(struct snd_soc_component *component,
|
|||
port_cfg.size = size;
|
||||
port_cfg.params = data;
|
||||
|
||||
ret = swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
if (rx_priv->swr_ctrl_data)
|
||||
ret = swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1152,16 +1153,18 @@ static int rx_macro_mclk_event(struct snd_soc_dapm_widget *w,
|
|||
rx_priv->is_native_on) ||
|
||||
(rx_priv->clk_id == RX_CORE_CLK &&
|
||||
!rx_priv->is_native_on)) {
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
if (rx_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
}
|
||||
}
|
||||
if (rx_priv->is_native_on)
|
||||
mclk_freq = MCLK_FREQ_NATIVE;
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_CLK_FREQ, &mclk_freq);
|
||||
if (rx_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_CLK_FREQ, &mclk_freq);
|
||||
ret = rx_macro_mclk_enable(rx_priv, 1, true);
|
||||
if (ret)
|
||||
rx_priv->dapm_mclk_enable = false;
|
||||
|
|
@ -1213,12 +1216,14 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
|
|||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
rx_priv->dev_up = false;
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
if (rx_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
}
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
rx_priv->dev_up = true;
|
||||
|
|
@ -1237,9 +1242,10 @@ static int rx_macro_event_handler(struct snd_soc_component *component,
|
|||
rx_priv->default_clk_id,
|
||||
RX_CORE_CLK, false);
|
||||
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
if (rx_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
rx_priv->swr_ctrl_data[0].rx_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -3570,6 +3576,8 @@ static int rx_macro_probe(struct platform_device *pdev)
|
|||
int ret = 0;
|
||||
u8 bcl_pmic_params[3];
|
||||
u32 default_clk_id = 0;
|
||||
u32 is_used_rx_swr_gpio = 1;
|
||||
const char *is_used_rx_swr_gpio_dt = "qcom,is-used-swr-gpio";
|
||||
|
||||
rx_priv = devm_kzalloc(&pdev->dev, sizeof(struct rx_macro_priv),
|
||||
GFP_KERNEL);
|
||||
|
|
@ -3598,9 +3606,20 @@ static int rx_macro_probe(struct platform_device *pdev)
|
|||
__func__, "qcom,default-clk-id");
|
||||
default_clk_id = RX_CORE_CLK;
|
||||
}
|
||||
if (of_find_property(pdev->dev.of_node, is_used_rx_swr_gpio_dt,
|
||||
NULL)) {
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
is_used_rx_swr_gpio_dt,
|
||||
&is_used_rx_swr_gpio);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "%s: error reading %s in dt\n",
|
||||
__func__, is_used_rx_swr_gpio_dt);
|
||||
is_used_rx_swr_gpio = 1;
|
||||
}
|
||||
}
|
||||
rx_priv->rx_swr_gpio_p = of_parse_phandle(pdev->dev.of_node,
|
||||
"qcom,rx-swr-gpios", 0);
|
||||
if (!rx_priv->rx_swr_gpio_p) {
|
||||
if (!rx_priv->rx_swr_gpio_p && is_used_rx_swr_gpio) {
|
||||
dev_err(&pdev->dev, "%s: swr_gpios handle not provided!\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -346,19 +346,22 @@ static int tx_macro_event_handler(struct snd_soc_component *component,
|
|||
|
||||
switch (event) {
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
if (tx_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
}
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
/* reset swr after ssr/pdr */
|
||||
tx_priv->reset_swr = true;
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
if (tx_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -375,9 +378,10 @@ static int tx_macro_reg_wake_irq(struct snd_soc_component *component,
|
|||
if (!tx_macro_get_data(component, &tx_dev, &tx_priv, __func__))
|
||||
return -EINVAL;
|
||||
|
||||
ret = swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_REGISTER_WAKE_IRQ, &ipc_wakeup);
|
||||
if (tx_priv->swr_ctrl_data)
|
||||
ret = swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_REGISTER_WAKE_IRQ, &ipc_wakeup);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1948,9 +1952,10 @@ static int tx_macro_set_port_map(struct snd_soc_component *component,
|
|||
port_cfg.size = size;
|
||||
port_cfg.params = data;
|
||||
|
||||
ret = swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
if (tx_priv->swr_ctrl_data)
|
||||
ret = swrm_wcd_notify(
|
||||
tx_priv->swr_ctrl_data[0].tx_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1977,6 +1982,8 @@ static int tx_macro_probe(struct platform_device *pdev)
|
|||
char __iomem *tx_io_base = NULL;
|
||||
int ret = 0;
|
||||
const char *dmic_sample_rate = "qcom,tx-dmic-sample-rate";
|
||||
u32 is_used_tx_swr_gpio = 1;
|
||||
const char *is_used_tx_swr_gpio_dt = "qcom,is-used-swr-gpio";
|
||||
|
||||
tx_priv = devm_kzalloc(&pdev->dev, sizeof(struct tx_macro_priv),
|
||||
GFP_KERNEL);
|
||||
|
|
@ -1993,9 +2000,20 @@ static int tx_macro_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
dev_set_drvdata(&pdev->dev, tx_priv);
|
||||
if (of_find_property(pdev->dev.of_node, is_used_tx_swr_gpio_dt,
|
||||
NULL)) {
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
is_used_tx_swr_gpio_dt,
|
||||
&is_used_tx_swr_gpio);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "%s: error reading %s in dt\n",
|
||||
__func__, is_used_tx_swr_gpio_dt);
|
||||
is_used_tx_swr_gpio = 1;
|
||||
}
|
||||
}
|
||||
tx_priv->tx_swr_gpio_p = of_parse_phandle(pdev->dev.of_node,
|
||||
"qcom,tx-swr-gpios", 0);
|
||||
if (!tx_priv->tx_swr_gpio_p) {
|
||||
if (!tx_priv->tx_swr_gpio_p && is_used_tx_swr_gpio) {
|
||||
dev_err(&pdev->dev, "%s: swr_gpios handle not provided!\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
|
|
@ -2064,7 +2082,8 @@ static int tx_macro_remove(struct platform_device *pdev)
|
|||
if (!tx_priv)
|
||||
return -EINVAL;
|
||||
|
||||
kfree(tx_priv->swr_ctrl_data);
|
||||
if (tx_priv->swr_ctrl_data)
|
||||
kfree(tx_priv->swr_ctrl_data);
|
||||
for (count = 0; count < tx_priv->child_count &&
|
||||
count < TX_MACRO_CHILD_DEVICES_MAX; count++)
|
||||
platform_device_unregister(tx_priv->pdev_child_devices[count]);
|
||||
|
|
|
|||
|
|
@ -473,9 +473,10 @@ static int wsa_macro_set_port_map(struct snd_soc_component *component,
|
|||
port_cfg.size = size;
|
||||
port_cfg.params = data;
|
||||
|
||||
ret = swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
if (wsa_priv->swr_ctrl_data)
|
||||
ret = swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_PORT_MAP, &port_cfg);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -910,19 +911,22 @@ static int wsa_macro_event_handler(struct snd_soc_component *component,
|
|||
|
||||
switch (event) {
|
||||
case BOLERO_MACRO_EVT_SSR_DOWN:
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
if (wsa_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_DOWN, NULL);
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_SSR_DOWN, NULL);
|
||||
}
|
||||
break;
|
||||
case BOLERO_MACRO_EVT_SSR_UP:
|
||||
/* reset swr after ssr/pdr */
|
||||
wsa_priv->reset_swr = true;
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
if (wsa_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_SSR_UP, NULL);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1135,12 +1139,14 @@ static int wsa_macro_enable_swr(struct snd_soc_dapm_widget *w,
|
|||
wsa_priv->rx_1_count++;
|
||||
ch_cnt = wsa_priv->rx_0_count + wsa_priv->rx_1_count;
|
||||
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_UP, NULL);
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_NUM_RX_CH, &ch_cnt);
|
||||
if (wsa_priv->swr_ctrl_data) {
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_DEVICE_UP, NULL);
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_NUM_RX_CH, &ch_cnt);
|
||||
}
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMD:
|
||||
if (!(strnstr(w->name, "RX0", sizeof("WSA_RX0"))) &&
|
||||
|
|
@ -1151,9 +1157,10 @@ static int wsa_macro_enable_swr(struct snd_soc_dapm_widget *w,
|
|||
wsa_priv->rx_1_count--;
|
||||
ch_cnt = wsa_priv->rx_0_count + wsa_priv->rx_1_count;
|
||||
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_NUM_RX_CH, &ch_cnt);
|
||||
if (wsa_priv->swr_ctrl_data)
|
||||
swrm_wcd_notify(
|
||||
wsa_priv->swr_ctrl_data[0].wsa_swr_pdev,
|
||||
SWR_SET_NUM_RX_CH, &ch_cnt);
|
||||
break;
|
||||
}
|
||||
dev_dbg(wsa_priv->dev, "%s: current swr ch cnt: %d\n",
|
||||
|
|
@ -2880,6 +2887,8 @@ static int wsa_macro_probe(struct platform_device *pdev)
|
|||
char __iomem *wsa_io_base;
|
||||
int ret = 0;
|
||||
u8 bcl_pmic_params[3];
|
||||
u32 is_used_wsa_swr_gpio = 1;
|
||||
const char *is_used_wsa_swr_gpio_dt = "qcom,is-used-swr-gpio";
|
||||
|
||||
wsa_priv = devm_kzalloc(&pdev->dev, sizeof(struct wsa_macro_priv),
|
||||
GFP_KERNEL);
|
||||
|
|
@ -2894,9 +2903,20 @@ static int wsa_macro_probe(struct platform_device *pdev)
|
|||
__func__, "reg");
|
||||
return ret;
|
||||
}
|
||||
if (of_find_property(pdev->dev.of_node, is_used_wsa_swr_gpio_dt,
|
||||
NULL)) {
|
||||
ret = of_property_read_u32(pdev->dev.of_node,
|
||||
is_used_wsa_swr_gpio_dt,
|
||||
&is_used_wsa_swr_gpio);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "%s: error reading %s in dt\n",
|
||||
__func__, is_used_wsa_swr_gpio_dt);
|
||||
is_used_wsa_swr_gpio = 1;
|
||||
}
|
||||
}
|
||||
wsa_priv->wsa_swr_gpio_p = of_parse_phandle(pdev->dev.of_node,
|
||||
"qcom,wsa-swr-gpios", 0);
|
||||
if (!wsa_priv->wsa_swr_gpio_p) {
|
||||
if (!wsa_priv->wsa_swr_gpio_p && is_used_wsa_swr_gpio) {
|
||||
dev_err(&pdev->dev, "%s: swr_gpios handle not provided!\n",
|
||||
__func__);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue