[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9e2aa325-b800-f2f0-6f56-0bf07644f689@ti.com>
Date: Mon, 20 Jun 2016 11:34:48 +0300
From: Peter Ujfalusi <peter.ujfalusi@...com>
To: Helen Koike <helen.koike@...labora.co.uk>, <lgirdwood@...il.com>,
<broonie@...nel.org>, <perex@...ex.cz>, <tiwai@...e.com>,
<jarkko.nikula@...mer.com>, <lars@...afoo.de>,
<k.kozlowski@...sung.com>, <alsa-devel@...a-project.org>,
<linux-kernel@...r.kernel.org>, <linux-omap@...r.kernel.org>
Subject: Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support
On 06/18/2016 07:42 AM, Helen Koike wrote:
> Add DAPM support and updated rx51 accordingly.
> As a consequence:
> - the exported function tpa6130a2_stereo_enable is not needed anymore
> - the mutex is dealt in the DAPM
> - the power state is tracked by the DAPM
>
> Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
> [koike: port for upstream]
> Signed-off-by: Helen Koike <helen.koike@...labora.co.uk>
> ---
> sound/soc/codecs/tpa6130a2.c | 184 +++++++++++++++++--------------------------
> sound/soc/codecs/tpa6130a2.h | 11 +--
> sound/soc/omap/rx51.c | 22 ++----
> 3 files changed, 86 insertions(+), 131 deletions(-)
>
> diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
> index dc7bfc9..7cb5066 100644
> --- a/sound/soc/codecs/tpa6130a2.c
> +++ b/sound/soc/codecs/tpa6130a2.c
> @@ -41,79 +41,71 @@ enum tpa_model {
> TPA6140A2,
> };
>
> -static struct i2c_client *tpa6130a2_client;
> -
> /* This struct is used to save the context */
> struct tpa6130a2_data {
> - struct mutex mutex;
> struct regmap *regmap;
> struct regulator *supply;
> int power_gpio;
> - u8 power_state:1;
> enum tpa_model id;
> };
>
> -static int tpa6130a2_power(u8 power)
> +static int tpa6130a2_power(struct device *dev, bool enable)
I would rather add 'struct device *dev' to tpa6130a2_data and pass the pointer
to the private struct instead to the device.
> {
> - struct tpa6130a2_data *data;
> - int ret = 0;
> -
> - if (WARN_ON(!tpa6130a2_client))
> - return -EINVAL;
> - data = i2c_get_clientdata(tpa6130a2_client);
> -
> - mutex_lock(&data->mutex);
> - if (power == data->power_state)
> - goto exit;
> + struct tpa6130a2_data *data = dev_get_drvdata(dev);
> + int ret;
>
> - if (power) {
> + if (enable) {
--
Péter
Powered by blists - more mailing lists