We need to set left/right control for the speaker amp to get stereo
output on speaker.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sDMA support only transfer elements with 1, 2, and 4 byte physical
size. Initialize the pcm driver accordingly.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
All DAI drivers has been converted to use edma-pcm instead of davinci-pcm
and the driver can be removed from the tree.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The edma-pcm performs as good as the old davinci-pcm and it's use does not
require the 'ping-pong' mode of davinci-pcm, which was introduced to
overcome under/over flow issues when using davinci-pcm.
Keep the SND_DAVINCI_SOC config option to select the SND_EDMA_SOC to avoid
regression in audio support.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The edma-pcm can replace the old davinci-pcm as platform driver.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The edma-pcm can replace the old davinci-pcm as platform driver.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
edma-pcm going to replace davinci-pcm as platform driver for daVinci
platform.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
DMA_BIT_MASK of 64 is not valid dma address mask for OMAPs, it should be
set to 32.
The 64 was introduced by commit (in 2009):
a152ff24b9 ASoC: OMAP: Make DMA 64 aligned
But the dma_mask and coherent_dma_mask can not be used to specify alignment.
Fixes: a152ff24b9 (ASoC: OMAP: Make DMA 64 aligned)
Reported-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The jacks are card level elements so use snd_soc_card_jack_new() instead of
snd_soc_jack_new() to register them.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
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>
The sn95031 driver currently gets the CODEC implicitly from the jack that is
passed to sn95031_jack_detection(). But the codec field is going to be
removed from the snd_soc_jack struct, so refactor things to pass the CODEC
explicitly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch fix spelling typo found in alsa-driver-api.xml.
It is because this file is generated from comments in source files,
I have to fix source files.
Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Move the destructor code to device release callback for the codec
object instead. This is a safer place to release the resources than
dev_free callback in general.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The events that are handled by HD-audio drivers are no frequent and
urgent ones, so we can use the standard workqueue without any problem
nowadays.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This makes the code flow easier -- instead of the controller driver
calling snd_hda_build_pcms() and snd_hda_build_controls() explicitly,
the codec driver itself builds PCMs and controls at probe time. Then
the controller driver only needs to call snd_card_register().
Also, this allows us the full bind/unbind control, too. Even when a
codec driver is bound later, it automatically registers the new PCM
and controls by itself.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now we have all pieces ready, and put them into places:
- add the hda_pcm refcount to azx_pcm_open() and azx_pcm_close(),
- call the most of cleanup code in hda_codec_reset() from the codec
driver remove,
- call the same code also from the hda_codec object free.
Then the codec driver can be unbound more safely now.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Revive snd_device_disconnect() again so that it can be called from the
individual driver. This time, HD-audio will need it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The PCM ops might be set NULL, or cleared to NULL when the driver is
unbound. Give a proper NULL check at each place to be more robust.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So far, the hda_codec object kept the hda_pcm list in an array, and
the codec driver was expected to assign the array. However, this
makes the object life cycle management harder, because the assigned
array is freed at the codec driver detach while it might be still
accessed by the opened streams.
In this patch, we allocate each hda_pcm object dynamically and manage
it as a linked list. Each object has a kref refcount, and both the
codec driver binder and the PCM open/close touches it, so that the
object won't be freed while in use.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The memory allocators should have already given the kernel warning
messages, thus we don't have to annoy again.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Allow the codec object to have an individual card pointer. Not only
this simplifies the redirections in many places, also this will allow
us to make each codec assigned to a different card object.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
snd_hda_build_pcms() does actually three things: let the codec driver
build up hda_pcm list, set the PCM default values, and call the
attach_pcm bus ops for each hda_pcm instance. The former two are
basically independent from the bus implementation, so it'd make the
code a bit more readable.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So userspace can enable and disable the external microphone.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Also adds a control for the pin of the internal mic, so userspace can
apply policy when the state of the external mic jack changes.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
So userspace can enable or disable it based on the current policy.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
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>
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>
When codec is in slave mode, ASRC can suppress noise for asynchronous
MCLK and LRCLK or special I2S format. This patch defines an API to select
the clock source for specified filters. And the codec driver will turn on ASRC
for these filters if ASRC is selected as their clock source.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The previous definition of registers 0x84 and 0x85 doesn't match the datasheet.
So this patch removes the wrong definition and writes a new one for the two
registers.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
System clock is necessary for rt5670 JD function. We assume system
clock source will be set in machine driver. So there are two things
left we should do in codec driver.
1. Set sysclk to codec internal clock in probe since machine driver
may not do that before JD function is registered.
2. Power up PLL once sysclk source is switched to PLL.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch adds runtime PM support on rt5670 codec.
Signed-off-by: Lin Mengdong <mengdong.lin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch set specific data according to dmi data.
Signed-off-by: Jin, Yao <yao.jin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Atmel based boards can now only be used with device tree. Drop non DT
initialization.
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
For received packet stream, the offset of 'RX_SEQ_START' locates after
the offset of 'RX_NUMBER_MIDI', although current macro and proc output
includes wrong offsets.
Fortunately, this bug doesn't affect streaming functionality because
these macro is not used.
This commit fixes these wrong macro and outputs.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The amdtp_stream_wait_callback() doesn't return minus value and
the return code is not for error code.
This commit fixes with a propper condition and an error code.
Fixes: f3699e2c77 ('ALSA: oxfw: Change the way to start stream')
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We leave the pcm field of struct hda_pcm at removal of each device, so
far. This hasn't been a problem since unbinding the codec driver
isn't supposed to happen and another route via snd_hda_codec_reset()
clears all the once. However, for a proper unbind implementation, we
need to care about it.
This patch does the thing above properly:
- Include struct hda_pcm pointer instead of struct hda_pcm_stream
pointers in struct azx_dev. This allows us to point the hda_pcm
object at dev_free callback.
- Introduce to_hda_pcm_stream() macro for better readability.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
So far, we let the controller driver power down the all codecs at the
end of probe. But this can be done better in the codec's dev_register
callback. This results in the reduction of duplicated codes in each
control driver.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now the final bit of runtime PM cleanup: instead of manual
notification of the power up/down of the codec via hda_bus pm_notify
ops, use the standard runtime PM feature.
The child codec device will kick off the runtime PM of the parent
(PCI) device upon suspend/resume automatically. For managing whether
the link can be really turned off, we use the bit flags
bus->codec_powered instead of the earlier bus->power_keep_link_on.
flag. Each codec driver is responsible to set/clear the bit flag, and
the controller device can be turned off only when all these bits are
cleared.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
We used to pass the power_save option value to hda_bus via a given
pointer. This was needed to refer to the value from the HD-audio core
side. However, after the transition to the runtime PM, this is no
longer needed.
This patch drops the power_save value indirection in hda_bus above,
and let the controller driver reprograms the autosuspend value
explicitly by a new helper, snd_hda_set_power_save(). Without this
call, the HD-audio core doesn't set up the autosuspend and flip the
runtime PM. (User may still be able to set up via sysfs, though.)
Along with this change, the pointer argument of azx_bus_create() is
dropped as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch fixes faulty behaviour in a setup where the input clock for the
SRG is fed through the CLKR/CLKX pin but the McBSP is configured to be
master (SND_SOC_DAIFMT_CBS_CFS). In that case of course CLKR/CLKX must
not be configured as output pin. Otherwise the input clock is messed up
horribly.
This patch makes it possible to use the CLKR/CLKX pin rather than CLKS to
inject a reference clock in setups where McBSP is master and not both
rx and tx are used. However for this to work it has to be ensured that
set_dai_sysclk() is called after set_dai_fmt().
This was tested on a beagleboard-xm using McBSP1 to drive a i2s DAC through
the tx lines (CLKX,FSX,DX). Using this patch the CLKR pin is used to inject
an external reference clock.
Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Use the standard naming convention for the codec DAI.
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
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>
The struct dev_pm_ops defines usage_count only when CONFIG_PM is defined. So
we should use this variable only in cases where this falg is true.
So we define a local variable and read the value under this flag. In non PM
cases, we set this to 1.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
A few minor tweaks to make things line up correctly.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
These weren't aligned on the same lines as the surrounding code and the
printk was quite messy.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The indenting here was really whacky and not consistent from one line to
the next. I also reverse the "if (opened)" and "if (tmr_running)" tests
so that I could remove two indent levels.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is essentially a partial revert of the commit [b1920c21102a:
'ALSA: hda - Enable runtime PM on Panther Point']. There was a bug
report showing the HD-audio bus hang during runtime PM on HP Spectre
XT.
Reported-by: Dang Sananikone <dang.sananikone@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Some platforms, e.g. WSB, don't need jack detection when
system is in Suspend, for power save reason.
Here add headphone/mic jack detection disable feature with NULL
jack passed in, when disabled, it will disable interrupt, and
disable LDO1, which is used for jack detection when headphone
is plugged in.
Signed-off-by: Jie Yang <yang.jie@intel.com>
Reviewed-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch adds snd_soc_of_parse_audio_routing() to get dapm routes
configurations via Device Tree.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The current helper functions, snd_soc_of_parse_audio_simple_widgets()
and snd_soc_of_parse_audio_routing(), set dapm_widgets and dapm_routes
without caring if they are already set by using build-in widgets and
routes in the card driver. So there could be one of them, build-in one
or Device Tree one, overrided by the other depending on which one was
assigned later.
This patch adds an extra pair of dapm_widgets and dapm_routes for DT
use only so as to prevent unexpected overriding.
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
When using non-standard rates, a relatively small amount of overclocking
can make a big difference to a number of cases.
- Not all rates are possible to achieve with the PLL, due to divider
restrictions.
- The higher oversampling rates that can be used by the DAC, the
simpler the analog output filters get (mirror frequencies move up,
away from the desired spectrum).
- The more work the DSP can perform per sample, the better.
For standard rates, there is little to gain as everything is
designed just right, and the needed overclocking to make a
real difference would be significant.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Mark Brown <broonie@kernel.org>
It is a bad idea to export static functions. GCC for some platforms
shows errors like:
error: __ksymtab_azx_get_response causes a section type conflict
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The STA32X_AUTO3 is a writable register that currently does not appear
in the regmap ranges(neither read nor write). By adding this register
to the register ranges there is no gap anymore and the existing
register ranges can be joined. This fixes a regression introduced in
commit a1be4cead9 where the driver was
moved to direct regmap usage and the STA32X_AUTO3 register was missed.
That made it impossible to choose the preset EQ mode set through the
STA32X_AUTO3 register.
Fixes: a1be4cead9 (ASoC: sta32x: Convert to direct regmap API usage)
Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Since 39b2bbe3d7 (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>
RT5670_IRQ_CTRL1(0xbd) is a non volatile register. And we need to
restore its value after suspend/resume.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
In our platform we want platform and codec driver routines to get invoked
and don't need the machine routines so remove here
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Thus removing the runtime_resume handler.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This adds support for system pm support. We need to save the dsp memory
which gets lost on suspend and restore that on resume
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
When a PCM draining is performed to an empty stream that has been
already in PREPARED state, the current code just ignores and leaves as
it is, although the drain is supposed to set all such streams to SETUP
state. This patch covers that overlooked case.
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Export 32-bit version of memcpy for use in suspend/resume.
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This adds support for platform suspend and resume. We ensure all pcms are
suspended by invoking snd_soc_suspend() and then stop the DSP
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The driver didn't implement support for pcm stream suspend and resume, so
add it
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This adds missing pcm pause and resume ops in the driver
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The updated firmware expects the MMX ID to be used as 3, so update the
driver as well
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The DSP messages are sent with nonatomic context, which include trigger
messages, so mark the driver as nonatomic
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
ALSA core with commit 257f8cce5d - "ALSA: pcm: Allow nonatomic trigger
operations" allows trigger ops to implemented as nonatomic. For ASoC, we can
specify this in dailinks and is updated while snd_pcm is created
Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
this patch will fix below sparse warnings
warning: incorrect type in argument 2 (different base types) expected
unsigned int [unsigned] val got restricted snd_pcm_format_t [usertype]
<noident>
sound/soc/intel/haswell.c:61:37
sound/soc/intel/broadwell.c:115:37:
sound/soc/intel/bytcr_dpcm_rt5640.c:118:37:
sound/soc/intel/cht_bsw_rt5672.c:183:37:
sound/soc/intel/cht_bsw_rt5645.c:208:37:
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
The manual recommends that we reset the DSP when we suspend so add that in
runtime suspend handler
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The IPC driver saved only IMR register, we need to save the CSR as well, so
add it
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The updated firmware expects the MMX ID to be used as 3, so update the
driver as well
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Like the previous transition of suspend/resume, now move the
power-save code to the standard runtime PM. As usual for runtime PM,
it's a bit tricky, but this simplified codes a lot in the end.
For keeping the usage compatibility, power_save module option still
controls the whole power-saving behavior on all codecs. The value is
translated to pm_runtime_*_autosuspend() and pm_runtime_allow() /
pm_runtime_forbid() calls.
snd_hda_power_up() and snd_hda_power_down() are translated to
pm_runtime_get_sync() and pm_runtime_put_autosuspend(), respectively.
Since we can do call pm_runtime_get_sync() more reliably, the sync
version is used always and snd_hda_power_up_d3wait() is dropped.
Another slight difference is that snd_hda_power_up()/down() don't call
runtime_pm code during the suspend/resume transition phase. Calling
them there isn't safe unlike our own code, resulted in unexpected
behavior (endless wakeups).
The hda_power_count tracepoint was removed, as it doesn't match well
with the new code.
Last but not least, we need to set ignore_children flag in the parent
dev.power field so that the runtime PM of the controller chip won't
get confused. The notification is still done in the bus pm_notify
callback. We'll get rid of this hack in the later patch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This patch moves the suspend/resume mechanisms down to each codec
driver level, as we have a proper codec driver bound on the bus now.
Then we get the asynchronous PM gratis without fiddling much in the
driver level.
As a soft-landing transition, implement the common suspend/resume pm
ops for hda_codec_driver and keep the each codec driver intact. Only
the callers of suspend/resume in the controller side (azx_suspend()
and azx_resume()) are removed.
Another involved place is azx_bus_reset() calling the temporary
suspend and resume as a hackish method of bus reset. The HD-audio
core provide a helper function snd_hda_bus_reset() instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Now we create the standard HD-audio bus (/sys/bus/hdaudio), and bind
the codec driver with the codec device over there. This is the first
step of the whole transition so that the changes to each codec driver
are kept as minimal as possible.
Each codec driver needs to register hda_codec_driver struct containing
the currently existing preset via the new helper macro
module_hda_codec_driver(). The old hda_codec_preset_list is replaced
with this infrastructure. The generic parsers (for HDMI and other)
are also included in the preset with the special IDs to bind
uniquely.
In HD-audio core side, the device binding code is split to
hda_bind.c. It provides the snd_hda_bus_type implementation to match
the codec driver with the given codec vendor ID. It also manages the
module auto-loading by itself like before: when the matching isn't
found, it tries to probe the corresponding codec modules, and finally
falls back to the generic drivers. (The special ID mentioned above is
set at this stage.)
The only visible change to outside is that the hdaudio sysfs entry now
appears in /sys/bus/devices, not as a sound class device.
More works to move the suspend/resume and remove ops will be
(hopefully) done in later patches.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This is a preliminary patch for the hda_bus implementation, removing
the parent device setup to codec device. Since the bus and the class
devices can't be crossed over, leave the sound devices to the default
parent device as is.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
A part of these drivers, especially BeBoB driver, are programmed to wait
some events. Thus the drivers should not destroy any data in .remove()
context.
This commit moves some destructors from 'struct fw_driver.remove()' to
'struct snd_card.private_free()' to shutdown safely.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Currently stream destructor in each driver has a problem to be called in
a context in which sound card object is released, because the destructors
call amdtp_stream_pcm_abort() and touch PCM runtime data.
The PCM runtime data is destroyed in application's context with
snd_pcm_close(), on the other hand PCM substream data is destroyed after
sound card object is released, in most case after all of ALSA character
devices are released. When PCM runtime is destroyed and PCM substream is
remained, amdtp_stream_pcm_abort() touches PCM runtime data and causes
Null-pointer-dereference.
This commit changes stream destructors and allows each driver to call
it after releasing runtime.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
AMDTP helper functions increment/decrement reference counter for an
instance of FireWire unit, while it's complicated for each driver to
process error state.
In previous commit, each driver has the role of reference counting. This
commit removes this role from the helper function.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Fireworks and Dice drivers try to touch instances of FireWire unit after
sound card object is released, while references to the unit is decremented
in .remove(). When unplugging during streaming, sound card object is
released after .remove(), thus Fireworks and Dice drivers causes GPF or
Null-pointer-dereferencing to application processes because an instance of
FireWire unit was already released.
This commit adds reference-counting for FireWire unit in drivers to allow
them to touch an instance of FireWire unit after .remove(). In most case,
any operations after .remove() may be failed safely.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # 3.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
BIOS doesn't seem to set up pins for 5.1 and the SPDIF out, so we need
to give explicitly here.
Reported-and-tested-by: Misan Thropos <misanthropos@gmx.de>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The sign for microsecond (U+0085, MICRO SIGN) was encoded to '0x c2 b5'
by UTF-8 character encoding scheme. But the byte sequence was converted
to '0x c3 82 c2 b5' in a previous commit. As a result, the byte
sequence cannot represent microsecond sign in UTF-8 or ASCII. This
may confuse developers.
This commit replaces the sign to string expression with 'microseconds'
to purge superfluous troubles.
Fixes: 5c697e5b46ef("ALSA: firewire-lib: remove rx_blocks_for_midi quirk")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Here are a few small fix patches for 3.20-rc1:
- Quirks for Denon and Lifecam USB-audio devices and HD-audio
on HP laptops
- A long-time regression fix for HDSP eMADI
- Add missing DRAIN_TRIGGER flag set for ASoC intel-sst
- Trivial fixes for sequencer core and HD-audio Tegra, a LINE6
cleanup
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJU5eAJAAoJEGwxgFQ9KSmkCJEP/RSEuVaDCvWOjq5Z0z2DJe9+
x+zmuaF7NYjAbLFt/ODtlv4xihkDGdiZyi1LPPH69pC57Yzx8mVGxSsjv4DRemWd
W+2mjHqkRV/bt0nQjJfAGiHEGH2ZPHsB74+6nvlVk7UN2VGdcE/6JSkJ67b6e/u8
yY3DUASaSn2xXGIAso7M3gWBdCCAE6qlVyeaP6xhs/VuclqTZHvc7nzg7jh0S0KL
Bfd/clFEaWy0cSoEQfxd7n+o0U+EnuXsIpL0Jg8pXgN7RMv3mBZQT8QSupd/GhNb
IhkIav+xeZyvq+Bw+vV8mbOe11o71K7qNXrVpckzF2C2HaLrLqwcl/U2UcowY4/3
ktbBvxhMwXL+BP2DE/Rz9GqE0WmuaSkQtu9O+L5+cXaMjecHze814v29P6/gq9Z5
pdSGMCI64IJrvKok8Lt2Y262P9oLsD9s4cDTsiZ4ylSXkKYcoXhOGoRWsm+bVp5U
dzjpwKtisk90FGJ2vYbVQHPb1G3QmKo8ibkS9RRbQohblc68HHOSXenVQ2CdrZvg
N1b4klyG6q+Emqt+3SRoZ64Ue1zovN9qVeD45TadHNOmajBhOpHljSowhYbGO5tD
ASxpprtPDBEsogzk/jZfMeeYJf2k0Tejlht4vJ9gtWgKekVQdcuHdnMqV8GKhNde
pJC3zz9K9fUC0LQNoab1
=IYJ7
-----END PGP SIGNATURE-----
Merge tag 'sound-fix-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Here are a few small fix patches for 3.20-rc1:
- Quirks for Denon and Lifecam USB-audio devices and HD-audio on HP
laptops
- A long-time regression fix for HDSP eMADI
- Add missing DRAIN_TRIGGER flag set for ASoC intel-sst
- Trivial fixes for sequencer core and HD-audio Tegra, a LINE6
cleanup"
* tag 'sound-fix-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: usb: Fix support for Denon DA-300USB DAC (ID 154e:1003)
ASoC: Intel: add SNDRV_PCM_INFO_DRAIN_TRIGGER flag
ALSA: usb-audio: Don't attempt to get Lifecam HD-5000 sample rate
ALSA: hda/tegra check correct return value from ioremap_resource
ALSA: hdspm - Constrain periods to 2 on older cards
ALSA: hda - enable mute led quirk for one more hp machine.
ALSA: seq: potential out of bounds in do_control()
ALSA: line6: Improve line6_read/write_data() interfaces
Add missing header files to avoid implicit
declarations and indirect inclusions.
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
The tlv320aic23 codec is selected by the ep93xx snapper platform,
which are missing a dependency on I2C, and that can result in this
build error, as found during randconfig builds:
.../codecs/tlv320aic23-i2c.c: In function 'tlv320aic23_i2c_probe':
.../codecs/tlv320aic23-i2c.c:27:2: error: implicit declaration of function 'i2c_check_functionality' [-Werror=implicit-function-declaration]
if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
^
This adds the missing dependency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
A few sound drivers for the samsung platforms are missing dependencies
on I2C or SPI, which can lead to build errors like
codecs/rt5631.c:1737:1: warning: data definition has no type or storage class
31_i2c_driver);
codecs/rt5631.c:1737:1: error: type defaults to 'int' in declaration of 'module_i2c_driver' [-Werror=implicit-int]
codecs/rt5631.c:1737:1: warning: parameter names (without types) in function declaration
codecs/rt5631.c:1726:26: warning: 'rt5631_i2c_driver' defined but not used [-Wunused-variable]
I have gone through all the ones that did not already have
an I2C dependency and added the ones that I found missing,
namely arndale, odroid-x2, littlemill, bells and speyside
and this patch adds all the dependencies.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Whilst the existing code does correctly round to the next 4-byte boundary
it does so rather inefficiently. This patch changes the rounding to be
simpler and more efficient.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Currently DSP controls are persistent (across DSP On/Off) only
if they were set whilst the DSP is off. This change makes the
controls persistent irrespective of when they are set.
Signed-off-by: Nikesh Oswal <Nikesh.Oswal@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
We need to set left/right control for the speaker amp to get stereo
output on speaker.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Currently, we will configure dmic related pin definition if pdata.dmic_en
is true. However, there is no disable option in the enum. So, any dmic is
used, all 3 dmic related pins will be configured. It may cause unexpected
pin definition. This patch adds a disable item for each dmic enum and
take it as default. So the driver will not set the pin configuration if
we don't set dmicx_data_pin in platform data.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Some codes in snd_pcm_dev_disconnect() are still valid even for
internal PCMs, but they are skipped because of the check of
list_empty(&pcm->list) at the beginning. Remove this check and put
pcm->internal checks appropriately for internal PCM object to process
through this function.
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
An internal PCM object shouldn't be added to the PCM device list, as
it's never accessed directly from the user-space, and it has no proc
or any similar accesses. Currently, it's excluded in snd_pcm_get()
and snd_pcm_next(), but it's easier not to add such an object to the
list.
Actually, the whole snd_pcm_dev_register() can be skipped for an
internal PCM. So this patch changes the code there, but also
addresses the uninitialized list_head access.
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
No real functional change, only take wall clock and system time
in same routine and add accuracy report.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Introduce more generic .get_time_info to retrieve
system timestamp and audio timestamp in single routine.
Backwards compatibility is preserved with same functionality
as with .wall_clock method (to be removed in following commits
to avoid breaking git bisect)
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Let userspace select audio timestamp config, ignore and zero all
other fields
Use audio_tstamp_data to retrieve config and pass report back to
user space
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Let userspace select audio timestamp config when the
STATUS_EXT ioctl is used, ignore and zero all
other fields
No change for the existing STATUS ioctl, parameters
are treated as read-only.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
When the mixer amp is touched by control elements, we don't have to
power up always; if the codec was suspended at the time, we can just
update the amp cache and it's reflected to the hardware upon resume.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
azx_create_codec() function does actually two things: create a bus and
probe codecs. For the future work, split this to two logical
functions, azx_bus_create() and azx_probe_codecs().
Signed-off-by: Takashi Iwai <tiwai@suse.de>