Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3453463pxb; Mon, 4 Apr 2022 17:28:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSMFMUw7Oh0/3KFHBkTqEw5sHb/hAU1s5dq7//2cc/gysndwXyRnTMTonj33xzVLQTvo38 X-Received: by 2002:a05:6a02:204:b0:399:1c4:3f45 with SMTP id bh4-20020a056a02020400b0039901c43f45mr649192pgb.246.1649118509271; Mon, 04 Apr 2022 17:28:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649118509; cv=none; d=google.com; s=arc-20160816; b=s0CVfGi+kxtEgLW8MDqutUe3T9CorSUk0Lm6cfJMbZ9SpncAMA5tYkMweyV36Bu24Y Yjf1Izburrpohh2OguljsbRlau7HtI+iYkt2h+BKPZbCsn/bieN83ROZOzbx3P0FwtkU izhIuvmvR0fyKH+Ya+0mQsjF6EHx9UcrRvKqfVuYS/lTt5kqr88K2NI++L0D7TZOsh3n IeakikmhIghRoCNey8Vzkv3CwforPWG7fRLGQwS8yReMZ2aMsVjC0r26V1H2syzIfhTj GDPCRGgSLKeWarM/X4oBeZi+IHZ3AygXDDs4LwOoPh3dJ6VzjKHWZl67fCOfC2BzBSga cMLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=pvoMmIHhyOPR2EF3gO1oUMUT3C6RH5tzPD/vPyOco8s=; b=PrDp2SNbMwOjvIv3zJ88RgdHLXY/L2OHSgLe05NKF48VQRY+jUnpqocnPwmO8aPH7y hZNkMvMPBRCVkC747a7tIa9R5J1Uw6LQCKuiC9k+oktfMIzcEEwQl17SeIyVsOE8SY5r ZaqVaihu1cv/OSHIgRfLiPPYEH6cqR98hAtZMoLnn7oQTmPAmi8tBpNv0tWHdxVSrTYt EkwsxBz8ph44ycd6jYAfzzZ/xmLIxB80UEXsdb6kwHSpQGoWNyROB3yJrgK8OFznVh2g DdSK1IX2saZPHrXSI/VipvUD5JqZA6I9iwMaEmMJLiZunMyIIb4zSwLQxDWeZDZaGMzt DHIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZbylgVab; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j4-20020a17090276c400b00153b2d16427si10102000plt.47.2022.04.04.17.28.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 17:28:29 -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=@kernel.org header.s=k20201202 header.b=ZbylgVab; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4BBBC12610; Mon, 4 Apr 2022 16:49:36 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358377AbiDBQpt (ORCPT + 99 others); Sat, 2 Apr 2022 12:45:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358372AbiDBQpo (ORCPT ); Sat, 2 Apr 2022 12:45:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB27F1AF3D; Sat, 2 Apr 2022 09:43:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 58721B80A27; Sat, 2 Apr 2022 16:43:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AAEEC340F2; Sat, 2 Apr 2022 16:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648917829; bh=HL5ErD+PNC54BIsnAcEv8+1ZhI/4B9+Tha0CXuwWvg8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZbylgVab8HyjN7gPZNVlQDJjJ8LU7lOLdJv06UIkBC9LH7qM5Zkua4APb3g4Sbo+1 +qrWrJl+mF3NnwitsoJFXaAySj1MQQdsAI3W7DC5MNpnkmP4QQDdutGOAsKJv7gSHi 5woLn4CRn14k6JM38GFaUwCcgIEZ5iMxD6cfb3dipuCFmr3myn2nmbSO9mgAVP/o+E +R/eaPBjeEwVrIzHZSKE3Xzsr9qAvCkvvDyusKy3hmV+qZjq7c3tqnJOp0EZvuvdYO UjAZhv16YRil6dr2GihTY73Y190nVe4KYCHkev/F1wMYdgRbBtNxavQxmK2rPwWjCG EquiA8+wDgvLg== Date: Sat, 2 Apr 2022 17:51:31 +0100 From: Jonathan Cameron To: Stephen Boyd Cc: Lars-Peter Clausen , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Gwendal Grignou Subject: Re: [PATCH v2] iio:proximity:sx9324: Fix hardware gain read/write Message-ID: <20220402175131.75bb95de@jic23-huawei> In-Reply-To: References: <20220324222928.874522-1-swboyd@chromium.org> <20220327155147.52e898b4@jic23-huawei> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Tue, 29 Mar 2022 22:25:31 +0200 Stephen Boyd wrote: > Quoting Jonathan Cameron (2022-03-27 07:51:47) > > On Thu, 24 Mar 2022 15:29:28 -0700 > > Stephen Boyd wrote: > > > > > There are four possible gain values according to 'sx9324_gain_vals[]': > > > > > > 1, 2, 4, and 8 > > > > > > The values are off by one when writing and reading the register. The > > > bits should be set according to this equation: > > > > > > ilog2() + 1 > > > > > > so that a gain of 8 is 0x3 in the register field and a gain of 4 is 0x2 > > > in the register field, etc > > > > Example seems wrong... > > > > ilog2(8) + 1 = 3 + 1 = 0x4 > > ilog2(4) + 1 = 2 + 1 = 0x3 > > ilog2(2) + 1 = 1 + 1 = 0x2 > > ilog2(1) + 1 = 0 + 1 = 0x1 > > 0x0 reserved. > > > > or have I misunderstood? > > Nope. I hit the wrong key but your table is correct. Can you fix it when > applying? Done and applied to the fixes-togreg branch of iio.git but I haven't pushed it out yet as I want to rebase that tree on rc1 when it comes out. After that, please take a quick look check I didn't mess up. Thanks, Jonathan