Skip to content

Commit 249535d

Browse files
arndbjic23
authored andcommitted
iio: adc: exynos_adc: add support for s3c64xx adc
The ADC in s3c64xx is almost the same as exynosv1, but has a different 'select' method. Adding this here will be helpful to move over the existing s3c64xx platform from the legacy plat-samsung/adc driver to the new exynos-adc. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent 44d6f2e commit 249535d

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

‎Documentation/devicetree/bindings/arm/samsung/exynos-adc.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Required properties:
1616
future controllers.
1717
Must be "samsung,exynos3250-adc" for
1818
controllers compatible with ADC of Exynos3250.
19+
Must be "samsung,s3c6410-adc" for
20+
the ADC in s3c6410 and compatibles
1921
- reg: Contains ADC register address range (base address and
2022
length) and the address of the phy enable register.
2123
- interrupts: Contains the interrupt information for the timer. The

‎drivers/iio/adc/exynos_adc.c‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <linux/iio/machine.h>
4141
#include <linux/iio/driver.h>
4242

43-
/* EXYNOS4412/5250 ADC_V1 registers definitions */
43+
/* S3C/EXYNOS4412/5250 ADC_V1 registers definitions */
4444
#define ADC_V1_CON(x) ((x) + 0x00)
4545
#define ADC_V1_DLY(x) ((x) + 0x08)
4646
#define ADC_V1_DATX(x) ((x) + 0x0C)
@@ -61,6 +61,9 @@
6161
#define ADC_V1_CON_PRSCLV(x) (((x) & 0xFF) << 6)
6262
#define ADC_V1_CON_STANDBY (1u << 2)
6363

64+
/* Bit definitions for S3C2410 ADC */
65+
#define ADC_S3C2410_CON_SELMUX(x) (((x) & 7) << 3)
66+
6467
/* Bit definitions for ADC_V2 */
6568
#define ADC_V2_CON1_SOFT_RESET (1u << 2)
6669

@@ -217,6 +220,26 @@ static const struct exynos_adc_data exynos_adc_v1_data = {
217220
.start_conv = exynos_adc_v1_start_conv,
218221
};
219222

223+
static void exynos_adc_s3c64xx_start_conv(struct exynos_adc *info,
224+
unsigned long addr)
225+
{
226+
u32 con1;
227+
228+
con1 = readl(ADC_V1_CON(info->regs));
229+
con1 &= ~ADC_S3C2410_CON_SELMUX(0x7);
230+
con1 |= ADC_S3C2410_CON_SELMUX(addr);
231+
writel(con1 | ADC_CON_EN_START, ADC_V1_CON(info->regs));
232+
}
233+
234+
static struct exynos_adc_data const exynos_adc_s3c64xx_data = {
235+
.num_channels = MAX_ADC_V1_CHANNELS,
236+
237+
.init_hw = exynos_adc_v1_init_hw,
238+
.exit_hw = exynos_adc_v1_exit_hw,
239+
.clear_irq = exynos_adc_v1_clear_irq,
240+
.start_conv = exynos_adc_s3c64xx_start_conv,
241+
};
242+
220243
static void exynos_adc_v2_init_hw(struct exynos_adc *info)
221244
{
222245
u32 con1, con2;
@@ -285,6 +308,9 @@ static const struct exynos_adc_data exynos3250_adc_data = {
285308

286309
static const struct of_device_id exynos_adc_match[] = {
287310
{
311+
.compatible = "samsung,s3c6410-adc",
312+
.data = &exynos_adc_s3c64xx_data,
313+
}, {
288314
.compatible = "samsung,exynos-adc-v1",
289315
.data = &exynos_adc_v1_data,
290316
}, {

0 commit comments

Comments
 (0)