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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 47220C433EF for ; Fri, 3 Jun 2022 18:21:43 +0000 (UTC) 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 4BE7417BC; Fri, 3 Jun 2022 20:20:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 4BE7417BC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1654280501; bh=Z7aBF6JqnH07q8Fd8EqKFekV2qfsLjpdPsgZuGJNUYU=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=f3Flp/p7CFV9T5kCewYXe1ltYH1KVqfNOWWOFAC5xF8OTqRguPOoEP5iSD/hgNZfH gyn8nDVYWO06vwJLIEyjeViV1z83I/o6uoOjPshDS7emuLlUXn1pC/iYla/lnUiyYs yynQv921NwpsNu/8Pl+M9Zkp3akiW/u4HGdSABqo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DDE94F804C1; Fri, 3 Jun 2022 20:20:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DAB97F804CC; Fri, 3 Jun 2022 20:20:48 +0200 (CEST) Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0CBD8F80089 for ; Fri, 3 Jun 2022 20:20:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0CBD8F80089 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=gerhold.net header.i=@gerhold.net header.b="p7RNxjyi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1654280429; s=strato-dkim-0002; d=gerhold.net; h=In-Reply-To:References:Message-ID:Subject:Cc:To:From:Date:Cc:Date: From:Subject:Sender; bh=jRzE700Iwk6JPnFC1XF3JnNELKmhJQ9Ut8G4hkkDJF0=; b=p7RNxjyiSayvHYPh3pHVP+T7P4Hcsn75gGJxiD5ywUMsVEPqBfsrMCiR1C47cvRHPG nCbifbauhHQMWv0vrZkk64YAzDa03TPeK2zI1an99Cd6KVmM/Cwh3yx+l5wlGoFPB+lz JbiBdHH/mpVYGdbK2X+pXmeZ7ppmt1PpMOwCSuLRj4L2foo2vDkQeuR4nBDvczVknpiH AYkEkOrGQ5yGk/JBTbx1GPRF89BaoAAqffAxeBBjPB1r3TGn9B/gVXvtqqy4P8X6gMPH 4/lRQ2MNTugVRSf8sTtvJtdeAkOVKpSVSbKKHkQk+2s8mclCSZ+3hjx0ZdP0EAMuvw8b zUFw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQ/OcYgojyw4j34+u267FZF9PwpcNKLVrKw7/aY=" X-RZG-CLASS-ID: mo00 Received: from gerhold.net by smtp.strato.de (RZmta 47.45.0 AUTH) with ESMTPSA id 9056edy53IKTwlV (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 3 Jun 2022 20:20:29 +0200 (CEST) Date: Fri, 3 Jun 2022 20:20:28 +0200 From: Stephan Gerhold To: Alexander Martinz Subject: Re: [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890 Message-ID: References: <20220602164504.261361-1-amartinz@shiftphones.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220602164504.261361-1-amartinz@shiftphones.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Dylan Van Assche , linux-kernel@vger.kernel.org, Takashi Iwai , Liam Girdwood , Rob Herring , Caleb Connolly , Mark Brown , ~postmarketos/upstreaming@lists.sr.ht, Krzysztof Kozlowski , phone-devel@vger.kernel.org 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" On Thu, Jun 02, 2022 at 06:45:03PM +0200, Alexander Martinz wrote: > The initialization sequence is taken from the version provided > by the supplier [1]. > > This allows speakers using the TFA9890 amplifier to work, which are > used by various mobile phones such as the SHIFT6mq. > > [1]: https://source.codeaurora.org/external/mas/tfa98xx/tree/src/tfa_init.c?id=d2cd12931fbc48df988b62931fb9960d4e9dc05d#n1827 > > Signed-off-by: Alexander Martinz > --- > sound/soc/codecs/tfa989x.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c > index dc86852752c5..8ab2656de750 100644 > --- a/sound/soc/codecs/tfa989x.c > +++ b/sound/soc/codecs/tfa989x.c ... > @@ -188,6 +190,33 @@ static struct snd_soc_dai_driver tfa989x_dai = { > .ops = &tfa989x_dai_ops, > }; > > +static int tfa9890_init(struct regmap *regmap) > +{ > + int ret; > + > + /* unhide keys to allow updating them */ Nitpick: I think the magic number is the "key" to hide/unhide certain *registers*. This comment implies that you are hiding *keys*. Maybe just write something like /* temporarily allow access to hidden registers */ ... /* hide registers again */ With that fixed, feel free to add my Reviewed-by: Stephan Gerhold Thanks! Stephan > + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x5a6b); > + if (ret) > + return ret; > + > + /* update PLL registers */ > + ret = regmap_set_bits(regmap, 0x59, 0x3); > + if (ret) > + return ret; > + > + /* hide keys again */ > + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x0000); > + if (ret) > + return ret; > + > + return regmap_write(regmap, TFA989X_CURRENTSENSE2, 0x7BE1); > +} > + > +static const struct tfa989x_rev tfa9890_rev = { > + .rev = TFA9890_REVISION, > + .init = tfa9890_init, > +}; > + k 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1A86C43334 for ; Fri, 3 Jun 2022 18:35:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245554AbiFCSfl (ORCPT ); Fri, 3 Jun 2022 14:35:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345278AbiFCSff (ORCPT ); Fri, 3 Jun 2022 14:35:35 -0400 X-Greylist: delayed 121 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 03 Jun 2022 11:23:39 PDT Received: from mo4-p02-ob.smtp.rzone.de (mo4-p02-ob.smtp.rzone.de [85.215.255.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8723A9CC86; Fri, 3 Jun 2022 11:23:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1654280429; s=strato-dkim-0002; d=gerhold.net; h=In-Reply-To:References:Message-ID:Subject:Cc:To:From:Date:Cc:Date: From:Subject:Sender; bh=jRzE700Iwk6JPnFC1XF3JnNELKmhJQ9Ut8G4hkkDJF0=; b=p7RNxjyiSayvHYPh3pHVP+T7P4Hcsn75gGJxiD5ywUMsVEPqBfsrMCiR1C47cvRHPG nCbifbauhHQMWv0vrZkk64YAzDa03TPeK2zI1an99Cd6KVmM/Cwh3yx+l5wlGoFPB+lz JbiBdHH/mpVYGdbK2X+pXmeZ7ppmt1PpMOwCSuLRj4L2foo2vDkQeuR4nBDvczVknpiH AYkEkOrGQ5yGk/JBTbx1GPRF89BaoAAqffAxeBBjPB1r3TGn9B/gVXvtqqy4P8X6gMPH 4/lRQ2MNTugVRSf8sTtvJtdeAkOVKpSVSbKKHkQk+2s8mclCSZ+3hjx0ZdP0EAMuvw8b zUFw== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVOQ/OcYgojyw4j34+u267FZF9PwpcNKLVrKw7/aY=" X-RZG-CLASS-ID: mo00 Received: from gerhold.net by smtp.strato.de (RZmta 47.45.0 AUTH) with ESMTPSA id 9056edy53IKTwlV (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Fri, 3 Jun 2022 20:20:29 +0200 (CEST) Date: Fri, 3 Jun 2022 20:20:28 +0200 From: Stephan Gerhold To: Alexander Martinz Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Caleb Connolly , Dylan Van Assche Subject: Re: [PATCH 1/2] ASoC: codecs: tfa989x: Add support for tfa9890 Message-ID: References: <20220602164504.261361-1-amartinz@shiftphones.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220602164504.261361-1-amartinz@shiftphones.com> Precedence: bulk List-ID: X-Mailing-List: phone-devel@vger.kernel.org On Thu, Jun 02, 2022 at 06:45:03PM +0200, Alexander Martinz wrote: > The initialization sequence is taken from the version provided > by the supplier [1]. > > This allows speakers using the TFA9890 amplifier to work, which are > used by various mobile phones such as the SHIFT6mq. > > [1]: https://source.codeaurora.org/external/mas/tfa98xx/tree/src/tfa_init.c?id=d2cd12931fbc48df988b62931fb9960d4e9dc05d#n1827 > > Signed-off-by: Alexander Martinz > --- > sound/soc/codecs/tfa989x.c | 30 ++++++++++++++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/sound/soc/codecs/tfa989x.c b/sound/soc/codecs/tfa989x.c > index dc86852752c5..8ab2656de750 100644 > --- a/sound/soc/codecs/tfa989x.c > +++ b/sound/soc/codecs/tfa989x.c ... > @@ -188,6 +190,33 @@ static struct snd_soc_dai_driver tfa989x_dai = { > .ops = &tfa989x_dai_ops, > }; > > +static int tfa9890_init(struct regmap *regmap) > +{ > + int ret; > + > + /* unhide keys to allow updating them */ Nitpick: I think the magic number is the "key" to hide/unhide certain *registers*. This comment implies that you are hiding *keys*. Maybe just write something like /* temporarily allow access to hidden registers */ ... /* hide registers again */ With that fixed, feel free to add my Reviewed-by: Stephan Gerhold Thanks! Stephan > + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x5a6b); > + if (ret) > + return ret; > + > + /* update PLL registers */ > + ret = regmap_set_bits(regmap, 0x59, 0x3); > + if (ret) > + return ret; > + > + /* hide keys again */ > + ret = regmap_write(regmap, TFA989X_HIDE_UNHIDE_KEY, 0x0000); > + if (ret) > + return ret; > + > + return regmap_write(regmap, TFA989X_CURRENTSENSE2, 0x7BE1); > +} > + > +static const struct tfa989x_rev tfa9890_rev = { > + .rev = TFA9890_REVISION, > + .init = tfa9890_init, > +}; > + k