History log of /linux-master/sound/soc/codecs/cx20442.c
Revision Date Author Comments
# 892bc209 10-Aug-2023 Jiri Slaby (SUSE) <jirislaby@kernel.org>

tty: use u8 for flags

This makes all those 'char's an explicit 'u8'. This is part of the
continuing unification of chars and flags to be consistent u8.

This approaches tty_port_default_receive_buf().

Note that we do not change signedness as we compile with
-funsigned-char.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Max Staudt <max@enpas.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-18-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a8d9cd23 10-Aug-2023 Jiri Slaby (SUSE) <jirislaby@kernel.org>

tty: use u8 for chars

This makes all those 'unsigned char's an explicit 'u8'. This is part of
the continuing unification of chars and flags to be consistent u8.

This approaches tty_port_default_receive_buf(). Flags to be next.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Max Staudt <max@enpas.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-17-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e8161447 10-Aug-2023 Jiri Slaby (SUSE) <jirislaby@kernel.org>

tty: make tty_ldisc_ops::*buf*() hooks operate on size_t

Count passed to tty_ldisc_ops::receive_buf*(), ::lookahead_buf(), and
returned from ::receive_buf2() is expected to be size_t. So set it to
size_t to unify with the rest of the code.

Signed-off-by: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Max Staudt <max@enpas.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: Matt Johnston <matt@codeconstruct.com.au>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230810091510.13006-16-jirislaby@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a0b6e404 23-Jun-2022 Charles Keepax <ckeepax@opensource.cirrus.com>

ASoC: cx20442: Remove now redundant non_legacy_dai_naming flag

The ASoC core has now been changed to default to the non-legacy DAI
naming, as such drivers using the new scheme no longer need to specify
the non_legacy_dai_naming flag.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220623125250.2355471-75-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 28f194da 14-Sep-2021 Jiri Slaby <jirislaby@kernel.org>

tty: make tty_ldisc_ops::hangup return void

The documentation says that the return value of tty_ldisc_ops::hangup
hook is ignored. And it really is, so there is no point for its return
type to be int. Switch it to void and all the hooks too.

Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210914091134.17426-4-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dfe11146 22-Jul-2021 Jiri Slaby <jirislaby@kernel.org>

ASoC: v253_init: eliminate pointer to string

There is no need to have an extra pointer to a string (v253_init).
Convert it to an array.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210722115141.516-2-jslaby@suse.cz
Signed-off-by: Mark Brown <broonie@kernel.org>


# d7a3a680 22-Jul-2021 Jiri Slaby <jirislaby@kernel.org>

ASoC: cx20442: tty_ldisc_ops::write_wakeup is optional

TTY layer does nothing if tty_ldisc_ops::write_wakeup is NULL, so there
is no need to implement an empty one in cx20442. Drop it.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210722115141.516-1-jslaby@suse.cz
Signed-off-by: Mark Brown <broonie@kernel.org>


# ccd1c4d7 28-Jul-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "v253_init: eliminate pointer to string"

This reverts commit 8496f60a670debe356a9168a66b7560641e53e93.

It will be coming in through the ASoC tree instead.

Reported-by: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a8cb3ede 28-Jul-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "cx20442: tty_ldisc_ops::write_wakeup is optional"

This reverts commit 0e9ffdb236b8d273a086e86887192a62dd8f144a.

It will be coming in through the ASoC tree instead.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Reported-by: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8496f60a 22-Jul-2021 Jiri Slaby <jirislaby@kernel.org>

v253_init: eliminate pointer to string

There is no need to have an extra pointer to a string (v253_init).
Convert it to an array.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210722115141.516-2-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0e9ffdb2 22-Jul-2021 Jiri Slaby <jirislaby@kernel.org>

cx20442: tty_ldisc_ops::write_wakeup is optional

TTY layer does nothing if tty_ldisc_ops::write_wakeup is NULL, so there
is no need to implement an empty one in cx20442. Drop it.

Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210722115141.516-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0f3dcf3b 05-May-2021 Jiri Slaby <jirislaby@kernel.org>

tty: make fp of tty_ldisc_ops::receive_buf{,2} const

Char pointer (cp) passed to tty_ldisc_ops::receive_buf{,2} is const.
There is no reason for flag pointer (fp) not to be too. So switch it in
the definition and all uses.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20210505091928.22010-12-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 981b22b8 01-Mar-2021 Jiri Slaby <jirislaby@kernel.org>

tty: remove TTY_LDISC_MAGIC

First, it is never checked. Second, use of it as a debugging aid is
at least questionable. With the current tools, I don't think anyone used
this kind of thing for debugging purposes for years.

On the top of that, e.g. serdev does not set this field of tty_ldisc_ops
at all.

So get rid of this legacy.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210302062214.29627-8-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 50c67877 24-Jun-2018 Janusz Krzysztofik <jmkrzyszt@gmail.com>

ASoC: cx20442: Don't ignore regulator_get() errors.

In its current shape, the driver just ignores errors returned by
regulator_get() at component_probe(). This doesn't hurt on Amstrad
Delta board as long as it registers the codec device at late_initcall,
when the regulator which depends on basic-mmio-gpio device (probed as
late as at dev_initcall) is already available. Otherwise the driver
may end up trying to control a codec which is not powered up.

Remove that dependency on initialization order by handling the error.
If the regulator is not yet available and -ENODEV is returned, convert
it to -EPROBE_DEFER to get another chance.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# d0fdfe34 28-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: cx20442: replace codec to component

Now we can replace Codec to Component. Let's do it.

Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3c89724e 15-Jan-2018 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: cx20442: fix regression by adding back .read/.write

commit 39b5a0f80c07f ("ASoC: cx20442: don't use reg_cache")
removed .read/.write from driver, but it might breaks non-regmap
driver, because ALSA SoC framework might call it.

To fix this regression, this patch back .read/.write.
and also this patch uses cx20442 internal reg_cache
which is needed for .read/.write.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 39b5a0f8 13-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: cx20442: don't use reg_cache

Codec reg_cache is legacy feature and very few driver only are using
it. But, ALSA SoC framework needs to support it.
Codec will be merged into Component in the future, so, let's remove
legacy and unused feature from framework.

cx20442 is using reg_cache but it is only 1byte, and it doesn't use
snd_soc_write/read/update_bits function which uses reg_cache.
reg_cache user is only debugfs. Let's clean reg_cache for now.
But let's keep .write function since it can be used for new additional
feature. .read will not be used, let's remove.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fac3f5e2 08-Nov-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: don't use codec hw_write on cx20442/omap-ams-delta

cx20442/omap-ams-delta driver is using codec hw_write/control_data,
but it is redundant code. This patch cleanup these

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a180ba45 03-Aug-2017 Bhumika Goyal <bhumirks@gmail.com>

ASoC: codecs: add const to snd_soc_codec_driver structures

Declare snd_soc_codec_driver structures as const as they are only passed
as an argument to the function snd_soc_register_codec. This argument is
of type const, so declare the structures with this property as const.
In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in
a copy operation along with getting passed to snd_soc_register_codec.
So, it can be made const too.
Done using Coccinelle:

@match disable optional_qualifier@
identifier s;
position p;
@@
static struct snd_soc_codec_driver s@p={...};

@good1@
identifier match.s;
position p;
@@
snd_soc_register_codec(...,&s@p,...)

@bad@
identifier match.s;
position p!={match.p,good1.p};
@@
s@p

@depends on !bad disable optional_qualifier@
identifier match.s;
@@
static
+const
struct snd_soc_codec_driver s={...};

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# a2c9c0f9 08-Aug-2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: codec duplicated callback function goes to component on cx20442

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>


# 86c0ae7c 16-Jun-2016 Janusz Krzysztofik <jmkrzyszt@gmail.com>

ASoC: cx20442: set tty->receiver_room in v253_open

Commit 79901317ce80 ("n_tty: Don't flush buffer when closing ldisc"),
introduced in v3.10, revealed a bug in the cx20442 codec driver
which has never been setting tty->receive_room on line discipline
open as it should from the beginning. Fix it.

Created and tested on Amstrad Delta against Linux-4.7-rc3

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3f36f3c7 11-May-2015 Lars-Peter Clausen <lars@metafoo.de>

ASoC: cx20442: 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>


# f4bf8d77 27-Apr-2015 Lars-Peter Clausen <lars@metafoo.de>

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>


# 32556394 09-Mar-2015 Dmitry Torokhov <dmitry.torokhov@gmail.com>

ASoC: cx20442: remove incorerct __exit markups

Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# c756e83d 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

ASoC: codecs: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# aaed2a62 04-Mar-2014 Mark Brown <broonie@linaro.org>

ASoC: cx20442: Fix strange indentation

Signed-off-by: Mark Brown <broonie@linaro.org>


# 00200107 17-Jul-2014 Lars-Peter Clausen <lars@metafoo.de>

ASoC: Move card field form platform/codec to component

Both the snd_soc_codec and snd_soc_platform struct do have a pointer to the
parent card and both handle this pointer in mostly the same way. This patch
moves the card field to the component level which will allow further code
consolidation between platforms and CODECS.

Since there are only a handful of users of the snd_soc_codec struct's card field
(and none of the snd_soc_platform's) these are update in this patch as well,
which allows it to be removed from the snd_soc_codec struct.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>


# f75a8ff6 29-Dec-2011 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: cx20442: add bias control over a platform provided regulator

Now that a regulator device for controlling the codec chip reset state
over a platform agnostic regulator API is available on the only board
using this driver so far, extend the driver with a bias control function
which will request virtual power to the codec chip from that virtual
regulator, and will supersede the present implementation existing at the
sound card level.

Thanks to the regulator sharing mechanism, both the old (the sound card)
and the new (the codec) implementations should coexist smoothly until
the sound card file is updated. For this to work as expected, update the
sound card .set_bias_level callback to not touch codec->dapm.bias_level.

While extending the cx20442 structure, drop unused control_type member.

Created against linxu-3.2-rc6, tested on top of patch 1/4 "ARM: OMAP1:
ams-delta: set up a regulator over the modem reset GPIO pin".

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@ti.com>


# 5bbcc3c0 23-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Convert CODEC drivers to module_platform_driver

Factors out a bit of boilerplate.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# da155d5b 14-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com>

sound: Add module.h to the previously silent sound users

Lots of sound drivers were getting module.h via the implicit presence
of it in <linux/device.h> but we are going to clean that up. So
fix up those users now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>


# bb3d6bf1 03-Jun-2011 Linus Torvalds <torvalds@linux-foundation.org>

Revert "ASoC: Update cx20442 for TTY API change"

This reverts commit ed0bd2333cffc3d856db9beb829543c1dfc00982.

Since we reverted the TTY API change, we should revert the ASoC update
to it too.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# ed0bd233 11-May-2011 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Update cx20442 for TTY API change

receive_buf() was recently changed to return the number of bytes
received but the cx20442 driver wasn't updated to match the new API.
I don't have any hardware but since we don't actually appears to be
listening to the data at all just report that we accepted all the data
that was offered to us.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 51fb1a87 30-Mar-2011 Lu Guanqun <guanqun.lu@intel.com>

ASoC: Use data based init for cx20442 DAPM

Signed-off-by: Lu Guanqun <guanqun.lu@intel.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 8e6bfb9b 10-Feb-2011 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: fix wrong reg_cache_default content

Content of the CX20442's snd_soc_codec_driver.reg_cache_default pointed
area, introduced with my recent NULL pointer dereferece fix (commit
f019ee5feb344ff0b22b58df4568676295aae14f), occured wrong after further
testing, more thorough than just booting successfully. There are two
problems with it:

1) It should read
(1 << CX20442_TELOUT) | (1 << CX20442_MIC),
not
CX20442_TELOUT | CX20442_MIC.

