summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-jack.c
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: soc-jack: calling snd_soc_jack_report causes a null pointer accessmnlife2023-08-141-1/+1
| | | | | | | | | When snd_soc_card_jack_new is not called or the call fails, calling this function causes a null pointer access Signed-off-by: mnlife <mnlife@126.com> Link: https://lore.kernel.org/r/20230811142511.6570-1-mnlife@126.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: jack: allow multiple interrupt per gpioSvyatoslav Ryhel2023-03-051-0/+1
| | | | | | | | | This feature is required for coupled hp-mic quirk used by some Nvidia Tegra 3 based devices work properly. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Link: https://lore.kernel.org/r/20230221183211.21964-3-clamor95@gmail.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: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIBKuninori Morimoto2021-08-161-6/+6
| | | | | | | | | | | | | | | This patch cleanups below cppcheck warning. sound/soc/soc-jack.c:21:6: style: struct member 'jack_gpio_tbl::count' is never used. [unusedStructMember] int count; ^ sound/soc/soc-jack.c:23:28: style: struct member 'jack_gpio_tbl::gpios' is never used. [unusedStructMember] struct snd_soc_jack_gpio *gpios; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87tujqyols.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-jack: cleanup cppcheck warning at snd_soc_jack_report()Kuninori Morimoto2021-08-161-2/+1
| | | | | | | | | | | | This patch cleanups below cppcheck warning. sound/soc/soc-jack.c:45:6: style: The scope of the variable 'enable' can be reduced. [variableScope] int enable; ^ Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87v946yolx.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-card: move snd_soc_card_jack_new() to soc-cardKuninori Morimoto2020-05-301-38/+0
| | | | | | | | | | Card related function should be implemented at soc-card now. This patch moves it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/878shc25kc.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Jack: Fix NULL pointer dereference in snd_soc_jack_reportPawel Harlozinski2019-11-121-2/+1
| | | | | | | | | | | Check for existance of jack before tracing. NULL pointer dereference has been reported by KASAN while unloading machine driver (snd_soc_cnl_rt274). Signed-off-by: Pawel Harlozinski <pawel.harlozinski@linux.intel.com> Link: https://lore.kernel.org/r/20191112130237.10141-1-pawel.harlozinski@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
* ASoC: add soc-component.cKuninori Morimoto2019-08-051-18/+0
| | | | | | | | | | | | ALSA SoC has many snd_soc_component_xxx(), but these are randomly located in many files. Because of it, code is difficult to read. This patch creates new soc-component.c, and moves existing snd_soc_component_xxx() into it. But not yet fully. We need more cleanup it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87imrp5roa.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: soc-jack.c: convert to SPDX identifiersKuninori Morimoto2018-07-021-12/+7
| | | | | Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: remove Codec related codeKuninori Morimoto2018-05-091-22/+0
| | | | | | | | | Now no one is using Codec related code. Let's remove all Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'asoc/topic/hisi', 'asoc/topic/img', ↵Mark Brown2017-09-011-12/+42
|\ \ | | | | | | | | | 'asoc/topic/jack' and 'asoc/topic/jz4740' into asoc-next
| | * ASoC: jack: Manage gpios via devresTakashi Iwai2017-08-221-11/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's be lazy -- this patch adds the devres code to snd_soc_jack_add_gpios() for releasing the gpio resources at device removal automagically. After this patch, you don't have to call snd_soc_jack_free_gpios() manually as long as it's managed from the machine driver. What about the gpios assigned in other levels? Well, you might still need to free the resources manually, depending on how the component unbind works. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * ASoC: jack: fix snd_soc_codec_set_jack return errorSrinivas Kandagatla2017-07-281-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | This patch changes the error code returned by snd_soc_codec_set_jack() from -EINVAL to -ENOTSUPP. The reason to do this is to make the caller aware that the underlying codec does not support this callback. This can make the caller write the code to handle this case properly. Other reason is that -EINVAL is not the correct error to return in this case anyway. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* / ASoC: add Component level set_jackKuninori Morimoto2017-08-301-0/+22
|/ | | | | | | | | | In current ALSA SoC, Codec only has set_jack feature. Codec will be merged into Component in next generation ALSA SoC, thus current Codec specific feature need to be merged into it. This is glue patch for it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: jack: add snd_soc_codec_set_jackBard Liao2017-04-101-0/+18
| | | | | | | | | | | | | There are many codecs with the capability of jack detection. Usually, we create a jack on machine driver but there is no common function for machine driver to deliver the jack pointer to codec driver. snd_soc_codec_set_jack can be used for delivering the jack pointer to codec driver and enable the jack detection function. To make it work, codec driver need to define a callback function to receive the jack pointer and do all necessary procedure for enabling jack detection. Signed-off-by: Bard Liao <bardliao@realtek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: jack - check status of GPIO-based pins on resumeDmitry Torokhov2017-03-241-0/+30
| | | | | | | | | For GPIO-backed pins that are not configured as wakeup sources, we may miss change in their state that happens while system is suspended. Let's use PM notifier to refresh their state upon resume. Signed-off-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* Merge tag 'asoc-v4.2' of ↵Takashi Iwai2015-06-081-3/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v4.2 The big thing this release has been Liam's addition of topology support to the core. We've also seen quite a bit of driver work and the continuation of Lars' refactoring for component support. - Support for loading ASoC topology maps from firmware, intended to be used to allow self-describing DSP firmware images to be built which can map controls added by the DSP to userspace without the kernel needing to know about individual DSP firmwares. - Lots of refactoring to avoid direct access to snd_soc_codec where it's not needed supporting future refactoring. - Big refactoring and cleanup serieses for the Wolfson ADSP and TI TAS2552 drivers. - Support for TI TAS571x power amplifiers. - Support for Qualcomm APQ8016 and ZTE ZX296702 SoCs. - Support for x86 systems with RT5650 and Qualcomm Storm.
| * ASoC: jack - add_gpiods accepts filled descriptorsDylan Reid2015-05-251-3/+6
| | | | | | | | | | | | | | | | | | | | Allow for the desc field to be pre-filled when adding gpios to a jack. This allows drivers to get the gpios and decide if they should be added to the list or not. Specifically this will allow the gpio jack driver to add gpios based on device property specifications. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: jack: create kctls according to jack pins infoJie Yang2015-04-271-0/+1
| | | | | | | | | | | | | | | | Jack kctls are now created according to the pin info. Signed-off-by: Jie Yang <yang.jie@intel.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* | ALSA: jack: extend snd_jack_new to support phantom jackJie Yang2015-04-271-1/+1
|/ | | | | | | | | | | | | | | Dont create input devices for phantom jacks. Here, we extend snd_jack_new() to support phantom jack creating: pass in a bool param for [non-]phantom flag, and a bool param initial_jack to indicate whether we need to create a kctl at this stage. We can also add a kctl to the jack after its created meaning we can now integrate the HDA and ASoC jacks. Signed-off-by: Jie Yang <yang.jie@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
* ASoC: Allow to register jacks at the card levelLars-Peter Clausen2015-03-041-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jacks are typically card level elements, but are currently registered with a CODEC. When it was originally introduced snd_soc_jack_new() took a snd_soc_card as its parameter, but at that time DAPM was only implemented at the CODEC level and there was only one CODEC per card. This made it clear which CODEC to use for the jack DAPM operations. But the multi-component patchset added support for having multiple CODECs per card and with it the API was updated to register jacks with a specific CODEC instance instead. Subsequently DAPM support at the card level has been introduced, but the snd_soc_jack_new() API has so remained unchanged. This leaves us with the issue that the DAPM pins that are managed by the jack detection logic usually are part of the card DAPM context but are accessed through a CODEC DAPM context. Currently this works fine, but might break in the future if we take a more hierarchical approach to DAPM contexts. Furthermore with componentization progressing systems that do not register a snd_soc_codec might appear, while these system may still want to able to register a jack. This patch addresses these issues by adding a new function called snd_soc_card_jack_new() that can be used to register jacks with the card rather than a CODEC. This new function is mostly identical to snd_soc_jack_new() except that it additionally allows to directly specify the DAPM pins associated with the jack. This was done since most users of snd_soc_jack_new() typically call snd_soc_jack_add_pins() right after it, which is not necessary with the new API and allows to reduce the amount of boiler plate code. The old snd_soc_jack_new() is re-implemented as a wrapper around snd_soc_card_jack_new(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'asoc/topic/hdmi', 'asoc/topic/intel', ↵Mark Brown2014-12-081-6/+3
|\ \ | | | | | | | | | 'asoc/topic/jack', 'asoc/topic/jz4740' and 'asoc/topic/lm49453' into asoc-next
| | * ASoC: jack: update calls to gpiod_get*()Alexandre Courbot2014-10-231-6/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Add the new flags argument to calls of (devm_)gpiod_get*() and remove any direction setting code afterwards. Currently both forms (with or without the flags argument) are valid thanks to transitional macros in <linux/gpio/consumer.h>. These macros will be removed once all consumers are updated and the flags argument will become compulsary. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / ASoC: jack: Fix warning while make htmldocs caused by soc-jack.cMasanari Iida2014-11-181-1/+1
|/ | | | | | | | | | | | | This patch fix following errors while "make htmldocs" on linux-next-20141110. Warning(.//sound/soc/soc-jack.c:126): No description found for parameter 'zones' Warning(.//sound/soc/soc-jack.c:126): Excess function parameter 'zone' description in 'snd_soc_jack_add_zones' Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Move card field form platform/codec to componentLars-Peter Clausen2014-07-221-2/+2
| | | | | | | | | | | | | | Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the parent card and both handle this pointer in mostly the same way. This patch moves the card field to the component level which will allow further code consolidation between platforms and CODECS. Since there are only a handful of users of the snd_soc_codec struct's card field (and none of the snd_soc_platform's) these are update in this patch as well, which allows it to be removed from the snd_soc_codec struct. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: jack: Add support for GPIO descriptor defined jack pinsJarkko Nikula2014-05-261-16/+57
| | | | | | | | | | | | | | | | | | Allow jack GPIO pins be defined also using GPIO descriptor-based interface in addition to legacy GPIO numbers. This is done by adding two new fields to struct snd_soc_jack_gpio: idx and gpiod_dev. Legacy GPIO numbers are used only when GPIO consumer device gpiod_dev is NULL and otherwise idx is the descriptor index within the GPIO consumer device. New function snd_soc_jack_add_gpiods() is added for typical cases where all GPIO descriptor jack pins belong to same GPIO consumer device. For other cases the caller must set the gpiod_dev in struct snd_soc_jack_gpio before calling snd_soc_jack_add_gpios(). Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: jack: Basic GPIO descriptor conversionJarkko Nikula2014-05-261-8/+11
| | | | | | | | | | | | This patch does basic GPIO descriptor conversion to soc-jack. Even the GPIOs are still passed and requested using legacy GPIO numbers the driver internals are converted to use GPIO descriptor API. Motivation for this is to prepare soc-jack so that it will allow registering jack GPIO pins using both GPIO descriptors and legacy GPIO numbers. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: delay the initial jack detect by debounce_timexiangxiao2014-02-241-1/+2
| | | | | | | so the hardware could get time to initialize and debounce Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: add data field into snd_soc_jack_gpioxiangxiao2014-02-241-1/+1
| | | | | | | so callback could get the context data as needed Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: dont call dapm_sync while reporting jack alwaysVinod Koul2013-10-221-1/+6
| | | | | | | | | | While reporting the jack status snd_soc_jack_report() invokes snd_soc_dapm_sync() always. This should be required when we have pins associated with jack and reporting enables or disables these. So add a check for this case Signed-off-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: jack: Remove unnecessary call to snd_soc_dapm_new_widgets()Lars-Peter Clausen2013-08-271-2/+0
| | | | | | | | snd_soc_jack_add_pins() does not create any new DAPM widgets, so there is no need to call snd_soc_dapm_new_widgets(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
* ASoC: jack: Use power efficient workqueueMark Brown2013-07-191-1/+1
| | | | | | | | | The accessory detect debounce work is not performance sensitive so let the scheduler run it wherever is most efficient rather than in a per CPU workqueue by using the system power efficient workqueue. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
* Merge remote-tracking branch 'asoc/topic/log' into asoc-nextMark Brown2012-12-021-6/+7
|\
| * ASoC: Jack: Standardise ASoC Jack messagesLiam Girdwood2012-11-211-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Currently ASoC has a mixture of message prefixes e.g. "ASoC", "asoc" or none and message types e.g. pr_debug or dev_dbg. Make sure all ASoC core messages use the same "ASoC" prefix and convert any component device specific messages to use dev_dbg instead of pr_debug. Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | ASoC: jack: remove unused variable in snd_soc_jack_report()Wei Yongjun2012-10-221-3/+0
|/ | | | | | | | | | | The variable oldstatus is initialized but never used otherwise, so remove the unused variable. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* ASoC: fix documentation in soc-jackPeter Meerwald2012-10-091-3/+4
| | | | | Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Merge branch 'asoc-omap' into for-3.7Mark Brown2012-09-051-1/+1
|\
| * ASoC: jack: Always notify full jack statusMark Brown2012-08-131-1/+1
| | | | | | | | | | | | | | Don't just notify for the bits we've updated, notify the full state of the jack otherwise users might get confused by misleading reports. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* | ASoC: jack: Always update jack state even for noop changesMark Brown2012-08-031-6/+0
|/ | | | | | | | | | Now that DAPM is very cheap for most updates we've no need to avoid trying to run it so always notify even if we don't think there are any changes. This avoids potential issues with bootstrapping state like the pin state or other notifiers when there's nothing in the jack. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
* ASoC: jack: Push locking for jacks down to the jackMark Brown2012-04-011-2/+3
| | | | | | | | | | | | | Currently operations on jack reporting take the CODEC mutex both to protect the current jack status and also to protect the DAPM run which is triggered on status updates. Since the addition of a DAPM-specific lock we no longer need to worry about locking DAPM as it has its own finer grained lock so create a per jack lock to take care of the jack status. This is both cleaner where the jack isn't specifically associated with a CODEC and clearer as it's much more obvious what the lock is protecting. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* ASoC: Remove ifdefs for GPIO_SYSFSMark Brown2011-12-211-4/+0
| | | | | | It is part of the GPIO API so should be stubbed appropriately. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* sound: Add export.h for THIS_MODULE/EXPORT_SYMBOL where neededPaul Gortmaker2011-10-311-0/+1
| | | | | | | | These aren't modules, but they do make use of these macros, so they will need export.h to get that definition. Previously, they got it via the implicit module.h inclusion. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* ASoC: Ensure DAPM widgets are set up before we sync jacksMark Brown2011-10-061-0/+2
| | | | | | | | | We synchronise jack state on startup - when we do that make sure that we have set up all the DAPM widgets first in case we end up touching any of the partially set up widgets when syncing the jack pins. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
* ASoC: Fix reporting of partial jack updatesMark Brown2011-09-051-1/+1
| | | | | | | | | | | We need to report the entire jack state to the core jack code, not just the bits that were being updated by the caller, otherwise the status reported by other detection methods will be omitted from the state seen by userspace. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com> Cc: stable@kernel.org
* ASoC: soc-jack: Fix checking return value of request_any_context_irqAxel Lin2011-08-151-1/+1
| | | | | | | | | request_any_context_irq() returns a negative value on failure. On success, it returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.orG
* ASoC: Merge branch 'for-2.6.39' into for-2.6.40Mark Brown2011-04-181-1/+1
|\ | | | | | | | | | | | | Fix trivial conflict caused by silly spelling fix patch. Conflicts: sound/soc/codecs/wm8994.c
| * sound: Fixup the last user of the old irq functionsThomas Gleixner2011-03-301-1/+1
| | | | | | | | | | | | I had seen that before, but now that I removed set_irq_wake it broke. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* | ASoC: Name jack GPIOs based on jack not codecStephen Warren2011-04-031-1/+1
|/ | | | | | | | | snd_soc_jack_gpio has a name field. Use that name when registering the IRQ, since this is far more informative than the codec driver name. This shows up in /proc/interrupts. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* ASoC: Pass the jack to jack notifiersMark Brown2011-02-241-1/+1
| | | | | | | | We're currently not passing anything and this will make the card and so on more discoverable. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
* ASoC: Allow GPIO jack detection to be configured as a wake sourceMark Brown2011-02-181-0/+8
| | | | | | | | | Some systems wish to use jacks as wake sources. Provide a wake flag in the GPIO configuration which causes the driver to enable the IRQ as a wake source. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>