Commit graph

83 commits

Author SHA1 Message Date
Anatol Pomozov cdab0d4ecc ASoC: rt5677: use 'active low' logic for reset pin
According to the datasheet RESET is active low pin, i.e. system goes to
reset state when pin signal is low.

The previous implementeation was assuming the pin is configured as
'active high' in DTS. Changle the gpio handling code and DTS configuration
to 'active low'.

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-16 10:14:32 +00:00
Mark Brown 428157c1e8 Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc/topic/tegra', 'asoc/topic/tlv' and 'asoc/topic/topology' into asoc-next 2015-08-30 15:57:34 +01:00
Mark Brown cfed47d7b5 Merge remote-tracking branches 'asoc/topic/rt5677', 'asoc/topic/sh', 'asoc/topic/simple', 'asoc/topic/sirf-codec' and 'asoc/topic/spear' into asoc-next 2015-08-30 15:56:44 +01:00
Mark Brown 532161e6cc Merge remote-tracking branches 'asoc/topic/rcar', 'asoc/topic/reg-default', 'asoc/topic/rl6231', 'asoc/topic/rockchip' and 'asoc/topic/rt286' into asoc-next 2015-08-30 15:55:54 +01:00
Mark Brown b18fec9fe4 Merge remote-tracking branches 'asoc/topic/const', 'asoc/topic/cs35l32', 'asoc/topic/cs4265' and 'asoc/topic/cs42l52' into asoc-next 2015-08-30 15:52:59 +01:00
Ben Zhang 7d4d443eb4 ASoC: rt5677: Allow arbitrary block read/write via SPI
Added rt5677_spi_read() and refactored rt5677_spi_write() so that
an arbitrary block in the DSP address space can be read/written
via SPI. For example, this allows us to load an ELF DSP firmware
with sparse sections, and stream audio samples from DSP ring buffer.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Acked-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-25 17:34:30 +01:00
Lars-Peter Clausen 53f28609b0 ASoC: rt5677: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

// <smpl>
@@
declarer name DECLARE_TLV_DB_RANGE;
identifier tlv;
constant x;
@@
-unsigned int tlv[] = {
-	TLV_DB_RANGE_HEAD(x),
+DECLARE_TLV_DB_RANGE(tlv,
	...
-};
+);
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-05 13:23:27 +01:00
Oder Chiou 00a6d6e50f ASoC: Add function "rl6231_get_pre_div" to correct the dmic clock calculation
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-05 10:42:35 +01:00
Axel Lin f8163c8673 ASoC: rt5677: Return error if devm_gpiod_get_optional return ERR_PTR
If devm_gpiod_get_optional() return ERR_PTR, it means something wrong
so request gpio fails. We had better return error in such case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-29 13:56:50 +01:00
Axel Lin f285f16103 ASoC: rt5677: Remove NULL test for desc before gpiod_set_value_cansleep call
It's safe to call gpiod_set_value_cansleep() with NULL desc.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-23 16:46:00 +01:00
Nariman Poushin 8019ff6cfc regmap: Use reg_sequence for multi_reg_write / register_patch
Separate the functionality using sequences of register writes from the
functions that take register defaults. This change renames the arguments
in order to support the extension of reg_sequence to take an optional
delay to be applied after any given register in a sequence is written.
This avoids adding an int to all register defaults, which could
substantially increase memory usage for regmaps with large default tables.

This also updates all the clients of multi_reg_write/register_patch.

Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 22:02:55 +01:00
Krzysztof Kozlowski 1c07a4de5b ASoC: drivers: Drop owner assignment from i2c_driver
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-15 12:50:43 +01:00
Axel Lin 6479304755 ASoC: Constify snd_soc_dai_ops variables
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-15 12:12:46 +01:00
Ben Zhang 9bfde72157 ASoC: rt5677: Switch to use unified device property API
This patch makes the driver use the unified device property API
so that platform data can be provided by Device Tree, ACPI
or board files.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 13:34:03 +01:00
Ben Zhang efd901ee4b ASoC: rt5677: Switch to use descriptor-based gpiod API
This patch makes the driver use the new descriptor-based gpiod API
so that gpio assignment info can be provided by Device Tree, ACPI
or board files.

