[alsa-devel] [ASoC] Missing shutdown() vectors in ASoC
Liam,
Shutdown() vectors is missing in ASoC, we need this to ensure proper shutdown of the system.
* codec device */ struct snd_soc_codec_device { int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, pm_message_t state); int (*resume)(struct platform_device *pdev); };
/* SoC CPU DAI */ struct snd_soc_cpu_dai {
/* DAI description */ char *name; unsigned int id; unsigned char type;
/* DAI callbacks */ int (*probe)(struct platform_device *pdev); void (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); unsigned int (*config_sysclk)(struct snd_soc_cpu_dai *cpu_dai, struct snd_soc_clock_info *info, unsigned int clk);
/* DAI capabilities */ struct snd_soc_pcm_stream capture; struct snd_soc_pcm_stream playback; struct snd_soc_dai_cap caps;
/* SoC platform interface */ struct snd_soc_platform { char *name;
int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai);
/* pcm creation and destruction */
/* SoC machine */ struct snd_soc_machine { char *name;
int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev);
/* the pre and post PM functions are used to do any PM work before and * after the codec and DAI's do any PM work. */ int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); int (*suspend_post)(struct platform_device *pdev, pm_message_t state); int (*resume_pre)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev);
Nobin Mathew
Liam
I am trying to implement shutdown in ASoC
/* dapm stream operations */ #define SND_SOC_DAPM_STREAM_NOP 0x0 #define SND_SOC_DAPM_STREAM_START 0x1 #define SND_SOC_DAPM_STREAM_STOP 0x2 #define SND_SOC_DAPM_STREAM_SUSPEND 0x4 #define SND_SOC_DAPM_STREAM_RESUME 0x8 #define SND_SOC_DAPM_STREAM_PAUSE_PUSH 0x10 #define SND_SOC_DAPM_STREAM_PAUSE_RELEASE 0x20
Is there any need to add stream operation called SND_SOC_DAPM_STREAM_SHUTDOWN even though this has no effect no the system behaviour.
Instead we can use SND_SOC_DAPM_STREAM_SUSPEND. Is this OK.
is there any better way to implement suspend?, i think suspend will be a copy of remove() function.
On 6/12/07, Nobin Mathew nobin.mathew@gmail.com wrote:
Liam,
Shutdown() vectors is missing in ASoC, we need this to ensure proper shutdown of the system.
- codec device */
struct snd_soc_codec_device { int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, pm_message_t state); int (*resume)(struct platform_device *pdev); };
/* SoC CPU DAI */ struct snd_soc_cpu_dai {
/* DAI description */ char *name; unsigned int id; unsigned char type; /* DAI callbacks */ int (*probe)(struct platform_device *pdev); void (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); unsigned int (*config_sysclk)(struct snd_soc_cpu_dai *cpu_dai, struct snd_soc_clock_info *info, unsigned int clk); /* DAI capabilities */ struct snd_soc_pcm_stream capture; struct snd_soc_pcm_stream playback; struct snd_soc_dai_cap caps;
/* SoC platform interface */ struct snd_soc_platform { char *name;
int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); int (*suspend)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); int (*resume)(struct platform_device *pdev, struct snd_soc_cpu_dai *cpu_dai); /* pcm creation and destruction */
/* SoC machine */ struct snd_soc_machine { char *name;
int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); /* the pre and post PM functions are used to do any PM work before and * after the codec and DAI's do any PM work. */ int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); int (*suspend_post)(struct platform_device *pdev, pm_message_t state); int (*resume_pre)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev);
Nobin Mathew
On Tue, 2007-06-12 at 17:44 +0530, Nobin Mathew wrote:
Liam
I am trying to implement shutdown in ASoC
/* dapm stream operations */ #define SND_SOC_DAPM_STREAM_NOP 0x0 #define SND_SOC_DAPM_STREAM_START 0x1 #define SND_SOC_DAPM_STREAM_STOP 0x2 #define SND_SOC_DAPM_STREAM_SUSPEND 0x4 #define SND_SOC_DAPM_STREAM_RESUME 0x8 #define SND_SOC_DAPM_STREAM_PAUSE_PUSH 0x10 #define SND_SOC_DAPM_STREAM_PAUSE_RELEASE 0x20
Is there any need to add stream operation called SND_SOC_DAPM_STREAM_SHUTDOWN even though this has no effect no the system behaviour.
Instead we can use SND_SOC_DAPM_STREAM_SUSPEND. Is this OK.
is there any better way to implement suspend?, i think suspend will be a copy of remove() function.
I assume your looking to shutdown the codec to a low power state without removing the driver ?
If so, SND_SOC_DAPM_STREAM_* operations all act upon stream and path based widgets (stream and path domain from soc-dapm.h). That is, they will always power up/down widgets that are actively used in the playback or capture of audio. This happens automatically at the end of playback/capture. The wont power down the codec domain.
Atm, the codec power domain (VRef, Vmid) is only affected by signalling a dapm device event. This happens at probe/remove and suspend/resume atm for most codecs, although some codecs can alter their Vmid/Vref settings as part of stream/path domain power changes (as above, e.g. WM8753 changes Vmid from 50k @ SNDRV_CTL_POWER_D0 to 500k SNDRV_CTL_POWER_D3)
Fwiw, I've already added the shutdown function in the new ppc-dev branch. All component drivers will contain a struct device_driver and inherit it's features. More on this later today, for the moment the latest soc.h is here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
and pxa-i2s driver is here fyi :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
Liam
Hi Liam,
Can you please look at this mail Thread.
http://mailman.alsa-project.org/pipermail/alsa-devel/2007-June/001436.html
On 6/12/07, Liam Girdwood lg@opensource.wolfsonmicro.com wrote:
On Tue, 2007-06-12 at 17:44 +0530, Nobin Mathew wrote:
Liam
I am trying to implement shutdown in ASoC
/* dapm stream operations */ #define SND_SOC_DAPM_STREAM_NOP 0x0 #define SND_SOC_DAPM_STREAM_START 0x1 #define SND_SOC_DAPM_STREAM_STOP 0x2 #define SND_SOC_DAPM_STREAM_SUSPEND 0x4 #define SND_SOC_DAPM_STREAM_RESUME 0x8 #define SND_SOC_DAPM_STREAM_PAUSE_PUSH 0x10 #define SND_SOC_DAPM_STREAM_PAUSE_RELEASE 0x20
Is there any need to add stream operation called SND_SOC_DAPM_STREAM_SHUTDOWN even though this has no effect no the system behaviour.
Instead we can use SND_SOC_DAPM_STREAM_SUSPEND. Is this OK.
is there any better way to implement suspend?, i think suspend will be a copy of remove() function.
I assume your looking to shutdown the codec to a low power state without removing the driver ?
If so, SND_SOC_DAPM_STREAM_* operations all act upon stream and path based widgets (stream and path domain from soc-dapm.h). That is, they will always power up/down widgets that are actively used in the playback or capture of audio. This happens automatically at the end of playback/capture. The wont power down the codec domain.
Atm, the codec power domain (VRef, Vmid) is only affected by signalling a dapm device event. This happens at probe/remove and suspend/resume atm for most codecs, although some codecs can alter their Vmid/Vref settings as part of stream/path domain power changes (as above, e.g. WM8753 changes Vmid from 50k @ SNDRV_CTL_POWER_D0 to 500k SNDRV_CTL_POWER_D3)
Fwiw, I've already added the shutdown function in the new ppc-dev branch. All component drivers will contain a struct device_driver and inherit it's features. More on this later today, for the moment the latest soc.h is here :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
and pxa-i2s driver is here fyi :-
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-aso...
Liam
On Mon, 2007-06-18 at 13:12 +0530, Nobin Mathew wrote:
Hi Liam,
Can you please look at this mail Thread.
http://mailman.alsa-project.org/pipermail/alsa-devel/2007-June/001436.html
Atm, shutdown can be implemented in the current version of ASoC by adding a shutdown callback to the "soc-audio" platform device in soc-core.c. This callback could then call your codec/platform/machine shutdown()'s.
Future versions (in dev-ppc branch atm) wont need this as shutdown can be added to each driver in the regular Linux way.
Liam
participants (2)
-
Liam Girdwood
-
Nobin Mathew