Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3074345pxb; Sun, 26 Sep 2021 04:41:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXswn31xHzVFeRvRlwKcuU0bGW3urEWqjlTpOseL5t+z3kI/D+T7RR2NsBMI7EtDnM62Mz X-Received: by 2002:a17:906:a18f:: with SMTP id s15mr22106692ejy.269.1632656496472; Sun, 26 Sep 2021 04:41:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632656496; cv=none; d=google.com; s=arc-20160816; b=BdbBepVqPS6D4LqVvr11abDSHN6OGmOKSzshKY2/oKiK+8S63yZ9YbNsjzj+p5ExTM Yw6AKtGs7XY4mYrkW02PuMUQSQgW/kN6xf1Tbjg3DliPPok64t0mxs4O3Qb/KyMShHUy Y2KgNyjjJpQeJkoe77TI92CxRWIGDL3X/zBKEVQ0SfO4l6HnYr7R5ZdW0vYvxxQ7pQMf f1o0EeLOPOo6/ADZDNbvLgQg941b9cXQUXUCWaFp7vqAHA9M07YSYdhnNaOD0H2VbkNv CBo05jE6IZE++L4+kXeTVaRf4+D69bF85mk4JsrLza/qBQ09SwP1AOAZovF6L60h93l+ sjeg== 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; bh=Ufu9o//khw90S2ZjJZFEaqEiC2ezdI5Lxjdv6M84COY=; b=cXx08xcLTDbYWQNM9yd4NWpfR+dyeQuLMthputc68ejPr1Me9ZyeqwUhcHTn1G2o+W qCDdrrYsEE1tEk4fZBbuvcO3/2PpnRJeQr5nZtVbwzlvWDqkPsgF5KqZSqwWNF9OYmSv mYObEQSIzIVEPWVXRPojRB9Ln91d69f3nkAMuG8kWXlec59YRu94+CvGATR5iDg41UP2 d5Uu5p1LyOiL2EviIZ218YYJuguZ+XYtsgbUAfHy3TU9WKf9vbeMbvEEHeGy4F8p7Jlb vgOiCRgw3lXdP0nQoECX6DmU9REc18bWLcRGHvWRcPNk94CElECKqjmhBN2lHo4yoiwt y+2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp20si2162443ejc.228.2021.09.26.04.41.12; Sun, 26 Sep 2021 04:41:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230498AbhIZLj1 (ORCPT + 99 others); Sun, 26 Sep 2021 07:39:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:36150 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbhIZLj0 (ORCPT ); Sun, 26 Sep 2021 07:39:26 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C1ED061038; Sun, 26 Sep 2021 11:37:47 +0000 (UTC) Date: Sun, 26 Sep 2021 12:41:37 +0100 From: Jonathan Cameron To: Cai Huoqing Cc: Lars-Peter Clausen , Rob Herring , Shawn Guo , "Sascha Hauer" , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , , , , Subject: Re: [PATCH v6 1/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC Message-ID: <20210926124137.0121a68d@jic23-huawei> In-Reply-To: <20210925020555.129-2-caihuoqing@baidu.com> References: <20210925020555.129-1-caihuoqing@baidu.com> <20210925020555.129-2-caihuoqing@baidu.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 25 Sep 2021 10:05:45 +0800 Cai Huoqing wrote: > The NXP i.MX 8QuadXPlus SOC has a new ADC IP, so add > driver support for this ADC. > > Signed-off-by: Cai Huoqing Hi Cai Huoqing, Having had a 'final' read through of the driver, I am basically happy to merge this after Fabio has had time for another look (plus anyone else who wishes to of course!) There were a few minor things inline though that I'll tidy up whilst applying. If you do a v7 for some other reason please sort these out as well. Thanks, Jonathan ... > +#define IMX8QXP_ADR_ADC_TCTRL(tid) (0xc0 + tid * 4) > +#define IMX8QXP_ADR_ADC_CMDH(cid) (0x100 + cid * 8) > +#define IMX8QXP_ADR_ADC_CMDL(cid) (0x104 + cid * 8) In macros, it is always a good idea to put brackets around any use of parameters so as to avoid potential odd issues due to operator precedence. (0xc0 + (tid) * 4) > +#define IMX8QXP_ADR_ADC_RESFIFO 0x300 > +#define IMX8QXP_ADR_ADC_TST 0xffc ... > + > +struct imx8qxp_adc { > + struct device *dev; > + void __iomem *regs; > + struct clk *clk; > + struct clk *ipg_clk; > + struct regulator *vref; > + struct mutex lock; A lock should have documentation to identify what it's precise scope is. I can add /* Serialise ADC channel reads */ above the lock definition whilst applying if you aren't doing a v7 for other reasons. > + struct completion completion; > +}; ... > + > +static irqreturn_t imx8qxp_adc_isr(int irq, void *dev_id) > +{ > + struct imx8qxp_adc *adc = dev_id; > + Really minor, but the blank line here doesn't help readability much and is inconsistent with the rest of the driver. I might remove this whilst applying if nothing else comes up. > + u32 fifo_count; > + > + fifo_count = FIELD_GET(IMX8QXP_ADC_FCTRL_FCOUNT_MASK, > + readl(adc->regs + IMX8QXP_ADR_ADC_FCTRL)); > + > + if (fifo_count) > + complete(&adc->completion); > + > + return IRQ_HANDLED; > +} > + ...