ASoC: Push workqueue data into snd_soc_card
ASoC v2 does not use the struct snd_soc_device at runtime, using struct snd_soc_card as the root of the card. Begin removing data from snd_soc_device by pushing the workqueue data into snd_soc_card, using a backpointer to the snd_soc_device to keep things going for the time being. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
0ecfe79878
commit
6308419a19
|
@ -349,6 +349,11 @@ struct snd_soc_card {
|
||||||
/* CPU <--> Codec DAI links */
|
/* CPU <--> Codec DAI links */
|
||||||
struct snd_soc_dai_link *dai_link;
|
struct snd_soc_dai_link *dai_link;
|
||||||
int num_links;
|
int num_links;
|
||||||
|
|
||||||
|
struct snd_soc_device *socdev;
|
||||||
|
|
||||||
|
struct delayed_work delayed_work;
|
||||||
|
struct work_struct deferred_resume_work;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SoC Device - the audio subsystem */
|
/* SoC Device - the audio subsystem */
|
||||||
|
@ -358,8 +363,6 @@ struct snd_soc_device {
|
||||||
struct snd_soc_platform *platform;
|
struct snd_soc_platform *platform;
|
||||||
struct snd_soc_codec *codec;
|
struct snd_soc_codec *codec;
|
||||||
struct snd_soc_codec_device *codec_dev;
|
struct snd_soc_codec_device *codec_dev;
|
||||||
struct delayed_work delayed_work;
|
|
||||||
struct work_struct deferred_resume_work;
|
|
||||||
void *codec_data;
|
void *codec_data;
|
||||||
#ifdef CONFIG_DEBUG_FS
|
#ifdef CONFIG_DEBUG_FS
|
||||||
struct dentry *debugfs_root;
|
struct dentry *debugfs_root;
|
||||||
|
|
|
@ -247,8 +247,9 @@ out:
|
||||||
*/
|
*/
|
||||||
static void close_delayed_work(struct work_struct *work)
|
static void close_delayed_work(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct snd_soc_device *socdev =
|
struct snd_soc_card *card = container_of(work, struct snd_soc_card,
|
||||||
container_of(work, struct snd_soc_device, delayed_work.work);
|
delayed_work.work);
|
||||||
|
struct snd_soc_device *socdev = card->socdev;
|
||||||
struct snd_soc_codec *codec = socdev->codec;
|
struct snd_soc_codec *codec = socdev->codec;
|
||||||
struct snd_soc_dai *codec_dai;
|
struct snd_soc_dai *codec_dai;
|
||||||
int i;
|
int i;
|
||||||
|
@ -299,6 +300,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_device *socdev = rtd->socdev;
|
struct snd_soc_device *socdev = rtd->socdev;
|
||||||
|
struct snd_soc_card *card = socdev->card;
|
||||||
struct snd_soc_dai_link *machine = rtd->dai;
|
struct snd_soc_dai_link *machine = rtd->dai;
|
||||||
struct snd_soc_platform *platform = socdev->platform;
|
struct snd_soc_platform *platform = socdev->platform;
|
||||||
struct snd_soc_dai *cpu_dai = machine->cpu_dai;
|
struct snd_soc_dai *cpu_dai = machine->cpu_dai;
|
||||||
|
@ -340,7 +342,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||||
/* start delayed pop wq here for playback streams */
|
/* start delayed pop wq here for playback streams */
|
||||||
codec_dai->pop_wait = 1;
|
codec_dai->pop_wait = 1;
|
||||||
schedule_delayed_work(&socdev->delayed_work,
|
schedule_delayed_work(&card->delayed_work,
|
||||||
msecs_to_jiffies(pmdown_time));
|
msecs_to_jiffies(pmdown_time));
|
||||||
} else {
|
} else {
|
||||||
/* capture streams can be powered down now */
|
/* capture streams can be powered down now */
|
||||||
|
@ -366,6 +368,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_device *socdev = rtd->socdev;
|
struct snd_soc_device *socdev = rtd->socdev;
|
||||||
|
struct snd_soc_card *card = socdev->card;
|
||||||
struct snd_soc_dai_link *machine = rtd->dai;
|
struct snd_soc_dai_link *machine = rtd->dai;
|
||||||
struct snd_soc_platform *platform = socdev->platform;
|
struct snd_soc_platform *platform = socdev->platform;
|
||||||
struct snd_soc_dai *cpu_dai = machine->cpu_dai;
|
struct snd_soc_dai *cpu_dai = machine->cpu_dai;
|
||||||
|
@ -411,7 +414,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
|
||||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
|
||||||
codec_dai->pop_wait) {
|
codec_dai->pop_wait) {
|
||||||
codec_dai->pop_wait = 0;
|
codec_dai->pop_wait = 0;
|
||||||
cancel_delayed_work(&socdev->delayed_work);
|
cancel_delayed_work(&card->delayed_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do we need to power up codec */
|
/* do we need to power up codec */
|
||||||
|
@ -645,7 +648,7 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close any waiting streams and save state */
|
/* close any waiting streams and save state */
|
||||||
run_delayed_work(&socdev->delayed_work);
|
run_delayed_work(&card->delayed_work);
|
||||||
codec->suspend_bias_level = codec->bias_level;
|
codec->suspend_bias_level = codec->bias_level;
|
||||||
|
|
||||||
for (i = 0; i < codec->num_dai; i++) {
|
for (i = 0; i < codec->num_dai; i++) {
|
||||||
|
@ -679,10 +682,10 @@ static int soc_suspend(struct platform_device *pdev, pm_message_t state)
|
||||||
*/
|
*/
|
||||||
static void soc_resume_deferred(struct work_struct *work)
|
static void soc_resume_deferred(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct snd_soc_device *socdev = container_of(work,
|
struct snd_soc_card *card = container_of(work,
|
||||||
struct snd_soc_device,
|
struct snd_soc_card,
|
||||||
deferred_resume_work);
|
deferred_resume_work);
|
||||||
struct snd_soc_card *card = socdev->card;
|
struct snd_soc_device *socdev = card->socdev;
|
||||||
struct snd_soc_platform *platform = socdev->platform;
|
struct snd_soc_platform *platform = socdev->platform;
|
||||||
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
||||||
struct snd_soc_codec *codec = socdev->codec;
|
struct snd_soc_codec *codec = socdev->codec;
|
||||||
|
@ -746,10 +749,11 @@ static void soc_resume_deferred(struct work_struct *work)
|
||||||
static int soc_resume(struct platform_device *pdev)
|
static int soc_resume(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
struct snd_soc_device *socdev = platform_get_drvdata(pdev);
|
||||||
|
struct snd_soc_card *card = socdev->card;
|
||||||
|
|
||||||
dev_dbg(socdev->dev, "scheduling resume work\n");
|
dev_dbg(socdev->dev, "scheduling resume work\n");
|
||||||
|
|
||||||
if (!schedule_work(&socdev->deferred_resume_work))
|
if (!schedule_work(&card->deferred_resume_work))
|
||||||
dev_err(socdev->dev, "resume work item may be lost\n");
|
dev_err(socdev->dev, "resume work item may be lost\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -769,6 +773,9 @@ static int soc_probe(struct platform_device *pdev)
|
||||||
struct snd_soc_platform *platform = socdev->platform;
|
struct snd_soc_platform *platform = socdev->platform;
|
||||||
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
||||||
|
|
||||||
|
/* Bodge while we push things out of socdev */
|
||||||
|
card->socdev = socdev;
|
||||||
|
|
||||||
if (card->probe) {
|
if (card->probe) {
|
||||||
ret = card->probe(pdev);
|
ret = card->probe(pdev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -797,10 +804,10 @@ static int soc_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DAPM stream work */
|
/* DAPM stream work */
|
||||||
INIT_DELAYED_WORK(&socdev->delayed_work, close_delayed_work);
|
INIT_DELAYED_WORK(&card->delayed_work, close_delayed_work);
|
||||||
#ifdef CONFIG_PM
|
#ifdef CONFIG_PM
|
||||||
/* deferred resume work */
|
/* deferred resume work */
|
||||||
INIT_WORK(&socdev->deferred_resume_work, soc_resume_deferred);
|
INIT_WORK(&card->deferred_resume_work, soc_resume_deferred);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -831,7 +838,7 @@ static int soc_remove(struct platform_device *pdev)
|
||||||
struct snd_soc_platform *platform = socdev->platform;
|
struct snd_soc_platform *platform = socdev->platform;
|
||||||
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
struct snd_soc_codec_device *codec_dev = socdev->codec_dev;
|
||||||
|
|
||||||
run_delayed_work(&socdev->delayed_work);
|
run_delayed_work(&card->delayed_work);
|
||||||
|
|
||||||
if (platform->remove)
|
if (platform->remove)
|
||||||
platform->remove(pdev);
|
platform->remove(pdev);
|
||||||
|
|
Loading…
Reference in New Issue