1
0
Fork 0
Commit Graph

53 Commits (ebe6ccc53ff06a3782b95547eecb393222de057f)

Author SHA1 Message Date
Mark Brown 428157c1e8 Merge remote-tracking branches 'asoc/topic/tas2552', 'asoc/topic/tas5086', 'asoc/topic/tegra', 'asoc/topic/tlv' and 'asoc/topic/topology' into asoc-next 2015-08-30 15:57:34 +01:00
Mark Brown 1d1ed2c23e Merge remote-tracking branches 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/max98357a', 'asoc/topic/max9877' and 'asoc/topic/max98925' into asoc-next 2015-08-30 15:54:57 +01:00
Lars-Peter Clausen 54c2011f5a ASoC: max98095: Replace TLV_DB_RANGE_HEAD with DECLARE_TLV_DB_RANGE
DECLARE_TLV_DB_RANGE() has the advantage over using TLV_DB_RANGE_HEAD()
that it automatically calculates the number of items in the TLV and is
hence less prone to manual error.

Generate using the following coccinelle script

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

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-05 13:23:00 +01:00
Axel Lin 5549ce82e2 ASoC: max98095: Get rid of max98095_access table
The max98095_access table is used for look up readable/writable
attributes of registers. The readable/writable/volatile registers are
mostly in continuous ranges, so we can replace the max98095_access table
entirely by using case range.

Below is a summary of the readable/writeable/volatile registers:

readable registers:
        0x01 ~ 0x97, 0xFF
writeable registers:
        0x0F ~ 0x97
volatile registers:
        0x00 ~ 0x0E, 0x98 ~ 0xFF

