Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
	lgirdwood@gmail.com
Subject: Re: [PATCH 4/5] ASoC: dapm: Add support for autodisable mux controls
Date: Thu, 30 Apr 2015 14:44:40 +0200	[thread overview]
Message-ID: <554223B8.1040304@metafoo.de> (raw)
In-Reply-To: <1430390332-14037-4-git-send-email-ckeepax@opensource.wolfsonmicro.com>

On 04/30/2015 12:38 PM, Charles Keepax wrote:
> Commit 57295073b6ac ("ASoC: dapm: Implement mixer input auto-disable")
> added support for autodisable controls, controls whose values are only
> written to the hardware when their respective widgets are powered up.
> But it only added support for controls based on the mixer abstraction.
>
> This patch add support for mux controls (DAPM controls based on the
> enum abstraction) to be auto-disabled as well. As each mux can only have
> a single control, there is no need to tie the autodisable widget to the
> inputs (as is done for the mixer controls) it can be tided directly to
> the mux widget itself.
>
> Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Looks pretty good.

[...]
> @@ -354,6 +355,34 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
>   			}
>   		}
>   		break;
> +	case snd_soc_dapm_mux:
> +		e = (struct soc_enum *)kcontrol->private_value;
> +
> +		if (e->autodisable) {
> +			struct snd_soc_dapm_widget template;
> +
> +			memset(&template, 0, sizeof(template));
> +			template.reg = e->reg;
> +			template.mask = e->mask << e->shift_l;
> +			template.shift = e->shift_l;
> +			template.off_val = 0;

I've though about adding a auto-disable MUX type as well and the chip were I 
wanted to use it has a non-zero power-off value. So I'd like to be able to 
somehow specify this. We could for example put it at the end of the values 
array. E.g.

if (e->values)
	template.off_val = e->values[e->items].
else
	template.off_val = 0;

> +			template.on_val = template.off_val;
> +			template.id = snd_soc_dapm_kcontrol;
> +			template.name = name;
> +
> +			data->value = template.on_val;
> +
> +			data->widget = snd_soc_dapm_new_control(widget->dapm,
> +					&template);
> +			if (!data->widget) {
> +				ret = -ENOMEM;
> +				goto err_name;
> +			}
> +
> +			snd_soc_dapm_add_path(widget->dapm, data->widget,
> +					      widget, NULL, NULL);
> +		}
> +		break;
>   	default:
>   		break;
>   	}

  reply	other threads:[~2015-04-30 12:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 10:38 [PATCH 1/5] ASoC: Correct typo in SOC_VALUE_ENUM_SINGLE macro Charles Keepax
2015-04-30 10:38 ` [PATCH 2/5] ASoC: dapm: Remove local OOM error message Charles Keepax
2015-04-30 10:38 ` [PATCH 3/5] ASoC: dapm: Append "Autodisable" to autodisable widget names Charles Keepax
2015-04-30 10:38 ` [PATCH 4/5] ASoC: dapm: Add support for autodisable mux controls Charles Keepax
2015-04-30 12:44   ` Lars-Peter Clausen [this message]
2015-04-30 15:00     ` Charles Keepax
2015-04-30 15:39       ` Lars-Peter Clausen
2015-04-30 15:58         ` Mark Brown
2015-04-30 10:38 ` [PATCH 5/5] ASoC: arizona: Use auto disable muxes for routing Charles Keepax

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=554223B8.1040304@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.wolfsonmicro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox