Re: [PATCH v2 1/4] ASoC: WM8903: Expose GPIOs through gpiolib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

> +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.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux