All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Ola Lilja <ola.o.lilja@stericsson.com>,
	alsa-devel@alsa-project.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 3/6] ASoC: ux500: Drop pinctrl sleep support
Date: Wed, 8 May 2013 09:07:08 +0100	[thread overview]
Message-ID: <20130508080708.GH3102@gmail.com> (raw)
In-Reply-To: <1367997261-32048-4-git-send-email-fabio.baltieri@linaro.org>

On Wed, 08 May 2013, Fabio Baltieri wrote:

> Drop pinctrl default/sleep state switching code, as it was breaking the
> capture interface by putting the I2S pins in hi-z mode regardless of its
> usage status, and not giving any real benefit.
> 
> Pinctrl default mode configuration is already managed automatically by a
> specific pinctrl hog.

I'm sure we should support pinctrl though shouldn't we?

Is there no way of fixing the implementation instead of ripping it out?

> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
> ---
>  sound/soc/ux500/ux500_msp_i2s.c | 56 ++---------------------------------------
>  sound/soc/ux500/ux500_msp_i2s.h |  6 -----
>  2 files changed, 2 insertions(+), 60 deletions(-)
> 
> diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
> index 964cfd6..8512c78 100644
> --- a/sound/soc/ux500/ux500_msp_i2s.c
> +++ b/sound/soc/ux500/ux500_msp_i2s.c
> @@ -15,7 +15,6 @@
>  
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> -#include <linux/pinctrl/consumer.h>
>  #include <linux/delay.h>
>  #include <linux/slab.h>
>  #include <linux/io.h>
> @@ -28,9 +27,6 @@
>  
>  #include "ux500_msp_i2s.h"
>  
> -/* MSP1/3 Tx/Rx usage protection */
> -static DEFINE_SPINLOCK(msp_rxtx_lock);
> -
>   /* Protocol desciptors */
>  static const struct msp_protdesc prot_descs[] = {
>  	{ /* I2S */
> @@ -358,24 +354,8 @@ static int configure_multichannel(struct ux500_msp *msp,
>  
>  static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config)
>  {
> -	int status = 0, retval = 0;
> +	int status = 0;
>  	u32 reg_val_DMACR, reg_val_GCR;
> -	unsigned long flags;
> -
> -	/* Check msp state whether in RUN or CONFIGURED Mode */
> -	if (msp->msp_state == MSP_STATE_IDLE) {
> -		spin_lock_irqsave(&msp_rxtx_lock, flags);
> -		if (msp->pinctrl_rxtx_ref == 0 &&
> -			!(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_def))) {
> -			retval = pinctrl_select_state(msp->pinctrl_p,
> -						msp->pinctrl_def);
> -			if (retval)
> -				pr_err("could not set MSP defstate\n");
> -		}
> -		if (!retval)
> -			msp->pinctrl_rxtx_ref++;
> -		spin_unlock_irqrestore(&msp_rxtx_lock, flags);
> -	}
>  
>  	/* Configure msp with protocol dependent settings */
>  	configure_protocol(msp, config);
> @@ -632,8 +612,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
>  
>  int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
>  {
> -	int status = 0, retval = 0;
> -	unsigned long flags;
> +	int status = 0;
>  
>  	dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir);
>  
> @@ -645,18 +624,6 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
>  			       (~(FRAME_GEN_ENABLE | SRG_ENABLE))),
>  			      msp->registers + MSP_GCR);
>  
> -		spin_lock_irqsave(&msp_rxtx_lock, flags);
> -		WARN_ON(!msp->pinctrl_rxtx_ref);
> -		msp->pinctrl_rxtx_ref--;
> -		if (msp->pinctrl_rxtx_ref == 0 &&
> -			!(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_sleep))) {
> -			retval = pinctrl_select_state(msp->pinctrl_p,
> -						msp->pinctrl_sleep);
> -			if (retval)
> -				pr_err("could not set MSP sleepstate\n");
> -		}
> -		spin_unlock_irqrestore(&msp_rxtx_lock, flags);
> -
>  		writel(0, msp->registers + MSP_GCR);
>  		writel(0, msp->registers + MSP_TCF);
>  		writel(0, msp->registers + MSP_RCF);
> @@ -745,25 +712,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
>  	dev_dbg(&pdev->dev, "I2S device-name: '%s'\n", i2s_cont->name);
>  	msp->i2s_cont = i2s_cont;
>  
> -	msp->pinctrl_p = pinctrl_get(msp->dev);
> -	if (IS_ERR(msp->pinctrl_p))
> -		dev_err(&pdev->dev, "could not get MSP pinctrl\n");
> -	else {
> -		msp->pinctrl_def = pinctrl_lookup_state(msp->pinctrl_p,
> -						PINCTRL_STATE_DEFAULT);
> -		if (IS_ERR(msp->pinctrl_def)) {
> -			dev_err(&pdev->dev,
> -				"could not get MSP defstate (%li)\n",
> -				PTR_ERR(msp->pinctrl_def));
> -		}
> -		msp->pinctrl_sleep = pinctrl_lookup_state(msp->pinctrl_p,
> -						PINCTRL_STATE_SLEEP);
> -		if (IS_ERR(msp->pinctrl_sleep))
> -			dev_err(&pdev->dev,
> -				"could not get MSP idlestate (%li)\n",
> -				PTR_ERR(msp->pinctrl_def));
> -	}
> -
>  	return 0;
>  }
>  
> diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h
> index 1311c0d..1ce336f 100644
> --- a/sound/soc/ux500/ux500_msp_i2s.h
> +++ b/sound/soc/ux500/ux500_msp_i2s.h
> @@ -530,12 +530,6 @@ struct ux500_msp {
>  	int loopback_enable;
>  	u32 backup_regs[MAX_MSP_BACKUP_REGS];
>  	unsigned int f_bitclk;
> -	/* Pin modes */
> -	struct pinctrl *pinctrl_p;
> -	struct pinctrl_state *pinctrl_def;
> -	struct pinctrl_state *pinctrl_sleep;
> -	/* Reference Count */
> -	int pinctrl_rxtx_ref;
>  };
>  
>  struct ux500_msp_dma_params {

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: Fabio Baltieri <fabio.baltieri@linaro.org>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Ola Lilja <ola.o.lilja@stericsson.com>
Subject: Re: [PATCH 3/6] ASoC: ux500: Drop pinctrl sleep support
Date: Wed, 8 May 2013 09:07:08 +0100	[thread overview]
Message-ID: <20130508080708.GH3102@gmail.com> (raw)
In-Reply-To: <1367997261-32048-4-git-send-email-fabio.baltieri@linaro.org>

On Wed, 08 May 2013, Fabio Baltieri wrote:

> Drop pinctrl default/sleep state switching code, as it was breaking the
> capture interface by putting the I2S pins in hi-z mode regardless of its
> usage status, and not giving any real benefit.
> 
> Pinctrl default mode configuration is already managed automatically by a
> specific pinctrl hog.

I'm sure we should support pinctrl though shouldn't we?

Is there no way of fixing the implementation instead of ripping it out?

> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
> ---
>  sound/soc/ux500/ux500_msp_i2s.c | 56 ++---------------------------------------
>  sound/soc/ux500/ux500_msp_i2s.h |  6 -----
>  2 files changed, 2 insertions(+), 60 deletions(-)
> 
> diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
> index 964cfd6..8512c78 100644
> --- a/sound/soc/ux500/ux500_msp_i2s.c
> +++ b/sound/soc/ux500/ux500_msp_i2s.c
> @@ -15,7 +15,6 @@
>  
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
> -#include <linux/pinctrl/consumer.h>
>  #include <linux/delay.h>
>  #include <linux/slab.h>
>  #include <linux/io.h>
> @@ -28,9 +27,6 @@
>  
>  #include "ux500_msp_i2s.h"
>  
> -/* MSP1/3 Tx/Rx usage protection */
> -static DEFINE_SPINLOCK(msp_rxtx_lock);
> -
>   /* Protocol desciptors */
>  static const struct msp_protdesc prot_descs[] = {
>  	{ /* I2S */
> @@ -358,24 +354,8 @@ static int configure_multichannel(struct ux500_msp *msp,
>  
>  static int enable_msp(struct ux500_msp *msp, struct ux500_msp_config *config)
>  {
> -	int status = 0, retval = 0;
> +	int status = 0;
>  	u32 reg_val_DMACR, reg_val_GCR;
> -	unsigned long flags;
> -
> -	/* Check msp state whether in RUN or CONFIGURED Mode */
> -	if (msp->msp_state == MSP_STATE_IDLE) {
> -		spin_lock_irqsave(&msp_rxtx_lock, flags);
> -		if (msp->pinctrl_rxtx_ref == 0 &&
> -			!(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_def))) {
> -			retval = pinctrl_select_state(msp->pinctrl_p,
> -						msp->pinctrl_def);
> -			if (retval)
> -				pr_err("could not set MSP defstate\n");
> -		}
> -		if (!retval)
> -			msp->pinctrl_rxtx_ref++;
> -		spin_unlock_irqrestore(&msp_rxtx_lock, flags);
> -	}
>  
>  	/* Configure msp with protocol dependent settings */
>  	configure_protocol(msp, config);
> @@ -632,8 +612,7 @@ int ux500_msp_i2s_trigger(struct ux500_msp *msp, int cmd, int direction)
>  
>  int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
>  {
> -	int status = 0, retval = 0;
> -	unsigned long flags;
> +	int status = 0;
>  
>  	dev_dbg(msp->dev, "%s: Enter (dir = 0x%01x).\n", __func__, dir);
>  
> @@ -645,18 +624,6 @@ int ux500_msp_i2s_close(struct ux500_msp *msp, unsigned int dir)
>  			       (~(FRAME_GEN_ENABLE | SRG_ENABLE))),
>  			      msp->registers + MSP_GCR);
>  
> -		spin_lock_irqsave(&msp_rxtx_lock, flags);
> -		WARN_ON(!msp->pinctrl_rxtx_ref);
> -		msp->pinctrl_rxtx_ref--;
> -		if (msp->pinctrl_rxtx_ref == 0 &&
> -			!(IS_ERR(msp->pinctrl_p) || IS_ERR(msp->pinctrl_sleep))) {
> -			retval = pinctrl_select_state(msp->pinctrl_p,
> -						msp->pinctrl_sleep);
> -			if (retval)
> -				pr_err("could not set MSP sleepstate\n");
> -		}
> -		spin_unlock_irqrestore(&msp_rxtx_lock, flags);
> -
>  		writel(0, msp->registers + MSP_GCR);
>  		writel(0, msp->registers + MSP_TCF);
>  		writel(0, msp->registers + MSP_RCF);
> @@ -745,25 +712,6 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
>  	dev_dbg(&pdev->dev, "I2S device-name: '%s'\n", i2s_cont->name);
>  	msp->i2s_cont = i2s_cont;
>  
> -	msp->pinctrl_p = pinctrl_get(msp->dev);
> -	if (IS_ERR(msp->pinctrl_p))
> -		dev_err(&pdev->dev, "could not get MSP pinctrl\n");
> -	else {
> -		msp->pinctrl_def = pinctrl_lookup_state(msp->pinctrl_p,
> -						PINCTRL_STATE_DEFAULT);
> -		if (IS_ERR(msp->pinctrl_def)) {
> -			dev_err(&pdev->dev,
> -				"could not get MSP defstate (%li)\n",
> -				PTR_ERR(msp->pinctrl_def));
> -		}
> -		msp->pinctrl_sleep = pinctrl_lookup_state(msp->pinctrl_p,
> -						PINCTRL_STATE_SLEEP);
> -		if (IS_ERR(msp->pinctrl_sleep))
> -			dev_err(&pdev->dev,
> -				"could not get MSP idlestate (%li)\n",
> -				PTR_ERR(msp->pinctrl_def));
> -	}
> -
>  	return 0;
>  }
>  
> diff --git a/sound/soc/ux500/ux500_msp_i2s.h b/sound/soc/ux500/ux500_msp_i2s.h
> index 1311c0d..1ce336f 100644
> --- a/sound/soc/ux500/ux500_msp_i2s.h
> +++ b/sound/soc/ux500/ux500_msp_i2s.h
> @@ -530,12 +530,6 @@ struct ux500_msp {
>  	int loopback_enable;
>  	u32 backup_regs[MAX_MSP_BACKUP_REGS];
>  	unsigned int f_bitclk;
> -	/* Pin modes */
> -	struct pinctrl *pinctrl_p;
> -	struct pinctrl_state *pinctrl_def;
> -	struct pinctrl_state *pinctrl_sleep;
> -	/* Reference Count */
> -	int pinctrl_rxtx_ref;
>  };
>  
>  struct ux500_msp_dma_params {

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2013-05-08  8:07 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08  7:14 [PATCH 0/6] Second set of fixes for ux500 ASoC drivers Fabio Baltieri
2013-05-08  7:14 ` [PATCH 1/6] ASoC: ab8500-codec: Add missing ad_to_slot definitions Fabio Baltieri
2013-05-08  7:53   ` Lee Jones
2013-05-08  8:30     ` Fabio Baltieri
2013-05-08  8:30       ` Fabio Baltieri
2013-05-08  8:47       ` Lee Jones
2013-05-08 10:58   ` Mark Brown
2013-05-08  7:14 ` [PATCH 2/6] ASoC: ux500: Do not clear state if already idle Fabio Baltieri
2013-05-08  8:04   ` Lee Jones
2013-05-08  8:04     ` Lee Jones
2013-05-08  8:39     ` [PATCH v2 " Fabio Baltieri
2013-05-08  8:39       ` Fabio Baltieri
2013-05-08 10:34       ` Mark Brown
2013-05-08 10:34         ` Mark Brown
2013-05-08 11:04         ` Lee Jones
2013-05-08 11:31           ` Mark Brown
2013-05-08 12:03             ` Lee Jones
2013-05-08 12:39               ` Mark Brown
2013-05-08 12:39                 ` Mark Brown
2013-05-08 13:05                 ` Lee Jones
2013-05-08 13:48                   ` Mark Brown
2013-05-08 13:48                     ` Mark Brown
2013-05-08 14:06                     ` Lee Jones
2013-05-09  9:28                       ` Mark Brown
2013-05-08 12:04         ` Fabio Baltieri
2013-05-08 12:39           ` Mark Brown
2013-05-08  7:14 ` [PATCH 3/6] ASoC: ux500: Drop pinctrl sleep support Fabio Baltieri
2013-05-08  8:07   ` Lee Jones [this message]
2013-05-08  8:07     ` Lee Jones
2013-05-08  8:20     ` Fabio Baltieri
2013-05-08  8:48       ` Lee Jones
2013-05-08  9:00         ` Fabio Baltieri
2013-05-08 10:51   ` Mark Brown
2013-05-08 10:51     ` Mark Brown
2013-05-08 11:42     ` Fabio Baltieri
2013-05-08 12:32       ` Mark Brown
2013-05-08 12:32         ` Mark Brown
2013-05-08 13:10         ` Fabio Baltieri
2013-05-08 13:54           ` Mark Brown
2013-05-08 14:17             ` Fabio Baltieri
2013-05-08 14:27               ` Fabio Baltieri
2013-05-08 14:27                 ` Fabio Baltieri
2013-05-08 14:49                 ` Mark Brown
2013-05-08 15:07                   ` Lee Jones
2013-05-09  9:34                     ` Mark Brown
2013-05-09  9:34                       ` Mark Brown
2013-05-08 14:29               ` Mark Brown
2013-05-08 15:48                 ` Fabio Baltieri
2013-05-08 15:48                   ` Fabio Baltieri
2013-05-09  9:41                   ` Mark Brown
2013-05-09  9:41                     ` Mark Brown
2013-05-13 10:43                     ` Fabio Baltieri
2013-05-17 22:02                   ` Linus Walleij
2013-05-17 22:02                     ` Linus Walleij
2013-05-08  7:14 ` [PATCH 4/6] ASoC: ux500: Update tx tdm slots configuration Fabio Baltieri
2013-05-08  8:18   ` Lee Jones
2013-05-08 11:01   ` Mark Brown
2013-05-08 11:01     ` Mark Brown
2013-05-08 11:11     ` Lee Jones
2013-05-08 11:11       ` Lee Jones
2013-05-08 11:32       ` Fabio Baltieri
2013-05-08 12:28       ` Mark Brown
2013-05-08 12:28         ` Mark Brown
2013-05-08 16:03     ` Fabio Baltieri
2013-05-08  7:14 ` [PATCH 5/6] ASoC: ux500: Swap even/odd AD slot definitions Fabio Baltieri
2013-05-08  8:19   ` Lee Jones
2013-05-08  8:19     ` Lee Jones
2013-05-08  7:14 ` [PATCH 6/6] ASoC: ux500: Use the first two AD slots for capture Fabio Baltieri
2013-05-08  8:22   ` Lee Jones
2013-05-08 10:56   ` Mark Brown
2013-05-08 10:56     ` Mark Brown
2013-05-08 11:12     ` Lee Jones
2013-05-08 12:30       ` Mark Brown
2013-05-08 12:30         ` Mark Brown
2013-05-08 16:08     ` Fabio Baltieri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130508080708.GH3102@gmail.com \
    --to=lee.jones@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=fabio.baltieri@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ola.o.lilja@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.