From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752622AbcFTIjx (ORCPT ); Mon, 20 Jun 2016 04:39:53 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:45787 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751896AbcFTIjo (ORCPT ); Mon, 20 Jun 2016 04:39:44 -0400 Subject: Re: [PATCH 4/4] ASoC: tpa6130a2: Add DAPM support To: Helen Koike , , , , , , , , , , References: <2aed60529eea206f2192a7236f2d80386a73f2ee.1466218805.git.helen.koike@collabora.co.uk> From: Peter Ujfalusi Message-ID: <9e2aa325-b800-f2f0-6f56-0bf07644f689@ti.com> Date: Mon, 20 Jun 2016 11:34:48 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <2aed60529eea206f2192a7236f2d80386a73f2ee.1466218805.git.helen.koike@collabora.co.uk> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > [koike: port for upstream] > Signed-off-by: Helen Koike > --- > 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