Signed-off-by: Ben Zhang <benzh@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 13:34:03 +01:00
Jarkko Nikula aa0bcc5c44 ASoC: rt5677: Prefix hexadecimal ID register value with 0x in error print
Make it obvious that unexpected value read from ID register is printed in
hexadecimal.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-06 20:30:16 +01:00
Mark Brown cee77be0ad Merge remote-tracking branches 'asoc/topic/rt5677', 'asoc/topic/samsung' and 'asoc/topic/sgtl5000' into asoc-next 2015-06-05 18:54:59 +01:00
Mark Brown 4b57895522 Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next 2015-06-05 18:54:45 +01:00
Lars-Peter Clausen 6b43c2eb9a ASoC: rt5677: Replace direct snd_soc_codec dapm field access
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-05-20 11:18:32 +01:00
Anatol Pomozov b3b10e99b7 ASoC: rt5677: Add reset-gpio dts option
It allows to configure codec's RESET pin gpio

Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-16 13:13:04 +01:00
Oder Chiou 5220f7fb49 ASoC: rt5677: Add DMIC ASRC detect function
The patch adds DMIC ASRC detect function to dominate whether the DMIC ASRC
enable or not.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-08 17:59:18 +01:00
Mark Brown d839c98f98 Merge remote-tracking branches 'asoc/fix/rt5677', 'asoc/fix/samsung' and 'asoc/fix/tfa9879' into asoc-linus 2015-04-29 13:37:31 +01:00
Bard Liao 16ab6e18c6 ASoC: rt5677: add i2s asrc clk src selection
The ASRC source of i2s are also configurable. We add the selection
in the existing rt5677_sel_asrc_clk_src API.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-29 12:20:26 +01:00
Bard Liao 60a8d62b84 ASoC: rt5677: fixed wrong DMIC ref clock
DMIC clock source is not from codec system clock directly. it is
generated from the division of system clock. And it should be 256 *
sample rate of AIF1.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-04-29 12:19:45 +01:00
Lars-Peter Clausen f4bf8d770b ASoC: Move bias level update to the core
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-04-27 21:34:45 +01:00
Lars-Peter Clausen bd1204cb51 ASoC: Route all bias level updates through the core
Use the new snd_soc_codec_force_bias_level() helper function to invoke the
bias_level callback of a driver instead of calling the callback by hand.
Currently the effect of this is the same, but having all bias level updates
go through a central place will allow us to move more of the bias level
management into the DAPM core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:34:45 +01:00
Bard Liao 74d6ea52ae ASoC: rt5677: add register patch for PLL
The PLL output will be unstable in some cases. We can fix it by
setting some registers.

Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-04-24 11:06:54 +01:00
Oder Chiou c36aa0a192 ASoC: rt5677: add API to select ASRC clock source
This patch defines an API to select the clock source for specified filters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-16 12:02:56 +00:00
Mark Brown 05a25fd53e Merge branch 'fix/rt5677' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-rt5677 2015-03-02 17:25:12 +00:00
Oder Chiou cbca4076d1 ASoC: rt5677: Keep the LDO2 powered while used in the suspend mode
The patch keeps the ldo2 power while the DSP function of "Voice Wake Up" used
in the suspend mode.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-02 17:22:59 +00:00
Oder Chiou ab1f70952f ASoC: rt5677: Add the chip type to distinguish the setting of the clock source
There is only one clock source in the rt5676, so the chip type is added to
distinguish the setting of the clock source in the VAD function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-02 17:22:59 +00:00
Oder Chiou 70068776c4 ASoC: rt5677: Correct the routing paths of that after IF1/2 DACx Mux
The patch corrects the routing paths of that after IF1/2 DACx Mux

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-26 11:06:51 +09:00
Mark Brown e89817d4af Merge remote-tracking branches 'asoc/topic/rockchip', 'asoc/topic/rt5645' and 'asoc/topic/rt5677' into asoc-next 2015-02-04 20:57:17 +00:00
Mark Brown 7a869e108e Merge remote-tracking branch 'asoc/topic/w-codec' into asoc-next 2015-02-04 20:57:06 +00:00
Arnd Bergmann 4c121129c9 ASoC: rt5677: fix SPI dependency
The rt5677 codec has gained code that requires SPI to work correctly,
but there is no provision in Kconfig to prevent the driver from
being used when SPI is disabled or a loadable module, resulting
in this build error:

sound/built-in.o: In function `rt5677_spi_write':
:(.text+0xa7ba0): undefined reference to `spi_sync'
sound/built-in.o: In function `rt5677_spi_driver_init':
:(.init.text+0x253c): undefined reference to `spi_register_driver'

