]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agoASoC: fsl_spdif: Fix incorrect usage of regmap_read()
Nicolin Chen [Tue, 6 May 2014 08:41:39 +0000 (16:41 +0800)]
ASoC: fsl_spdif: Fix incorrect usage of regmap_read()

We should not copy the return value into this val since it's supposed to
get the value of the register not the success result of regmap_read().
Thus fix it.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e9b383dc940f4cba6876887ecb47df3082ec925e)

9 years agoASoC: fsl-ssi: Use regmap
Markus Pargmann [Tue, 27 May 2014 08:24:25 +0000 (10:24 +0200)]
ASoC: fsl-ssi: Use regmap

This patch replaces the ssi specific functions write_ssi, read_ssi and
write_ssi_mask by standard regmap function calls.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 432481220101166a0b33dc6f951b38a8af3d281c)

Conflicts:
sound/soc/fsl/Kconfig

9 years agoASoC: fsl-ssi: reorder and document fsl_ssi_private
Markus Pargmann [Tue, 27 May 2014 08:24:24 +0000 (10:24 +0200)]
ASoC: fsl-ssi: reorder and document fsl_ssi_private

Reorder all variables in struct fsl_ssi_private to have groups that make
sense together. The patch also updates the struct documentation.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 737a6b418a83d8de87e0170010dce9fc2399b4e8)

9 years agoASoC: fsl-ssi: Fix baudclock handling
Markus Pargmann [Tue, 27 May 2014 08:24:23 +0000 (10:24 +0200)]
ASoC: fsl-ssi: Fix baudclock handling

The baudclock may be used and set by different streams.

Allow only the first stream to set the bitclock rate. Other streams have
to try to get to the correct rate without modifying the bitclock rate
using the SSI internal clock modifiers.

The variable baudclk_streams is introduced to keep track of the active
streams that are using the baudclock. This way we know if the baudclock
may be set and whether we may enable/disable the clock.

baudclock enable/disable is moved to hw_params()/hw_free(). This way we can
keep track of the baudclock in those two functions and avoid a running
clock while it is not used. As hw_params()/hw_free() may be called
multiple times for the same stream, we have to use baudclk_streams
variable to know whether we may enable/disable the clock.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d429d8e3324cae120784a1e194ef6ea62aeb327e)

9 years agoASoC: fsl-ssi: Set framerate divider correctly for i2s master mode
Sascha Hauer [Tue, 27 May 2014 08:24:22 +0000 (10:24 +0200)]
ASoC: fsl-ssi: Set framerate divider correctly for i2s master mode

In i2s master mode the fsl_ssi driver depends on someone calling
.set_tdm_slot correctly. In this mode though only a DC value of
2 is allowed, so set it in this case and no longer depend on
.set_tdm_slot.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b5dd91b3dcf937ce42583711fe4d679cacdbd2d0)

9 years agoASoC: fsl-ssi: remove unnecessary spinlock
Sascha Hauer [Tue, 27 May 2014 08:24:21 +0000 (10:24 +0200)]
ASoC: fsl-ssi: remove unnecessary spinlock

The baudclock_locked variable is only used in functions which
are serialized anyway from the core. No need to have a lock
around the variable, so remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit d8ced4793f3f114fa82fb423b71c2899caf8b7b0)

9 years agoASoC: fsl-ssi: set bitclock in master mode from hw_params
Sascha Hauer [Tue, 27 May 2014 08:24:20 +0000 (10:24 +0200)]
ASoC: fsl-ssi: set bitclock in master mode from hw_params

The fsl_ssi driver uses the .set_sysclk callback to configure the
bitclock for master mode. This is unnecessary since the bitclock
is known in hw_params. This patch configures the bitclock from .hw_params.
.set_dai_sysclk now sets a bitclock frequency which is preferred over
the default calculated bitclock frequency.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 8dd51e23a1ef3b5f22eeff4827260b75bafba620)

9 years agoASoC: fsl-ssi: make fsl,mode property optional
Markus Pargmann [Tue, 27 May 2014 08:24:19 +0000 (10:24 +0200)]
ASoC: fsl-ssi: make fsl,mode property optional

The simple soundcard binding has its own way for specifying the dai
format. To be able to use this binding we have to make the fsl,mode
property optional. As the property is used in existing devicetrees
keep the option around for compatibility reasons.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 85e59af24056ca7ffaf617cf6201c519e31dc668)

9 years agoASoC: fsl-ssi: introduce SoC specific data
Sascha Hauer [Tue, 27 May 2014 08:24:18 +0000 (10:24 +0200)]
ASoC: fsl-ssi: introduce SoC specific data

Introduce a SoC data struct which contains the differences between
the different SoCs this driver supports. This makes it easy to support
more differences without having to introduce a new switch/case each
time.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit fcdbadef378bc9cc64cb8cbfd96c23fc15812923)

9 years agoASoC: fsl_ssi: Add suspend/resume support
Fabio Estevam [Fri, 23 May 2014 05:38:56 +0000 (02:38 -0300)]
ASoC: fsl_ssi: Add suspend/resume support

Doing a suspend/resume sequence while playing an audio track in the backgroung
causes broken audio right after resume:

root@freescale /$ aplay clarinet.wav &

root@freescale /home$ Playing WAVE 'clarinet.wav' : Signed 16 bit Little Endian,
 Rate 44100 Hz, Mono

root@freescale /home$ echo mem > /sys/power/state
PM: Syncing filesystems ... done.
Freezing user space processes ... (elapsed 0.002 seconds) done.
Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
Suspending console(s) (use no_console_suspend to debug)
PM: suspend of devices complete after 37.082 msecs
PM: suspend devices took 0.040 seconds
PM: late suspend of devices complete after 4.234 msecs
PM: noirq suspend of devices complete after 4.618 msecs
Disabling non-boot CPUs ...
PM: noirq resume of devices complete after 4.013 msecs
PM: early resume of devices complete after 4.000 msecs
PM: resume of devices complete after 68.907 msecs
PM: resume devices took 0.070 seconds
Restarting tasks ... Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
Suspended. Trying resume. Failed. Restarting stream. Done.
....

Add SNDRV_PCM_TRIGGER_RESUME/SUSPEND cases so that we can gracefully handle
system suspend/resume.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b20e53a826a7adc3bfd2772bd49a83b6f21b4cce)

