Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp641386rwb; Tue, 4 Oct 2022 08:40:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kZU9SSpAZGt7zZj5aPJLKA5Q81mHnkPBjs2+XyPqHmoO3WhTiOVBDsvg/JiXn0kexFhp1 X-Received: by 2002:a63:9049:0:b0:44f:1ae2:3f87 with SMTP id a70-20020a639049000000b0044f1ae23f87mr9231706pge.6.1664898043371; Tue, 04 Oct 2022 08:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664898043; cv=none; d=google.com; s=arc-20160816; b=0CIuhCUmqjds+1GoyGeOuRCkXDutvSaJCFjpe0ygc43FpEfQGuZYflr3/3xfw3OcRC ubq0OMDKedyrUgg9reDjNi/+bWaDQmdqx8krbTe2EEJQVYweEnh9Yilc6quTKLup+0s+ ZtTE9mEw0CULbOdb/XYHWz+iEdDRxmLjEFJJ112suTaDrBU+xkdy4U3ZaaKyUJQXi1CF 10zUgRGZ7xm2D5mn7B6nzbD8jdp8mG37GKzu5/ph+swf0ThXzXgCfTV5TSRWCd4ZWtAz Kxhry1deomosmmUujyq0/Lf/qLPlv48OcoiHmxQmNzS3h13bsvMel1ELGN4QR8fdGuw/ X5iQ== 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=7JQ+kbmcSP5RNYOOPozaAGUuDB8WoxkQS0RnWZ/8sdc=; b=Q2EWhsrFaLwHZWMGP7Zd0PlQIuu5sdqeGmnJNxLjUp3wdoYbVG6muOEUb5lXYXLAfy 3iDzZQmnvOAlZNn4wsbgwBNZlfxpsYtXYFv+VEaun02k70FY3NYt9yXCcA0hgrS7cC42 nAV5sTm2XcwIKHXkiqMSHJ7SxCSadOG41tuFL62x1sJ2AWT3BLROi/sSfYTuW2LNVQjE 3nlzNbF46wRmpTuDpaPNbsQJr9/Tb7sEo87X+jSSTPYHNfBg106a7RFwjMBbI+NPciU8 McXWhOFSIK62JkvYqERxvSOmC9867Yo+xqM8pafmI7GviLdBv0fdVIKHjtLt27zWAPE1 Zg/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=A5MxBR14; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020aa7888e000000b00536f8a6acadsi13353619pfe.2.2022.10.04.08.40.31; Tue, 04 Oct 2022 08:40:43 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b=A5MxBR14; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbiJDO5V (ORCPT + 99 others); Tue, 4 Oct 2022 10:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbiJDO5S (ORCPT ); Tue, 4 Oct 2022 10:57:18 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C89F7275CA; Tue, 4 Oct 2022 07:57:14 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id o17so2359836ljj.2; Tue, 04 Oct 2022 07:57:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=7JQ+kbmcSP5RNYOOPozaAGUuDB8WoxkQS0RnWZ/8sdc=; b=A5MxBR14HPfmLNB7E9WbzrgnMny3yTnUHwuZbi2Rr0dDF3ndcPi+BGhfoS9oO3PrVK dvguRHsFiO7F+cVkfxz2j5Sz4HyiDgg4FVqcJWyV916GQQcKZTLRMc2BZSrp6CE/I0gx FGosglv9fRh2KyoSateTnNmtbfCcFz7f/kBg2HqNbE5OHpwee2bvO7Fkq7yYk35c9aax dG+53fo6XK+ofWsIbqVsemjU0l+L6cZL5EhwUyn9T0RbgDlCO1Usj/V6mTVSasib300p s3WVObf2vn0lj32kg5o8ir4WIa8bG7AGEW+oqVrXFDr37thI1joBh1BAPdvI1J30p1FC DlmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=7JQ+kbmcSP5RNYOOPozaAGUuDB8WoxkQS0RnWZ/8sdc=; b=RbWLEOF4ArS72zgN5QTqMWW4DK5mmMvDoIGW6MBDY0fQS/s8i8FUFv1QO3C3bEPoPI Pru4t5W0/aUJhZVWmJhJD+CHPWrlZlEjJVI4LU4yNvdhcU6DZVWawfHAD2F6MWDaTJD3 gvLY7+aQOwOPiqqD5/gTfr0WhmL25G8wSekFC4d2Q+1I+BlT332UDc4frVUFpqZanIQj QHqwtmHY89s1IpuM95MHS/F8wxHWFY09pyhJpAKQyTT2SIjC9S31NBdb7f6qSd2N68/k p5w+Uc1kzl90CxbXwWFud6s3tgdEhKjyW4lcPse81oE7WcqyfdPk7MJG5DNIYlmbABjr cSJg== X-Gm-Message-State: ACrzQf1U8ak71u6TeTaBnD4543ot1VCXs3c8WmE8MfIwijq8xSEspwRZ oMM6kDDqUGOlQxY7ONDJy22h30v8Gvys7A== X-Received: by 2002:a05:651c:546:b0:26c:698f:a4a2 with SMTP id q6-20020a05651c054600b0026c698fa4a2mr8906460ljp.161.1664895433142; Tue, 04 Oct 2022 07:57:13 -0700 (PDT) Received: from gmail.com (82-209-154-112.cust.bredband2.com. [82.209.154.112]) by smtp.gmail.com with ESMTPSA id q3-20020a0565123a8300b00494a11c5f52sm1945147lfu.256.2022.10.04.07.57.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 07:57:11 -0700 (PDT) Date: Tue, 4 Oct 2022 16:57:08 +0200 From: Marcus Folkesson To: Leonard =?iso-8859-1?Q?G=F6hrs?= Cc: Jonathan Cameron , Lars-Peter Clausen , kernel@pengutronix.de, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: Re: [PATCH v1 2/2] iio: adc: add ADC driver for the TI LMP92064 controller Message-ID: References: <20221004134238.3144326-1-l.goehrs@pengutronix.de> <20221004134238.3144326-2-l.goehrs@pengutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="krXJhXCH+I9hQ/Op" Content-Disposition: inline In-Reply-To: <20221004134238.3144326-2-l.goehrs@pengutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 --krXJhXCH+I9hQ/Op Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, Overall, a lot of comments does not have the right formatting. Please run scripts/checkpatch.pl. On Tue, Oct 04, 2022 at 03:42:38PM +0200, Leonard G=F6hrs wrote: > The TI LMP92064 is a dual 12 Bit ADC connected via SPI. > The two channels are intended for simultaneous measurements of the voltage > across- and current through a load to allow accurate instantaneous power > measurements. > The driver does not yet take advantage of this feature, as buffering is n= ot yet > implemented. >=20 > Signed-off-by: Leonard G=F6hrs > --- > +static const struct iio_chan_spec lmp92064_adc_channels[] =3D { > + { > + .type =3D IIO_CURRENT, > + .address =3D TI_LMP92064_CHAN_INC, > + .info_mask_separate =3D > + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), > + .datasheet_name =3D "INC", > + }, > + { > + .type =3D IIO_VOLTAGE, > + .address =3D TI_LMP92064_CHAN_INV, > + .info_mask_separate =3D > + BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE), > + .datasheet_name =3D "INV", > + }, > +}; > + [...] > +static int lmp92064_write_reg(struct lmp92064_adc_priv *priv, u16 reg, u= 8 val) > +static int lmp92064_read_reg(struct lmp92064_adc_priv *priv, u16 reg, u8= *val) Does not regmap work for this? [...] > +static int lmp92064_adc_probe(struct spi_device *spi) > +{ > + struct device *dev =3D &spi->dev; > + struct lmp92064_adc_priv *priv; > + struct iio_dev *indio_dev; > + struct gpio_desc *gpio_reset; > + int ret; > + u32 shunt_resistor; > + > + spi->bits_per_word =3D 8; > + spi->mode &=3D ~SPI_MODE_X_MASK; > + spi->mode |=3D SPI_MODE_0; > + ret =3D spi_setup(spi); > + if (ret < 0) > + return dev_err_probe(dev, ret, "Error in SPI setup\n"); > + > + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*priv)); > + if (!indio_dev) > + return -ENOMEM; > + > + priv =3D iio_priv(indio_dev); > + > + priv->spi =3D spi; > + > + ret =3D of_property_read_u32(dev->of_node, "shunt-resistor", > + &shunt_resistor); device_property_read_u32() ? > + if (ret < 0) > + return dev_err_probe(dev, ret, --krXJhXCH+I9hQ/Op Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmM8Sb8ACgkQiIBOb1ld UjJJMRAArlMzqVmgkLxZUed6pPK2BrT90bF6UApdw6YxWeEcmNt74WjGuNA8fF7s 8yazOsXsGuUh0A4CplLlQD4AQFDPr5gk1cL2Iwl1wpD05Gk+5sAKC6ZPIpm58yp8 pZYlr/GkbFXmnnhoDEWvcxOGBi7hIzWyXSivc3LoEGoiETkz6Y4O6su0ojCBPurW Z8X7W5fVKo7hA60QpnXsNzCRSYiNS7bbYiscqIR1OEAtMOYELKh/GGvaxDPjAMf8 eqlpiBhQIk+TffUpmViFapyscpa0vMox8tFQO8U+RextUOJtUD1JyHgTzAqGWDQ1 aJZaLCs56JSTMeJPa0w+M7DhLZnAM5C7Mgi7oRrviHTYKTsniGb81Jmfew4ST4eM I0Z1qa7WUQhYyn9uA7yy1Sb0JNN/uYbutuHbs8xz+gZ4fiQuBVtKpsqwo10NmVFo pPM479LskPWIK6OeZvOA6alI7KvjOtFQPonaiaRY4Qn8TJ9roRYaPG1czuLA+lM5 xAloZ+VsWnjQM7JMgoUk3psy16Zl3ftLF4YHIbMSpihgIXa97CjjlhHszKij9zvq RvHElz+j1TKNTtqCRiP7lnBBEVVXK9DtsvY/VWqKxz1Mf0C3bq8wkvLnZJeWz5c6 d5flT28E6KbBf3zWl/16KHmkutTtRu9Pvt3UHLRP7mGDnQ6/UME= =PAtT -----END PGP SIGNATURE----- --krXJhXCH+I9hQ/Op--