summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tlv320aic31xx.c
AgeCommit message (Collapse)Author
2017-12-07ASoC: tlv320aic31xx: Reset registers during power upAndrew F. Davis
Add a reset function that toggles the reset line if available or uses the software reset command otherwise. Use this in power up to ensure the registers are in a sane state. This is useful when the driver module is reloaded, or after Kexec, warm-reboots, etc.. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-07ASoC: tlv320aic31xx: Use fwnode APIs over raw OF callsAndrew F. Davis
Use fwnode_* API instead of of_*, the results are the same but fwnode_* is cleaner and we get ACPI support. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-07ASoC: tlv320aic31xx: Fix GPIO header includesAndrew F. Davis
Use of gpiod_* needs <linux/gpio/consumer.h>, add this here. Fixes: b6b247cd5e37 ("ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* API") Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: Handle inverted BCLK in non-DSP modesAndrew F. Davis
Currently BCLK inverting is only handled when the DAI format is DSP, but the BCLK may be inverted in any supported mode. Without this using this CODEC in any other mode than DSP with the BCLK inverted leads to bad sampling timing and very poor audio quality. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: Add CODEC clock slave supportAndrew F. Davis
This CODEC supports being the WCLK and/or BCLK slave, add support for this here. Also make the alert into an error as alert is more urgent than needed here and is rarely used. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: Check clock and divider before divisionAndrew F. Davis
If our set_sysclk DAI callback has not been called yet p_div will be 0 and dividing by this will cause an error. Print an error message and leave before this. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: Switch GPIO handling to use gpiod_* APIAndrew F. Davis
Move to using newer gpiod_* GPIO handling functions. This simplifies the code and eases dropping platform data in the next patch. Also remember GPIO are active low, so set "1" to reset. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: Merge init function into probeAndrew F. Davis
The function aic31xx_device_init() is only called from probe and does nothing that logically shouldn't be in probe, remove this unneeded function call and move its code into probe where it was called. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-12-01ASoC: tlv320aic31xx: General source formatting cleanupAndrew F. Davis
Simple non-functional changes including: * Fix spelling errors * Reformat code for easier reading * Remove unneeded code * Remove assignments that are always overridden * Normalize function return paths Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-30ASoC: tlv320aic31xx: Move ACPI table next to OF tableAndrew F. Davis
Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-30ASoC: tlv320aic31xx: Change aic31xx_power_off return type to voidAndrew F. Davis
The return value is not checked, and even if it was there is nothing we could do about it and messages are already printed. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-30ASoC: tlv320aic31xx: File header and copyright cleanupAndrew F. Davis
Fix header copyright tags, while we are here, also switch to SPDX and fixup MODULE tags to match. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-30ASoC: tlv320aic31xx: Use standard reset GPIO OF nameAndrew F. Davis
The correct DT property for specifying a GPIO used for reset is "reset-gpios", fix this here. [Retitled for accuracy -- broonie] Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-11-08ASoC: tlv320dac31xx: mark expected switch fall-throughGustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Addresses-Coverity-ID: 1195220 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.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-14ASoC: tlv320dac31xx: Fix mistype in tlv320dac31xx codecTomas Vilda
Signed-off-by: Tomas Vilda <tomas.vilda@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-12ASoC: tlv320aic31xx: Add support for tlv320dac3101Peter Ujfalusi
The DAC3101 is mostly identical to DAC3100 with the exception that it has stereo speaker AMP instead of mono used in DAC3100. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-11-10ASoC: tlv320aic31xx: Add missing of_device_id for dac3100Peter Ujfalusi
The compatible table was not updated when the support for DAC3100 was added. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reviewed-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-27ASoC: tlv320aic31xx: do not declare support for mono DAINikita Yushchenko
This hardware supports only 2-channel DAI, even mono ADC digital output has two channels with the same data. Having min_channels=1 results in broken playback of mono files in setups where CPU DAI supports mono. Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-26ASoC: tlv320aic31xx: add explicit support for tlv320dac31xxNikita Yushchenko
tlv320dac31xx is a subset of tlv320aic31xx: - it does not have MIC inputs and ADC, thus capture is not supported, - it has analog inputs AIN1/AIN2 that can be mixed into output. Although tlv320dac31xx does work with tlv320aic31xx driver, this setup does register non-existent widgets and non-existent capture stream. Thus userspace lists non-existent objects in user interfaces, an can access these, causing operations with device registers that are declared as "reserved" in tlv320dac31xx datasheet. This patch fixes this situation by separating controls/widgets/routes into common, aic31xx-specific, and dac31xx-specific parts. Only parts that match actual hardware (as declared in "compatible" device tree property) are registered. Changes from v1: - update device tree binding documentation, - rebased on top of "ASoC: codec duplicated callback function goes to component on tlv320aic31xx" commit. Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on tlv320aic31xxKuninori 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-04-19ASoC: tlv320aix31xx: Add ACPI match for Lenovo 100SBastien Nocera
The Lenovo 100S netbook has a codec controller for which there is a driver, but doesn't know how to access the device. This adds the necessary ACPI table for the driver to find the device. Device (TTLV) { Name (_ADR, Zero) // _ADR: Address Name (_HID, "10TI3100") // _HID: Hardware ID Name (_CID, "10TI3100") // _CID: Compatible ID Name (_DDN, "TI TLV320AIC3100 Codec Controller ") // _DDN: DOS Device Name Name (_UID, One) // _UID: Unique ID Signed-off-by: Bastien Nocera <hadess@hadess.net> Tested-by: Jan Schmidt <jan@centricular.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30Merge remote-tracking branches 'asoc/topic/const', 'asoc/topic/cs35l32', ↵Mark Brown
'asoc/topic/cs4265' and 'asoc/topic/cs42l52' into asoc-next
2015-07-15ASoC: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15ASoC: Constify snd_soc_dai_ops variablesAxel Lin
The snd_soc_dai_ops variables are not modified after initialization in these drivers, so make them const. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-15ASoC: tlv320aix31xx: Replace direct snd_soc_codec dapm field accessLars-Peter Clausen
The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all other manual access to codec->dapm with snd_soc_codec_get_dapm(). Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27ASoC: Move bias level update to the coreLars-Peter Clausen
All drivers have the same line at the end of the set_bias_level callback to update the bias_level state. Move this update into snd_soc_dapm_force_bias_level() and remove them from the drivers. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-15ASoC: tlv320aic31xx: Replace w->codec snd_soc_dapm_to_codec(w->dapm)Lars-Peter Clausen
The codec field of the snd_soc_widget struct is eventually going to be removed, use snd_soc_dapm_to_codec(w->dapm) instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-08Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tegra', ↵Mark Brown
'asoc/topic/tfa9879', 'asoc/topic/tlv320aic23' and 'asoc/topic/tlv320aic31xx' into asoc-next
2014-11-27ASoC: tlv320aix31xx: Cleanup manual bias level transitionsLars-Peter Clausen
Set the CODEC driver's suspend_bias_off flag rather than manually going to SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes the code a bit shorter and cleaner. Since the ASoC core now takes care of setting the bias level to SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually anymore either. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-24ASoC: tlv320aic31xx: Fix off by one error in the loop stucture.Jyri Sarha
Fix off by one read beyond the end of a table. Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2014-09-03ASoC: tlv320aic31xx: Choose PLL p divider automaticallyJyri Sarha
This simplifies aic31xx_divs table. There is no more need for p_val or separate lines for 12 and 24 MHz mclks. Signed-off-by: Jyri Sarha <jsarha@ti.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-03Merge branch 'fix/tlv320aic31xx' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-tlv320aic31xx
2014-09-03ASoC: tlv320aic31xx: Fix 24bit samples with I2S format and 12MHz mclkJyri Sarha
I2S format requires bitclock to have an exact amount of cycles in a frame for audio to work cleanly. With dsp formats that is not so important. Updates aic31xx_setup_pll() to look for a line in aic31xx_divs table that produces the best match for the bitclock and adds lines to aic31xx_divs for 12MHz mclk and 24bit samples. Signed-off-by: Jyri Sarha <jsarha@ti.com> Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-01ASoC: tlv320aic31xx: Correct interface register 2 variable namePeter Ujfalusi
Rename iface_reg3 to iface_reg2 since this variable is actually used for interface register 2. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-04Merge remote-tracking branches 'asoc/topic/tlv320aic3x', 'asoc/topic/width', ↵Mark Brown
'asoc/topic/wm0010', 'asoc/topic/wm8904' and 'asoc/topic/wm8962' into asoc-next
2014-08-04Merge remote-tracking branches 'asoc/topic/tlv', 'asoc/topic/tlv320aic23', ↵Mark Brown
'asoc/topic/tlv320aic31xx' and 'asoc/topic/tlv320aic32x4' into asoc-next
2014-07-31ASoC: tlv320aic31xx: Convert to params_width()Mark Brown
The CODEC doesn't care how data is laid out in memory. Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25ASoC: tlv320aic31xx: Do not ignore errors in aic31xx_device_init()Peter Ujfalusi
We need to return the error codes from aic31xx_device_init() and return from the i2c_probe with the error code. We will have kernel panic (NULL pointer dereference) in regulator_register_notifier() in case the devm_regulator_bulk_get() fails (with -EPROBE_DEFER for example). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
2014-06-22ASoC: tlv320aic31xx: Fixed Coding Style IssuesShahina Shaik
Fixed coding style issues of "Missing Blank line after declaration" Signed-off-by: Shahina Shaik <sharab.shaik@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-06-21ASoC: tlv320aic31xx: Remove duplicate constLars-Peter Clausen
SOC_ENUM_SINGLE_DECL() already adds the const qualifier, so there is no need to manually specify it. Fixes the following warnings from sparse: sound/soc/codecs/tlv320aic31xx.c:253:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:255:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:257:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:260:1: warning: duplicate const sound/soc/codecs/tlv320aic31xx.c:262:1: warning: duplicate const Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-22Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', ↵Mark Brown
'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next
2014-04-25ASoC: tlv320aic31xx: Convert /n to \nJoe Perches
Use a newline character appropriately. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: tlv320aic23: Include of.hSachin Kamat
of_match_ptr is defined in of.h. Include it explicitly. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-18ASoC: codecs: Replace instances of rtd->codec with dai->codecLars-Peter Clausen
With CODEC to CODEC links rtd->codec does not necessarily point to the driver's CODEC. CODEC drivers should always use dai->codec and never even look at the PCM runtime. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-18ASoC: tlv320aic31xx: Don't call kfree for memory allocated by devm_kzallocAxel Lin
The kfree call is not necessary, but we need to call snd_soc_unregister_codec() in remove(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-17ASoC: tlv320aic31xx: Turn power off only once.Jyri Sarha
Regulator code keep count of enables and disables. Double disable causes an ugly warning. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-13ASoC: tlv320aic31xx: Staticise non-exported symbolsMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-13ASoC: tlv320aic31xx: Remove snd_soc_codec_set_cache_io() callJyri Sarha
Remove snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP) call and codec->control_data = aic31xx->regmap assignment since that already done by core. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-13ASoC: tlv320aic31xx: Fix unused variable warning from aic31xx_clk_offJyri Sarha
Fix "warning: unused variable 'aic31xx'" from function 'aic31xx_clk_off'. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>