9 years agoASoC: fsl-ssi: Move fsl_ssi_set_dai_sysclk above fsl_ssi_hw_params
Sascha Hauer [Mon, 28 Apr 2014 10:54:52 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Move fsl_ssi_set_dai_sysclk above fsl_ssi_hw_params

fsl_ssi_set_dai_sysclk will be called from fsl_ssi_hw_params in the
next patch. Move up to avoid forward declaration and to keep the next patch
more readable. No functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ee9daad4953418ecf28a6b0b920f982fe0c24814)

9 years agoASoC: fsl-ssi: Transmit enable synchronization
Markus Pargmann [Mon, 28 Apr 2014 10:54:51 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Transmit enable synchronization

When the fsl-ssi unit is used in i2s slave mode, it is possible that the
SSI unit starts transmitting data on the wrong channel. This happens
because the SSI does not synchronize with the left-right-clock by
default.

This patch enables transmit enable synchronization.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 504894799fa122822f5c48be2968e04d3f1af8e8)

9 years agoASoC: fsl-ssi: Remove unnecessary variables from ssi_private
Markus Pargmann [Mon, 28 Apr 2014 10:54:48 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Remove unnecessary variables from ssi_private

There are some variables defined in struct fsl_ssi_private that describe
states that are also described by other variables.

This patch adds some helper functions that return exactly the same
information based on available variables. This helps to clean up struct
fsl_ssi_private and remove them from the probe function.

It also removes some not really used variables (new_binding, name).

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 171d683d2ac4ab6f220cc99de08ef9ec2c039966)

9 years agoASoC: fsl-ssi: Cleanup probe function
Markus Pargmann [Mon, 28 Apr 2014 10:54:47 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Cleanup probe function

Reorder the probe function to be able to move the second imx-specific
block to the seperate imx probe function. The patch also removes some
comments/variables/code that are not used anymore or could be simply
replaced by other variables.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4d9b7926f2ce271e0670cf0e7131a0e2a686690a)

9 years agoASoC: fsl-ssi: Remove useless DMA code
Markus Pargmann [Mon, 28 Apr 2014 10:54:46 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Remove useless DMA code

Simplify dma DT property handling. fsl,ssi-dma-events is not used
anymore. It passes invalid data to imx_pcm_dma_params_init_data() which
copies some data into an imx dma struct. This struct is never used in
imx-dma or imx-sdma because of generic OF DMA handling. The
"fsl,ssi-dma-events" is not used anywhere in dts files.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ed0f1604e93c686d8151c5a9bcbe36a2986caf40)

9 years agoASoC: fsl-ssi: Move imx-specific probe to seperate function
Markus Pargmann [Mon, 28 Apr 2014 10:54:45 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Move imx-specific probe to seperate function

Move imx specific probe code to a seperate function. It reduces the
size of the probe() function and makes the code and error handling
easier to understand.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 49da09e26577702516e946ecd537f50b87533315)

9 years agoASoC: fsl-ssi: Use dev_name for DAI driver struct
Markus Pargmann [Mon, 28 Apr 2014 10:54:44 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Use dev_name for DAI driver struct

Instead of creating a name using string manipulation functions, we can
simply use the device name for the DAI driver struct.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2a1d102de40a799072309d4d84fa6f214c5ee999)

9 years agoASoC: fsl-ssi: Move debugging to seperate file
Markus Pargmann [Mon, 28 Apr 2014 10:54:43 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Move debugging to seperate file

Move all code that is only used for debugging to a seperate file. This
makes it easier to see what functions are used for debugging only.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit f138e6212427d0ea6283e07b706823b657ddf14f)

9 years agoASoC: fsl-ssi: Fix register values when disabling
Markus Pargmann [Mon, 28 Apr 2014 10:54:42 +0000 (12:54 +0200)]
ASoC: fsl-ssi: Fix register values when disabling

The bits we have to clear when disabling are different when the other
stream is still active.

This patch fixes the calculation of new register values after disabling
one stream. It also adds a more detailed description of the new register
value calculation.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Tested-By: Michael Grzeschik <mgr@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 65c961cc59345fa347173e5a1f5866bc866fd626)

9 years agoASoC: fsl_esai: Bypass divider settings if clock requirement is not changed
Nicolin Chen [Tue, 6 May 2014 08:56:01 +0000 (16:56 +0800)]
ASoC: fsl_esai: Bypass divider settings if clock requirement is not changed

We don't need to change those dividers if bclk and mclk remains the same
directions and values.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit f975ca46f634660a52d8c815b465258ae9bce3b7)

9 years agoASoC: fsl_esai: Set PCRC and PRRC registers at the end of hw_params()
Nicolin Chen [Tue, 6 May 2014 08:56:02 +0000 (16:56 +0800)]
ASoC: fsl_esai: Set PCRC and PRRC registers at the end of hw_params()

According to Reference Manual -- ESAI Initialization chapter, as the
standard procedure of ESAI personal reset, the PCRC and PRRC registers
should be remained in its reset value and then configured after T/RCCR
and T/RCR configurations's done but before TE/RE's enabling.

So this patch moves PCRC and PRRC settings to the end of hw_params().

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 4f8210f66e5a200c63770ea9445ff913a28a3be2)

9 years agoASoC: fsl_esai: Only bypass sck_div for EXTAL source
Nicolin Chen [Tue, 6 May 2014 08:56:00 +0000 (16:56 +0800)]
ASoC: fsl_esai: Only bypass sck_div for EXTAL source

ESAI can only output EXTAL clock source directly. But for FSYS clock source,
ESAI can not output it without getting through PSR PM dividers.

So this patch adds an extra check in the code.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 57ebbcafab0ce8cce4493c6a243ecdd7066e6ef1)

9 years agoASoC: fsl_esai: Fix incorrect condition within ratio range check for FP
Nicolin Chen [Tue, 6 May 2014 08:55:59 +0000 (16:55 +0800)]
ASoC: fsl_esai: Fix incorrect condition within ratio range check for FP

The range here from 1 to 16 is confined to FP divider only while the
sck_div indicates if the calculation contains PSR and PM dividers. So
for the case using PSR and PM since the sck_div is true, the range of
ratio would simply become bigger than 16.

So this patch fixes the condition here and adds one line comments to
make the purpose here clear.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 89e47f62cf3eea7ad5e3d7d72ea846be37d6e352)

9 years agoASoc: fsl_spdif: Add descriptions for fsl_spdif_priv
Nicolin Chen [Wed, 30 Apr 2014 10:54:09 +0000 (18:54 +0800)]
ASoc: fsl_spdif: Add descriptions for fsl_spdif_priv

