From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BD81C433F5 for ; Tue, 12 Oct 2021 03:08:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F1E9960EE5 for ; Tue, 12 Oct 2021 03:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbhJLDJ7 (ORCPT ); Mon, 11 Oct 2021 23:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231742AbhJLDJ5 (ORCPT ); Mon, 11 Oct 2021 23:09:57 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92EE9C061570; Mon, 11 Oct 2021 20:07:56 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id o83so19805894oif.4; Mon, 11 Oct 2021 20:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vVvBHngaWKoiA0++47ZxjHijX6w95ry8pBLW3rnsyKM=; b=H9QwPe1Ga5lUz1oYHLYo1JXPU/nYvZOAWkRMgEQdMGj79GPeGqm9vTqS2PhYSElTeb dKUQWF04Fo4hEOu/O+5K+8jO3EE0iteMyFjRNi+8yvHdvvSwEwLRLY1xuFAF5TeY1OHr zXcrXJtpIye4HG2gHbsswu78EUWdqXmH3sSpfJwQkBf9AAQ/8igFUaNx1fCGhb/JWeUy xyhtmsrfkwBjtnsLO0hFN376XVyHwckh5ohEZ6S2OVK4QqX941k2w9M1n5mjbzE1S04K vu/VnFoSLCmetvsOswr7gR8QR6QnDW7LAmV5DMAgzHmKKpHWAEU7wKeFbEUa4Hy4cYP7 ofBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vVvBHngaWKoiA0++47ZxjHijX6w95ry8pBLW3rnsyKM=; b=7/Rc2nRmkvgR/ZLVVGj2+T5jl0wlvIddhJm2l8kZin3nSsXXD/x+PtVmIDIAb4b+VN 86Wq7OdVNUGEKwGN5T5WoAgnGEePqbfaFngMsn3xC4/6fRuNpPfbr54qt4fACp4EYWlS nUO0qHYb4WVCTglGm19x/2VHGVdAAmsv/+PfByhH6Dy6nCbf+LXm4hgAHA1AqsqWEYL/ OFFyAQn10b7GAuWLPEJg8ZYCD4aY/fZIWm6wUoLpv4QlZEz2lkDy1OcFOxa/3+FDmm7L 1BU9MZeXrTELfR27HpYqVw54X1S27eObKPot90FannVk4XB56BB+28Pf2C1GpIn6AmEH aNSQ== X-Gm-Message-State: AOAM530M5BWRjuLdN2pVz2bdH71G4Fe3JTX0GIk4cJ0eeli1sloR+Zx0 5tQtZsDF1NdEos4eJyzfFI6IXR5WDSN7D44MTXQ= X-Google-Smtp-Source: ABdhPJxgyBjsHO8t4SthfXn3vCmil4DtjN9T0E5geL0LHORC7tvbOOtT5ExBRj+csc1mPr5d7b3pBuGYbtFvoCflkE8= X-Received: by 2002:aca:3e8a:: with SMTP id l132mr1838200oia.95.1634008075820; Mon, 11 Oct 2021 20:07:55 -0700 (PDT) MIME-Version: 1.0 References: <1633668612-25524-1-git-send-email-u0084500@gmail.com> <1633668612-25524-3-git-send-email-u0084500@gmail.com> In-Reply-To: From: ChiYuan Huang Date: Tue, 12 Oct 2021 11:07:43 +0800 Message-ID: Subject: Re: [PATCH v3 2/2] ASoC: rt9120: Add rt9210 audio amplifier support To: Mark Brown Cc: oder_chiou@realtek.com, perex@perex.cz, tiwai@suse.com, Rob Herring , Liam Girdwood , alsa-devel@alsa-project.org, lkml , cy_huang , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , allen lin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ChiYuan Huang =E6=96=BC 2021=E5=B9=B410=E6=9C=8812=E6= =97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8A=E5=8D=8810:47=E5=AF=AB=E9=81=93=EF=BC= =9A > > Mark Brown =E6=96=BC 2021=E5=B9=B410=E6=9C=888=E6=97= =A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=888:51=E5=AF=AB=E9=81=93=EF=BC=9A > > > > On Fri, Oct 08, 2021 at 12:50:12PM +0800, cy_huang wrote: > > > > > +static const struct snd_kcontrol_new rt9120_snd_controls[] =3D { > > > + SOC_SINGLE_TLV("MS Volume", RT9120_REG_MSVOL, 0, 2047, 1, digit= al_gain), > > > + SOC_SINGLE("SPK Gain", RT9120_REG_SPKGAIN, 0, 7, 0), > > > > Volume controls should end in Volume even if they don't have TLV > > information so applications know how to render them. I'll fix > > this up as I apply. > > It's not linear mapping analog gain and cannot use the TLV as you said. > Mappling table is listed like as below > 0 -> 6dB > 1 -> 8dB > 2 -> 10dB > 3 -> 12dB > 4 -> 13dB > 5 -> 14dB > 6 -> 15dB > 7 -> 16dB > > Do I just need to change it to 'SPK Gain Volume' to present this control = item? > Or is there any table mapping for the nonlinear TLV information? Finally found there's 'DECLARE_TLV_DB_RANGE' that can meet the requirement. I will fix this by the tlv db range and naming it to 'SPK Gain Volume'. If there's any changes still needed, please feel free to let me know. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6AEEC433EF for ; Tue, 12 Oct 2021 03:08:59 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F42460F9B for ; Tue, 12 Oct 2021 03:08:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6F42460F9B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 150E91684; Tue, 12 Oct 2021 05:08:06 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 150E91684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1634008136; bh=J4/xTGLbAtwjE0t0pDMTzyFDDHExkPkZh3ooYqTtuFA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JXVNb/Ch7AMhP7hBoKY12003oeDNNO/2jLGa37BLnEC4DNNu9e2pn+2Ce3AnU8rQu 9HeYj38JI9WB7OeErCiuJTpS0/KNRGFsDobeaeLWO0NdUBlBM8+0LJSFNMqJ3DQX+h WvrE8skSwBRMM4phFr1cM44PXFyhlmi9H3JGCIvU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2C508F800CB; Tue, 12 Oct 2021 05:08:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 45946F80212; Tue, 12 Oct 2021 05:08:03 +0200 (CEST) Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BC240F800CB for ; Tue, 12 Oct 2021 05:07:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BC240F800CB Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H9QwPe1G" Received: by mail-oi1-x22a.google.com with SMTP id u69so14787159oie.3 for ; Mon, 11 Oct 2021 20:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vVvBHngaWKoiA0++47ZxjHijX6w95ry8pBLW3rnsyKM=; b=H9QwPe1Ga5lUz1oYHLYo1JXPU/nYvZOAWkRMgEQdMGj79GPeGqm9vTqS2PhYSElTeb dKUQWF04Fo4hEOu/O+5K+8jO3EE0iteMyFjRNi+8yvHdvvSwEwLRLY1xuFAF5TeY1OHr zXcrXJtpIye4HG2gHbsswu78EUWdqXmH3sSpfJwQkBf9AAQ/8igFUaNx1fCGhb/JWeUy xyhtmsrfkwBjtnsLO0hFN376XVyHwckh5ohEZ6S2OVK4QqX941k2w9M1n5mjbzE1S04K vu/VnFoSLCmetvsOswr7gR8QR6QnDW7LAmV5DMAgzHmKKpHWAEU7wKeFbEUa4Hy4cYP7 ofBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vVvBHngaWKoiA0++47ZxjHijX6w95ry8pBLW3rnsyKM=; b=48Ul9jc59OUJYlpqMk29bgtK12JhbofE+7z2MDizMoPH3EYyrsKnR1V4lm3oHig76j JpdILU3ZPFQDnCYy7kY1wc/EMyoce6GH0OuFfSSPPa8E0UZ/WmWCIgQ+m0wPpnhE4pF4 OgIFk6b2WG/ChThHAeTPNihZpdFKxNtfQs2PwsIwU6aXX4qo/ft2kAxXT3lVzUeJbKpF Qf/COS3hxeA8roiyGaUX6Zqir1898qE0KNBdiK7iYQLKKLYSQ6SsXEWJomZ4xFsbCqC5 le9+0tOWM6BE2s5FEOpT9UIMMh76+6rXC2OZ+zxYiD08MfVPNMuDJ3ulKgyta3kPFxQl 5f8Q== X-Gm-Message-State: AOAM531/HFMWXmGERAlo+gYsSasVKGIDFTtCpuIzBr0D4E72EnIWM2S8 Sf+5ITvJ5A1QOUylJD+WU1iaEhpmGXoJDO9bkMM= X-Google-Smtp-Source: ABdhPJxgyBjsHO8t4SthfXn3vCmil4DtjN9T0E5geL0LHORC7tvbOOtT5ExBRj+csc1mPr5d7b3pBuGYbtFvoCflkE8= X-Received: by 2002:aca:3e8a:: with SMTP id l132mr1838200oia.95.1634008075820; Mon, 11 Oct 2021 20:07:55 -0700 (PDT) MIME-Version: 1.0 References: <1633668612-25524-1-git-send-email-u0084500@gmail.com> <1633668612-25524-3-git-send-email-u0084500@gmail.com> In-Reply-To: From: ChiYuan Huang Date: Tue, 12 Oct 2021 11:07:43 +0800 Message-ID: Subject: Re: [PATCH v3 2/2] ASoC: rt9120: Add rt9210 audio amplifier support To: Mark Brown Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Cc: oder_chiou@realtek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , alsa-devel@alsa-project.org, lkml , Liam Girdwood , tiwai@suse.com, cy_huang , Rob Herring , allen lin X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" ChiYuan Huang =E6=96=BC 2021=E5=B9=B410=E6=9C=8812=E6= =97=A5 =E9=80=B1=E4=BA=8C =E4=B8=8A=E5=8D=8810:47=E5=AF=AB=E9=81=93=EF=BC= =9A > > Mark Brown =E6=96=BC 2021=E5=B9=B410=E6=9C=888=E6=97= =A5 =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=888:51=E5=AF=AB=E9=81=93=EF=BC=9A > > > > On Fri, Oct 08, 2021 at 12:50:12PM +0800, cy_huang wrote: > > > > > +static const struct snd_kcontrol_new rt9120_snd_controls[] =3D { > > > + SOC_SINGLE_TLV("MS Volume", RT9120_REG_MSVOL, 0, 2047, 1, digit= al_gain), > > > + SOC_SINGLE("SPK Gain", RT9120_REG_SPKGAIN, 0, 7, 0), > > > > Volume controls should end in Volume even if they don't have TLV > > information so applications know how to render them. I'll fix > > this up as I apply. > > It's not linear mapping analog gain and cannot use the TLV as you said. > Mappling table is listed like as below > 0 -> 6dB > 1 -> 8dB > 2 -> 10dB > 3 -> 12dB > 4 -> 13dB > 5 -> 14dB > 6 -> 15dB > 7 -> 16dB > > Do I just need to change it to 'SPK Gain Volume' to present this control = item? > Or is there any table mapping for the nonlinear TLV information? Finally found there's 'DECLARE_TLV_DB_RANGE' that can meet the requirement. I will fix this by the tlv db range and naming it to 'SPK Gain Volume'. If there's any changes still needed, please feel free to let me know.