2) While correctly matching actual codec hardware state on boot when
fixed per 1), a few more code modifications would still be required
to reflect that state not only into register cache, but also force
them into DAPM pins state, otherwise an inconsitency occures which
may prevent further codec state changes from being applied correctly.
As a result, the phone stops ringing after reboot, until someone
picks up the handset for the first time.

Revert that reg_cache_default content to a working, previous de facto
default value of 0, in hope this change can still be accepted as an rc
cycle fix.

Created and tested against linux-2.6.38-rc4

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f019ee5f 01-Feb-2011 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: fix NULL pointer dereference

The CX20442 codec driver never provided the snd_soc_codec_driver's
.reg_cache_default member. With the latest ASoC framework changes, it
seems to be referred unconditionally, resulting in a NULL pointer
dereference if missing. Provide it.

Created and tested on Amstrad Delta against linux-2.6.38-rc2

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 839d271c 28-Dec-2010 Lars-Peter Clausen <lars@metafoo.de>

ASoC: codecs: Remove unused reg_cache fields from device structs

The multi-component patch(commit f0fba2ad1) moved the allocation of the
register cache from the driver to the ASoC core. Most drivers where adjusted to
this, but there are quite a few drivers left which now have an unused reg_cache field in
their private device struct.
This patch removes these unused fields.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 3a45b867 05-Nov-2010 Jarkko Nikula <jhnikula@gmail.com>

ASoC: Move pop time from DAPM context to sound card

Based on discussion the dapm_pop_time in debugsfs should be per card rather
than per device. Single pop time value for entire card is cleaner when the
DAPM sequencing is extended to cross-device paths.

debugfs/asoc/{card->name}/{codec dir}/dapm_pop_time
->
debugfs/asoc/{card->name}/dapm_pop_time

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ce6120cc 05-Nov-2010 Liam Girdwood <lrg@slimlogic.co.uk>

ASoC: Decouple DAPM from CODECs

Decoupling Dynamic Audio Power Management (DAPM) from codec devices is
required when developing ASoC further. Such as for other ASoC components to
have DAPM widgets or when extending DAPM to handle cross-device paths.

This patch decouples DAPM related variables from struct snd_soc_codec and
moves them to new struct snd_soc_dapm_context that is used to encapsulate
DAPM context of a device. ASoC core and API of DAPM functions are modified
to use DAPM context instead of codec.

This patch does not change current functionality and a large part of changes
come because of structure and internal API changes.

Core implementation is from Liam Girdwood <lrg@slimlogic.co.uk> with some
minor core changes, codecs and machine driver conversions from
Jarkko Nikula <jhnikula@gmail.com>.

Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Manuel Lauss <manuel.lauss@googlemail.com>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Cliff Cai <cliff.cai@analog.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: Timur Tabi <timur@freescale.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Jassi Brar <jassi.brar@samsung.com>
Cc: Daniel Gloeckner <dg@emlix.com>
Cc: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 5394637a 19-Aug-2010 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: Use a more adequate name for the CX20442 codec DAI

In the process of unification of codec DAI names while implementing
multi-component, the CX20442 codec DAI has been renamed to "cx20442-hifi".
This new name seems not adequate for a 8kHz voice codec.

Use a better name, "cx20442-voice", as suggested by Liam Girdwood.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# f0fba2ad 17-Mar-2010 Liam Girdwood <lrg@slimlogic.co.uk>

ASoC: multi-component - ASoC Multi-Component Support

This patch extends the ASoC API to allow sound cards to have more than one
CODEC and more than one platform DMA controller. This is achieved by dividing
some current ASoC structures that contain both driver data and device data into
structures that only either contain device data or driver data. i.e.

struct snd_soc_codec ---> struct snd_soc_codec (device data)
+-> struct snd_soc_codec_driver (driver data)

struct snd_soc_platform ---> struct snd_soc_platform (device data)
+-> struct snd_soc_platform_driver (driver data)