Other people would clearly understand each member and improve if they want.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b8a832a0b667d48642c495af17b19443208dd09e)

9 years agoASoC: fsl_spdif: Print actual sample rate for debug
Nicolin Chen [Wed, 30 Apr 2014 10:54:08 +0000 (18:54 +0800)]
ASoC: fsl_spdif: Print actual sample rate for debug

People would simply know what the driver gets the best for the current
sample rate playback.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 527cda78eb601b0ad303dc4999811731eff5560e)

9 years agoASoC: fsl_spdif: Add sysclk df support to derive txclk from sysclk
Nicolin Chen [Wed, 30 Apr 2014 10:54:07 +0000 (18:54 +0800)]
ASoC: fsl_spdif: Add sysclk df support to derive txclk from sysclk

The sysclk is one the clock sources that could be selected to derive
tx clock. But the route for sysclk is a bit different that it does
not only contain txclk df divider but also have an extra sysclk df.

So this patch mainly adds syclk df configuration support so as to
let the driver be able to get clock from sysclk.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 27c647bff20c6883dd0b4e3fc24c3d414a9e192a)

9 years agoASoC: fsl_spdif: Rename all _div to _df
Nicolin Chen [Wed, 30 Apr 2014 10:54:06 +0000 (18:54 +0800)]
ASoC: fsl_spdif: Rename all _div to _df

We should have used _df by following the reference manual at the beginning.
So this patch just renames them.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e41a4a79af5cad172971af8681292af33496b119)

9 years agoASoC: fsl_spdif: Use clk_set_rate() for spdif root clock only
Nicolin Chen [Wed, 30 Apr 2014 10:54:05 +0000 (18:54 +0800)]
ASoC: fsl_spdif: Use clk_set_rate() for spdif root clock only

The clock mux for the Freescale S/PDIF controller has eight clock sources
while most of them are from other moudles and even system clocks that do
not allow a rate-changing operation.

So we here only allow the clk_set_rate() and clk_round_rate() happened to
spdif root clock, the private clock for S/PDIF controller.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 9c6344b3fa547ce7ec78da95134d92d9f9309b31)

9 years agoASoC: fsl: select SND_SOC_IMX_PCM_DMA where needed
Arnd Bergmann [Tue, 29 Apr 2014 19:36:22 +0000 (21:36 +0200)]
ASoC: fsl: select SND_SOC_IMX_PCM_DMA where needed

Since commit 204dec93eaa "ASoC: fsl: Allow to select individual common
options", it is possible to enable SND_SOC_FSL_SSI and SND_SOC_FSL_SPDIF
manually, either as loadable modules or built-in. This unfortunately
leads to a link error if one or both of them are built-in, while
the imx-pcm-dma framework is a loadable module:

sound/built-in.o: In function `fsl_ssi_probe':
:(.text+0x51fb8): undefined reference to `imx_pcm_dma_init'
sound/built-in.o: In function `fsl_spdif_probe':
:(.text+0x52e20): undefined reference to `imx_pcm_dma_init'

This changes Kconfig to prevent this case by using 'select' to turn
on the imx-pcm-dma code from both drivers. For consistency, we also
turn on the imx-pcm-fiq code, which is an alternative to the dma
implementation.

Note that imx-pcm-fiq is platform dependent, so we must not enable
that unless we are building a kernel for i.MX. Note also the
"if SND_IMX_SOC != n" syntax as opposed to the normal "if SND_IMX_SOC".
This is needed to avoid turning on the options as 'm' if 'SND_IMX_SOC'
is a module.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 31ee2bfd724ab1fa2fba6472a071bca5e9132139)

9 years agoASoC: fsl: Allow to select ESAI device individually
Nicolin Chen [Mon, 16 Jun 2014 11:56:15 +0000 (19:56 +0800)]
ASoC: fsl: Allow to select ESAI device individually

This will be useful for out-of-tree drivers since in-tree drivers
could select it automatically.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 40e3b934be0e0e04da3b56093958389d5c325c18)

Conflicts:
sound/soc/fsl/Kconfig

9 years agoASoC: fsl: Allow to select SAI device individually
Xiubo Li [Wed, 30 Apr 2014 10:10:05 +0000 (18:10 +0800)]
ASoC: fsl: Allow to select SAI device individually

This will be useful for out-of-tree drivers since in-tree drivers
could select it automatically.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b71fc4e6c9eb1b5ce1c0861825835da273367104)

9 years agoASoC: fsl_spdif: Fix clock source for rxclk rate measurement
Nicolin Chen [Mon, 28 Apr 2014 15:07:51 +0000 (23:07 +0800)]
ASoC: fsl_spdif: Fix clock source for rxclk rate measurement

The rxclk rate actually uses sysclk, ipg clock for example, as its
reference clock to calculate it. But the driver currently doesn't
pass a correct clock source. So fix it.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 0b8643900a1bff32ad8bf17ef1f5d57b6d490502)

9 years agoASoC: fsl: Drop formats limitation for imx-pcm-dma.c
Nicolin Chen [Thu, 24 Apr 2014 11:33:07 +0000 (19:33 +0800)]
ASoC: fsl: Drop formats limitation for imx-pcm-dma.c

Now ASoC core is getting the intersection of supported formats not only
from CPU and CODEC dai's but also from DMA's. However, there should be
no specific width limitation from SDMA side.

So drop it. Otherwise, we would only support S16_LE format for all i.MX
platforms.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e9ffb5ba4de17f14ca592e06a397c85541a72c7d)

9 years agoASoC: fsl_spdif: Add core clock control for DMA access
Nicolin Chen [Thu, 24 Apr 2014 10:52:24 +0000 (18:52 +0800)]
ASoC: fsl_spdif: Add core clock control for DMA access

Regmap is able to enable/disable the core clock automatically each time
it's going to access the registers. But for DMA cases during playback or
recording, it's totally beyong control of regmap. So we have to open the
clock manually.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 08f7336e6404698158966d0c8a2937d3580e2693)

9 years agoASoC: imx-audmux: Fix section mismatch
Lars-Peter Clausen [Thu, 24 Apr 2014 06:25:56 +0000 (08:25 +0200)]
ASoC: imx-audmux: Fix section mismatch

audmux_debugfs_init() is marked as __init, but is called from imx_audmux_probe()
which is not marked as __init. This creates a section mismatch and a potential
runtime crash (if imx_audmux_probe() is called after the .init section was
dropped). This patch removes the __init annotation from audmux_debugfs_init(),
which fixes the following warning:
WARNING: sound/soc/built-in.o(.text+0x86960): Section mismatch in reference
from the function imx_audmux_probe() to the function
.init.text:audmux_debugfs_init()

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b8909783a22b4f169ade830e0aa6dafe313426f1)