This patch reworks the implement for .readable and .volatile and also add
implementation for .writable callback.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-29 14:53:55 +01:00
Krzysztof Kozlowski 1c07a4de5b ASoC: drivers: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15 12:50:43 +01:00
Fabio Estevam 402f2a4f80 ASoC: max98095: Check for clk_prepare_enable() error
clk_prepare_enable() may fail, so we should better 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@kernel.org>
2015-07-08 19:09:30 +01:00
Mark Brown a178831a63 Merge remote-tracking branches 'asoc/topic/max98095', 'asoc/topic/omap', 'asoc/topic/pxa', 'asoc/topic/qcom' and 'asoc/topic/rcar' into asoc-next 2015-06-05 18:54:57 +01:00
Lars-Peter Clausen 1179a36850 ASoC: max98095: Replace direct snd_soc_codec dapm field access
The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-18 04:46:56 +01:00
Fabio Estevam 16f0acd0ca ASoC: max98095: Pass the IRQF_ONESHOT flag
Since commit 1c6c69525b ("genirq: Reject
bogus threaded irq requests") threaded IRQs without a primary handler
need to be requested with IRQF_ONESHOT, otherwise the request will fail.

So pass the IRQF_ONESHOT flag in this case.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/irqf_oneshot.cocci.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-12 19:48:24 +01:00
Lars-Peter Clausen f4bf8d770b ASoC: Move bias level update to the core
All drivers have the same line at the end of the set_bias_level callback to
update the bias_level state. Move this update into
snd_soc_dapm_force_bias_level() and remove them from the drivers.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:34:45 +01:00
Lars-Peter Clausen bd1204cb51 ASoC: Route all bias level updates through the core
Use the new snd_soc_codec_force_bias_level() helper function to invoke the
bias_level callback of a driver instead of calling the callback by hand.
Currently the effect of this is the same, but having all bias level updates
go through a central place will allow us to move more of the bias level
management into the DAPM core.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27 21:34:45 +01:00
Mark Brown 41967b775e Merge remote-tracking branches 'asoc/topic/max98088', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/max9850' and 'asoc/topic/mop500' into asoc-next 2014-12-08 13:12:02 +00:00
Lars-Peter Clausen 0db5dc943e ASoC: max98095: Replace w->codec snd_soc_dapm_to_codec(w->dapm)
The codec field of the snd_soc_widget struct is eventually going to be
removed, use snd_soc_dapm_to_codec(w->dapm) instead.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-21 18:17:22 +00:00
Lars-Peter Clausen 210a5fae55 ASoC: max98095: Move mutex to the driver level
The max98095 uses the snd_soc_codec mutex to protect against concurrent
access in some of its control put handlers. Move this mutex to the driver
level so we can eventually remove the snd_soc_codec mutex.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-10 19:07:42 +00:00
Lars-Peter Clausen a8669f6032 ASoC: max98095: Cleanup manual bias level transitions
Since the ASoC core now takes care of setting the bias level to
SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually
anymore either.

The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe()
can also be removed as the core will automatically do this after the CODEC
has been probed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-22 11:30:03 +01:00
Mark Brown 1ae1f3a200 ASoC: max98095: Convert to params_width()
The CODEC doesn't care how data is laid out in memory.

Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-31 13:30:03 +01:00
Mark Brown b12a1906be Merge remote-tracking branches 'asoc/topic/max98090' and 'asoc/topic/max98095' into asoc-next 2014-06-03 10:39:52 +01:00
Tushar Behera e3048c3d2b ASoC: max98095: Add master clock handling
If master clock is provided through device tree, then update
the master clock frequency during set_sysclk.

Documentation has been updated to reflect the change.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-05-26 16:18:59 +01:00
Mark Brown 6630f30ed5 Merge remote-tracking branches 'asoc/topic/headers', 'asoc/topic/intel', 'asoc/topic/jz4740', 'asoc/topic/max98090', 'asoc/topic/max98095', 'asoc/topic/mc13783' and 'asoc/topic/multicodec' into asoc-next 2014-05-22 00:23:54 +01:00
Tushar Behera c4839c87f5 ASoC: max98095: Add an explicit of_match_table
Create an explicit of_match_table entry for MAX98095 codec. Also
add a binding Documentation for this compatible string.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-23 11:37:27 +01:00
Lars-Peter Clausen ea53bf77d1 ASoC: Add snd_soc_kcontrol_codec() helper function
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the
CODEC that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_codec() helper function that will hide the implementation
details of how the CODEC for a control can be obtained. This will allow us to
change this easily in the future.

The patch also updates all CODEC drivers to use the new helper function.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 17:22:43 +01:00
Mark Brown 7d50141421 Merge remote-tracking branch 'asoc/topic/max98095' into asoc-next 2014-03-13 14:19:40 +00:00
Mark Brown 2620954d64 Merge remote-tracking branch 'asoc/topic/io' into asoc-next 2014-03-13 14:19:21 +00:00
Xiubo Li 5d6be5aa6b ASoC: codec: Simplify ASoC probe code.
For some CODEC drivers like who act as the MFDs children are ignored
by this patch.

Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-11 09:59:05 +00:00
Takashi Iwai af1f0a5082 ASoC: max98095: Use SOC_ENUM_SINGLE_DECL()
Just replace with the helper macro.  No functional change at all.

Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 11:26:38 +09:00
Takashi Iwai 9a8d38db03 ASoC: Rename soc_enum.max field with items
The name "max" in struct soc_enum is rather confusing since it
actually takes the number of items.  With "max", one might try to
assign (nitems - 1) value.

Rename the field to a more appropriate one, "items", which is also
used in struct snd_ctl_elem_info, too.

This patch also rewrites some code like "if (x > e->nitems - 1)" with
"if (x >= e->nitems)".  Not only the latter improves the readability,
it also fixes a potential bug when e->items is zero.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 10:42:53 +09:00
Mark Brown 580ce08d5c ASoC: max98095: Use params_width() rather than memory format
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13 11:45:53 +00:00
Mark Brown 108145a606 Merge remote-tracking branch 'asoc/topic/warn' into asoc-next 2013-11-08 10:43:41 +00:00
Mark Brown b8a77af201 Merge remote-tracking branch 'asoc/topic/max98095' into asoc-next 2013-11-08 10:43:30 +00:00
Takashi Iwai a922cd7151 ASoC: max98095: Use WARN_ON() instead of BUG_ON()
Use WARN_ON() and handle the error cases accordingly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-06 10:26:16 +00:00
Mark Brown 14acbbbbc6 ASoC: max98095: Convert to direct regmap API usage
Saves code and moves us towards being able to remove the duplicate ASoC
level register I/O functionality.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-24 19:30:26 +01:00
Mark Brown c6b3283f6d ASoC: max90895: Convert to table based control init
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-24 19:30:25 +01:00
Mark Brown d36126ac56 ASoC: max98095: Remove custom hw_write() implementation
The registers that are being kept uncached are marked as volatile anyway
so the call has no practical impact.

Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-24 19:30:24 +01:00
Dan Carpenter f8d7b13e14 ASoC: max98095: a couple array underflows
The ->put() function are called from snd_ctl_elem_write() with user
supplied data.  The limit checks here could underflow leading to a
crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2013-09-13 18:33:18 +01:00
Bill Pemberton 7a79e94e97 ASoC: codecs: remove __dev* attributes
CONFIG_HOTPLUG is going away as an option.  As result the __dev*
markings will be going away.

Remove use of __devinit, __devexit_p, __devinitdata, __devinitconst,
and __devexit.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 00:31:51 +09:00
Sachin Kamat a8af02cf62 ASoC: max98095: Use module_i2c_driver
module_i2c_driver makes the code simpler by eliminating module_init
and module_exit calls.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-06 15:20:35 +01:00
Mark Brown a265367ccb ASoC: max98095: Staticise non-exported functions and export jack detect
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-08 05:47:19 +08:00
Mark Brown 0841b04a5f ASoC: max98095: Fix build failure
sound/soc/codecs/max98095.c: In function 'max98095_jack_detect_enable':
sound/soc/codecs/max98095.c:2229:14: error: 'struct max98095_priv' has no member named 'jack_detect_delay'
sound/soc/codecs/max98095.c:2230:18: error: 'struct max98095_priv' has no member named 'jack_detect_delay'

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-02 14:53:13 +01:00
Rhyland Klein 9dd90c5db0 ASoC: max98095: add jack detection
This change adds the logic to support using the jack detect mechanism built
in to the codec to detect both when a jack was inserted and what type of
jack is present.

This change also supports the use of an external mechanism for headphone
detection. If this mechanism exists, when the max98095_jack_detect function
is called, the hp_jack is simply passed NULL.

This change supports both simple headphones, powered headphones, microphones
and headsets with both headphones and a mic.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:28:24 +01:00
Liam Girdwood 022658beab ASoC: core: Add support for DAI and machine kcontrols.
Currently ASoC can only add kcontrols using codec and platform component device
handles. It's also desirable to add kcontrols for DAIs (i.e. McBSP) and for
SoC card machine drivers too. This allows the kcontrol to have a direct handle to
the parent ASoC component DAI/SoC Card/Platform/Codec device and hence easily
get it's private data.

This change makes snd_soc_add_controls() static and wraps it in the folowing
calls (card and dai are new) :-

snd_soc_add_card_controls()
snd_soc_add_codec_controls()
snd_soc_add_dai_controls()
snd_soc_add_platform_controls()

This patch also does a lot of small mechanical changes in individual codec drivers
to replace snd_soc_add_controls() with snd_soc_add_codec_controls().

It also updates the McBSP DAI driver to use snd_soc_add_dai_controls().

Finally, it updates the existing machine drivers that register controls to either :-

1) Use snd_soc_add_card_controls() where no direct codec control is required.
2) Use snd_soc_add_codec_controls() where there is direct codec control.

In the case of 1) above we also update the machine drivers to get the correct
component data pointers from the kcontrol (rather than getting the machine pointer
via the codec pointer).

Signed-off-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-04 12:40:11 +00:00
Axel Lin b1b548824b ASoC: Convert max98095 to devm_kzalloc()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02 12:28:11 +00:00
Lars-Peter Clausen 84b315ee89 ASoC: Drop unused state parameter from CODEC suspend callback
The existence of this parameter is purely historical. None of the CODEC drivers
uses it and we always pass in the same value anyway, so it should be safe to
remove it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-02 10:32:03 +00:00
Mark Brown 997c2ea916 ASoC: Remove unneeded platform_device.h inclusions from CODECs
They've not been needed for a long time if they were ever required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27 12:24:48 +00:00
Lars-Peter Clausen 85e7652d89 ASoC: Constify snd_soc_dai_ops structs
Commit 1ee46ebd("ASoC: Make the DAI ops constant in the DAI structure")
introduced the possibility to have constant DAI ops structures, yet this is
barley used in both existing drivers and also new drivers being submitted,
although none of them modifies its DAI ops structure. The later is not
surprising since existing drivers are often used as templates for new drivers.
So this patch just constifies all existing snd_soc_dai_ops structs to eliminate
the issue altogether.

The patch was generated with the following coccinelle semantic patch:
// <smpl>
@@
identifier ops;
@@
-struct snd_soc_dai_ops ops =
+const struct snd_soc_dai_ops ops =
{ ... };
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 10:40:46 +00:00
Axel Lin 0d8d293898 ASoC: max98095: Convert codec->hw_write to snd_soc_write
codec->hw_write is broken now, convert codec->hw_write to snd_soc_write.

The hardware has 2 banks of registers sharing a section in I2C register space.
The 1st bank is the primary one and is cached.
The 2nd bank is for loading coefficients only and they do not need cache.
These coefficients registers are therefore direct writes.
Thus we set cache_bypass flag to deal with this before calling snd_soc_write.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-22 11:09:54 +01:00
Ryan Mallon c855a1a7ff ASoC: max98095 codec: Catch driver bugs for biquad channel name
Move the biquad channel names to a separate array and iterate over it in
max98095_get_bq_channel rather than duplicating the hardcoded channel
names. Add an error message if an invalid channel is passed and check
the error in the callers.

Also added a BUILD_BUG_ON to ensure that the bq_mode_name and controls
arrays are the same size.

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-04 12:03:47 +01:00
Axel Lin 63de012f35 ASoC: Remove unused "control_data" field of struct max98095_priv
The control_data field is used to initialize the codec's control_data field,
but since this is also done by the snd-soc-cache core, the redundant
assignment can be removed and the field can be dropped.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-28 13:19:59 +01:00
Taylor Hutt bab3b59d53 ASoC: codecs: Max98095: Fix logging of hardware revision.
The base hardware revision of the Maxim 98095 part is 0x40; the code
which outputs the revision of the hardware has been updated to
properly use uppercase alphabetic values for the revision numbers.

Also, the use of a constant for the length 'max98095_dai' has been
replaced with ARRAY_SIZE().

Signed-off-by: Taylor Hutt <thutt@chromium.org>
Acked-by: Peter Hsiang <peter.hsiang@maxim-ic.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-06-22 00:27:39 +01:00
Mark Brown d21685ec25 Merge branch 'for-2.6.40' into for-2.6.41 2011-05-30 10:54:18 +08:00
Axel Lin 74ab24af4f ASoC: Remove redundant freq assignment for max98095->sysclk/max98088->sysclk
Current implementation set max98095->sysclk/max98088->sysclk to freq twice.
Set it once is enough, this patch removes the first assignment in case
we may set invalid clock frequency to max98095->sysclk/max98088->sysclk.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Peter Hsiang <peter.hsiang@maxim-ic.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-05-29 01:57:21 +08:00