All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: "linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"lrg@slimlogic.co.uk" <lrg@slimlogic.co.uk>
Subject: Re: [PATCH v2 1/4] ASoC: WM8903: Expose GPIOs through gpiolib
Date: Thu, 20 Jan 2011 09:23:45 -0800	[thread overview]
Message-ID: <74CDBE0F657A3D45AFBB94109FB122FF03109556B6@HQMAIL01.nvidia.com> (raw)
In-Reply-To: <20110120115317.GC2551@opensource.wolfsonmicro.com>

Mark Brown wrote on Thursday, January 20, 2011 4:53 AM:
> 
> On Wed, Jan 19, 2011 at 01:50:02PM -0700, Stephen Warren wrote:
> 
> This looks good, one query and one minor omission though.
> 
> >  /* Used to enable configuration of a GPIO to all zeros */
> > -#define WM8903_GPIO_NO_CONFIG 0x8000
> > +#define WM8903_GPIO_NO_CONFIG 0x10000
> 
> Why this change?  The top bit in the registers is never actually used,
> really they're all 15 bit.

Some other registers appear to have bit 15 defined, so I made sure this flag
was completely outside any valid register bits.

Although mainly, I just made it consistent with wm8962.h, which I assume
picked that value for the same reason.

That said, the original value was OK for the GPIO registers, so I can revert
that if you want.

> > +static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
> > +{
> > +	struct wm8903_priv *wm8903 = gpio_to_wm8903(chip);
> > +	struct snd_soc_codec *codec = wm8903->codec;
> > +
> > +	return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset,
> > +				   WM8903_GP1_DIR_MASK, WM8903_GP1_DIR);
> > +}
> 
> > +static int wm8903_gpio_direction_out(struct gpio_chip *chip,
> > +				     unsigned offset, int value)
> > +{
> > +	struct wm8903_priv *wm8903 = gpio_to_wm8903(chip);
> > +	struct snd_soc_codec *codec = wm8903->codec;
> > +
> > +	return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset,
> > +				   WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK,
> > +				   value << WM8903_GP2_LVL_SHIFT);
> > +}
> 
> These should also set GPn_FN - to zero for GPIO output, 3 for GPIO
> input.  Otherwise changing between input and output mode at runtime
> won't do the right thing.  As a side effect of that you probably
> wouldn't need to specify the GPIO configuration in platform data.

Ooops. I didn't notice that. How does this interact with bit 7; GPn_DIR? I
assume both need to be set appropriately since they're both defined bits.

-- 
nvpublic

  reply	other threads:[~2011-01-20 17:24 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1295393859-3396-1-git-send-email-swarren@wwwdotorg.org>
     [not found] ` <1295393859-3396-2-git-send-email-swarren@wwwdotorg.org>
2011-01-19  0:21   ` [PATCH 1/3] ASoC: WM8903: Add wm8903_set_gpio Mark Brown
2011-01-19  0:25 ` [PATCH 0/3] Tegra: Add internal speaker support Mark Brown
2011-01-19  0:29   ` Stephen Warren
     [not found]     ` <AANLkTi=m585PZum2NQUOqq1PiqP84LuT-qCruzaO7x7t@mail.gmail.com>
2011-01-19 11:30       ` Mark Brown
2011-01-19 12:47 ` Liam Girdwood
2011-01-19 20:50 ` [PATCH v2 0/4] Tegra: Harmony: " Stephen Warren
2011-01-20 10:04   ` Liam Girdwood
2011-01-19 20:50 ` [PATCH v2 1/4] ASoC: WM8903: Expose GPIOs through gpiolib Stephen Warren
2011-01-20 11:53   ` Mark Brown
2011-01-20 17:23     ` Stephen Warren [this message]
2011-01-20 20:33       ` Mark Brown
2011-01-19 20:50 ` [PATCH v2 2/4] ARM: tegra: Add Harmony sound platform data type Stephen Warren
2011-01-19 20:50 ` [PATCH v2 3/4] ARM: tegra: Platform data fixes for ASoC driver updates Stephen Warren
2011-01-19 20:50 ` [PATCH v2 4/4] ASoC: tegra: Harmony: Support the internal speaker Stephen Warren
2011-01-20 11:58   ` Mark Brown
2011-01-25 20:29   ` Mark Brown
2011-01-26  3:46     ` Stephen Warren
2011-01-26 11:00       ` Mark Brown
2011-01-20 20:52 ` [PATCH v3 0/4] Tegra: Harmony: Add internal speaker support Stephen Warren
2011-01-20 20:52 ` [PATCH v3 1/4] ASoC: WM8903: Expose GPIOs through gpiolib Stephen Warren
2011-01-21 12:05   ` Mark Brown
2011-01-20 20:52 ` [PATCH v3 2/4] ARM: tegra: Add Harmony sound platform data type Stephen Warren
2011-01-21 18:43   ` Colin Cross
2011-01-21 22:35     ` Stephen Warren
2011-01-21 22:41       ` Colin Cross
2011-01-21 23:41         ` Mark Brown
2011-01-21 23:49           ` Stephen Warren
2011-01-22  5:14             ` Olof Johansson
2011-01-22  5:34               ` Stephen Warren
2011-01-22  5:40                 ` Olof Johansson
2011-01-20 20:52 ` [PATCH v3 3/4] ARM: tegra: Platform data fixes for ASoC driver updates Stephen Warren
2011-01-20 21:22   ` Mark Brown
2011-01-20 22:15     ` Liam Girdwood
2011-01-21 17:45     ` Stephen Warren
2011-01-21 17:50       ` Mark Brown
2011-01-21 18:06         ` Stephen Warren
2011-01-21 18:11           ` Mark Brown
2011-01-21 18:22             ` Stephen Warren
2011-01-21 18:27               ` Mark Brown
2011-01-21 18:36                 ` Stephen Warren
2011-01-21 18:39                   ` Mark Brown
2011-01-21 18:51                     ` Stephen Warren
2011-01-21 18:57                       ` Mark Brown
2011-01-21 22:41                         ` Stephen Warren
2011-01-20 20:52 ` [PATCH v3 4/4] ASoC: tegra: Harmony: Support the internal speaker Stephen Warren

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=74CDBE0F657A3D45AFBB94109FB122FF03109556B6@HQMAIL01.nvidia.com \
    --to=swarren@nvidia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /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.