Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp4956415rwn; Mon, 12 Sep 2022 01:52:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR4aimC0tBUk9b0NaS3F6NgP1gf7c47WtCVUJ4YHpV9fwDFCxoIm9SmkU7lXC07t5oyqopX1 X-Received: by 2002:a65:6e87:0:b0:438:e26c:167a with SMTP id bm7-20020a656e87000000b00438e26c167amr5440292pgb.421.1662972722614; Mon, 12 Sep 2022 01:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662972722; cv=none; d=google.com; s=arc-20160816; b=aw/59EfMV5CSRHZd13f9kbOdWGGamdzkVofu4ISQqHZ2AeMV8yS73AKpooU3nWoz6D RqgmQJ2fB74tMMYkMgFjd1hmCMEEJVk8fpEyoekmXLrysgzvp+7yJoiTMNogJwlfLqqV nIKg76yVl3bU7GALBCgJyvvMM7T1nfuPFHv1ZOoPaNd2072uoSPmJaLz1H2hil8cVgF8 ywNOMudIOQ14z/OjzCNqlg9DeAYbvA3yqfbWW3BlbtDoboU1n+EXY99iVynPZdtSsBRC eBAOAaBuTtIna0qE3/nEgzXTWkrIEFaC+uFqtSygywzMct6kztLUqBeWejtv82UjE0ni snuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oIPlj77S7TL3EFKkzdGb3gdQ5LXHDMLWke3cCptq+uM=; b=nA84bPOKIJ6KDutY0/sqa+s7s40YPegd0dQAKipN/KglEpuSQn6RMQbG0hG9wHfOFy 4A9+HOAA4MQaxSZ2DVKPpou+rZ64nXU220bOclHq4JhwAh1AJWm93rAjKtVJgIy9JRFG NnnpslWczE7JLoyNLybC6ls0br+gAJrRlDZ90/4zR1k06LEAiGZYrvnBoz0ilfGfSaTg kIxtCkYc20fdle576VHMx9JK4gF7dp8t/hjDbnJQjOVNqZnpCVciS0QOEr87N3ju8R5A w2X2LKdtkbQKaR4ZukXfu8lUtZ7nTMKp7e+PKByC+MlnbWHdpU6QL3XbTIOl9jw+N6/a gM4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Phx26Sw0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q23-20020a632a17000000b00438f2ce90a2si3234470pgq.346.2022.09.12.01.51.50; Mon, 12 Sep 2022 01:52:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Phx26Sw0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229978AbiILIsq (ORCPT + 99 others); Mon, 12 Sep 2022 04:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbiILIsm (ORCPT ); Mon, 12 Sep 2022 04:48:42 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DAB62AE29 for ; Mon, 12 Sep 2022 01:48:40 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id p15-20020a056830130f00b006544f5228e3so5395486otq.2 for ; Mon, 12 Sep 2022 01:48:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=oIPlj77S7TL3EFKkzdGb3gdQ5LXHDMLWke3cCptq+uM=; b=Phx26Sw0C0/q7KiFz7tbZrU15U/bIg1itlUhlajdilKJCe+ZEn0BY9dMFemw/JaFlM D32lZi4+ywqgMBRKDKiKOxWMMgY9qXMhepZ296QYJeLrrPDBY6I/JBRtqcXRk46omA2l dZQdUMgmJyDFxq4HLMQK3/dJzOtxq0jT+RSlo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=oIPlj77S7TL3EFKkzdGb3gdQ5LXHDMLWke3cCptq+uM=; b=OGiPZNYRre7f7pT7KpHUpVBZrU+GUz6baE+iqd3whX/l47IHeXWJ4XR65su9cEXGo4 PmvB6ZIqe89OavetHVI2iAEQQqppYUuhIi4Hv6tmrORWEfUIFfDQebbsX7A3sIUXYL2d iW29PGD2EmptmheITh0Radk0XiZfiFckjGcKEc3DmTv0NvGC9f9fxSUiySrmWG79pmEf ZH9LbAZDFCB2iozNQuqqIFv9pFwZI2kFe7l0D5H7dsIml5U0yQoEanRBHYSyDGBwVxiE 59WfdJjr98Duy6f0UZ1vsdN/XBPW74R06KRIDl59hjLXj0x6zvUs0rjQurDX/OT7ud82 E8OA== X-Gm-Message-State: ACgBeo2dQp3pLomEkjU2KUKDIpj/D/nhbYeipJWAUKYFA3UphMseZMaV t3x4S9RwS5uio9I5m9iYpX2ZUsDWvxZqUZkT4OPr7JuwjR4= X-Received: by 2002:a9d:51cc:0:b0:655:de5c:f2f3 with SMTP id d12-20020a9d51cc000000b00655de5cf2f3mr1987188oth.237.1662972519102; Mon, 12 Sep 2022 01:48:39 -0700 (PDT) MIME-Version: 1.0 References: <20220912072945.760949-1-yunjunlee@chromium.org> <87pmg1hvw7.wl-tiwai@suse.de> In-Reply-To: <87pmg1hvw7.wl-tiwai@suse.de> From: YJ Lee Date: Mon, 12 Sep 2022 16:48:27 +0800 Message-ID: Subject: Re: [PATCH v1] ALSA: dummy: Add customizable volume min/max. To: Takashi Iwai Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, yuhsuan@chromium.org, whalechang@chromium.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 12, 2022 at 3:52 PM Takashi Iwai wrote: > > 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 > > --- > > 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 Thanks for the insight! Learned a lot from your kind explanation and constant help. Appreciated, YJ