9 years agoASoC: fsl_spdif: Fix wrong OFFSET of STC_SYSCLK_DIV
Nicolin Chen [Fri, 18 Apr 2014 09:32:08 +0000 (17:32 +0800)]
ASoC: fsl_spdif: Fix wrong OFFSET of STC_SYSCLK_DIV

It should use STC_SYSCLK_DIV_OFFSET. Thus fix it.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 6ae6698276ca36f37afc2ad38054092021519ad4)

9 years agoASoC: fsl: Add explicit include of of.h
Mark Brown [Tue, 15 Apr 2014 11:02:02 +0000 (12:02 +0100)]
ASoC: fsl: Add explicit include of of.h

Hopefully fixing a build failure reported by Stephen Rothwell - though
quite why the other OF headers don't include this as well I'm not sure.

Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 9c72a04ca78606bf10211efa93b3332c710afc65)

9 years agoASoC: fsl_sai: Use FSL_SAI_xXR() and regmap_update_bits() to simplify code
Nicolin Chen [Fri, 11 Apr 2014 10:30:09 +0000 (18:30 +0800)]
ASoC: fsl_sai: Use FSL_SAI_xXR() and regmap_update_bits() to simplify code

By doing this, the driver can drop around 50 lines and become neater.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2a266f8b2ae790454edb79cb8c707c9305e0307a)

9 years agoASoC: spdif: Add VF610+ compatibles support.
Xiubo Li [Fri, 4 Apr 2014 07:10:29 +0000 (15:10 +0800)]
ASoC: spdif: Add VF610+ compatibles support.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 1014fad0fca91181acc68396d84573e4ae301380)

9 years agoASoC: esai: Add VF610+ compatibles support.
Xiubo Li [Fri, 4 Apr 2014 07:10:28 +0000 (15:10 +0800)]
ASoC: esai: Add VF610+ compatibles support.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit b21cc2f5fdfe22429501cd7040db0b2b2a9b29de)

9 years agoASoC: spdif: Sort the header files alphabetically.
Xiubo Li [Fri, 4 Apr 2014 07:10:27 +0000 (15:10 +0800)]
ASoC: spdif: Sort the header files alphabetically.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit add180ed780e9031d65e7c94cad936e719401acf)

9 years agoASoC: esai: use the precise definition of 'ret'.
Xiubo Li [Fri, 4 Apr 2014 07:10:26 +0000 (15:10 +0800)]
ASoC: esai: use the precise definition of 'ret'.

Use the precise definition of 'ret', which will be used for
the error check.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 3e185238a37d1f0a37a1d910344cdcff578bf333)

9 years agoASoC: fsl_sai: Fix incorrect condition check in trigger()
Nicolin Chen [Fri, 11 Apr 2014 14:10:00 +0000 (22:10 +0800)]
ASoC: fsl_sai: Fix incorrect condition check in trigger()

Patch ASoC: fsl_sai: Fix buggy configurations in trigger() doesn't entirely
fix the condition: FRDE of the current substream direction is being cleared
while the code is still using the non-updated one.

Thus this patch fixes this issue by checking the opposite one's FRDE alone
since the current one's is absolutely disabled.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit f84526cfae46672308a361333c76b724384b61ee)

9 years agoASoC: fsl-ssi: Fix i2s_mode variable setup
Markus Pargmann [Sat, 15 Mar 2014 12:44:10 +0000 (13:44 +0100)]
ASoC: fsl-ssi: Fix i2s_mode variable setup

In fsl_ssi_hw_params() we update the I2S and NET bits using the i2s_mode
variable. The fsl_ssi_set_dai_fmt() function only writes the i2s-mode to
the i2s_mode variable and not the NET bit. This fixes it by adding that
bit to i2s_mode.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 07a28dbe7ad8e72868239450ff796c90e621d46f)

9 years agoASoC: fsl-ssi: Remove fsl_ssi_setup
Markus Pargmann [Sat, 15 Mar 2014 12:44:09 +0000 (13:44 +0100)]
ASoC: fsl-ssi: Remove fsl_ssi_setup

fsl_ssi_set_dai_fmt() manages most of the register setup routines now.
fsl_ssi_setup() makes the same as fsl_ssi_set_dai_fmt() but it relies on
DT properties.

In most cases the settings of fsl_ssi_setup() are already overwritten by
fsl_ssi_set_dai_fmt() when it is called by the soc-core when a sound
card is added. As these settings depend on the combination of codec and
cpu DAI, this should really be done by sound cards.

This patch removes fsl_ssi_setup() and adds the missing register setups
to fsl_ssi_set_dai_fmt(). It also removes all calls to fsl_ssi_setup().

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 2b0db996ba2d9b833c2bd2d73cbf301abe11c60e)

9 years agoASoC: fsl_sai: Add clock controls for SAI
Nicolin Chen [Thu, 10 Apr 2014 15:26:15 +0000 (23:26 +0800)]
ASoC: fsl_sai: Add clock controls for SAI

The SAI mainly has the following clocks:
  bus clock
    control and configure registers and to generate synchronous
    interrupts and DMA requests.

  mclk1, mclk2, mclk3
    to generate the bit clock when the receiver or transmitter is
    configured for an internally generated bit clock.

So this patch adds these clocks and their clock controls to the driver.

[ To concern the old DTB cases, I've added a bit of extra code to make
  the driver compatible with them. And by marking clock NULL if failed
  to get, the clk_prepare() or clk_get_rate() would easily return 0
  so no further path should be broken. -- by Nicolin ]

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ca3e35c7a37cb59b12a1839d03c621cf8fa9a3d9)

9 years agoASoC: fsl_sai: Add imx6sx platform support
Nicolin Chen [Tue, 1 Apr 2014 11:34:09 +0000 (19:34 +0800)]
ASoC: fsl_sai: Add imx6sx platform support

The next coming i.MX6 Solo X SoC also contains SAI module while we use
imp_pcm_init() for i.MX platform.

So this patch adds one compatible route for imx6sx and updates the DT
doc accordingly.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit c754064453e0d48043bd6a111f5c1f8ef1b75f7e)

9 years agoASoC: fsl_sai: Separately enable interrupts for Tx and Rx streams
Nicolin Chen [Tue, 1 Apr 2014 03:17:07 +0000 (11:17 +0800)]
ASoC: fsl_sai: Separately enable interrupts for Tx and Rx streams

