1
0
Fork 0

ASoC: Intel: use platform_data for machine drivers

For some reason we have different mechanisms for passing data to
machine drivers. Use the solution used by Atom/SST and SOF instead of
using drv_data as done by Skylake.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
hifive-unleashed-5.1
Pierre-Louis Bossart 2018-11-16 18:47:06 -06:00 committed by Mark Brown
parent b92826fa8c
commit 5a619b9e88
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
6 changed files with 15 additions and 8 deletions

View File

@ -984,7 +984,7 @@ static int kabylake_audio_probe(struct platform_device *pdev)
kabylake_audio_card->dev = &pdev->dev;
snd_soc_card_set_drvdata(kabylake_audio_card, ctx);
mach = dev_get_drvdata(&pdev->dev);
mach = (&pdev->dev)->platform_data;
if (mach)
dmic_constraints = mach->mach_params.dmic_num == 2 ?
&constraints_dmic_2ch : &constraints_dmic_channels;

View File

@ -659,7 +659,7 @@ static int kabylake_audio_probe(struct platform_device *pdev)
kabylake_audio_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&kabylake_audio_card, ctx);
mach = dev_get_drvdata(&pdev->dev);
mach = (&pdev->dev)->platform_data;
if (mach)
dmic_constraints = mach->mach_params.dmic_num == 2 ?
&constraints_dmic_2ch : &constraints_dmic_channels;

View File

@ -146,7 +146,7 @@ static int skl_hda_audio_probe(struct platform_device *pdev)
INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
mach = dev_get_drvdata(&pdev->dev);
mach = (&pdev->dev)->platform_data;
if (!mach)
return -EINVAL;

View File

@ -652,7 +652,7 @@ static int skylake_audio_probe(struct platform_device *pdev)
skylake_audio_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
mach = dev_get_drvdata(&pdev->dev);
mach = (&pdev->dev)->platform_data;
if (mach)
dmic_constraints = mach->mach_params.dmic_num == 2 ?
&constraints_dmic_2ch : &constraints_dmic_channels;

View File

@ -705,7 +705,7 @@ static int skylake_audio_probe(struct platform_device *pdev)
skylake_audio_card.dev = &pdev->dev;
snd_soc_card_set_drvdata(&skylake_audio_card, ctx);
mach = dev_get_drvdata(&pdev->dev);
mach = (&pdev->dev)->platform_data;
if (mach)
dmic_constraints = mach->mach_params.dmic_num == 2 ?
&constraints_dmic_2ch : &constraints_dmic_channels;

View File

@ -534,6 +534,16 @@ static int skl_machine_device_register(struct skl *skl)
return -EIO;
}
mach->mach_params.platform = dev_name(bus->dev);
mach->mach_params.codec_mask = bus->codec_mask;
ret = platform_device_add_data(pdev, (const void *)mach, sizeof(*mach));
if (ret) {
dev_err(bus->dev, "failed to add machine device platform data\n");
platform_device_put(pdev);
return ret;
}
ret = platform_device_add(pdev);
if (ret) {
dev_err(bus->dev, "failed to add machine device\n");
@ -541,9 +551,6 @@ static int skl_machine_device_register(struct skl *skl)
return -EIO;
}
mach->mach_params.platform = dev_name(bus->dev);
mach->mach_params.codec_mask = bus->codec_mask;
dev_set_drvdata(&pdev->dev, mach);
skl->i2s_dev = pdev;