summaryrefslogtreecommitdiffstats
path: root/sound/soc/qcom/apq8016_sbc.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: qcom: Fix trivial code style issuesKrzysztof Kozlowski2023-12-181-1/+1
| | | | | | | | | | | | | | | | Fix few trivial code style issues, pointed out by checkpatch, so they do not get copied to new code (when old code is used as template): WARNING: Prefer "GPL" over "GPL v2" - see commit bf7fbeeae6db ("module: Cure the MODULE_LICENSE "GPL" vs. "GPL v2" bogosity") WARNING: function definition argument 'struct platform_device *' should also have an identifier name ERROR: code indent should use tabs where possible WARNING: please, no spaces at the start of a line WARNING: Missing a blank line after declarations WARNING: unnecessary whitespace before a quoted newline Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://msgid.link/r/20231204100048.211800-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: reduce number of binding headers includesKrzysztof Kozlowski2023-10-091-0/+1
| | | | | | | | | | | Move the includes of binding headers from Qualcomm SoC sound drivers headers to unit files actually using these bindings. This reduces the amount of work for C preprocessor and makes usage of bindings easier to follow. No impact expected on the final binaries. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20231005075250.88159-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: convert not to use asoc_xxx()Kuninori Morimoto2023-09-251-4/+4
| | | | | | | | | 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/87v8cgqnjc.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: Map missing jack kcontrolsAlper Nebi Yasak2023-08-071-8/+29
| | | | | | | | | | | This driver does not properly map jack pins to kcontrols that PulseAudio and PipeWire need to handle jack detection events. It seems to support detecting Headphone and Headset Mic connections. Expose each to userspace as a kcontrol and add the necessary widgets. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Link: https://lore.kernel.org/r/20230802175737.263412-20-alpernebiyasak@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: Update to use set_fmt_new callbackCharles Keepax2022-06-061-1/+1
| | | | | | | | | | As part of updating the core to directly tell drivers if they are clock provider or consumer update these CPU side drivers to use the new direct callback. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-18-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-card: Create jack kcontrol without pinsAkihiko Odaki2022-04-141-1/+1
| | | | | | | | | | | | | | | 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>
* ASoC: qcom: apq8016_sbc: Allow routing audio through QDSP6Stephan Gerhold2021-12-131-5/+129
| | | | | | | | | | | | | | | | | | | | The apq8016-sbc-sndcard is designed to be used with the LPASS drivers (bypassing the combined audio/modem DSP in MSM8916/APQ8016). Make it possible to use QDSP6 audio instead for the msm8916-qdsp6-sndcard. This only requires adding some additional hooks that set up the DPCM backends correctly. Similar code is already used in drivers for newer SoCs such as apq8096.c, sdm845.c and sm8250.c. A slightly different initialization sequence is used for the apq8016-sbc and msm8916-qdsp6 sound card by defining the apq8016_sbc_add_ops() function as device match data. Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20211202145505.58852-6-stephan@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: Add SEC_MI2S supportVincent Knecht2021-08-091-0/+17
| | | | | | | | | | This patch adds external codec support on secondary mi2s. It is used for headphones on some devices, eg. alcatel-idol347. Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210806114116.895473-1-vincent.knecht@mailoo.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: Use devm_platform_get_and_ioremap_resource()Yang Yingliang2021-06-211-5/+2
| | | | | | | | | Use devm_platform_get_and_ioremap_resource() to simplify code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20210615140711.1676704-1-yangyingliang@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: mark OF related data as maybe unusedKrzysztof Kozlowski2020-11-261-1/+1
| | | | | | | | | | | The driver can be compile tested with !CONFIG_OF making certain data unused: sound/soc/qcom/lpass-apq8016.c:294:34: warning: ‘apq8016_lpass_cpu_device_id’ defined but not used [-Wunused-const-variable=] Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20201125164452.89239-10-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: Set card->owner to avoid warningsStephan Gerhold2020-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Linux 5.9-rc1 I get the following warning with apq8016-sbc: WARNING: CPU: 2 PID: 69 at sound/core/init.c:207 snd_card_new+0x36c/0x3b0 [snd] CPU: 2 PID: 69 Comm: kworker/2:1 Not tainted 5.9.0-rc1 #1 Workqueue: events deferred_probe_work_func pc : snd_card_new+0x36c/0x3b0 [snd] lr : snd_card_new+0xf4/0x3b0 [snd] Call trace: snd_card_new+0x36c/0x3b0 [snd] snd_soc_bind_card+0x340/0x9a0 [snd_soc_core] snd_soc_register_card+0xf4/0x110 [snd_soc_core] devm_snd_soc_register_card+0x44/0xa0 [snd_soc_core] apq8016_sbc_platform_probe+0x11c/0x140 [snd_soc_apq8016_sbc] This warning was introduced in commit 81033c6b584b ("ALSA: core: Warn on empty module"). It looks like we are supposed to set card->owner to THIS_MODULE. Fix this for all the qcom ASoC drivers. Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Fixes: 79119c798649 ("ASoC: qcom: Add Storm machine driver") Fixes: bdb052e81f62 ("ASoC: qcom: add apq8016 sound card support") Fixes: a6f933f63f2f ("ASoC: qcom: apq8096: Add db820c machine driver") Fixes: 6b1687bf76ef ("ASoC: qcom: add sdm845 sound card support") Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20200820154511.203072-1-stephan@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: Use qcom_snd_parse_of()Stephan Gerhold2020-07-241-106/+14
| | | | | | | | | | | | | Now that we have updated qcom_snd_parse_of() to handle the device tree bindings used for apq8016_sbc, update the apq8016_sbc driver to use the common function and remove the duplicated code. Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20200723183904.321040-7-stephan@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointerKuninori Morimoto2020-03-271-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/87imivir5q.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: use for_each_rtd_codecs/cpus_dai() macroKuninori Morimoto2020-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | This patch switch to use plural form macro. - for_each_rtd_codec_dai() + for_each_rtd_codec_dais() - for_each_rtd_codec_dai_rollback() + for_each_rtd_codec_dais_rollback() - for_each_rtd_cpu_dai() + for_each_rtd_cpu_dais() - for_each_rtd_cpu_dai_rollback() + for_each_rtd_cpu_dais_rollback() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/87wo7ugogy.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: use for_each_rtd_codec_dai() macroKuninori Morimoto2020-02-191-4/+3
| | | | | | | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/87lfozjcaw.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: Fix oops with multiple DAI linksStephan Gerhold2019-07-231-8/+8
| | | | | | | | | | | | | | | | | | | | | | | apq8016_sbc_parse_of() sets up multiple DAI links, depending on the number of nodes in the device tree. However, at the moment CPU and platform components are only allocated for the first link. This causes an oops when more than one link is defined: Internal error: Oops: 96000044 [#1] SMP CPU: 0 PID: 1015 Comm: kworker/0:2 Not tainted 5.3.0-rc1 #4 Call trace: apq8016_sbc_platform_probe+0x1a8/0x3f0 platform_drv_probe+0x50/0xa0 ... Move the allocation inside the loop to ensure that each link is properly initialized. Fixes: 98b232ca9e0e ("ASoC: qcom: apq8016_sbc: use modern dai_link style") Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/20190722130352.95874-1-stephan@gerhold.net Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016_sbc: consider CPU-Platform possibilityKuninori Morimoto2019-06-281-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | commit 564684387969 ("ASoC: qcom: apq8016_sbc: 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 564684387969 ("ASoC: qcom: apq8016_sbc: don't select unnecessary Platform") Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'v5.2-rc6' into asoc-5.3Mark Brown2019-06-261-10/+1
|\ | | | | | | Linux 5.2-rc6
| * treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284Thomas Gleixner2019-06-051-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 and only version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 294 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | ASoC: qcom: apq8016_sbc: don't select unnecessary PlatformKuninori Morimoto2019-06-191-7/+3
| | | | | | | | | | | | | | | | | | | | 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>
* | ASoC: qcom: apq8016_sbc: use modern dai_link styleKuninori Morimoto2019-06-061-4/+15
|/ | | | | | | | | 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>
* ASoC: qcom: Fix of-node refcount unbalance in apq8016_sbc_parse_of()Takashi Iwai2019-02-201-5/+16
| | | | | | | | | | | | | The apq8016 driver leaves the of-node refcount at aborting from the loop of for_each_child_of_node() in the error path. Not only the iterator node of for_each_child_of_node(), the children nodes referred from it for codec and cpu have to be properly unreferenced. Fixes: bdb052e81f62 ("ASoC: qcom: add apq8016 sound card support") Cc: Patrick Lai <plai@codeaurora.org> Cc: Banajit Goswami <bgoswami@codeaurora.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
* treewide: Use struct_size() for devm_kmalloc() and friendsKees Cook2018-06-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaces open-coded struct size calculations with struct_size() for devm_*, f2fs_*, and sock_* allocations. Automatically generated (and manually adjusted) from the following Coccinelle script: // Direct reference to struct field. @@ identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc"; expression HANDLE; expression GFP; identifier VAR, ELEMENT; expression COUNT; @@ - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP) + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP) // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL); @@ identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc"; expression HANDLE; expression GFP; identifier VAR, ELEMENT; expression COUNT; @@ - alloc(HANDLE, sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP) + alloc(HANDLE, struct_size(VAR, ELEMENT, COUNT), GFP) // Same pattern, but can't trivially locate the trailing element name, // or variable name. @@ identifier alloc =~ "devm_kmalloc|devm_kzalloc|sock_kmalloc|f2fs_kmalloc|f2fs_kzalloc"; expression HANDLE; expression GFP; expression SOMETHING, COUNT, ELEMENT; @@ - alloc(HANDLE, sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP) + alloc(HANDLE, CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP) Signed-off-by: Kees Cook <keescook@chromium.org>
* ASoC: don't use rtd->codec on qcom/apq8016_sbcKuninori Morimoto2017-12-051-4/+4
| | | | | | | | | 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>
* ASoC: qcom: apq8016-sbc: Map BTN_0 to KEY_PLAYPAUSEBenson Leung2017-11-271-1/+1
| | | | | | | | | | | | | | | | The Android 3.5mm Headset jack specification mentions that BTN_0 should be mapped to KEY_MEDIA, but this is less logical than KEY_PLAYPAUSE, which has much broader userspace support. For example, the Chrome OS userspace now supports KEY_PLAYPAUSE to toggle play/pause of videos and audio, but does not handle KEY_MEDIA. Furthermore, Android itself now supports KEY_PLAYPAUSE equivalently, as the new USB headset spec requires KEY_PLAYPAUSE for BTN_0. https://source.android.com/devices/accessories/headset/usb-headset-spec Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: Add support to Headset JACKSrinivas Kandagatla2017-08-211-0/+34
| | | | | | | | | | This patch adds support to Headset JACK, also provides board specific vref ranges for mbhc buttons to be detected. This headset supports both 3 pole and 4 pole headset type and 5 buttons. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: Remove useless function callDonglin Peng2017-08-211-1/+0
| | | | | | | | | | | | The function platform_set_drvdata(pdev, data) copies the value of the variable data to pdev->dev.driver_data,but when calling snd_soc_register_card,the function dev_set_drvdata(card->dev, card) will override it, so i think that the former copy operation is useless and can be removed. Signed-off-by: Peng Donglin <dolinux.peng@gmail.com> Acked-by: Banajit Goswami <bgoswami@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: set default mclk rateSrinivas Kandagatla2017-08-021-4/+19
| | | | | | | | MCLK for internal audio codec is expected to be at 9.6MHz by default. This patch adds support to 9.6MHz to make the default case possible. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: Add support to multi codec.Srinivas Kandagatla2016-10-241-8/+3
| | | | | | | | | | | | This patch adds support to multi codec, as the msm8916 codec is now split into two codecs, Analog and Digital. Also update the bindings and example to show that the card supports multicodec. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: add support to routing via DTSrinivas Kandagatla2016-09-061-0/+9
| | | | | | | | | This patch adds support to allow audio routing via Device Tree. This is mostly used to specify MICBIAS and other power supplies relation. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: add board specific dapm mic widgetsSrinivas Kandagatla2016-09-061-0/+11
| | | | | | | | | This patch adds support to board specific dapm mic widgets so that these can be used to specify proper connections of various micbias supported by the board and SOC. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: apq8016-sbc: add mic supportSrinivas Kandagatla2016-02-201-3/+7
| | | | | | | | | This patch add mic support on apq8016-sbc board aka db410c. Tested it with headset mic. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Acked-by: Kenneth Westfield <kwestfie@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: qcom: add apq8016 sound card supportSrinivas Kandagatla2015-06-101-0/+198
This patch adds apq8016 machine driver support. This patch is tested on DB410c and msm8916-mtp board for both hdmi and analog audio features. Acked-by: Kenneth Westfield <kwestfie@codeaurora.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>