Commit graph

105 commits

Author SHA1 Message Date
Mark Brown ee61b89298 Merge remote-tracking branches 'asoc/topic/dwc', 'asoc/topic/fsl', 'asoc/topic/gpio-chip' and 'asoc/topic/hdmi' into asoc-next 2016-09-29 12:44:24 -07:00
Julia Lawall c59b24f87b ASoC: constify gpio_chip structures
These structures are only used to copy into other structures, so declare
them as const.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct gpio_chip i@p = { ... };

@ok@
identifier r.i;
expression e;
position p;
@@
e = i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct gpio_chip e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct gpio_chip i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-12 20:04:54 +01:00
Julia Lawall f802d6c020 ASoC: constify snd_soc_codec_driver structures
Check for snd_soc_codec_driver structures that are only passed to
snd_soc_register_codec or memcpy (2nd arg), for which the corresponding
parameters are declared const.  Declare as const snd_soc_codec_driver
structures that have these properties.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_codec_driver i@p = { ... };

@ok@
identifier r.i;
expression e1,e2,e3;
position p;
@@
(
snd_soc_register_codec(e1,&i@p,e2,e3)
|
memcpy(e1,&i@p,e2)
)

@bad@
position p != {r.p,ok.p};
identifier r.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
 struct snd_soc_codec_driver i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-01 20:55:31 +01:00
Kuninori Morimoto efee13aa36 ASoC: codec duplicated callback function goes to component on wm8996
codec driver and component driver has duplicated callback functions,
and codec side functions are just copied to component side when
register timing. This was quick-hack, but no longer needed.
This patch moves these functions from codec driver to component driver.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08 11:57:57 +01:00
Linus Walleij c2aea142af ASoC: wm8996: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: alsa-devel@alsa-project.org
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-04-26 15:36:57 +02:00
Takashi Iwai 8293004c81 ASoC: wm8996: Fix enum ctl accesses in a wrong type
"DSP1 EQ Mode" and "DSP2 EQ Mode" ctls in wm8996 codec driver are
enum, while the current driver accesses wrongly via
value.integer.value[].  They have to be via value.enumerated.item[]
instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-01 12:12:05 +09:00
Linus Walleij 58383c7842 gpio: change member .dev to .parent
The name .dev in a struct is normally reserved for a struct device
that is let us say a superclass to the thing described by the struct.
struct gpio_chip stands out by confusingly using a struct device *dev
to point to the parent device (such as a platform_device) that
represents the hardware. As we want to give gpio_chip:s real devices,
this is not working. We need to rename this member to parent.

This was done by two coccinelle scripts, I guess it is possible to
combine them into one, but I don't know such stuff. They look like
this:

@@
struct gpio_chip *var;
@@
-var->dev
+var->parent

and:

@@
struct gpio_chip var;
@@
-var.dev
+var.parent

and:

@@
struct bgpio_chip *var;
@@
-var->gc.dev
+var->gc.parent

Plus a few instances of bgpio that I couldn't figure out how
to teach Coccinelle to rewrite.

This patch hits all over the place, but I *strongly* prefer this
solution to any piecemal approaches that just exercise patch
mechanics all over the place. It mainly hits drivers/gpio and
drivers/pinctrl which is my own backyard anyway.

Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Alek Du <alek.du@intel.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2015-11-19 09:24:35 +01:00
Mark Brown 91931320cf Merge remote-tracking branches 'asoc/topic/wm8996', 'asoc/topic/xtensa' and 'asoc/topic/zx296702' into asoc-next 2015-08-30 15:59:18 +01:00
Mark Brown c009d370dd Merge remote-tracking branches 'asoc/topic/txx9', 'asoc/topic/uda134x', 'asoc/topic/ux500' and 'asoc/topic/width' into asoc-next 2015-08-30 15:58:18 +01:00
Axel Lin 0a3dcb509a ASoC: Use params_width() at appropriate places
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-24 18:31:31 +01:00
Mark Brown 7d9fb377a7 Merge branches 'topic/owner' and 'topic/reg-default' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-max9877 2015-07-16 21:35:01 +01:00
Krzysztof Kozlowski 1c07a4de5b ASoC: drivers: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-15 12:50:43 +01:00
Axel Lin ca94085139 ASoC: wm8996: Remove spurious IRQF_ONESHOT flag
This reverts ed043aebe6 ("ASoC: wm8996: Pass the IRQF_ONESHOT flag").

The coccinelle warnings is false positive because the original code does
set IRQF_ONESHOT by "trigger |= IRQF_ONESHOT;".

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-08 19:33:49 +01:00
Axel Lin c418a84a8c ASoC: Constify reg_default tables
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Peter Rosin <peda@axentia.se>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07 14:39:02 +01:00
Mark Brown 11e688862c Merge remote-tracking branches 'asoc/topic/wm8994', 'asoc/topic/wm8996' and 'asoc/topic/zx' into asoc-next 2015-06-05 18:55:07 +01:00
Lars-Peter Clausen 6a141e462e ASoC: wm8996: Replace direct snd_soc_codec dapm field access
The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all
other manual access to codec->dapm with snd_soc_codec_get_dapm().

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-01 16:45:46 +01:00
Fabio Estevam ed043aebe6 ASoC: wm8996: 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:45:38 +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
Nicholas Mc Guire 159366ea38 ASoC: wm8996: ensure lower bounds of 1 for timeout
wait_for_completion_timeout can be called with timeout == 0 due to
msecs_to_jiffies(2) == 1 for HZ < 1000 and usecs_to_jiffies(300) == 1
for all reasonable values of HZ, thus the following timeout /= 2; sets
timeout to 0. This patch simply adds a lower-bounds of 1.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-09 18:15:56 +00:00
Nicholas Mc Guire 62c76fe2e5 ASoC: wm8996: match wait_for_completion_timeout return type
return type of wait_for_completion_timeout is unsigned long not int. An
appropriately named unsigned long is added and the assignment fixed up
in case of completion occurring the remaining time is >=1 so ret is set to
1 if no timeout occurred.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-09 18:15:44 +00:00
Lars-Peter Clausen 00748490f7 ASoC: wm8996: 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>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-01-14 19:53:48 +00:00
abdoulaye berthe 88d5e520aa driver:gpio remove all usage of gpio_remove retval in driver
this remove all reference to gpio_remove retval in all driver
except pinctrl and gpio. the same thing is done for gpio and
pinctrl in two different patches.

Signed-off-by: Abdoulaye Berthe <berthe.ab@gmail.com>
Acked-by: Michael Büsch <m@bues.ch>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-09-18 11:03:10 -07:00
Mark Brown 62e951ea65 Merge remote-tracking branches 'asoc/topic/atmel', 'asoc/topic/cirrus' and 'asoc/topic/cleanup' into asoc-next 2014-08-04 16:31:29 +01:00
Mark Brown a486f183da Merge remote-tracking branches 'asoc/topic/adau1977', 'asoc/topic/ak4642', 'asoc/topic/ak5386' and 'asoc/topic/arizona' into asoc-next 2014-08-04 16:31:23 +01:00
Sachin Kamat 63d36f8814 ASoC: wm8996: Remove unused variable
'ret' is not used in the function. Remove it.

Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-07-03 19:46:23 +01:00
Lars-Peter Clausen e73a257198 ASoC: wm5100/wm8903/wm8996: Replace open-coded snd_soc_dapm_to_codec()
We now have a generic helper function to cast from a DAPM context to a CODEC.
Make use of it in the places which previously open-coded it.

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-06-19 10:55:38 +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 2620954d64 Merge remote-tracking branch 'asoc/topic/io' into asoc-next 2014-03-13 14:19:21 +00:00
Mark Brown deeed33850 Merge remote-tracking branches 'asoc/topic/wm8996', 'asoc/topic/wm9081' and 'asoc/topic/wm9705' into asoc-next 2014-03-12 23:05:31 +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
Mark Brown a304681f36 Merge branches 'topic/dapm', 'topic/sign', 'topic/adau1373', 'topic/max98090', 'topic/mc13783', 'fix/wm8994' and 'topic/wm8995' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-enum 2014-03-01 12:03:16 +09:00
Lars-Peter Clausen b7c1b73097 ASoC: wm8996: Replace codec->control_data with wm8996->regmap
With the ongoing component-ization of the ASoC framework and the continuing
migration to using regmap for IO the control_data field of the snd_soc_codec
struct will eventually be removed. Prepare the wm8996 driver for this by using
wm8996->regmap instead of accessing the CODEC's control_data field.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-25 13:35:19 +09:00
Takashi Iwai 5cca5a916f ASoC: wm8996: Use SOC_ENUM_SINGLE_DECL()
Just replace with the helper macro.  No functional change at all.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23 11:43:57 +09:00
Charles Keepax 02afc6a238 ASoC: wm8996: Update locking around use of DAPM pin API
The pin updates in this driver look like they are intended to be done
atomically, update to do so.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-20 19:22:57 +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 dd212bd5bb Merge remote-tracking branch 'asoc/topic/wm8996' into asoc-next 2013-11-08 10:43:43 +00:00
Takashi Iwai d8e9a54414 ASoC: wm8996: Replace BUG() with WARN()
BUG() used in the driver is just to spit the stack trace on buggy
points, not really needed to stop the whole operation.  For that
purpose, it'd be more convenient to use WARN() instead with more
error information.

Cc: patches@opensource.wolfsonmicro.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-11-07 19:55:20 +00:00
Takashi Iwai fe329a1a92 ASoC: wm8996: Fix negative array index read
Spotted by coverity CID 146355.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-30 09:50:21 -07: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
Mark Brown 822b4b8d63 ASoC: dapm: Add flags to regulator supplies
This will be used to enable additional control of the regulators.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
2012-09-08 08:47:28 +08:00
Mark Brown ec8ffe1868 ASoC: wm8996: Move register default configuration to I2C probe
This gets the registers set up as early as possible, mainly useful for the
GPIOs to ensure that they're in the correct mode.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25 09:55:02 +01:00
Mark Brown d4b3d0fbb7 ASoC: wm8996: Inline wm8996_reset() and optimise cache-only usage
There is only one caller and this allows us to cleanly leave the CODEC
with the internal LDO powered down which is the default state we're
looking for and means that we can robustly disable the register cache
only when we either disable the LDO or power down the external
regulators.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25 09:55:01 +01:00
Mark Brown 625c4888ff ASoC: wm8996: Move regulator notifier callbacks into I2C level
Now that we're using regmap the cache is available here.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25 09:55:00 +01:00
Mark Brown d1e16c1a61 Linux 3.5-rc4
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iQEcBAABAgAGBQJP53AxAAoJEHm+PkMAQRiGs2QH/RaqkXz96fwjhDcyiKpDqA3c
 kGuS5mz5cOhnqKSmR88HFm6pwuhLux/qSJzeAmoQy1MC8a0ACx7AnANW0lfN3/qe
 /HGYz8h60yCL/fhn8/bUYtdt9xsoDqoDcq/ooFl9mcsJGWbC6WeMSZU5dAUYqviE
 qFrp5zjY07FG53CRGT0hFpezQNwNL+VLH30CF9LD+fJLPVEYum2zBNGXWM42rcw5
 fxzGL/6SO8YqA/Upic1ht6HAd6s5LOrlST7qvnyXUMvRXN5z/Y92ueYJZefkS1Om
 ohuLIKM2bv9/dJS67H8N2baSKGCzBdfSe5/5WaHdLYW9MiVju0wRl6HPJtAMrkk=
 =H8t8
 -----END PGP SIGNATURE-----

Merge tag 'v3.5-rc4' into for-3.6

Linux 3.5-rc4 contains some bug fixes which overlap with new features.
2012-06-25 09:52:59 +01:00
Mark Brown af691fb62c ASoC: wm8996: Convert to devm_regmap_init_i2c()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-11 20:22:26 +08:00
Mark Brown 66c2b7377a ASoC: wm8996: Remove write sequencer registers from the defaults table
They aren't marked as readable and the feature is never used so they'll
never get referenced.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-11 20:22:12 +08:00
Mark Brown 9c699e0a95 ASoC: wm8996: Mark the CODEC as cache only when powering off on boot
Otherwise we might try to write to a powered off device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-11 20:20:51 +08:00
Mark Brown db13340983 ASoC: wm8996: Move reset before the initial regulator disable
If we don't have control over the LDO but do have control over the other
regulators then we may end up trying to write to a powered off device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-11 20:20:38 +08:00
Mark Brown 90ba6859ce ASoC: wm8996: Remove spurious regulator_bulk_free()
We're using demv_regulator_bulk_get() so don't need to manually free and
this is in the CODEC driver not the I2C driver anyway.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-11 20:20:22 +08:00
Mark Brown 656baaebf9 ASoC: codecs: Refresh copyrights for Wolfson drivers
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-03 13:06:37 +01:00