We only enable one side interrupt for each stream since over/underrun
on the opposite stream would be resulted from what we previously did,
enabling TERE but remaining FRDE disabled, even though the xrun on the
opposite direction will not break the current stream.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 8abba5d64835c636d97ac0009ab7430ed832cb93)

9 years agoASoC: fsl_sai: Fix buggy configurations in trigger()
Nicolin Chen [Tue, 1 Apr 2014 03:17:06 +0000 (11:17 +0800)]
ASoC: fsl_sai: Fix buggy configurations in trigger()

The current trigger() has two crucial problems:
1) The DMA request enabling operations (FSL_SAI_CSR_FRDE) for Tx and Rx are
   now totally exclusive: It would fail to run simultaneous Tx-Rx cases.
2) The TERE disabling operation depends on an incorrect condition -- active
   reference count that only gets increased in snd_pcm_open() and decreased
   in snd_pcm_close(): The TERE would never get cleared.

So this patch overwrites the trigger function by following these rules:
A) We continue to support tx-async-while-rx-sync-to-tx case alone, which's
   originally limited by this fsl_sai driver, but we make the code easy to
   modify for the further support of the opposite case.
B) We enable both TE and RE for PLAYBACK stream or CAPTURE stream but only
   enabling the DMA request bit (FSL_SAI_CSR_FRDE) of the current direction
   due to the requirement of SAI -- For tx-async-while-rx-sync-to-tx case,
   the receiver is enabled only when both the transmitter and receiver are
   enabled.

Tested cases:
a) aplay test.wav -d5
b) arecord -r44100 -c2 -fS16_LE test.wav -d5
c) arecord -r44100 -c2 -fS16_LE -d5 | aplay
d) (aplay test2.wav &); sleep 1; arecord -r44100 -c2 -fS16_LE test.wav -d1
e) (arecord -r44100 -c2 -fS16_LE test.wav -d5 &); sleep 1; aplay test.wav -d1

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e6b398465821fb8e08d208bd4ef2b5b73ce87b58)

9 years agoASoC: fsl_sai: Improve fsl_sai_isr()
Nicolin Chen [Fri, 28 Mar 2014 11:39:25 +0000 (19:39 +0800)]
ASoC: fsl_sai: Improve fsl_sai_isr()

This patch improves fsl_sai_isr() in these ways:
1, Add comment for mask fetching code.
2, Return IRQ_NONE if the IRQ is not for the device.
3, Use regmap_write() instead of regmap_update_bits().

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 413312aa17ceefe7003ad690778ab72f023128f0)

9 years agoASoC: fsl: Allow to select individual common options
Alexander Shiyan [Sun, 16 Mar 2014 04:21:35 +0000 (08:21 +0400)]
ASoC: fsl: Allow to select individual common options

This patch allow to select individual common sound options and
as a result allow using sound cards/codecs based on DT description.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 204dec93eaaba3a7afdc09aa3c3f6d08c773a367)

9 years agoASoC: fsl: Separation of the main audio options and boards
Alexander Shiyan [Sun, 16 Mar 2014 04:21:34 +0000 (08:21 +0400)]
ASoC: fsl: Separation of the main audio options and boards

This patch provide separation of the main audio options and boards.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit eba9e06f0ceb2ea3342e72577b244d8b02645396)

9 years agoASoC: fsl_sai: Fix Bit Clock Polarity configurations
Nicolin Chen [Fri, 4 Apr 2014 07:09:47 +0000 (15:09 +0800)]
ASoC: fsl_sai: Fix Bit Clock Polarity configurations

The BCP bit in TCR4/RCR4 register rules as followings:
  0 Bit clock is active high with drive outputs on rising edge
    and sample inputs on falling edge.
  1 Bit clock is active low with drive outputs on falling edge
    and sample inputs on rising edge.

For all formats currently supported in the fsl_sai driver, they're exactly
sending data on the falling edge and sampling on the rising edge.

However, the driver clears this BCP bit for all of them which results click
noise when working with SGTL5000 and big noise with WM8962.

Thus this patch corrects the BCP settings for all the formats here to fix
the nosie issue.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ef33bc3217c7aa9868f497c4f797cc50ad3ce357)

9 years agoASoC: fsl_sai: Add isr to deal with error flag
Nicolin Chen [Thu, 27 Mar 2014 11:06:59 +0000 (19:06 +0800)]
ASoC: fsl_sai: Add isr to deal with error flag

It's quite cricial to clear error flags because SAI might hang if getting
FIFO underrun during playback (I haven't confirmed the same issue on Rx
overflow though).

So this patch enables those irq and adds isr() to clear the flags so as to
keep playback entirely safe.

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit e2681a1bf5ae053426a6c5c1daaed17b2f95efe6)

9 years agoASoC: fsl-sai: Add SND_SOC_DAIFMT_DSP_A/B support.
Xiubo Li [Thu, 27 Feb 2014 00:45:01 +0000 (08:45 +0800)]
ASoC: fsl-sai: Add SND_SOC_DAIFMT_DSP_A/B support.

o Add SND_SOC_DAIFMT_DSP_A support.
o Add SND_SOC_DAIFMT_DSP_B support.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit a3f7dcc9cc0392528bff75b17adfcd74fb8a0ecd)

9 years agoASoC: fsl-sai: fix Freescale SAI DAI format setting.
Xiubo Li [Tue, 25 Feb 2014 09:54:51 +0000 (17:54 +0800)]
ASoC: fsl-sai: fix Freescale SAI DAI format setting.

o Fix some bugs of fsl_sai_set_dai_fmt_tr().
o Add SND_SOC_DAIFMT_LEFT_J support.
o Add SND_SOC_DAIFMT_CBS_CFM support.
o Add SND_SOC_DAIFMT_CBM_CFS support.
o And SND_SOC_DAIFMT_RIGHT_J need to be done in the future.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 13cde090030c7d00e991c85b87c12891cc8e4df4)

9 years agoASoC: fsl: imx-pcm-fiq: Remove unneeded 'out' label
Fabio Estevam [Mon, 24 Feb 2014 03:20:43 +0000 (00:20 -0300)]
ASoC: fsl: imx-pcm-fiq: Remove unneeded 'out' label

Instead of jumping to the 'out' label, just return the error code immediately.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit ea9f8535a46d3753649b6e28f47e3109ca63284a)

