mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
kernel: Add notifier for SSR
Add support for subsystem register in audioreach dummy driver. This will receive SSR events and will update soundcard status Change-Id:I97392800eaf5cd22f6bfdea76bd16951976a9233
This commit is contained in:
parent
29b346368f
commit
86f3ddf9cf
1 changed files with 30 additions and 0 deletions
30
asoc/gvm_auto_spf_dummy.c
Executable file → Normal file
30
asoc/gvm_auto_spf_dummy.c
Executable file → Normal file
|
|
@ -29,6 +29,8 @@
|
|||
#include <sound/info.h>
|
||||
#include <dsp/audio_notifier.h>
|
||||
#include "msm_dailink.h"
|
||||
#include <soc/qcom/subsystem_restart.h>
|
||||
#include <soc/qcom/subsystem_notif.h>
|
||||
|
||||
|
||||
#define DRV_NAME "spf-asoc-snd"
|
||||
|
|
@ -823,6 +825,31 @@ void msm_common_set_pdata(struct snd_soc_card *card,
|
|||
pdata->common_pdata = common_pdata;
|
||||
}
|
||||
|
||||
static int auto_spf_dummy_ssr_cb(struct notifier_block *this,
|
||||
unsigned long code,
|
||||
void *data)
|
||||
{
|
||||
struct snd_soc_card *card = platform_get_drvdata(spdev);
|
||||
|
||||
switch (code) {
|
||||
case SUBSYS_BEFORE_SHUTDOWN:
|
||||
snd_soc_card_change_online_state(card, 0); // change sndcard status to OFFLINE
|
||||
dev_info(&spdev->dev, "ssr restart, mark sndcard offline\n");
|
||||
break;
|
||||
case SUBSYS_AFTER_POWERUP:
|
||||
snd_soc_card_change_online_state(card, 1); // change sndcard status to ONLINE
|
||||
dev_info(&spdev->dev, "ssr complete, mark sndcard online\n");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct notifier_block auto_spf_dummy_ssr_notifier = {
|
||||
.notifier_call = auto_spf_dummy_ssr_cb,
|
||||
};
|
||||
|
||||
static int msm_asoc_machine_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card;
|
||||
|
|
@ -883,6 +910,9 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||
pr_err("Sound card %s registered\n", card->name);
|
||||
spdev = pdev;
|
||||
|
||||
subsys_notif_register_notifier("adsp", &auto_spf_dummy_ssr_notifier);
|
||||
dev_info(&pdev->dev, "Audio driver register for SSR complete\n");
|
||||
|
||||
return 0;
|
||||
err:
|
||||
devm_kfree(&pdev->dev, pdata);
|
||||
|
|
|
|||
Loading…
Reference in a new issue