asoc: codecs: add support to disable soundwire devices
Add changes to support disabling of soundwire devices so that soundwire pins can be freed for other purposes if needed. Change-Id: Iae14d43c2c3d5380347be4c3b443c209b2612a97 Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
c63ec8cd8f
commit
3bd80a59b2
@@ -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;
|
||||
|
Reference in New Issue
Block a user