summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/tas2552.c
AgeCommit message (Collapse)AuthorFilesLines
2017-04-25ASoC: tas2552: Propagate the error code in suspend/resumeFabio Estevam1-2/+2
tas2552_suspend() and tas2552_resume() currently always return success, even though they may fail. Fix this behaviour by always propagating the error code. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-04-11ASoC: tas2552: Return the real error codeFabio Estevam1-1/+1
In the case of error in tas2552_codec_probe() we should better propagate the real error code instead of always returning '-EIO'. Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on tas2552Kuninori Morimoto1-6/+8
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>
2015-10-06ASoC: tas2552: fix dBscale-min declarationAndreas Dannenberg1-1/+1
The minimum volume level for the TAS2552 (control register value 0x00) is -7dB however the driver declares it as -0.07dB. Running amixer before the patch reports: dBscale-min=-0.07dB,step=1.00dB,mute=0 Running amixer with the patch applied reports: dBscale-min=-7.00dB,step=1.00dB,mute=0 Signed-off-by: Andreas Dannenberg <dannenberg@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-08-30Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', ↵Mark Brown1-10/+5
'asoc/topic/tegra', 'asoc/topic/tlv' and 'asoc/topic/topology' into asoc-next
2015-08-30Merge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/max98095', ↵Mark Brown1-1/+1
'asoc/topic/max98357a', 'asoc/topic/max9877' and 'asoc/topic/max98925' into asoc-next
2015-08-30Merge remote-tracking branches 'asoc/topic/const', 'asoc/topic/cs35l32', ↵Mark Brown1-1/+1
'asoc/topic/cs4265' and 'asoc/topic/cs42l52' into asoc-next
2015-07-29ASoC: tas2552: Remove unneeded NULL test for tas2552->enable_gpioAxel Lin1-10/+5
It's safe to call gpiod_set_value() with NULL desc. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16Merge branches 'topic/owner' and 'topic/reg-default' of ↵Mark Brown1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-max9877
2015-07-15ASoC: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-1/+0
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 Lin1-1/+1
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-07-07ASoC: Constify reg_default tablesAxel Lin1-1/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Peter Rosin <peda@axentia.se> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-11ASoC: tas2552: Use devm_gpiod_get_optional for enable-gpioAxel Lin1-7/+4
commit ea178d1456dc ("ASoC: tas2552: Make the enable-gpio really optional") makes enable-gpio optional. devm_gpiod_get_optional() is the better function for optional gpio, so let's switch to use it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Use consistent name for 'struct tas2552_data'Peter Ujfalusi1-3/+3
In tas2552_sw_shutdown() tas_data is used while the rest of the driver uses tas2552 when dealing with the 'struct tas2552_data' Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Remove unneeded semicolonPeter Ujfalusi1-1/+1
Double semicolon was added by the following commit: ea178d1456dc ASoC: tas2552: Make the enable-gpio really optional Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Call pm_runtime_disable when the module is removedPeter Ujfalusi1-0/+1
The module can not be loaded again after it has been removed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Code, define alignment changes for uniformityPeter Ujfalusi1-2/+2
Align the numbers in the header file to the same column. At the same time change the wrapping of CFG_2 register write in the probe function to be uniform with the other calls. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Correct Boost Auto-Pass Through Control register usagePeter Ujfalusi1-3/+3
Correct the bit definition so the code will change the bits what it supposed to change. Also rename the register define to TAS2552_BOOST_APT_CTRL. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Correct Output Data register usagePeter Ujfalusi1-2/+3
Do not write to DOUT Tristate register at probe time, specially not write data which is defined to be used in Output Data Register. Fix the defines for the Output Data Register and correct the register write at probe time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Add control for selecting DIN sourcePeter Ujfalusi1-0/+11
'DIN source' enum can be used to select the DIN Source (muted, left, right or average of left and right channels). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-08ASoC: tas2552: Correct the PLL configurationPeter Ujfalusi1-47/+91
Do not restrict the sampling rate to 44.1/48KHz. The pll_clk clock should be (sampling rate * 512) in all cases. Correct the J.D calculation (the D part was incorrectly calculated). Restore PLL enable status after we are done with the configuration. Implement hardware constraint handling towards the pll_clkin: if D != 0 (in J.D) then 1.1MHz <= pll_clkin <= 9.2MHz needs to be checked. If the PLL setup does not met with this constraint, fall back to BCLK as reference clock, if BCLK fails, use the internal 1.8MHz clock. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Configure the WCLK frequency based on the streamPeter Ujfalusi1-2/+41
Instead of hard wiring the WCLK frequency at probe time do it runtime. The hard wired 88_96KHz was not even setting the correct bits since it was defined as (1 << 6) which will change the I2S_OUT_SEL bit and will leave the amplifier configured for 8KHz. At the same time clean up and fix the CFG3 register bits. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Add support for word length configurationPeter Ujfalusi1-0/+38
Configure the word length based on the params_width of the stream. Also configure the clock per frame value which is used when tas2552 is bus master. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Implement startup/stop sequence as per TRMPeter Ujfalusi1-16/+28
Certain sequence need to be followed in order to have smooth power up and power down performance. Execute this sequence via DAPM_POST widget. Remove patching the RESERVED_0D register at probe time since it has to be handled every time when we stop or start the amplifier. In order to be able to execute the sequence at the correct time, the driver need to request to ignore the pmdown time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Correct the Speaker Driver Playback Volume (PGA_GAIN)Peter Ujfalusi1-2/+2
The last parameter for DECLARE_TLV_DB_SCALE() is to tell if the gain will be muted or not when it is set to raw 0. IN this case it is not muted. The PGA_GAIN is in 0-4 bits in the register. Fix the offset in the SOC_SINGLE_TLV() for this. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Clean up the Digital - Analog DAPM route definitionPeter Ujfalusi1-8/+6
The strings should be: 'static const char * const tas2552_input_texts[]' SOC_DAPM_ENUM should have "Route" in place of xname and no need to have it as an array. Also align the parameters. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Add TDM supportPeter Ujfalusi1-4/+55
TDM support is achieved using DSP transfer mode and setting a programmable offset which specifies where data begins with respect to the frame sync. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Correct and clean up data format and BCLK/WCLK directionPeter Ujfalusi1-9/+9
Use names from the datasheet for the definitions. Correct the data format definitions since they were not correct. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Correct dai format supportPeter Ujfalusi1-14/+15
DSP_A mode require one bit delay from the FS, DSP_B is without data delay. When checking the requested format, also match the bit and fs inversion flag along with the format since it is not possible to change inversion. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-05ASoC: tas2552: Add support for pll and pdm source clock selectionPeter Ujfalusi1-4/+29
Instead of hard wiring the PLL_CLKIN and PDM_CLK to be sourced from BCLK add proper clock configuration via the set_dai_sysclk callback. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Rename mclk parameter to pll_clkin to match with the datasheetPeter Ujfalusi1-7/+7
MCLK is one of the possible source for the pll_clkin frequency. Make this clear by renaming the variable. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Simplify and reverse the functionality of tas2552_sw_shutdownPeter Ujfalusi1-5/+3
The function name and parameters of: tas2552_sw_shutdown(struct tas2552_data *tas_data, int sw_shutdown) implies that if sw_shutdown is 1 we should be entering to the software shutdown mode. The code can be simplified as well within the function. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Simplify the tas2552_mute functionPeter Ujfalusi1-4/+2
Initialize the cfg1_reg to 0 and set the mute bit only when it is needed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Correct CFG1 register bit definitionsPeter Ujfalusi1-7/+7
Remove the _MASK postfix of the bit definitions, collect the CFG1 bit definition in one place and correct the bit shifts at the same time. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Correct PDM configuration register bit definitionsPeter Ujfalusi1-1/+1
The PDM clock can be selected via bit0-1. PDM_DATA_ES bit is at bit2. The code were trying to select BCLK as PDM reference clock but instead it was selecting PLL and set the DATA_ES bit to 1. Selecting the PLL output as reference clock as default does make sense, but the driver should not change the PDM data edge. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-04ASoC: tas2552: Fix kernel crash caused by wrong kcontrol entryPeter Ujfalusi1-1/+0
SOC_DAPM_SINGLE("Playback AMP", ..) should not be under kcontrols. It causes kernel crash (NULL pointer) when the mixers are listed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-06-04ASoC: tas2552: Fix kernel crash when the codec is loaded but not part of a cardPeter Ujfalusi1-0/+3
If the card is not part of any card the tas_data->codec is NULL since it is set only during snd_soc_codec_driver.probe, which is not yet called. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-06-04ASoC: tas2552: Make the enable-gpio really optionalPeter Ujfalusi1-2/+6
Do not fail the probe if the enable-gpio is not specifiedbut handle deferred probe case. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-24ASoC: improve usage of gpiod APIUwe Kleine-König1-10/+3
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions) which appeared in v3.17-rc1, the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output. Simplify drivers accordingly. Also there is an *_optional variant that serves well here. The sematics is slightly changed here by using it as error checking is more strict now: If GPIOLIB is not enabled an error is returned instead of just ignoring the gpio. On one hand this is bad for devices that don't "have" the respective gpio as the driver is failing now. On the other hand there is no means to assert that this gpio is really not needed or if only the driver to control it is not available. The latter is a real reason to fail and so it's defensive to fail here, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-19Merge tag 'pm+acpi-3.19-rc1-2' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull more ACPI and power management updates from Rafael Wysocki: "These are regression fixes (leds-gpio, ACPI backlight driver, operating performance points library, ACPI device enumeration messages, cpupower tool), other bug fixes (ACPI EC driver, ACPI device PM), some cleanups in the operating performance points (OPP) framework, continuation of CONFIG_PM_RUNTIME elimination, a couple of minor intel_pstate driver changes, a new MAINTAINERS entry for it and an ACPI fan driver change needed for better support of thermal management in user space. Specifics: - Fix a regression in leds-gpio introduced by a recent commit that inadvertently changed the name of one of the properties used by the driver (Fabio Estevam). - Fix a regression in the ACPI backlight driver introduced by a recent fix that missed one special case that had to be taken into account (Aaron Lu). - Drop the level of some new kernel messages from the ACPI core introduced by a recent commit to KERN_DEBUG which they should have used from the start and drop some other unuseful KERN_ERR messages printed by ACPI (Rafael J Wysocki). - Revert an incorrect commit modifying the cpupower tool (Prarit Bhargava). - Fix two regressions introduced by recent commits in the OPP library and clean up some existing minor issues in that code (Viresh Kumar). - Continue to replace CONFIG_PM_RUNTIME with CONFIG_PM throughout the tree (or drop it where that can be done) in order to make it possible to eliminate CONFIG_PM_RUNTIME (Rafael J Wysocki, Ulf Hansson, Ludovic Desroches). There will be one more "CONFIG_PM_RUNTIME removal" batch after this one, because some new uses of it have been introduced during the current merge window, but that should be sufficient to finally get rid of it. - Make the ACPI EC driver more robust against race conditions related to GPE handler installation failures (Lv Zheng). - Prevent the ACPI device PM core code from attempting to disable GPEs that it has not enabled which confuses ACPICA and makes it report errors unnecessarily (Rafael J Wysocki). - Add a "force" command line switch to the intel_pstate driver to make it possible to override the blacklisting of some systems in that driver if needed (Ethan Zhao). - Improve intel_pstate code documentation and add a MAINTAINERS entry for it (Kristen Carlson Accardi). - Make the ACPI fan driver create cooling device interfaces witn names that reflect the IDs of the ACPI device objects they are associated with, except for "generic" ACPI fans (PNP ID "PNP0C0B"). That's necessary for user space thermal management tools to be able to connect the fans with the parts of the system they are supposed to be cooling properly. From Srinivas Pandruvada" * tag 'pm+acpi-3.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits) MAINTAINERS: add entry for intel_pstate ACPI / video: update the skip case for acpi_video_device_in_dod() power / PM: Eliminate CONFIG_PM_RUNTIME NFC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM SCSI / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / EC: Fix unexpected ec_remove_handlers() invocations Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()" tracing / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM x86 / PM: Replace CONFIG_PM_RUNTIME in io_apic.c PM: Remove the SET_PM_RUNTIME_PM_OPS() macro mmc: atmel-mci: use SET_RUNTIME_PM_OPS() macro PM / Kconfig: Replace PM_RUNTIME with PM in dependencies ARM / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM sound / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM phy / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM tty / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM spi: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / PM: Do not disable wakeup GPEs that have not been enabled ACPI / utils: Drop error messages from acpi_evaluate_reference() ...
2014-12-13sound / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PMRafael J. Wysocki1-2/+2
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under sound/. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Nicolin Chen <nicoleotsuka@gmail.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Acked-by: Mark Brown <broonie@kernel.org>
2014-11-05ASoC: tas2552: Use table based DAPM setupLars-Peter Clausen1-6/+4
Makes the code a bit cleaner and shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-02ASoC: tas2552: Fix compilation warning for !PM_RUNTIMEThierry Reding1-0/+2
The tas2552_sw_shutdown() function is only used by runtime suspend support, so only build it when necessary. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-08-17ASoC: tas2552: Add DAPM calls for amp and PLLDan Murphy1-20/+48
Add DAPM calls to enable/disable the Class D amp. Also add a DAPM call to turn off the PLL upon the stream completing. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-25ASoC: tas2552: Return proper error for probe error pathsAxel Lin1-2/+4
Return error if devm_regulator_bulk_get() or snd_soc_register_codec() fails. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-21ASoC: tas2552: Fix PM sequencingDan Murphy1-3/+5
In the pm suspend/resume it is better to disable the GPIO after the regmap_cache setting calls so that if the call is interrupted the new reg values will be cached and set on resume. Also add pm_runtime_put in the remove call. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-17ASoC: tas2552: Support TI TAS2552 AmplifierDan Murphy1-0/+540
Support the TI TAS2552 Class D amplifier. The TAS2552 is a high efficiency Class-D audio power amplifier with advanced battery current management and an integrated Class-G boost The device constantly measures the current and voltage across the load and provides a digital stream of this information. Signed-off-by: Dan Murphy <dmurphy@ti.com> Signed-off-by: Mark Brown <broonie@linaro.org>