mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: YJ Lee <yunjunlee@chromium.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	yuhsuan@chromium.org, whalechang@chromium.org
Subject: Re: [PATCH v1] ALSA: dummy: Add customizable volume min/max.
Date: Mon, 12 Sep 2022 09:52:40 +0200	[thread overview]
Message-ID: <87pmg1hvw7.wl-tiwai@suse.de> (raw)
In-Reply-To: <20220912072945.760949-1-yunjunlee@chromium.org>

On Mon, 12 Sep 2022 09:29:45 +0200,
YJ Lee wrote:
> 
> Add module parameters to support customized min/max volume leveling,
> which will be useful to test devices with different volume granularity.
> 
> Signed-off-by: YJ Lee <yunjunlee@chromium.org>
> ---
>  sound/drivers/dummy.c | 34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
> index 2a7fc49c1a7c5..64fb2778f1e9a 100644
> --- a/sound/drivers/dummy.c
> +++ b/sound/drivers/dummy.c
> @@ -42,6 +42,8 @@ MODULE_LICENSE("GPL");
>  #define USE_CHANNELS_MAX 	2
>  #define USE_PERIODS_MIN 	1
>  #define USE_PERIODS_MAX 	1024
> +#define USE_MIXER_VOLUME_LEVEL_MIN	-50
> +#define USE_MIXER_VOLUME_LEVEL_MAX	100
>  
>  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
>  static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
> @@ -50,6 +52,8 @@ static char *model[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = NULL};
>  static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
>  static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
>  //static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
> +static int mixer_volume_level_min = USE_MIXER_VOLUME_LEVEL_MIN;
> +static int mixer_volume_level_max = USE_MIXER_VOLUME_LEVEL_MAX;
>  #ifdef CONFIG_HIGH_RES_TIMERS
>  static bool hrtimer = 1;
>  #endif
> @@ -69,6 +73,10 @@ module_param_array(pcm_substreams, int, NULL, 0444);
>  MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-128) for dummy driver.");
>  //module_param_array(midi_devs, int, NULL, 0444);
>  //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
> +module_param(mixer_volume_level_min, int, 0444);

I can imagine that the permission could be 0644, so that the
parameters can be changed dynamically via sysfs, too.  But it may skip
the sanity check at probe, hence more code would be needed, OTOH.

So I applied the patch as is now.


thanks,

Takashi

  reply	other threads:[~2022-09-12  7:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12  7:29 YJ Lee
2022-09-12  7:52 ` Takashi Iwai [this message]
2022-09-12  8:48   ` YJ Lee

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=87pmg1hvw7.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=whalechang@chromium.org \
    --cc=yuhsuan@chromium.org \
    --cc=yunjunlee@chromium.org \
    /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

all inboxes | Powered by JetHome®