9 years agoASoC: fsl-esai: big-endian support
Xiubo Li [Tue, 11 Feb 2014 07:42:49 +0000 (15:42 +0800)]
ASoC: fsl-esai: big-endian support

For most platforms, the CPU and ESAI device is in the same endianess
mode. While for the LS1 platform, the CPU is in LE mode and the ESAI
is in BE mode.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit eaba603fc7c6281908c316d9e58de688943d58be)

9 years agoASoC: fsl-spdif: big-endian support
Xiubo Li [Tue, 11 Feb 2014 07:42:48 +0000 (15:42 +0800)]
ASoC: fsl-spdif: big-endian support

For most platforms, the CPU and SPDIF device is in the same endianess
mode. While for the LS1 platform, the CPU is in LE mode and the SPDIF
is in BE mode.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 86f28d76435b619bd0bc5f6fde2803a5bc27ca24)

9 years agoASoC: fsl_esai: Check the return value from clk_prepare_enable()
Fabio Estevam [Mon, 10 Feb 2014 18:01:28 +0000 (16:01 -0200)]
ASoC: fsl_esai: Check the return value from clk_prepare_enable()

clk_prepare_enable() may fail, so let's check its return value and propagate it
in the case of error.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 33529ec94f7cb25f6c98908eefde42a1e8d4e67a)

9 years agoASoC: fsl: make sure the regmap-mmio is actually enabled
Xiubo Li [Tue, 11 Feb 2014 02:47:04 +0000 (10:47 +0800)]
ASoC: fsl: make sure the regmap-mmio is actually enabled

Since the Freescale SAI, ESAI and SPDIF are using the regmap-mmio,
there needs a select of REGMAP_MMIO in the Kconfig to ensure that
regmap-mmio is actually enabled.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 7d150c60f1a29c62e115e0ee2a5678400e724873)

9 years agoASoC: fsl-sai: convert to use regmap API for Freeacale SAI
Xiubo Li [Sat, 8 Feb 2014 06:38:28 +0000 (14:38 +0800)]
ASoC: fsl-sai: convert to use regmap API for Freeacale SAI

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 78957fc349bcf29d415a649601581a993ff25e4d)

9 years agoASoC: fsl: use snd_soc_dai_init_dma_data()
Xiubo Li [Mon, 20 Jan 2014 07:27:26 +0000 (15:27 +0800)]
ASoC: fsl: use snd_soc_dai_init_dma_data()

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 05cf482d7e76bb02138d6b04a94375bc9f86e927)

9 years agoASoC: cs42xx8: Do not use rtd->codec
Lars-Peter Clausen [Mon, 19 May 2014 06:03:03 +0000 (08:03 +0200)]
ASoC: cs42xx8: Do not use rtd->codec

rtd->codec does not necessarily point to the CODEC instance for which the
callback was called (e.g. for CODEC<->CODEC or multi-CODEC links). Use
dai->codec instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 5958de23edc4148a07a75abf7216a8426b8e199b)

9 years agoASoC: cs42xx8: Check return value of regmap_read and report correct chipid value
Axel Lin [Fri, 4 Apr 2014 03:04:35 +0000 (11:04 +0800)]
ASoC: cs42xx8: Check return value of regmap_read and report correct chipid value

Fix checking return value of regmap_read().
Also fix reporting the chip_id value. CS42XX8_CHIPID_CHIP_ID_MASK is 0xF0,
so the chip_id value is (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Paul Handrigan <paul.handrigan@cirrus.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Acked-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 06b4b813058f6092ded5d7e0d92d4c34d92975bd)

9 years agoASoC: cs42xx8: Add codec driver support for CS42448/CS42888
Nicolin Chen [Thu, 20 Mar 2014 10:18:37 +0000 (18:18 +0800)]
ASoC: cs42xx8: Add codec driver support for CS42448/CS42888

This patch adds support for the Cirrus Logic CS42448/CS42888 Audio CODEC that
has six/four 24-bit AD and eight 24-bit DA converters.

[ CS42448/CS42888 supports both I2C and SPI control ports. As initial patch,
  this patch only adds the support for I2C. ]

Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Acked-by: Paul Handrigan <Paul.Handrigan@cirrus.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit 0c516b4ff85c0be4cee5b30ae59c9565c7f91a00)

9 years agoASoC: core: Add SOC_DOUBLE_R_S_TLV
Markus Pargmann [Thu, 16 Jan 2014 15:02:11 +0000 (16:02 +0100)]
ASoC: core: Add SOC_DOUBLE_R_S_TLV

Add a macro for signed mixer with two registers and tlv array.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit cd21b123346c6a2f033d8c3bd2bf240198b5712a)

9 years agoASoC: core: Add signed register volume control logic
Markus Pargmann [Thu, 16 Jan 2014 15:02:10 +0000 (16:02 +0100)]
ASoC: core: Add signed register volume control logic

Some codecs use signed volume control representation with non standard
register sizes, e.g. 6 or 7 bit signed integers.

This patch adds generic signed register volume control logic to
soc-core. Instead of a fixed width signed register control, this
implementation uses a 'min' value and the signed bit location to translate
it to an absolute volume. Using the 'sign_bit' we can calculate a
correct mask for the register values and translate it back into signed
integers of standard size.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
(cherry picked from commit f227b88f0fce5f9b82aa934f8829a741c2e06d82)

9 years agoARM: enable interactive as default cpufreq governor in imx_v7_defconfig
Anson Huang [Tue, 17 Jun 2014 07:27:46 +0000 (15:27 +0800)]
ARM: enable interactive as default cpufreq governor in imx_v7_defconfig

enable performance governor;
enable interactive as default cpufreq governor.

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agocpufreq: interactive: fix internal_create_group failure
Anson Huang [Tue, 17 Jun 2014 07:13:59 +0000 (15:13 +0800)]
cpufreq: interactive: fix internal_create_group failure

when interactive governor try to register sysfs interface,
need to make sure global kobject is initialized first,
otherwise, it will cause kernel Oops:

