Thread (9 messages) 9 messages, 3 authors, 2021-09-26

Re: [PATCH v6 1/3] iio: imx8qxp-adc: Add driver support for NXP IMX8QXP ADC

From: Cai Huoqing <hidden>
Date: 2021-09-26 13:42:33
Also in: linux-devicetree, linux-iio, lkml

On 26 9月 21 12:41:37, Jonathan Cameron wrote:
On Sat, 25 Sep 2021 10:05:45 +0800
Cai Huoqing [off-list ref] wrote:
quoted
The NXP i.MX 8QuadXPlus SOC has a new ADC IP, so add
driver support for this ADC.

Signed-off-by: Cai Huoqing <redacted>
Hi Jonathan
Thanks for your feedback.
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.
Feel free to fix these directly.
If you do a v7 for some other reason please sort these out as well.
Sure, if v7 is needed for other issue, I will add these changes BTW.

Many thanks,
Cai
Thanks,

Jonathan

...
quoted
+#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)
quoted
+#define IMX8QXP_ADR_ADC_RESFIFO		0x300
+#define IMX8QXP_ADR_ADC_TST		0xffc
...
quoted
+
+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.
quoted
+	struct completion completion;
+};
...

quoted
+
+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.
quoted
+	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;
+}
+
...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help