summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs4271.c
AgeCommit message (Collapse)Author
2021-01-21ASoC: cs*: sync parameter naming (rate/sample_bits)Kuninori Morimoto
This patch syncs naming rule. - xxx_rates; + xxx_rate; - xxx_samplebits; + xxx_sample_bits; Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/871remolg1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-05-18ASoC: codecs: use snd_soc_xxx_active()Kuninori Morimoto
We have snd_soc_dai/dai_stream/component_active() macro This patch uses 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/87wo5e58j4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-02-18ASoC: soc-pcm: merge playback/cature_active into stream_activeKuninori Morimoto
DAI has playback_active and capture_active to care usage count. OTOH, we have SNDRV_PCM_STREAM_PLAYBACK/CAPTURE. But because of this kind of implementation mismatch, ALSA SoC has many verbose code. To solve this issue, this patch merge playback_active/capture_active into stream_active[2]; 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/875zg5botu.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-31ASoC: cs4271: Fix a typo in the CS4171_NR_RATIOSChristophe JAILLET
This should be CS4271_NR_RATIOS. Fix it and use it. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/20190724060023.31302-1-christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157Thomas Gleixner
Based on 3 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 as published by the free software foundation either version 2 of the license or at your option any later version 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 this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] 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 this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version [author] [graeme] [gregory] [gg]@[slimlogic] [co] [uk] [author] [kishon] [vijay] [abraham] [i] [kishon]@[ti] [com] [based] [on] [twl6030]_[usb] [c] [author] [hema] [hk] [hemahk]@[ti] [com] 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-or-later has been chosen to replace the boilerplate/reference in 1105 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.202006027@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-07ASoC: cs4271: fix boolean assignmentsPierre-Louis Bossart
Reported by Coccinelle: sound/soc/codecs/cs4271.c:226:2-16: WARNING: Assignment of bool to 0/1 sound/soc/codecs/cs4271.c:229:2-16: WARNING: Assignment of bool to 0/1 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: cs4271: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-10ASoC: codecs: add const to snd_soc_codec_driver structuresBhumika Goyal
Declare snd_soc_codec_driver structures as const as they are only passed as an argument to the function snd_soc_register_codec. This argument is of type const, so declare the structures with this property as const. In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in a copy operation along with getting passed to snd_soc_register_codec. So, it can be made const too. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_soc_codec_driver s@p={...}; @good1@ identifier match.s; position p; @@ snd_soc_register_codec(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_soc_codec_driver s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-05-24ASoC: cs4271: Remove unnecessary additional variable definitionCharles Keepax
The function already defines a ret variable at the top and makes no particular use of the shadowed definition, as such remove the redundant definition. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-30ASoC: cs4271: configure reset GPIO as outputAlexander Sverdlin
During reset "refactoring" the output configuration was lost. This commit repairs sound on EDB93XX boards. Fixes: 9a397f4 ("ASoC: cs4271: add regulator consumer support") Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org> # 4.6+
2016-08-08ASoC: codec duplicated callback function goes to component on cs4271Kuninori Morimoto
codec driver and component driver has duplicated callback functions, and codec side functions are just copied to component side when register timing. This was quick-hack, but no longer needed. This patch moves these functions from codec driver to component driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-02-26ASoC: cs4271: add regulator consumer supportPascal Huerst
The cs4271 has three power domains: vd, vl and va. Enable them all, as long as the codec is in use. While at it, factored out the reset code into its own function. Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-12Merge remote-tracking branches 'asoc/fix/ak4642', 'asoc/fix/atmel', ↵Mark Brown
'asoc/fix/cs4271', 'asoc/fix/davinci' and 'asoc/fix/rcar' into asoc-linus
2015-04-02ASoC: cs4271: Increase delay time after resetPascal Huerst
The delay time after a reset in the codec probe callback was too short, and did not work on certain hw because the codec needs more time to power on. This increases the delay time from 1us to 1ms. Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-03-10ASoC: cs4271: Fix wrong value references for boolean kctlTakashi Iwai
The correct values referred by a boolean control are value.integer.value[], not value.enumerated.item[]. The former is long while the latter is int, so it's even incompatible on 64bit architectures. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org>
2014-10-20ASoC: cs4271: Split SPI and I2C code into different modulesAxel Lin
Currently the cs4271 driver depends on SND_SOC_I2C_AND_SPI. So the driver cannot be built as built-in if CONFIG_I2C=m. Split SPI and I2C code into different modules to avoid this issue. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-04-14ASoC: Add snd_soc_kcontrol_codec() helper functionLars-Peter Clausen
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the CODEC that registered the control. With the upcoming consolidation of platform and CODEC controls this will change. Prepare for this by introducing the snd_soc_kcontrol_codec() helper function that will hide the implementation details of how the CODEC for a control can be obtained. This will allow us to change this easily in the future. The patch also updates all CODEC drivers to use the new helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-06ASoC: cs4271: Fix build error without CONFIG_SPI_MASTERTakashi Iwai
cs4271_common_probe() is called from cs4271_i2c_probe() but defined in CONFIG_SPI_MASTER block, thus it results in a build error when CONFIG_SPI_MASTER=n: sound/soc/codecs/cs4271.c:721:2: error: implicit declaration of function ‘cs4271_common_probe’ [-Werror=implicit-function-declaration] Move the function out of #if block. Fixes: d6cf89ee07cb ('ASoC: cs4271: claim reset GPIO in bus probe function') Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Daniel Mack <daniel@zonque.org> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20ASoC: cs4271: claim reset GPIO in bus probe functionDaniel Mack
Move the GPIO acquisition from the codec to the bus probe functions. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-05ASoC: cs4271: Remove outdated commentLars-Peter Clausen
Commit 1b1861ead ("ASoC: cs4271: convert to direct regmap API usage") removed the bus_type field from the cs4271_private struct, but left the comment that described the field in there. This patch removes the comment. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Daniel Mack <daniel@zonque.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-27ASoC: cs4271: Use IS_ENABLED() macroFabio Estevam
Using the IS_ENABLED() macro can make the code shorter and simpler. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-16ASoC: cs4271: Include linux/of.h headerSachin Kamat
'of_match_ptr' is defined in linux/of.h. Include it explicitly. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-11ASoC: cs4271: Add DAPM supportMark Brown
This makes it possible to hook the device into a more complex board and ensures it will continue to work with non-DAPM support removed from the core. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Alexander Sverdlin <subaparts@yandex.ru>
2013-08-11ASoC: cs4271: Convert to table based control initMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Alexander Sverdlin <subaparts@yandex.ru>
2013-03-22ASoC: cs4271: switch to mute_streamDaniel Mack
Use the newly introduced mute_stream DAI operation, and don't mute the codec if it's called for the _CAPTURE stream. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-15ASoC: cs4271: convert to direct regmap API usageDaniel Mack
By using the regmap API directly, we can make use of the .write_flag_mask for SPI, which allows us to drop the strange register hacks that were necessary so far. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Alexander Sverdlin <alexander.sverdlin@gmx.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24ALSA: ASoC: cs4271: add optional soft reset workaroundDaniel Mack
The CS4271 requires its LRCLK and MCLK to be stable before its RESET line is de-asserted. That also means that clocks cannot be changed without putting the chip back into hardware reset, which also requires a complete re-initialization of all registers. One (undocumented) workaround is to assert and de-assert the PDN bit in the MODE2 register. This patch adds a new flag to both the DT bindings as well as to the platform data to enable that workaround. Signed-off-by: Daniel Mack <zonque@gmail.com> Acked-by: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24Merge branch 'asoc-fix-cs4271' into asoc-cs4271Mark Brown
2012-12-10ASoC: codecs: remove __dev* attributesBill Pemberton
CONFIG_HOTPLUG is going away as an option. As result the __dev* markings will be going away. Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10Merge remote-tracking branch 'asoc/topic/cs4271' into asoc-nextMark Brown
2012-12-02ASoC: cs4271: fix property checkDaniel Mack
The driver had the property check for 'cirrus,amutec_eq_bmutec' the wrong way around. That happens if you misspell the property in the bindings during tests. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-02ASoC: cs4271: fix sparse warningDaniel Mack
Make the flag in the pdata of type bool to fix a sparse warning. Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-13ASoC: cs4271: free allocated GPIODaniel Mack
In case of probe deferral, the allocated GPIO line is not freed, which prevents it from being claimed and properly asserted in later attempts. Fix this by using devm_gpio_request(). Signed-off-by: Daniel Mack <zonque@gmail.com> Reported-by: Michael Hirsch <hirsch@teufel.de> Cc: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-15ASoC: cs4271: add support for AMUTEB=BMUTEC featureDaniel Mack
The CS4271 has a feature to sync its analog mute flags, so one mute circuitry can be used for both channels. Give users access to this feature with a new DT property and a flag in the platform data. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-09-28ALSA: ASoC: add DT bindings for CS4271Daniel Mack
Apart from pure matching, the bindings also support setting the the reset gpio line. Signed-off-by: Daniel Mack <zonque@gmail.com> Cc: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: codecs: Remove rtd->codec usage from CODEC driversMark Brown
In order to support CODEC<->CODEC links remove the assumption that there is only a single CODEC on a DAI link by removing the use of the CODEC pointer in the rtd from the CODEC drivers. They are already being passed their DAI whenever they are passed an rtd and can get the CODEC from there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-04ASoC: core: Add support for DAI and machine kcontrols.Liam Girdwood
Currently ASoC can only add kcontrols using codec and platform component device handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for SoC card machine drivers too. This allows the kcontrol to have a direct handle to the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily get it's private data. This change makes snd_soc_add_controls() static and wraps it in the folowing calls (card and dai are new) :- snd_soc_add_card_controls() snd_soc_add_codec_controls() snd_soc_add_dai_controls() snd_soc_add_platform_controls() This patch also does a lot of small mechanical changes in individual codec drivers to replace snd_soc_add_controls() with snd_soc_add_codec_controls(). It also updates the McBSP DAI driver to use snd_soc_add_dai_controls(). Finally, it updates the existing machine drivers that register controls to either :- 1) Use snd_soc_add_card_controls() where no direct codec control is required. 2) Use snd_soc_add_codec_controls() where there is direct codec control. In the case of 1) above we also update the machine drivers to get the correct component data pointers from the kcontrol (rather than getting the machine pointer via the codec pointer). Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02ASoC: Drop unused state parameter from CODEC suspend callbackLars-Peter Clausen
The existence of this parameter is purely historical. None of the CODEC drivers uses it and we always pass in the same value anyway, so it should be safe to remove it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23ASoC: Constify snd_soc_dai_ops structsLars-Peter Clausen
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure") introduced the possibility to have constant DAI ops structures, yet this is barley used in both existing drivers and also new drivers being submitted, although none of them modifies its DAI ops structure. The later is not surprising since existing drivers are often used as templates for new drivers. So this patch just constifies all existing snd_soc_dai_ops structs to eliminate the issue altogether. The patch was generated with the following coccinelle semantic patch: // <smpl> @@ identifier ops; @@ -struct snd_soc_dai_ops ops = +const struct snd_soc_dai_ops ops = { ... }; // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-20ASoC: cs4271: Fix wrong mask parameter in some snd_soc_update_bits callsAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Alexander Sverdlin <subaparts@yandex.ru> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-30ASoC: Remove unused "control_data" field of struct cs4271_privateAxel Lin
The control_data field is used to initialize the codec's control_data field, but since this is also done by the snd-soc-cache core, the redundant assignment can be removed and the field can be dropped. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-03-09ASoC: Manage mode and rate bits correctly for CS4271 CODEC.Alexander Sverdlin
Manage mode and rate bits correctly, according to datasheet in CS4271 CODEC. This is done to make capture work properly. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-03-07ASoC: Extend range of supported sample rates for CS4271 CODEC.Alexander Sverdlin
Extend range of supported sample rates for CS4271 CODEC. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-03-07ASoC: Constify i2c_device_id tableAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Timur Tabi <timur@freescale.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-02-08ASoC: CS4271: Move Chip Select control out of the CODEC code.Alexander Sverdlin
Move Chip Select control out of the CODEC code for CS4271. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-01-26ASoC: Staticise non-exported symbols in cs4271Mark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-25ASoC: cs4271.c: improve error handlingAlexander Sverdlin
CS4271 CODEC driver adapted to recently introduced error handling in snd_soc_update_bits(). Added snd_soc_cache_sync() error handling. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-01-21ASoC: CS4271 codec supportAlexander Sverdlin
Added support for CS4271 codec to ASoC. Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>