Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp52080iof; Sun, 5 Jun 2022 20:50:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0hW2fAiQwknt2vaqBc2CwyAsUZP/W1Z72QwopuDaqM2/lSZZ0cJ6QhHOeHPo0lUwfkQ7u X-Received: by 2002:a62:7cd2:0:b0:51b:9ba6:a028 with SMTP id x201-20020a627cd2000000b0051b9ba6a028mr29340772pfc.24.1654487422936; Sun, 05 Jun 2022 20:50:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654487422; cv=none; d=google.com; s=arc-20160816; b=E3C7qR/w7U6Q21H1QU3WDiU0HYeA6GxCjfhiEsnHRF04QjMvvi3zy1dJtRZc416l22 04PcTcpdLHZzoscEbHO1vFyfGs7vhYUPvVtvINnJShxCThkwjkPLO1dTOzTGMhL6V8LP B6zhU+qiXl9qhGP1BzU4JF605A4l/WcdSOg8u2eAtm2nAkvdiCQAI4vOAXsx6NJjP/yk OAvJwwiFZ0yoZnXh2CZqz9GZqRU0ZKxrUBbVwWZkP18kF0SkbUqAZrM9wYsjwY3ygE0z 1F7bQu7STF/cQ6cL+JfozAixWbH/qlQURd7AAGs+KssVR/4AUBk2Dps1qZGS9XunDHCw IEgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jRzE700Iwk6JPnFC1XF3JnNELKmhJQ9Ut8G4hkkDJF0=; b=tjiSSvCRvu+K7IFXxeZEqS/1V9p9wxkY+y92jSaFTUQH/xswEfOeYHKJ00SfvrhbNa AVEKTTN1K2pdAaHCUil1ZIQtKOBBCYkzF9RZK0oLTAiJrPgfvfe7u4s8JNZSvWkQRm5k jD3/2TfRHuNxrv8g2KoPcEZfXNn5jgBIns1/oRvOANDXwEsIN1oF9B/nx8F/yMMSoevN i5PVXhtu+0hYCoGbQ2mJ+8+Qt+EZn7EC+8RqmfhW/qibVER1F41WN7ksiIXfl5LofPUB WrZh6y5vMymQze6cjNg7EwgLO0fLZOJHaUc0ei+EYw3mmR3FIeK3FREdOp44sa1N7Mul j/Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=p7RNxjyi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y17-20020a634b11000000b003aaf76cfd76si19363144pga.835.2022.06.05.20.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jun 2022 20:50:22 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gerhold.net header.s=strato-dkim-0002 header.b=p7RNxjyi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98A28D84; Sun, 5 Jun 2022 20:42:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347621AbiFCSfn (ORCPT + 99 others); Fri, 3 Jun 2022 14:35:43 -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> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 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