struct snd_soc_dai ---> struct snd_soc_dai (device data)
+-> struct snd_soc_dai_driver (driver data)

struct snd_soc_device ---> deleted

This now allows ASoC to be more tightly aligned with the Linux driver model and
also means that every ASoC codec, platform and (platform) DAI is a kernel
device. ASoC component private data is now stored as device private data.

The ASoC sound card struct snd_soc_card has also been updated to store lists
of it's components rather than a pointer to a codec and platform. The PCM
runtime struct soc_pcm_runtime now has pointers to all its components.

This patch adds DAPM support for ASoC multi-component and removes struct
snd_soc_socdev from DAPM core. All DAPM calls are now made on a card, codec
or runtime PCM level basis rather than using snd_soc_socdev.

Other notable multi-component changes:-

* Stream operations now de-reference less structures.
* close_delayed work() now runs on a DAI basis rather than looping all DAIs
in a card.
* PM suspend()/resume() operations can now handle N CODECs and Platforms
per sound card.
* Added soc_bind_dai_link() to bind the component devices to the sound card.
* Added soc_dai_link_probe() and soc_dai_link_remove() to probe and remove
DAI link components.
* sysfs entries can now be registered per component per card.
* snd_soc_new_pcms() functionailty rolled into dai_link_probe().
* snd_soc_register_codec() now does all the codec list and mutex init.

This patch changes the probe() and remove() of the CODEC drivers as follows:-

o Make CODEC driver a platform driver
o Moved all struct snd_soc_codec list, mutex, etc initialiasation to core.
o Removed all static codec pointers (drivers now support > 1 codec dev)
o snd_soc_register_pcms() now done by core.
o snd_soc_register_dai() folded into snd_soc_register_codec().

CS4270 portions:
Acked-by: Timur Tabi <timur@freescale.com>

Some TLV320aic23 and Cirrus platform fixes.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>

TI CODEC and OMAP fixes
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>

Samsung platform and misc fixes :-
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Seungwhan Youn <sw.youn@samsung.com>

MPC8610 and PPC fixes.
Signed-off-by: Timur Tabi <timur@freescale.com>

i.MX fixes and some core fixes.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

J4740 platform fixes:-
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>

CC: Tony Lindgren <tony@atomide.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Kevin Hilman <khilman@deeprootsystems.com>
CC: Sascha Hauer <s.hauer@pengutronix.de>
CC: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
CC: Kuninori Morimoto <morimoto.kuninori@renesas.com>
CC: Daniel Gloeckner <dg@emlix.com>
CC: Manuel Lauss <mano@roarinelk.homelinux.net>
CC: Mike Frysinger <vapier.adi@gmail.com>
CC: Arnaud Patard <apatard@mandriva.com>
CC: Wan ZongShun <mcuos.com@gmail.com>

Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>


# b2c812e2 14-Apr-2010 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Add indirection for CODEC private data

One of the features of the multi CODEC work is that it embeds a struct
device in the CODEC to provide diagnostics via a sysfs class rather than
via the device tree, at which point it's much better to use the struct
device private data rather than having two places to store it. Provide
an accessor function to allow this change to be made more easily, and
update all the CODEC drivers are updated.

To ensure use of the accessor the private data structure member is
renamed, meaning that if code developed with older an older core that
still uses private_data is merged it will fail to build.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>


# 5a0e3ad6 24-Mar-2010 Tejun Heo <tj@kernel.org>

include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>


# 0a3f5e35 12-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Remove redundant snd_soc_dapm_new_widgets() calls

The DAPM widgets are now insntantiated by the core when creating the card
so there is no need for the individual CODEC drivers to do so.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4cae37fa 07-Nov-2009 Takashi Iwai <tiwai@suse.de>

ASoC: Remove dead code and labels

Remove the dead code and labels "card_err" in the error paths of
some codec drivers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>


# fe3e78e0 03-Nov-2009 Mark Brown <broonie@opensource.wolfsonmicro.com>