ERROR: "spi_sync" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!
ERROR: "spi_register_driver" [sound/soc/codecs/snd-soc-rt5677-spi.ko] undefined!

This makes the SPI portion of the driver depend on the SPI subsystem,
and disables the function that uses SPI for firmware download if SPI
is disabled. The latter may not be the correct solution, but I could
not come up with a better one.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: af48f1d08a ("ASoC: rt5677: Support DSP function for VAD application")
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-29 11:52:21 +00:00
Mark Brown 8d23dd9c66 Merge branch 'fix/rt5677' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-w-codec 2015-01-27 17:54:24 +00:00
Mark Brown 88343ee38d Merge remote-tracking branches 'asoc/fix/rt5677', 'asoc/fix/simple', 'asoc/fix/ts3a227e', 'asoc/fix/wm8904' and 'asoc/fix/wm8960' into asoc-linus 2015-01-26 11:29:58 +00:00
Lars-Peter Clausen 46f20872bc ASoC: rt5677: Replace w->codec snd_soc_dapm_to_codec(w->dapm)
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>
2015-01-15 11:57:34 +00:00
Oder Chiou 9913b9f549 ASoC: rt5677: Add the slot_width "25" support in the TDM mode
Add the slot_width "25" support in the TDM mode for the Intel platform.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-14 17:19:51 +00:00
Oder Chiou e4b7e6a899 ASoC: rt5677: Use the regmap functions instead of the snd_soc functions
The patch uses the regmap functions instead of the snd_soc functions in some
cases.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-14 17:19:51 +00:00
Oder Chiou bdfbf2550d ASoC: rt5677: Modify the behavior that updates the PLL parameter.
The patch modified the behavior that updates the PLL parameter. It set the
update bit before the PLL power up.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-09 17:18:28 +00:00
Oder Chiou 277880a356 ASoC: rt5677: Add the MICBIAS VDD setting in the platform data
The patch adds the MICBIAS VDD setting in the platform data. It can be set to
1V8 or 3V3 in the MICBIAS VDD.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-08 18:36:02 +00:00
Oder Chiou 38d595e2e0 ASoC: rt5677: Adjust the routing of "PLL1"
Remove the duplicated PLL1 connections of the adc stereo filters,
and remove the PLL1 connections of the DACs because the PLL1 should be
connected to dac filters.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24 12:16:19 +00:00
Oder Chiou 5a8c7c2628 ASoC: rt5677: Add the ASRC support
Add the ASRC support

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24 12:16:19 +00:00
Oder Chiou 6800b5ba15 ASoC: rt5677: Revise the filter powers
Add the filter powers of the dac mono3 and mono4, and remove the connection
of dac stereo1 filter that connect to DAC1 MIX.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24 12:16:19 +00:00
Fang, Yang A 6087fcab7b ASoC: rt5677: fixed rt5677_dsp_vad_put rt5677_dsp_vad_get panic
snd_kcontrol_chip should return snd_soc_component instead of
snd_soc_codec

Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-24 11:56:52 +00:00
Dylan Reid 40e3262e42 ASoC: rt5677: make volume TLV closer to reality
The volume blocks have an step of 0.375dB, but TLV uses 0.01dB for
units.  Only use the resolution supported, ignoring the LSB of the
volume register.  This results in half the steps and 0.75dB per step,
but reports accurate levels through TLV.  Update the masks to reflect
that these are registers have the LSB ignored.

Signed-off-by: Dylan Reid <dgreid@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-05 11:06:56 +00:00
Oder Chiou 6fe17da00b ASoC: rt5677: Fix the issue that the regmap_range "rt5677_ranges" cannot be accessed
After the patch "ASoC: rt5677: Use specific r/w function for DSP mode", the
regmap_range "rt5677_ranges" was not registered in rt5677_regmap_physical, and
it caused that the regmap_range "rt5677_ranges" cannot be accessed by the
specific r/w function. The patch fixes this issue.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25 12:30:37 +00:00
Oder Chiou 683996cb22 ASoC: rt5677: Set the slow charge of the vref in the end of the power sequences
Set the slow charge of the vref in the end of the power sequences

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-19 10:18:05 +00:00
Oder Chiou 35d40d10e9 ASoC: rt5677: Follow the gpio naming rule to rename the irq function
Follow the gpio naming rule to rename the irq function.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-19 10:18:05 +00:00