summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/fsl-asoc-card.c
AgeCommit message (Collapse)Author
2019-06-28ASoC: fsl: fsl-asoc-card: consider CPU-Platform possibilityKuninori Morimoto
commit e57a4c2f15df27 ("ASoC: fsl: fsl-asoc-card: don't select unnecessary Platform") Current ALSA SoC avoid to add duplicate component to rtd, and this driver was selecting CPU component as Platform component. Thus, above patch removed Platform settings from this driver, because it assumed these are same component. But, some CPU driver is using generic DMAEngine, in such case, both CPU component and Platform component will have same of_node/name. In other words, there are some components which are different but have same of_node/name. In such case, Card driver definitely need to select Platform even though it is same as CPU. It is depends on CPU driver, but is difficult to know it from Card driver. This patch reverts above patch. Fixes: commit e57a4c2f15df27 ("ASoC: fsl: fsl-asoc-card: don't select unnecessary Platform") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-19ASoC: fsl: fsl-asoc-card: don't select unnecessary PlatformKuninori Morimoto
ALSA SoC is now supporting "no Platform". Sound card doesn't need to select "CPU component" as "Platform" anymore if it doesn't need special Platform. This patch removes such settings. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-06ASoC: fsl: fsl-asoc-card: use modern dai_link styleKuninori Morimoto
ASoC is now supporting modern style dai_link (= snd_soc_dai_link_component) for CPU/Codec/Platform. This patch switches to use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-02-04ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probewen yang
The of_find_device_by_node() takes a reference to the underlying device structure, we should release that reference. Signed-off-by: Wen Yang <yellowriver2010@hotmil.com> Cc: Timur Tabi <timur@kernel.org> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <festevam@gmail.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2018-12-06ASoC: Use of_node_name_eq for node name comparisonsRob Herring
Convert string compares of DT node names to use of_node_name_eq helper instead. This removes direct access to the node name pointer. For the FSL ASoC card, the full node names appear to be "ssi", "esai", and "sai", so there's not any reason to use strstr and of_node_name_eq can be used instead. Cc: Timur Tabi <timur@kernel.org> Cc: Nicolin Chen <nicoleotsuka@gmail.com> Cc: Xiubo Li <Xiubo.Lee@gmail.com> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: fsl: Use snd_mask_set_format()Takashi Iwai
Use the new helper function snd_mask_set_format() for avoiding the ugly cast with __force prefix. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-24ASoC: fsl-asoc-card: Switch to SPDX identifierFabio Estevam
Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: fsl-asoc-card: Use 'snd_pcm_format_t' type when appropriateFabio Estevam
A better suited type for 'sample_format' and 'asrc_format' is 'snd_pcm_format_t'. Change the type so that the following build warnings with W=1 are gone: sound/soc/fsl/fsl-asoc-card.c:153:29: warning: incorrect type in assignment (different base types) sound/soc/fsl/fsl-asoc-card.c:153:29: expected unsigned int [unsigned] [usertype] sample_format sound/soc/fsl/fsl-asoc-card.c:153:29: got restricted snd_pcm_format_t sound/soc/fsl/fsl-asoc-card.c:258:44: warning: restricted snd_pcm_format_t degrades to integer sound/soc/fsl/fsl-asoc-card.c:525:29: warning: incorrect type in assignment (different base types) sound/soc/fsl/fsl-asoc-card.c:525:29: expected unsigned int [unsigned] [usertype] sample_format sound/soc/fsl/fsl-asoc-card.c:525:29: got restricted snd_pcm_format_t [usertype] <noident> sound/soc/fsl/fsl-asoc-card.c:680:43: warning: incorrect type in assignment (different base types) sound/soc/fsl/fsl-asoc-card.c:680:43: expected unsigned int [unsigned] [usertype] asrc_format sound/soc/fsl/fsl-asoc-card.c:680:43: got restricted snd_pcm_format_t [usertype] <noident> sound/soc/fsl/fsl-asoc-card.c:682:43: warning: incorrect type in assignment (different base types) sound/soc/fsl/fsl-asoc-card.c:682:43: expected unsigned int [unsigned] [usertype] asrc_format sound/soc/fsl/fsl-asoc-card.c:682:43: got restricted snd_pcm_format_t [usertype] <noident> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-05ASoC: don't use rtd->codec on fsl-asoc-cardKuninori Morimoto
rtd->codec will be removed soon. rtd->codec = rtd->codec_dai->codec, thus, we can use rtd->codec_dai->component instead of it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-21ASoC: fsl-asoc-card: Handle return value of devm_kasprintfArvind Yadav
devm_kasprintf() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-09-19ASoC: fsl-asoc-card: Don't error out if ENOTSUPPNicolin Chen
The snd_soc_component_set_sysclk() and snd_soc_dai_set_tdm_slot() in the soc-core.c will return -ENOTSUPP if there is no function implementation for them in the dai and component drivers. So this patch tries to ignore this errno. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-21ASoC: fsl-asoc-card: don't print EPROBE_DEFER as errorLucas Stach
Probe deferral is to be expected during normal operation, so avoid printing an error when it is encountered. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-10-24ASoC: constify snd_soc_ops structuresJulia Lawall
Check for snd_soc_ops structures that are only stored in the ops field of a snd_soc_dai_link structure. This field is declared const, so snd_soc_ops structures that have this property can be declared as const also. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct snd_soc_ops i@p = { ... }; @ok1@ identifier r.i; struct snd_soc_dai_link e; position p; @@ e.ops = &i@p; @ok2@ identifier r.i, e; position p; @@ struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., }; @bad@ position p != {r.p,ok1.p,ok2.p}; identifier r.i; struct snd_soc_ops e; @@ e@i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct snd_soc_ops i = { ... }; // </smpl> The effect on the layout of the .o files is shown by the following output of the size command, first before then after the transformation: text data bss dec hex filename 8748 1024 0 9772 262c sound/soc/fsl/fsl-asoc-card.o 8812 952 0 9764 2624 sound/soc/fsl/fsl-asoc-card.o text data bss dec hex filename 4165 264 8 4437 1155 sound/soc/fsl/imx-wm8962.o 4229 200 8 4437 1155 sound/soc/fsl/imx-wm8962.o Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-05ASoC: fsl-asoc-card: add cs4271 and cs4272 supportFelipe F. Tonello
add cs4271 and cs42727 support for fsl-asoc-card Signed-off-by: Felipe F. Tonello <eu@felipetonello.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-04ASoC: fsl-asoc-card: Don't add DAPM routes for ASRC if it doesn't existNicolin Chen
There are a pair of warnings when ASRC is absent in the DTB: fsl-asoc-card sound: ASoC: no source widget found for ASRC-Playback fsl-asoc-card sound: ASoC: Failed to add route ASRC-Playback -> direct -> CPU-Playback fsl-asoc-card sound: ASoC: no sink widget found for ASRC-Capture fsl-asoc-card sound: ASoC: Failed to add route CPU-Capture -> direct -> ASRC-Capture This is because the driver is still trying to add DAPM routes for ASRC even if it doesn't exist on that platform. The warnings are harmless but it might be annoying. So this patch drops the DAPM routes of ASRC when it's absent in the DAI link. Signed-off-by: Nicolin Chen <nicolinc@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-23Merge remote-tracking branches 'asoc/topic/dpcm', 'asoc/topic/dwc', ↵Mark Brown
'asoc/topic/fsl', 'asoc/topic/fsl-asrc' and 'asoc/topic/fsl-esai' into asoc-next
2015-12-23ASoC: fsl-asoc-card: use different route map for AC'97 modeMaciej S. Szmigiero
fsl_ssi uses different stream names ("AC97 Playback" / "AC97 Capture") in AC'97 mode so in this case fsl-asoc-card route map should also be using them. Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-20ASoC: fsl-asoc-card: Update the rtd queryVinod Koul
sound card rtd was an array and was updated to a list so update the driver to use a list Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-18ASoC: Vendor drivers get a link's runtime by snd_soc_get_pcm_runtime()Mengdong Lin
Vendor drivers no longer access a DAI link's runtime by the link index but by matching the link name via snd_soc_get_pcm_runtime(). We assume each DAI link has a unique name. This is preparation for changing runtimes from an array to a list later. Vendor drivers changed: sound/soc/fsl/fsl-asoc-card.c sound/soc/fsl/imx-wm8962.c sound/soc/pxa/mioa701_wm9713.c sound/soc/samsung/bells.c sound/soc/samsung/littlemill.c sound/soc/samsung/odroidx2_max98090.c sound/soc/samsung/snow.c sound/soc/samsung/speyside.c sound/soc/samsung/tobermory.c sound/soc/tegra/tegra_wm8903 Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-26Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/es8328', ↵Mark Brown
'asoc/topic/fsl' and 'asoc/topic/fsl-card' into asoc-next
2015-10-23ASoC: fsl-asoc-card: add AC'97 supportMaciej S. Szmigiero
Add AC'97 support to fsl-asoc-card using generic ASoC AC'97 CODEC. The SSI controller will silently enable any TX AC'97 slots that have their bits set in SLOTREQ received from CODEC and then will redirect some of playback samples there. That's why it is important to make sure that any of CODEC playback slots that can pull samples are set to slots 3/4 (standard PCM playback slots). Currently, this applies to S/PDIF slots as they were seen to pull samples sometimes even with S/PDIF output being disabled. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-23Merge remote-tracking branches 'asoc/topic/blackfin', 'asoc/topic/davinci', ↵Mark Brown
'asoc/topic/fsl', 'asoc/topic/hdmi' and 'asoc/topic/intel' into asoc-next
2015-09-14ASoC: fsl-asoc-card: Fix module autoload for OF platform driverLuis de Bethencourt
This platform driver has a OF device ID table but the OF module alias information is not created so module autoloading won't work. Signed-off-by: Luis de Bethencourt <luis@debethencourt.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-31ASoC: fsl-asoc-card: put ASRC OF node in case of unknown deviceMaciej S. Szmigiero
In case of unknown DT compatible device the ASRC OF node possibly acquired earlier by of_parse_phandle() has to be put before returning from probe method. Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-15ASoC: fsl-asoc-card: add wm8960 supportZidan Wang
add wm8960 support for fsl-asoc-card Signed-off-by: Zidan Wang <zidan.wang@freescale.com> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-13ASoC: fsl-asoc-card: Specify codec_dai_name for DAI linksNicolin Chen
The dev->name of CODEC might not be identical to its codec_dai_name, so using dev->name to probe the CODEC dai is not a correct approach. This patch specifies each supporting codec_dai_name instead of using dev->name any more. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()Nicolin Chen
This patch adds snd_soc_of_parse_audio_routing() to get dapm routes configurations via Device Tree. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25ASoC: fsl-asoc-card: Add slot_width setting for cpu-daiNicolin Chen
ESAI may need to use fixed slot width to comply with external CODEC. So this set_tdm_slot() call will allow the ESAI driver to override its default dynamic slot width policy. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28ASoC: fsl-asoc-card: Don't bypass settings if cpu-dai is MasterNicolin Chen
When cpu-dai is the DAI Master (CBM_CFx), it may need some configurations, set_sysclk() call for eample, for cpu-dai side in the hw_params(), even if the set_bias_level() has already taken care of the codec-dai side. So this patch just simply adds an additional condition. Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-18ASoC: fsl-asoc-card: Fix build warning for maybe-uninitializedShengjiu Wang
When build fsl-asoc-card as module, there is following error: sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe': >> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized] of_node_put(asrc_np); ^ vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c 531 if (width == 24) 532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE; 533 else 534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE; 535 } 536 537 /* Finish card registering */ 538 platform_set_drvdata(pdev, priv); 539 snd_soc_card_set_drvdata(&priv->card, priv); 540 541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card); 542 if (ret) 543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret); 544 545 fail: 546 of_node_put(codec_np); > 547 of_node_put(asrc_np); 548 of_node_put(cpu_np); 549 550 return ret; 551 } 552 553 static const struct of_device_id fsl_asoc_card_dt_ids[] = { 554 { .compatible = "fsl,imx-audio-cs42888", }, 555 { .compatible = "fsl,imx-audio-sgtl5000", }, Add 'asrc_fail' branch for error jump after asrc_np initialized. Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-08-16ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC supportNicolin Chen
The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that can be used, ideally, for all Freescale CPU DAI drivers and external CODECs. The idea of this generic sound card is a bit like ASoC Simple Card. However, for Freescale SoCs (especially those released in recent years), most of them have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And this is a specific feature that might be painstakingly controlled and merged into the Simple Card driver. So having this driver will allow all Freescale SoC users to benefit from the simplification to support a new card and the capability of wide sample rates support through ASRC. The driver is initially designed for sound card using I2S or PCM DAI formats. However, it's also possible to merge those non-I2S/PCM type sound cards, such as S/PDIF audio and HDMI audio, into this card as long as the merge will not break the original function and as long as there is something redundant that can be abstracted along with I2S type sound cards. As an initial version, it only supports three cards that I can test: imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver imx-audio-wm8962, just like the old imx-wm8962.c driver The driver is also compatible with the old Device Tree bindings of WM8962 and SGTL5000. So we may consider to remove those two drivers after this driver is totally enabled. (It needs to be added into defconfig) Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>