Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426330

Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support

From Peter Ujfalusi <peter.ujfalusi@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support
Date 2016-06-20 10:40 +0200
Message-ID <rM2Up-5T4-17@gated-at.bofh.it> (permalink)
References <rLfgZ-74e-3@gated-at.bofh.it> <rLfgZ-74e-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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@metafoo.de>
> [koike: port for upstream]
> Signed-off-by: Helen Koike <helen.koike@collabora.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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Helen Koike <helen.koike@collabora.co.uk> - 2016-06-18 05:40 +0200
  Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Sebastian Reichel <sre@kernel.org> - 2016-06-19 01:30 +0200
    Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Lars-Peter Clausen <lars@metafoo.de> - 2016-06-19 11:40 +0200
      Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Sebastian Reichel <sre@kernel.org> - 2016-06-19 22:10 +0200
  Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support Peter Ujfalusi <peter.ujfalusi@ti.com> - 2016-06-20 10:40 +0200

csiph-web