mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-26 08:51:13 +00:00
2e715fb4fc
Add support for BCM2712 (Raspberry Pi 5).
3bb5880ab3
Patches were generated from the diff between linux kernel branch linux-6.1.y
and rpi-6.1.y from raspberry pi kernel source:
- git format-patch linux-6.1.y...rpi-6.1.y
Build system: x86_64
Build-tested: bcm2708, bcm2709, bcm2710, bcm2711
Run-tested: bcm2710/RPi3B, bcm2711/RPi4B
Signed-off-by: Marty Jones <mj8263788@gmail.com>
[Remove applied and reverted patches, squash patches and config commits]
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From 3cafcfbab9b5f3f1357b415b6ca09911eeb405d6 Mon Sep 17 00:00:00 2001
|
|
From: Jonathan Bell <jonathan@raspberrypi.com>
|
|
Date: Thu, 4 May 2023 15:48:53 +0100
|
|
Subject: [PATCH] drivers: hwmon: rp1-adc: check conversion validity before
|
|
supplying value
|
|
|
|
The SAR ADC architecture may complete a conversion but instability in the
|
|
comparator can corrupt the result. Such corruption is signalled in the CS
|
|
ERR bit, asserted alongside each conversion result.
|
|
|
|
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
|
|
---
|
|
drivers/hwmon/rp1-adc.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/hwmon/rp1-adc.c
|
|
+++ b/drivers/hwmon/rp1-adc.c
|
|
@@ -97,8 +97,14 @@ static int rp1_adc_read(struct rp1_adc_d
|
|
data->base + RP1_ADC_RWTYPE_SET + RP1_ADC_CS);
|
|
|
|
ret = rp1_adc_ready_wait(data);
|
|
- if (!ret)
|
|
- *val = readl(data->base + RP1_ADC_RESULT);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ /* Asserted if the completed conversion had a convergence error */
|
|
+ if (readl(data->base + RP1_ADC_CS) & RP1_ADC_CS_ERR)
|
|
+ return -EIO;
|
|
+
|
|
+ *val = readl(data->base + RP1_ADC_RESULT);
|
|
|
|
spin_unlock(&data->lock);
|
|
|