[alsa-devel] [PATCH 2/2] ASoC: arizona: Add GPIO output for DRC

Mark Brown broonie at kernel.org
Tue Jul 2 17:36:42 CEST 2013

On Tue, Jul 02, 2013 at 03:53:37PM +0100, Charles Keepax wrote:

> In some use cases, such as signal activity detection, the only output
> from the DRC will be a GPIO pin. This patch adds GPIO outputs to the
> CODEC driver and hooks these up to the DRC when a GPIO is configured to
> output the DRC activity detection.

> +static const char * const arizona_gpio_name[] = {
> +	"GPIO1",
> +	"GPIO2",
> +	"GPIO3",
> +	"GPIO4",
> +	"GPIO5",
> +};

This seems like the wrong way to be doing things - having the GPIOs in
the routing table is needlessly complicated as the don't go anywhere
routing wise and they're not exactly helping anything usability wise as
the function of the output is translated into a magic number making it
harder for people to write code interacting with this (eg, turning it on
and off depending on use case), you need to know which GPIO is in use so
it's harder to write generic code.

Just have a functional thing in there, enabling or disabling it by
default depending on the GPIO settings seems reasonable.

> +		switch (arizona->pdata.gpio_defaults[i] & ARIZONA_GPN_FN_MASK) {
> +		case 0x1d: /* DRC1 Signal Detect */
> +			routes[0].source = "DRC1L";
> +			routes[1].source = "DRC1R";
> +			add = true;
> +			break;
> +		case 0x22: /* DRC2 Signal Detect */

You're going to be using these in multiple places, #defines..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20130702/8baeadb4/attachment.sig>

More information about the Alsa-devel mailing list