summaryrefslogtreecommitdiff
path: root/sound/soc/amd/acp-da7219-max98357a.c
AgeCommit message (Collapse)AuthorFilesLines
2024-04-15ASoC: amd: acp-da7219-max98357a: Constify regulator_opsKrzysztof Kozlowski1-1/+1
Neither core nor the driver modifes 'struct regulator_ops', so it can be const for code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20240414164703.239851-1-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25ASoC: amd: convert not to use asoc_xxx()Kuninori Morimoto1-14/+14
ASoC is now unified asoc_xxx() into snd_soc_xxx(). This patch convert asoc_xxx() to snd_soc_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/878r9cs25b.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-07ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrolsAlper Nebi Yasak1-10/+31
This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. The DA7219 codec used here can detect Headphones, Headset Mic and Line Out connections. Expose each to userspace as kcontrols and add the necessary widgets. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/r/20230802175737.263412-2-alpernebiyasak@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-13ASoC: amd: use use new trigger ordering methodKuninori Morimoto1-10/+10
ASoC is now supporting generic trigger ordering method. This patch switch to use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87pm66fnzi.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-07ASoC: amd: Drop da7219_aad_jack_det() usageCezary Rojewski1-2/+1
Do not access the internal function directly, do so through component->set_jack() instead. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221031160227.2352630-6-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-14ASoC: soc-card: Create jack kcontrol without pinsAkihiko Odaki1-2/+2
snd_soc_card_jack_new() allowed to create jack kcontrol without pins, but did not create kcontrols. The jack would not have kcontrols if pins were not going to be added. This renames the old snd_soc_card_jack_new() to snd_soc_card_jack_new_pins() for use when pins are provided or will be added later. The new snd_soc_card_jack_new() appropriately creates a jack for use without pins and adds a kcontrol. Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08ASoC: amd: Convert to new style DAI format definitionsMark Brown1-10/+10
Convert the AMD machine drivers to use the new style defines for clocking in DAI formats. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210915180957.39996-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13ASoC: amd: acp: declare and add prefix to 'bt_uart_enable' symbolPierre-Louis Bossart1-3/+3
Sparse reports the following warning: sound/soc/amd/acp-pcm-dma.c:39:6: error: symbol 'bt_uart_enable' was not declared. Should it be static? It's not very good practice to export such symbols that can easily conflict, add the acp_ prefix and add declaration in header file. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20210907184216.33067-1-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-06Merge some cs42l42 patches into asoc-5.15Mark Brown1-0/+10
2021-07-23ASoC: amd: Use dev_probe_err helperMario Limonciello1-9/+3
Replace the pattern of check for err to match -EPROBE_DEFER and only output errors to use the dev_err_probe helper instead. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20210722132731.13264-2-mario.limonciello@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-22ASoC: amd: enable stop_dma_first flag for cz_dai_7219_98357 dai linkVijendar Mukunda1-0/+5
DMA driver stop sequence should be invoked first before invoking I2S controller driver stop sequence for Stoneyridge platform. Enable stop_dma_first flag for cz_dai_7219_98357 dai link structure. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20210722130328.23796-1-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-16ASoC: amd: reverse stop sequence for stoneyridge platformVijendar Mukunda1-0/+5
For Stoneyridge platform, it is required to invoke DMA driver stop first rather than invoking DWC I2S controller stop. Enable dai_link structure stop_dma_fist flag to reverse the stop sequence. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/20210716123015.15697-2-vijendar.mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-29ASoC: amd: update spdx license for acp machine driverVijendar Mukunda1-24/+5
update SPDX license for acp machine driver. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/1616777074-5151-1-git-send-email-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-22ASoC: amd: Add support for RT5682 codec in machine driverVijendar Mukunda1-15/+342
Add support for RT5682 codec in machine driver. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Link: https://lore.kernel.org/r/1616118056-5506-1-git-send-email-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-08ASoC: amd: change clk_get() to devm_clk_get() and add missed checksChuhong Yuan1-2/+7
cz_da7219_init() does not check the return values of clk_get(), while da7219_clk_enable() calls clk_set_rate() to dereference the pointers. Add checks to fix the problems. Also, change clk_get() to devm_clk_get() to avoid data leak after failures. Fixes: bb24a31ed584 ("ASoC: AMD: Configure wclk and bclk of master codec") Signed-off-by: Chuhong Yuan <hslester96@gmail.com> Link: https://lore.kernel.org/r/20201204063610.513556-1-hslester96@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-23ASoC: amd: use asoc_substream_to_rtd()Kuninori Morimoto1-6/+6
Now we can use asoc_substream_to_rtd() macro, let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87ft9n0ytv.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-07ASoC: amd: acp-da7219-max98357a: fix 'defined but not used' warningPierre-Louis Bossart1-0/+2
Fix W=1 warning Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200702164433.162815-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-03-27ASoC: amd: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointerKuninori Morimoto1-1/+1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/874kufk5uu.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-11-27ASoC: AMD: Enable clk in startup intead of hw_paramsYu-Hsuan Hsu1-32/+14
Some usages only call startup and shutdown without setting hw_params (e.g. arecord --dump-hw-params). If we don't enable clk in startup, it will cause ref count error because the clk will be disabled in shutdown. For this reason, we should move enabling clk from hw_params to startup. In addition, the hw_params is fixed in this driver(48000 rate, 2 channels, S16_LE format) so we don't need to change the clk rate after the hw_params is set. Signed-off-by: Yu-Hsuan Hsu <yuhsuan@chromium.org> Acked-by: Akshu Agrawal <akshu.agarawal@amd.com> Link: https://lore.kernel.org/r/20191126075424.80668-1-yuhsuan@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-06-06ASoC: amd: acp-da7219-max98357a: use modern dai_link styleKuninori Morimoto1-20/+22
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-05-02ASoC: AMD: Configure wclk and bclk of master codecAgrawal, Akshu1-24/+42
With CCF support in da7219, we can now set the correct rate of wclk and bclk. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-25ASoC: AMD: Fix incorrect externAndi Kleen1-1/+1
When using bare externs outside include files that types should at least match. This fixes a type confusion between bool and int. Cc: broonie@kernel.org Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-03-21ASoC: AMD: Update DA7219 DAI clock name to align with codec updatesAdam Thomson1-1/+1
As the DAI clocks for DA7219 have now been split into BCLK and WCLK, the clock lookup name needs to be udpated here to select BCLK to achieve the same functionality as before with regards to DAI clock gating. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-11-05ASoC: AMD: constify regulator_desc structureJulia Lawall1-1/+1
The regulator_desc structure can be const as it is only passed as the second argument of devm_regulator_register and the corresponding parameter is declared as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-15ASoC: AMD: Add SND_JACK_LINEOUT jack typeAkshu Agrawal1-1/+1
Some 3 pole connectors report impedance greater than threshold of 1000Ohm. Thus, da7219 reports them as LINEOUT. Adding the SND_JACK_LINEOUT type so that we don't fail to detect any 3 pole jack type. Also, changing SND_JACK_HEADPHONE | SND_JACK_MICROPHONE -> SND_JACK_HEADSET Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-09-10ASoC: AMD: Fix simultaneous playback and capture on different channelAkshu Agrawal1-7/+33
If capture and playback are started on different channel (I2S/BT) there is a possibilty that channel information passed from machine driver is overwritten before the configuration is done in dma driver. Example: 113.597588: cz_max_startup: ---playback sets BT channel 113.597694: cz_dmic1_startup: ---capture sets I2S channel 113.597979: acp_dma_hw_params: ---configures capture for I2S channel 113.598114: acp_dma_hw_params: ---configures playback for I2S channel This is fixed by having 2 separate instance for playback and capture. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28ASoC: AMD: Change MCLK to 48MhzAkshu Agrawal1-1/+1
25Mhz MCLK which was earlier used was of spread type. Thus, we were not getting accurate rate. The 48Mhz system clk is of non-spread type and we are changing to it to get accurate rate. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-08-28ASoC: AMD: Set constraints for DMIC and MAX98357a codecAkshu Agrawal1-0/+33
We support dual channel, 48Khz. This constraint was set only for da7219. It is being extended to DMIC and MAX98357a. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: AMD: Fix build warningAkshu Agrawal1-1/+1
Fixes sound/soc/amd/acp-da7219-max98357a.c: In function 'cz_probe': sound/soc/amd/acp-da7219-max98357a.c:367:3: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] dev_err(&pdev->dev, "Failed to register regulator: %d\n", ret); Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-07-26ASoC: AMD: Add a fix voltage regulator for DA7219 and ADAU7002Akshu Agrawal1-0/+43
DA7219 for our platform need to be configured for 1.8V. Hence, we add a volatge regulator with supplies of 1.8V in the machine driver. Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-22ASoC: AMD: Configure channel 1 or channel 0 for captureAkshu Agrawal1-6/+37
ST/CZ SoC have 2 channels for capture in the I2SSP path. The DMA though these channels is done using the same dma descriptors. We configure the channel and enable it on the basis of channel selected by machine driver. Machine driver knows which codec sits on which channel and thus sends the information to dma driver. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-06-22ASoC: AMD: Change codec to channel link as per hardware redesignAgrawal, Akshu1-8/+19
This is a correction to match acutal hardware configuration. The hardware configuration looks like: I2S_BT -> SPK(Max) + DMIC(Adau) I2S_SP -> DA7219 Headset No actual products have been shipped with previous configuration. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: amd: dma driver changes for bt i2s instanceMukunda, Vijendar1-0/+24
With in ACP, There are three I2S controllers can be configured/enabled ( I2S SP, I2S MICSP, I2S BT). Default enabled I2S controller instance is I2S SP. This patch provides required changes to support I2S BT controller Instance. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Add const to snd_soc_ops instancesAkshu Agrawal1-3/+3
Marking snd_soc_ops instances const Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Fix clocks in CZ DA7219 machine driverAkshu Agrawal1-3/+2
System clock on the platform is 25Mhz and not 24Mhz. PLL_OUT for da7219 codec to use DA7219_PLL_FREQ_OUT_98304 as it is for 48KHz SR. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-21ASoC: AMD: Move clk enable from hw_params/free to startup/shutdownAkshu Agrawal1-14/+35
hw_param can be called multiple times and thus we can have more clk enable. The clk may not get diabled due to refcounting. startup/shutdown ensures single clk enable/disable call. Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-16ASoC: amd: acp-da7219-max98357: Make symbol da7219_dai_clk staticWei Yongjun1-1/+1
Fixes the following sparse warning: sound/soc/amd/acp-da7219-max98357a.c:46:12: warning: symbol 'da7219_dai_clk' was not declared. Should it be static? Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-04-16ASoC: AMD: Support headset button on Stoney DA7219Agrawal, Akshu1-0/+6
Adds headset button support. TEST=Tested Volume UP/Down, Play/Pause functionality Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-28ASoC: amd: don't use codec anymoreKuninori Morimoto1-2/+1
commit c88d31153356 ("ASoC: amd: Enable da7219 master clock using common clock framework") is using rtd->codec, but codec is replaced to component. Let's use component Fixes: c88d31153356 ("ASoC: amd: Enable da7219 master clock using common clock framework") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-20ASoC: amd: Enable da7219 master clock using common clock frameworkAkshu Agrawal1-0/+41
DA7219 is clock master for other codecs. DA7219 has exposed clock control by using common clock framework and same is used to enable and disable clock for all codecs in the system. TEST=aplay -D hw:0,0 -vv <file> arecord -D hw:0,0 -f dat -d 5 -vv <file> aplay -D hw:0,1 -vv <file> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-03-20ASoC: amd: Use single dai for da7219 playback and captureAkshu Agrawal1-12/+2
BT I2S is a bi-directional dai, we will use the same cpu dai for playback and capture. TEST=aplay -D hw:0,0 -vv <file> arecord -D hw:0,0 -f dat -d 5 -vv <file> Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-19ASoC: amd: acp-da7219-max98357: replace codec to componentKuninori Morimoto1-2/+2
Now we can replace Codec to Component. Let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-16ASoC: AMD: Add machine driver for ST DA7219 MAX98357Akshu Agrawal1-0/+246
The driver is used for AMD board using DA7219 and MAX98357 codec. TEST=Build, apply grunt_mixer_settings: iotools mmio_write32 0xfed80e40 0x040c40c0 iotools mmio_write32 0xfed80e28 0x10000 iotools mmio_write8 0xfed816de 0xc0 aplay -D plughw:0,0 ./sample_48000.wav -vv aplay -D plughw:0,0 ./sample_44100.wav -vv Signed-off-by: Akshu Agrawal <akshu.agrawal@amd.com> Signed-off-by: Daniel Kurtz <djkurtz@chromium.org> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mark Brown <broonie@kernel.org>