Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4759119rwb; Sun, 4 Dec 2022 07:42:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5aoNXxco+Xd5Yj1er2V1NMT8bbL8TV2axA+lay8fWJmOd7+Y/dYQelCBsBImUsMqxvxcsC X-Received: by 2002:a05:6402:3210:b0:46c:6f53:6176 with SMTP id g16-20020a056402321000b0046c6f536176mr4851493eda.190.1670168538936; Sun, 04 Dec 2022 07:42:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670168538; cv=none; d=google.com; s=arc-20160816; b=fdsNyYuR7lc1FYbmA134xX4YiE/Wg1VD1lcpF6IvE05IDCywwlg6QWK+vcnJChOVD7 fTYSyK9vj7eFn8pkG3+ILcyaZgTcgv0JKoNN5Oc3tQY3OkjKx/BNj1Tq8n7y127u5SAF 3oY0xIzYOZdWnDgZNDsSD5JhtO6VPpPtqvheCtnwbxNkNYM9E6N1McRDr+cyWFqDdniH BrVCMeljrUEdA/NyL9a57MzslTWFGAc+i/ZMELtG9Xdt8rFiTyEav7Q/HEQ7RyMbtyzj LMxMRL06P8TL5nOf8hJNkS/OZH7hZr/Q1rDMyrd5ZiLoIkmLqXPQpdG82CF2JcLnYQIh RNOA== 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=Cp92t1eJwUMh2MDyplSe8b+4E85w1Q0h0PIc+uzn+RM=; b=r7KlUdYiZpiqVMKUePP9BOcRnecEqWdekDXnoI4fhrT4FKL1S7WoErsKVm01pCicOi sRs8/ISUS1vvd2q9zwrRflR0yhWIuqpvq/4vh6LrttEtXX/f5ZrHABex8a+x2rp9svcZ cCFX0w9TigHFqixobK0zGOx1YU6M/5o7l5mter9y1Ma5n7Xw1mhVYi52hmTI9yt/kR0N QWiSRw2XMQ8QB9fO3E2J/qRdbpsarXfhyDvFHjJTIpFJJripLeKfvd1RyhcgzT1YP9cY mgSvLN6LBl5ZTLlUEpFP/W9MSlyin0kmywHpCB6UvUsaH9lVfF/nJPw1yPjhmpeODyCr +62Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oCxNzFAr; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb41-20020a1709071ca900b007aed5ffeffbsi1854011ejc.78.2022.12.04.07.41.58; Sun, 04 Dec 2022 07:42:18 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=oCxNzFAr; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229985AbiLDP3N (ORCPT + 83 others); Sun, 4 Dec 2022 10:29:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbiLDP3K (ORCPT ); Sun, 4 Dec 2022 10:29:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD5614D27; Sun, 4 Dec 2022 07:29:09 -0800 (PST) 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 2692DB8075D; Sun, 4 Dec 2022 15:29:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6711EC433C1; Sun, 4 Dec 2022 15:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670167746; bh=+4UWp3q3T8/z7j3IT3NJBs3BVLIHV3S8FeXV9XhEXcg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oCxNzFArpSesYBXlBvPnI1v6ofzIW7TJOoWYwzorGkcbMl1/PWRyNVFwKYwa5ckEb fXhm7wv8RaLGEMPVLKSN9JGB5NxriBFTybAX0AObXCpntkOKfJtytsN8S+hfD0ORub VhWRBNSflQdrqG03Wu9ixVtvnTAKg4BSqj5C2MwuIM/YwIFPu6WfKrzg9kEQucK1H/ r5qNowpiz72CvvP6sdhIC9MWkwq4oWQLAGbIipryC6LZPFNGBciTxB9WmNKhtymdIP hTsYunpRuYpx3mJr5CJDph7bXxLrPhE4i6Jag9UtLQGK/3bJjIkTHTONttLP+WgGKB TSIYE48yNuilQ== Date: Sun, 4 Dec 2022 15:41:52 +0000 From: Jonathan Cameron To: Andreas Kemnade Cc: lars@metafoo.de, jiasheng@iscas.ac.cn, paul@crapouillou.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Lindgren Subject: Re: [PATCH] iio:adc:twl6030: Enable measurements of VUSB, VBAT and others Message-ID: <20221204154152.5f7948b9@jic23-huawei> In-Reply-To: <20221201181635.3522962-1-andreas@kemnade.info> References: <20221201181635.3522962-1-andreas@kemnade.info> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; 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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Thu, 1 Dec 2022 19:16:35 +0100 Andreas Kemnade wrote: > Some inputs need to be wired up to produce proper measurements, > without this change only near zero values are reported. > > Signed-off-by: Andreas Kemnade Sounds like a fix to me. If so, Fixes tag? Anything in here we should be turning off again if the driver is removed or toggling on suspend? If not, other than the space below this looks fine to me. Jonathan > --- > drivers/iio/adc/twl6030-gpadc.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c > index f53e8558b560c..40438e5b49702 100644 > --- a/drivers/iio/adc/twl6030-gpadc.c > +++ b/drivers/iio/adc/twl6030-gpadc.c > @@ -57,6 +57,18 @@ > #define TWL6030_GPADCS BIT(1) > #define TWL6030_GPADCR BIT(0) > > +#define USB_VBUS_CTRL_SET 0x04 > +#define USB_ID_CTRL_SET 0x06 > + > +#define TWL6030_MISC1 0xE4 > +#define VBUS_MEAS 0x01 > +#define ID_MEAS 0x01 > + > +#define VAC_MEAS 0x04 > +#define VBAT_MEAS 0x02 > +#define BB_MEAS 0x01 > + I'm always of the view one blank line is enough! I'll tidy this up whilst applying. > + > /** > * struct twl6030_chnl_calib - channel calibration > * @gain: slope coefficient for ideal curve > @@ -927,6 +939,26 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) > return ret; > } > > + ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET); > + if (ret < 0) { > + dev_err(dev, "failed to wire up inputs\n"); > + return ret; > + } > + > + ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET); > + if (ret < 0) { > + dev_err(dev, "failed to wire up inputs\n"); > + return ret; > + } > + > + ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, > + VBAT_MEAS | BB_MEAS | BB_MEAS, > + TWL6030_MISC1); > + if (ret < 0) { > + dev_err(dev, "failed to wire up inputs\n"); > + return ret; > + } > + > indio_dev->name = DRIVER_NAME; > indio_dev->info = &twl6030_gpadc_iio_info; > indio_dev->modes = INDIO_DIRECT_MODE;