------------[ cut here ]------------
Kernel BUG at 80128178 [verbose debug info unavailable]
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.7+ #2883
task: ab078000 ti: ab05e000 task.ti: ab05e000
PC is at internal_create_group+0x1f4/0x230
LR is at cpufreq_governor_interactive+0x114/0x4f0
pc : [<80128178>]    lr : [<8043232c>]    psr: 60000113
sp : ab05fc48  ip : 00000063  fp : aaa3a128
r10: 8093c510  r9 : aaa3a0c0  r8 : 808d5834
r7 : 00000000  r6 : ab109200  r5 : aaa3a0c0  r4 : ab109200
r3 : 808d5aa4  r2 : 808d5834  r1 : 00000000  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 1000404a  DAC: 00000015
Process swapper/0 (pid: 1, stack limit = 0xab05e240)
Stack: (0xab05fc48 to 0xab060000)

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agocpufreq: add interactive governor support
Anson Huang [Tue, 17 Jun 2014 05:33:17 +0000 (13:33 +0800)]
cpufreq: add interactive governor support

This patch adds interactive governor support, the original files
are coming from google android experimental android-3.14 branch,
latest commit is:

c0eb5f75d cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Anson Huang <b20788@freescale.com>
9 years agoARM: Call idle notifiers
Todd Poynor [Thu, 16 Jun 2011 00:44:50 +0000 (17:44 -0700)]
ARM: Call idle notifiers

Change-Id: Id833e61c13baa1783705ac9e9046d1f0cc90c95e
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
9 years agoMove x86_64 idle notifiers to generic
Todd Poynor [Thu, 16 Jun 2011 00:21:57 +0000 (17:21 -0700)]
Move x86_64 idle notifiers to generic

Move the x86_64 idle notifiers originally by Andi Kleen and Venkatesh
Pallipadi to generic.

Change-Id: Idf29cda15be151f494ff245933c12462643388d5
Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
9 years agoENGR00381674 ARM: imx_v7_defconfig: enable the SPI NOR subsystem
Huang Shijie [Tue, 17 Jun 2014 06:15:50 +0000 (14:15 +0800)]
ENGR00381674 ARM: imx_v7_defconfig: enable the SPI NOR subsystem

Enable the SPI NOR subsystem which is used by the m25p80.c and our
qspi driver.

Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: allow to be built as module
Brian Norris [Thu, 10 Apr 2014 18:05:34 +0000 (11:05 -0700)]
mtd: spi-nor: allow to be built as module

There's no reason this can't be a module. Also, give SPI-NOR its own
submenu.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: spi-nor: shorten Kconfig naming
Brian Norris [Wed, 9 Apr 2014 03:30:25 +0000 (20:30 -0700)]
mtd: spi-nor: shorten Kconfig naming

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand_bbt: remove unused variable
Brian Norris [Fri, 3 Jan 2014 01:14:10 +0000 (17:14 -0800)]
mtd: nand_bbt: remove unused variable

Set, but unused, variable.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand_bbt: handle error case for nand_create_badblock_pattern()
Brian Norris [Wed, 21 May 2014 05:34:40 +0000 (22:34 -0700)]
mtd: nand_bbt: handle error case for nand_create_badblock_pattern()

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: add support for SanDisk SDTNRGAMA-008G
Huang Shijie [Fri, 3 Jan 2014 05:37:03 +0000 (13:37 +0800)]
mtd: nand: add support for SanDisk SDTNRGAMA-008G

The datasheet does not tell us how to parse out the ID data,
so handle it as a full ID nand.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: Warn the user if the selected ECC strength is too weak
Ezequiel Garcia [Wed, 14 May 2014 17:58:06 +0000 (14:58 -0300)]
mtd: nand: Warn the user if the selected ECC strength is too weak

This commit makes use of the chip->ecc_strength_ds and chip->ecc_step_ds which
contain the datasheet minimum requested ECC strength to produce a noisy warning
if the configured ECC strength is weaker.

Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoNAND_ECC_SOFT_BCH can support subpage reads too
Ron Lee [Fri, 25 Apr 2014 05:31:35 +0000 (15:01 +0930)]
NAND_ECC_SOFT_BCH can support subpage reads too

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix a typo in a comment line
Masahiro Yamada [Wed, 9 Apr 2014 07:26:26 +0000 (16:26 +0900)]
mtd: nand: fix a typo in a comment line

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: use the nand_read_subpage index everywhere
Ron [Sat, 15 Mar 2014 17:31:08 +0000 (04:01 +1030)]
mtd: nand: use the nand_read_subpage index everywhere

Now that the index variable is correctly set earlier in this function
we can use it in other places that compute the same thing too.

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agoFix index regression in nand_read_subpage
Ron [Sat, 15 Mar 2014 17:31:07 +0000 (04:01 +1030)]
Fix index regression in nand_read_subpage

Commit 7351d3a5dbf42ba3299af71db3296be447bc1516 added an index variable
as part of fixing checkpatch warnings, presumably as a tool to make some
long lines shorter, however it only set that index in the case of there
being no gaps in eccpos for the fragment being read.  Which means the
later step of filling ecccode from oob_poi will use the wrong indexing
into eccpos in that case.

This patch restores the behaviour that existed prior to that change.

Signed-off-by: Ron Lee <ron@debian.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH
Erico Nunes [Tue, 11 Mar 2014 04:31:26 +0000 (01:31 -0300)]
mtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH

Mention to CONFIG_MTD_ECC_BCH in the warning message can be confusing as this
doesn't match the exact name of the configuration option.
This warning showed up once to me when I was starting to set up BCH. After
checking my .config file, it took a moment before realizing it is
CONFIG_MTD_NAND_ECC_BCH instead of CONFIG_MTD_ECC_BCH.

Signed-off-by: Erico Nunes <nunes.erico@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: remove unused function input parameter
Cai Zhiyong [Wed, 25 Dec 2013 12:11:15 +0000 (20:11 +0800)]
mtd: nand: remove unused function input parameter

The nand_get_flash_type parameter "busw" input value is not used by any
branch, and it is updated before use it in the function, so remove it,
define the "busw" as an internal variable.

Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: print out the right information for JEDEC compliant NAND
Huang Shijie [Fri, 21 Feb 2014 05:39:41 +0000 (13:39 +0800)]
mtd: nand: print out the right information for JEDEC compliant NAND

Check the chip->jedec_version, and print out the right information
for JEDEC compliant NAND.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: Add support to use nand_base poi databuf as bounce buffer
Kamal Dasu [Fri, 2 May 2014 00:51:19 +0000 (20:51 -0400)]
mtd: nand: Add support to use nand_base poi databuf as bounce buffer

nand_base can be passed a kmap()'d buffers from highmem by
filesystems like jffs2. This results in failure to map the
physical address of the DMA buffer on various contoller
driver on different platforms. This change adds a chip option
to use preallocated databuf as bounce buffers used in
nand_do_read_ops() and nand_do_write_ops().
This allows for specific nand controller driver to set this
option as needed.

Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: refactor erase_cmd() to return chip status
Brian Norris [Tue, 6 May 2014 23:02:19 +0000 (16:02 -0700)]
mtd: nand: refactor erase_cmd() to return chip status

