asoc: sa8155: support SSR handling for snd card status
Add support for handling snd card status upon SERVICE_DOWN and SERVICE_UP callback for ADSP SSR. Change-Id: Ie753a0edc59ca10da8d9c23f9e6c7c6244a8e8a6 Signed-off-by: Rahul Sharma <rahsha@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
8766446f90
commit
3c95e9c53b
@@ -691,6 +691,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_rx_format, bit_format_text);
|
|||||||
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
|
static SOC_ENUM_SINGLE_EXT_DECL(aux_pcm_tx_format, bit_format_text);
|
||||||
|
|
||||||
static bool is_initial_boot = true;
|
static bool is_initial_boot = true;
|
||||||
|
static struct platform_device *spdev;
|
||||||
|
|
||||||
static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
|
static struct afe_clk_set mi2s_clk[MI2S_MAX] = {
|
||||||
{
|
{
|
||||||
@@ -7099,6 +7100,7 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
|
dev_info(&pdev->dev, "Sound card %s registered\n", card->name);
|
||||||
|
spdev = pdev;
|
||||||
|
|
||||||
/* Parse pinctrl info from devicetree */
|
/* Parse pinctrl info from devicetree */
|
||||||
ret = msm_get_pinctrl(pdev);
|
ret = msm_get_pinctrl(pdev);
|
||||||
@@ -7165,10 +7167,22 @@ static struct platform_driver sa8155_dummy_asoc_machine_driver = {
|
|||||||
static int sa8155_notifier_service_cb(struct notifier_block *this,
|
static int sa8155_notifier_service_cb(struct notifier_block *this,
|
||||||
unsigned long opcode, void *ptr)
|
unsigned long opcode, void *ptr)
|
||||||
{
|
{
|
||||||
|
struct snd_soc_card *card = NULL;
|
||||||
|
|
||||||
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
|
pr_debug("%s: Service opcode 0x%lx\n", __func__, opcode);
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case AUDIO_NOTIFIER_SERVICE_DOWN:
|
case AUDIO_NOTIFIER_SERVICE_DOWN:
|
||||||
|
if (!spdev)
|
||||||
|
return -EINVAL;
|
||||||
|
card = platform_get_drvdata(spdev);
|
||||||
|
if (card == NULL){
|
||||||
|
pr_err("%s: card is NULL\n",__func__);
|
||||||
|
return -EINVAL;
|
||||||
|
} else {
|
||||||
|
pr_debug("%s: setting snd_card to OFFLINE\n", __func__);
|
||||||
|
snd_soc_card_change_online_state(card, 0);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case AUDIO_NOTIFIER_SERVICE_UP:
|
case AUDIO_NOTIFIER_SERVICE_UP:
|
||||||
if (is_initial_boot) {
|
if (is_initial_boot) {
|
||||||
@@ -7176,11 +7190,20 @@ static int sa8155_notifier_service_cb(struct notifier_block *this,
|
|||||||
platform_device_register(&sa8155_dummy_asoc_machine_device);
|
platform_device_register(&sa8155_dummy_asoc_machine_device);
|
||||||
is_initial_boot = false;
|
is_initial_boot = false;
|
||||||
}
|
}
|
||||||
|
if (!spdev)
|
||||||
|
return -EINVAL;
|
||||||
|
card = platform_get_drvdata(spdev);
|
||||||
|
if (card == NULL){
|
||||||
|
pr_err("%s: card is NULL\n",__func__);
|
||||||
|
return -EINVAL;
|
||||||
|
} else {
|
||||||
|
pr_debug("%s: setting snd_card to ONLINE\n", __func__);
|
||||||
|
snd_soc_card_change_online_state(card, 1);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NOTIFY_OK;
|
return NOTIFY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user