Loading asoc/codecs/wcd9335.c +62 −5 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. */ #include <linux/module.h> #include <linux/init.h> Loading @@ -22,6 +22,7 @@ #include <linux/gpio.h> #include <linux/mfd/wcd9xxx/wcd9xxx_registers.h> #include <soc/swr-wcd.h> #include <soc/snd_event.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> Loading Loading @@ -13739,10 +13740,22 @@ static int tasha_device_down(struct wcd9xxx *wcd9xxx) component = (struct snd_soc_component *)(wcd9xxx->ssr_priv); priv = snd_soc_component_get_drvdata(component); snd_event_notify(priv->dev->parent, SND_EVENT_DOWN); wcd_cpe_ssr_event(priv->cpe_core, WCD_CPE_BUS_DOWN_EVENT); for (i = 0; i < priv->nr; i++) if (!priv->swr_ctrl_data) return -EINVAL; for (i = 0; i < priv->nr; i++) { if (is_snd_event_fwk_enabled()) swrm_wcd_notify( priv->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_SSR_DOWN, NULL); swrm_wcd_notify(priv->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_DOWN, NULL); } if (!is_snd_event_fwk_enabled()) snd_soc_card_change_online_state(component->card, 0); for (count = 0; count < NUM_CODEC_DAIS; count++) priv->dai[count].bus_down_in_recovery = true; Loading Loading @@ -13778,6 +13791,7 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx) if (tasha->machine_codec_event_cb) tasha->machine_codec_event_cb(component, WCD9335_CODEC_EVENT_CODEC_UP); if (!is_snd_event_fwk_enabled()) snd_soc_card_change_online_state(component->card, 1); /* Class-H Init*/ Loading Loading @@ -13838,9 +13852,21 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx) goto err; } if (!tasha->swr_ctrl_data) { ret = -EINVAL; goto err; } if (is_snd_event_fwk_enabled()) { for (i = 0; i < tasha->nr; i++) swrm_wcd_notify( tasha->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_SSR_UP, NULL); } tasha_set_spkr_mode(component, tasha->spkr_mode); wcd_cpe_ssr_event(tasha->cpe_core, WCD_CPE_BUS_UP_EVENT); snd_event_notify(tasha->dev->parent, SND_EVENT_UP); err: mutex_unlock(&tasha->codec_mutex); return ret; Loading @@ -13866,6 +13892,28 @@ static struct regulator *tasha_codec_find_ondemand_regulator( return NULL; } static void tasha_ssr_disable(struct device *dev, void *data) { struct wcd9xxx *wcd9xxx = dev_get_drvdata(dev); struct tasha_priv *tasha; struct snd_soc_component *component; int count = 0; if (!wcd9xxx) { dev_dbg(dev, "%s: wcd9xxx pointer NULL.\n", __func__); return; } component = (struct snd_soc_component *)(wcd9xxx->ssr_priv); tasha = snd_soc_component_get_drvdata(component); for (count = 0; count < NUM_CODEC_DAIS; count++) tasha->dai[count].bus_down_in_recovery = true; } static const struct snd_event_ops tasha_ssr_ops = { .disable = tasha_ssr_disable, }; static int tasha_codec_probe(struct snd_soc_component *component) { struct wcd9xxx *control; Loading Loading @@ -14687,6 +14735,14 @@ static int tasha_probe(struct platform_device *pdev) tasha_update_reg_defaults(tasha); schedule_work(&tasha->tasha_add_child_devices_work); tasha_get_codec_ver(tasha); ret = snd_event_client_register(pdev->dev.parent, &tasha_ssr_ops, NULL); if (!ret) { snd_event_notify(pdev->dev.parent, SND_EVENT_UP); } else { pr_err("%s: Registration with SND event fwk failed ret = %d\n", __func__, ret); ret = 0; } dev_info(&pdev->dev, "%s: Tasha driver probe done\n", __func__); return ret; Loading Loading @@ -14715,6 +14771,7 @@ static int tasha_remove(struct platform_device *pdev) if (!tasha) return -EINVAL; snd_event_client_deregister(pdev->dev.parent); for (count = 0; count < tasha->child_count && count < WCD9335_CHILD_DEVICES_MAX; count++) platform_device_unregister(tasha->pdev_child_devices[count]); Loading Loading
asoc/codecs/wcd9335.c +62 −5 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. */ #include <linux/module.h> #include <linux/init.h> Loading @@ -22,6 +22,7 @@ #include <linux/gpio.h> #include <linux/mfd/wcd9xxx/wcd9xxx_registers.h> #include <soc/swr-wcd.h> #include <soc/snd_event.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> Loading Loading @@ -13739,10 +13740,22 @@ static int tasha_device_down(struct wcd9xxx *wcd9xxx) component = (struct snd_soc_component *)(wcd9xxx->ssr_priv); priv = snd_soc_component_get_drvdata(component); snd_event_notify(priv->dev->parent, SND_EVENT_DOWN); wcd_cpe_ssr_event(priv->cpe_core, WCD_CPE_BUS_DOWN_EVENT); for (i = 0; i < priv->nr; i++) if (!priv->swr_ctrl_data) return -EINVAL; for (i = 0; i < priv->nr; i++) { if (is_snd_event_fwk_enabled()) swrm_wcd_notify( priv->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_SSR_DOWN, NULL); swrm_wcd_notify(priv->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_DOWN, NULL); } if (!is_snd_event_fwk_enabled()) snd_soc_card_change_online_state(component->card, 0); for (count = 0; count < NUM_CODEC_DAIS; count++) priv->dai[count].bus_down_in_recovery = true; Loading Loading @@ -13778,6 +13791,7 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx) if (tasha->machine_codec_event_cb) tasha->machine_codec_event_cb(component, WCD9335_CODEC_EVENT_CODEC_UP); if (!is_snd_event_fwk_enabled()) snd_soc_card_change_online_state(component->card, 1); /* Class-H Init*/ Loading Loading @@ -13838,9 +13852,21 @@ static int tasha_post_reset_cb(struct wcd9xxx *wcd9xxx) goto err; } if (!tasha->swr_ctrl_data) { ret = -EINVAL; goto err; } if (is_snd_event_fwk_enabled()) { for (i = 0; i < tasha->nr; i++) swrm_wcd_notify( tasha->swr_ctrl_data[i].swr_pdev, SWR_DEVICE_SSR_UP, NULL); } tasha_set_spkr_mode(component, tasha->spkr_mode); wcd_cpe_ssr_event(tasha->cpe_core, WCD_CPE_BUS_UP_EVENT); snd_event_notify(tasha->dev->parent, SND_EVENT_UP); err: mutex_unlock(&tasha->codec_mutex); return ret; Loading @@ -13866,6 +13892,28 @@ static struct regulator *tasha_codec_find_ondemand_regulator( return NULL; } static void tasha_ssr_disable(struct device *dev, void *data) { struct wcd9xxx *wcd9xxx = dev_get_drvdata(dev); struct tasha_priv *tasha; struct snd_soc_component *component; int count = 0; if (!wcd9xxx) { dev_dbg(dev, "%s: wcd9xxx pointer NULL.\n", __func__); return; } component = (struct snd_soc_component *)(wcd9xxx->ssr_priv); tasha = snd_soc_component_get_drvdata(component); for (count = 0; count < NUM_CODEC_DAIS; count++) tasha->dai[count].bus_down_in_recovery = true; } static const struct snd_event_ops tasha_ssr_ops = { .disable = tasha_ssr_disable, }; static int tasha_codec_probe(struct snd_soc_component *component) { struct wcd9xxx *control; Loading Loading @@ -14687,6 +14735,14 @@ static int tasha_probe(struct platform_device *pdev) tasha_update_reg_defaults(tasha); schedule_work(&tasha->tasha_add_child_devices_work); tasha_get_codec_ver(tasha); ret = snd_event_client_register(pdev->dev.parent, &tasha_ssr_ops, NULL); if (!ret) { snd_event_notify(pdev->dev.parent, SND_EVENT_UP); } else { pr_err("%s: Registration with SND event fwk failed ret = %d\n", __func__, ret); ret = 0; } dev_info(&pdev->dev, "%s: Tasha driver probe done\n", __func__); return ret; Loading Loading @@ -14715,6 +14771,7 @@ static int tasha_remove(struct platform_device *pdev) if (!tasha) return -EINVAL; snd_event_client_deregister(pdev->dev.parent); for (count = 0; count < tasha->child_count && count < WCD9335_CHILD_DEVICES_MAX; count++) platform_device_unregister(tasha->pdev_child_devices[count]); Loading