The nand_chip::erase_cmd callback previously served a dual purpose; for
one, it allowed a per-flash-chip override, so that AG-AND devices could
use a different erase command than other NAND. These AND devices were
dropped in commit 14c6578683367b1e7af0c3c09e872b45a45183a7 (mtd: nand:
remove AG-AND support). On the other hand, some drivers (denali and
doc-g4) need to use this sort of callback to implement
controller-specific erase operations.

To make the latter operation easier for some drivers (e.g., ST's new BCH
NAND driver), it helps if the command dispatch and wait functions can be
lumped together, rather than called separately.

This patch does two things:
 1. Pull the call to chip->waitfunc() into chip->erase_cmd(), and return
    the status from this callback
 2. Rename erase_cmd() to just erase(), since this callback does a
    little more than just send a command

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix GET/SET_FEATURES address on 16-bit devices
David Mosberger [Fri, 21 Mar 2014 22:05:10 +0000 (16:05 -0600)]
mtd: nand: fix GET/SET_FEATURES address on 16-bit devices

GET_FEATURES and SET_FEATURES also need byte-addressing on 16-bit devices.

Signed-off-by: David Mosberger <davidm@egauge.net>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: parse out the JEDEC compliant NAND
Huang Shijie [Fri, 21 Feb 2014 05:39:40 +0000 (13:39 +0800)]
mtd: nand: parse out the JEDEC compliant NAND

This patch adds the parsing code for the JEDEC compliant NAND.

Since we need the 0x40 as the column address, this patch also
makes the NAND_CMD_PARAM to use the 8-bit address only.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add a helper to get the supported features for JEDEC
Huang Shijie [Fri, 21 Feb 2014 05:39:39 +0000 (13:39 +0800)]
mtd: nand: add a helper to get the supported features for JEDEC

Add a helper to get the supported features for JEDEC compliant NAND.
Also add a macro JEDEC_FEATURE_16_BIT_BUS.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add fields for JEDEC in nand_chip
Huang Shijie [Fri, 21 Feb 2014 05:39:38 +0000 (13:39 +0800)]
mtd: nand: add fields for JEDEC in nand_chip

Add the jedec_version field, and add an anonymous union which
contains the nand_onfi_params and nand_jedec_params.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: add the data structures for JEDEC parameter page
Huang Shijie [Fri, 21 Feb 2014 05:39:37 +0000 (13:39 +0800)]
mtd: nand: add the data structures for JEDEC parameter page

Create the nand_jedec_params{} and jedec_ecc_info{} according to
the JESD230A (Revision of JESD230, October 2012).

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agomtd: nand: remove the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE
Huang Shijie [Fri, 20 Dec 2013 16:02:30 +0000 (00:02 +0800)]
mtd: nand: remove the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE

There is no reference to these two macros now.
Just remove them.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: fix erroneous read_buf call in nand_write_page_raw_syndrome
Boris BREZILLON [Sat, 1 Feb 2014 18:10:28 +0000 (19:10 +0100)]
mtd: nand: fix erroneous read_buf call in nand_write_page_raw_syndrome

read_buf is called in place of write_buf in the
nand_write_page_raw_syndrome function.

Signed-off-by: Boris BREZILLON <b.brezillon.dev@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: don't use read_buf for 8-bit ONFI transfers
Brian Norris [Sat, 30 Nov 2013 06:04:28 +0000 (22:04 -0800)]
mtd: nand: don't use read_buf for 8-bit ONFI transfers

Use a repeated read_byte() instead of read_buf(), since for x16 buswidth
devices, we need to avoid the upper I/O[16:9] bits. See the following
commit for reference:

commit 05f7835975dad6b3b517f9e23415985e648fb875
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Thu Dec 5 22:22:04 2013 +0100

    mtd: nand: don't use {read,write}_buf for 8-bit transfers

Now, I think that all barriers to probing ONFI on x16 devices are
removed, so remove the check from nand_flash_detect_onfi().

Tested on 8-bit ONFI NAND (Micron MT29F32G08CBADAWP).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-By: Pekon Gupta <pekon@ti.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: force NAND_CMD_READID onto 8-bit bus
Brian Norris [Wed, 29 Jan 2014 22:08:12 +0000 (14:08 -0800)]
mtd: nand: force NAND_CMD_READID onto 8-bit bus

The NAND command helpers tend to automatically shift the column address
for x16 bus devices, since most commands expect a word address, not a
byte address. The Read ID command, however, expects an 8-bit address
(i.e., 0x00, 0x20, or 0x40 should not be translated to 0x00, 0x10, or
0x20).

This fixes the column address for a few drivers which imitate the
nand_base defaults. Note that I don't touch sh_flctl.c, since it already
handles this problem slightly differently (note its comment "READID is
always performed using an 8-bit bus").

I have not tested this patch, as I only have x8 parts up for testing at
this point. Hopefully that can change soon...

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-By: Pekon Gupta <pekon@ti.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
9 years agomtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{}
Huang Shijie [Mon, 13 Jan 2014 06:27:12 +0000 (14:27 +0800)]
mtd: nand: kill the the NAND_MAX_PAGESIZE/NAND_MAX_OOBSIZE for nand_buffers{}

The patch converts the arrays to buffer pointers for nand_buffers{}.

The cafe_nand.c is the only NAND_OWN_BUFFERS user which allocates
nand_buffers{} itself.

This patch disables the DMA for nand_scan_ident, and restores the DMA
status after we finish the nand_scan_ident. This way, we can get page
size and OOB size and use them to allocate cafe->dmabuf.

Since the cafe_nand.c uses the NAND_ECC_HW_SYNDROME ECC mode, we do not
allocate the buffers for @ecccalc and @ecccode.

Signed-off-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
9 years agoENGR00317981: ARM: remove DEBUG_LL from imx_v7_defconfig
Shawn Guo [Tue, 17 Jun 2014 06:02:40 +0000 (14:02 +0800)]
ENGR00317981: ARM: remove DEBUG_LL from imx_v7_defconfig

The CONFIG_DEBUG_LL should only be enabled for debugging early boot
issue on particular board.  Let's drop it from defconfig.

Note, CONFIG_MTD_M25P80 is dropped by running savedefconfig.

Signed-off-by: Shawn Guo <shawn.guo@freescale.com>