ASoC: Factor out snd_soc_init_card()

snd_soc_init_card() is always called as the last part of the CODEC probe
function so we can factor it out into the core card setup rather than
have each CODEC replicate the code to do the initialiastation. This will
be required to support multiple CODECs per card.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 9029bb31 05-Aug-2009 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: simplify codec controller usage

This patch is a workaround for the problem of several subsequent control
statements not being applied correctly to the codec controller (modem).

In order to follow the hook switch state change from handset to handsfree
while
in full duplex mode, two consecutive +VLS control commands were sent to the
modem. The first one was M1 (microphone only), the seconds one was M1S1 (both
microphone and speaker). As there was no real modem handshaking procedure
implemented, neither in the codec nor in the machine driver part of the line
discipline, the modem was having the second command missed.

Since a possibility to switch to microphone only mode (and speaker only mode
as well) seams of no value, I have modified the code to issue single M1S1
command only for any of those cases.

Tested on my Amstrad Delta.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 4977b03e 05-Aug-2009 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: add some debugging

This patch adds debugging statement that can help in tracing
how the driver is trying to control the codec device.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# ad120dae 28-Jul-2009 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: push down machine independent line discipline bits

This corrected patch adds machine independent line discipline code, prevoiusly
exsiting inside my Amstrad Delta ASoC machine dirver, to the Conexant CX20442
codec driver. The code can be used as a standalone line discipline, or as a
set of codec specific functions called from machine's line discipline
callbacks. Anyway, the line discipline itself must be registered by a machine
driver.

Applies on top of the followup to my initial driver version:
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-July/019757.html

Suggested by ASoC manintainer Mark Brown <broonie@opensource.wolfsonmicro.com>

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# b84eab08 28-Jul-2009 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: CX20442: fix issues pointed out by subsystem maintainer

The patch fixes some checkpatch identified issues and adds a comment about
line discipline interaction to my driver code, as requested by Mark on my
inital submission (thank you Mark for applying my imperfect patch anyway).
It also fixes MODULE_ALIAS mismatch as used in my machine driver.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>


# 459dc352 21-Jul-2009 Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>

ASoC: Add support for Conexant CX20442-11 voice modem codec

This patch adds support for Conexant CX20442-11 voice modem codec, suitable
for use by the ASoC board driver for Amstrad E3 (Delta) videophone. Related
sound card driver will follow.

This codec is an optional part of the Conexant SmartV three chip modem design.
As such, documentation for its proprietary digital audio interface is not
available. However, on Amstrad Delta board, thanks to Mark Underwood who
created an initial, omap-alsa based sound driver a few years ago[1], the codec
has been discovered to be accessible not only from the modem side, but also
over the OMAP McBSP based CPU DAI. Thus, the driver can be used by any sound
card that can access the codec DAI directly. The DAI configuration parameters
(sample rate and format, number of channels) has been selected out empirically
for best user experience.

The codec analogue interface consists of two pairs of analogue I/O pins:
speakerphone interface or telephone handset/headset interface. Furthermore, it
seams to provide two operation modes for speakerphone I/O: standard and
advanced, with automatic gain control and echo cancelation. Even if the codec
control interface is unknown and not available, all those interfaces and modes
can be selected over the modem chip using V.253 commands. The driver is able
to issue necessary commands over a suitable hw_write function if provided by a
sound card driver. Otherwise, the codec can be controlled over the modem from
userspace while inactive.

Even if nothig is known about the codec internal power management
capabilities, DAPM widgets has been used to model the codec audio map.
Automatically performed powering up/down of those virtual widgets results in
corresponding V.253 commands being issued.

Some driver features/oddities may be board specific, but I have no way to
verify that with any board other than Amstrad Delta.

[1] http://www.earth.li/pipermail/e3-hacking/2006-April/000481.html

Created and tested against linux-2.6.31-rc3.
Applies and works with linux-omap-2.6 commit
7c5cb7862d32cb344be7831d466535d5255e35ac as well.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>