From 9cf83000da2611923c9c250f6e14fd09dae45df9 Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Tue, 22 Sep 2009 05:22:57 -0500 Subject: S3C: ADC: Fix lines with more than 80 chars in adc.h Small cleanup. Signed-off-by: Nelson Castillo [ben-linux@fluff.org: rewrote subject] Signed-off-by: Ben Dooks --- arch/arm/plat-s3c/include/plat/adc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/arm/plat-s3c/include/plat/adc.h b/arch/arm/plat-s3c/include/plat/adc.h index 43df2a404b0..ef92e50ac0a 100644 --- a/arch/arm/plat-s3c/include/plat/adc.h +++ b/arch/arm/plat-s3c/include/plat/adc.h @@ -19,10 +19,11 @@ struct s3c_adc_client; extern int s3c_adc_start(struct s3c_adc_client *client, unsigned int channel, unsigned int nr_samples); -extern struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, - void (*select)(unsigned selected), - void (*conv)(unsigned d0, unsigned d1), - unsigned int is_ts); +extern struct s3c_adc_client * + s3c_adc_register(struct platform_device *pdev, + void (*select)(unsigned selected), + void (*conv)(unsigned d0, unsigned d1), + unsigned int is_ts); extern void s3c_adc_release(struct s3c_adc_client *client); -- cgit v1.2.3 From f4ad756aceabef95fea74609de81375ee8efc6c5 Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Tue, 22 Sep 2009 05:23:04 -0500 Subject: S3C: ADC: Expose number of remaining conversions to convert callback This patch allow us to efficiently modify the number of remaining conversions from the client side. This us useful when we do not know in advance how many conversions we will need or when we need to cancel pending conversions. This change is simple enough to be compatible with existing code that can just define the new pointer in the callback and ignore it. Sample usage: http://tinyurl.com/s3c2410-ts-c (function stylus_adc_action). Signed-off-by: Nelson Castillo Signed-off-by: Ben Dooks --- arch/arm/plat-s3c/include/plat/adc.h | 3 ++- arch/arm/plat-s3c24xx/adc.c | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'arch') diff --git a/arch/arm/plat-s3c/include/plat/adc.h b/arch/arm/plat-s3c/include/plat/adc.h index ef92e50ac0a..d847bd476b6 100644 --- a/arch/arm/plat-s3c/include/plat/adc.h +++ b/arch/arm/plat-s3c/include/plat/adc.h @@ -22,7 +22,8 @@ extern int s3c_adc_start(struct s3c_adc_client *client, extern struct s3c_adc_client * s3c_adc_register(struct platform_device *pdev, void (*select)(unsigned selected), - void (*conv)(unsigned d0, unsigned d1), + void (*conv)(unsigned d0, unsigned d1, + unsigned *samples_left), unsigned int is_ts); extern void s3c_adc_release(struct s3c_adc_client *client); diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index 9a5c767e0a4..03429b2a27f 100644 --- a/arch/arm/plat-s3c24xx/adc.c +++ b/arch/arm/plat-s3c24xx/adc.c @@ -45,7 +45,8 @@ struct s3c_adc_client { unsigned char channel; void (*select_cb)(unsigned selected); - void (*convert_cb)(unsigned val1, unsigned val2); + void (*convert_cb)(unsigned val1, unsigned val2, + unsigned *samples_left); }; struct adc_device { @@ -158,7 +159,8 @@ static void s3c_adc_default_select(unsigned select) struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, void (*select)(unsigned int selected), - void (*conv)(unsigned d0, unsigned d1), + void (*conv)(unsigned d0, unsigned d1, + unsigned *samples_left), unsigned int is_ts) { struct s3c_adc_client *client; @@ -210,9 +212,10 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) data1 = readl(adc->regs + S3C2410_ADCDAT1); adc_dbg(adc, "read %d: 0x%04x, 0x%04x\n", client->nr_samples, data0, data1); - (client->convert_cb)(data0 & 0x3ff, data1 & 0x3ff); + client->nr_samples--; + (client->convert_cb)(data0 & 0x3ff, data1 & 0x3ff, &client->nr_samples); - if (--client->nr_samples > 0) { + if (client->nr_samples > 0) { /* fire another conversion for this */ client->select_cb(1); -- cgit v1.2.3 From 16e3d48d8ff84d279483b237c1e509ff1388eca2 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Tue, 22 Sep 2009 05:23:12 -0500 Subject: s3c24xx: introduce s3c-adc delay Without this patch we cannot make the s3c2410/s3c2440 touchscreen driver work. Is this delay device-dependant? Is there a better way to do this? We specify the delay value (S3C2410_ADCDLY). Signed-off-by: Vasily Khoruzhick Signed-off-by: Nelson Castillo --- arch/arm/plat-s3c24xx/adc.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch') diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index 03429b2a27f..a9eec95f70d 100644 --- a/arch/arm/plat-s3c24xx/adc.c +++ b/arch/arm/plat-s3c24xx/adc.c @@ -58,6 +58,7 @@ struct adc_device { void __iomem *regs; unsigned int prescale; + unsigned int delay; int irq; }; @@ -247,6 +248,7 @@ static int s3c_adc_probe(struct platform_device *pdev) adc->pdev = pdev; adc->prescale = S3C2410_ADCCON_PRSCVL(49); + adc->delay = 0x2710; adc->irq = platform_get_irq(pdev, 1); if (adc->irq <= 0) { @@ -286,6 +288,7 @@ static int s3c_adc_probe(struct platform_device *pdev) writel(adc->prescale | S3C2410_ADCCON_PRSCEN, adc->regs + S3C2410_ADCCON); + writel(adc->delay, adc->regs + S3C2410_ADCDLY); dev_info(dev, "attached adc driver\n"); @@ -341,6 +344,7 @@ static int s3c_adc_resume(struct platform_device *pdev) writel(adc->prescale | S3C2410_ADCCON_PRSCEN, adc->regs + S3C2410_ADCCON); + writel(adc->delay, adc->regs + S3C2410_ADCDLY); return 0; } -- cgit v1.2.3 From 7ddf2bb46771e10d4cc7da94b3c1210426806def Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Fri, 18 Sep 2009 01:45:39 -0500 Subject: Make s3c TS driver use s3c-adc API I had a patch by Vasily Khoruzhick in the linux-arm-kernel as a guide for some of the changes. Signed-off-by: Nelson Castillo --- arch/arm/configs/gta01_moredrivers_defconfig | 2 +- arch/arm/configs/gta02_micro_defconfig | 2 +- arch/arm/configs/gta02_moredrivers_defconfig | 2 +- arch/arm/configs/gta02_packaging_defconfig | 2 +- arch/arm/mach-s3c2410/mach-gta01.c | 4 ++++ arch/arm/mach-s3c2442/mach-gta02.c | 3 +++ arch/arm/plat-s3c24xx/adc.c | 9 +++++++++ arch/arm/plat-s3c24xx/devs.c | 1 + 8 files changed, 21 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/arm/configs/gta01_moredrivers_defconfig b/arch/arm/configs/gta01_moredrivers_defconfig index 36d2b170b52..0ed35d8bd1b 100644 --- a/arch/arm/configs/gta01_moredrivers_defconfig +++ b/arch/arm/configs/gta01_moredrivers_defconfig @@ -180,7 +180,7 @@ CONFIG_S3C2410_CLOCK=y CONFIG_S3C24XX_GPIO_EXTRA=0 CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set -# CONFIG_S3C24XX_ADC is not set +CONFIG_S3C24XX_ADC=y CONFIG_MACH_NEO1973=y CONFIG_PLAT_S3C=y CONFIG_CPU_LLSERIAL_S3C2410_ONLY=y diff --git a/arch/arm/configs/gta02_micro_defconfig b/arch/arm/configs/gta02_micro_defconfig index ae30c4b1ddb..6a6ff77ea2c 100644 --- a/arch/arm/configs/gta02_micro_defconfig +++ b/arch/arm/configs/gta02_micro_defconfig @@ -158,7 +158,7 @@ CONFIG_S3C24XX_PWM=y CONFIG_S3C24XX_GPIO_EXTRA=0 CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set -# CONFIG_S3C24XX_ADC is not set +CONFIG_S3C24XX_ADC=y CONFIG_MACH_NEO1973=y CONFIG_PLAT_S3C=y CONFIG_CPU_LLSERIAL_S3C2440_ONLY=y diff --git a/arch/arm/configs/gta02_moredrivers_defconfig b/arch/arm/configs/gta02_moredrivers_defconfig index bd66869f74a..13b41215faa 100644 --- a/arch/arm/configs/gta02_moredrivers_defconfig +++ b/arch/arm/configs/gta02_moredrivers_defconfig @@ -180,7 +180,7 @@ CONFIG_S3C24XX_PWM=y CONFIG_S3C24XX_GPIO_EXTRA=0 CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set -# CONFIG_S3C24XX_ADC is not set +CONFIG_S3C24XX_ADC=y CONFIG_MACH_SMDK=y CONFIG_MACH_NEO1973=y CONFIG_PLAT_S3C=y diff --git a/arch/arm/configs/gta02_packaging_defconfig b/arch/arm/configs/gta02_packaging_defconfig index 15defd28841..03c72d5652b 100644 --- a/arch/arm/configs/gta02_packaging_defconfig +++ b/arch/arm/configs/gta02_packaging_defconfig @@ -180,7 +180,7 @@ CONFIG_S3C24XX_PWM=y CONFIG_S3C24XX_GPIO_EXTRA=0 CONFIG_S3C2410_DMA=y # CONFIG_S3C2410_DMA_DEBUG is not set -# CONFIG_S3C24XX_ADC is not set +CONFIG_S3C24XX_ADC=y CONFIG_MACH_SMDK=y CONFIG_MACH_NEO1973=y CONFIG_PLAT_S3C=y diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index 8a13a4adcfd..339eb845744 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -993,6 +993,10 @@ static void __init gta01_machine_init(void) printk(KERN_DEBUG "Enabled GSM wakeup IRQ %d (rc=%d)\n", GTA01_IRQ_MODEM, rc); +#ifdef CONFIG_S3C24XX_ADC + platform_device_register(&s3c_device_adc); +#endif + pm_power_off = >a01_power_off; } diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index e4f052595bd..346c2298b08 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -1717,6 +1717,9 @@ static void __init gta02_machine_init(void) gta02_vibrator_dev.dev.parent = &s3c24xx_pwm_device.dev; platform_device_register(>a02_vibrator_dev); #endif +#ifdef CONFIG_S3C24XX_ADC + platform_device_register(&s3c_device_adc); +#endif } void DEBUG_LED(int n) diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index a9eec95f70d..9056bcc6c17 100644 --- a/arch/arm/plat-s3c24xx/adc.c +++ b/arch/arm/plat-s3c24xx/adc.c @@ -69,10 +69,19 @@ static LIST_HEAD(adc_pending); #define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg) +#define AUTOPST (S3C2410_ADCTSC_YM_SEN | S3C2410_ADCTSC_YP_SEN | \ + S3C2410_ADCTSC_XP_SEN | S3C2410_ADCTSC_AUTO_PST | \ + S3C2410_ADCTSC_XY_PST(0)) + + static inline void s3c_adc_convert(struct adc_device *adc) { unsigned con = readl(adc->regs + S3C2410_ADCCON); + if (adc->cur->is_ts) + writel(S3C2410_ADCTSC_PULL_UP_DISABLE | AUTOPST, + adc->regs + S3C2410_ADCTSC); + con |= S3C2410_ADCCON_ENABLE_START; writel(con, adc->regs + S3C2410_ADCCON); } diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c index 0fdaa54ada9..eeb95f863ce 100644 --- a/arch/arm/plat-s3c24xx/devs.c +++ b/arch/arm/plat-s3c24xx/devs.c @@ -205,6 +205,7 @@ EXPORT_SYMBOL(s3c_device_nand); struct platform_device s3c_device_ts = { .name = "s3c2410-ts", .id = -1, + .dev.parent = &s3c_device_adc.dev, }; EXPORT_SYMBOL(s3c_device_ts); -- cgit v1.2.3 From 03ef252d6732527904eeec98849f49a09a515382 Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Tue, 22 Sep 2009 05:23:50 -0500 Subject: GTA01: Disable glamo Remove glamo from defconfig. Signed-off-by: Nelson Castillo --- arch/arm/configs/gta01_moredrivers_defconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'arch') diff --git a/arch/arm/configs/gta01_moredrivers_defconfig b/arch/arm/configs/gta01_moredrivers_defconfig index 0ed35d8bd1b..411acab046f 100644 --- a/arch/arm/configs/gta01_moredrivers_defconfig +++ b/arch/arm/configs/gta01_moredrivers_defconfig @@ -1192,11 +1192,7 @@ CONFIG_SSB_POSSIBLE=y CONFIG_MFD_PCF50606=y CONFIG_PCF50606_ADC=y CONFIG_PCF50606_GPO=y -CONFIG_MFD_GLAMO=y -CONFIG_MFD_GLAMO_FB=y -CONFIG_MFD_GLAMO_SPI_GPIO=y -CONFIG_MFD_GLAMO_SPI_FB=y -CONFIG_MFD_GLAMO_MCI=y +# CONFIG_MFD_GLAMO is not set # # Multimedia devices -- cgit v1.2.3 From f7c1655ba09cdf316156883ab088f2030a651678 Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Wed, 23 Sep 2009 02:01:37 -0500 Subject: Require CONFIG_S3C24XX_ADC for GTA01/GTA02 Select CONFIG_S3C24XX_ADC by defult for GTA01/GTA02. Somebody will hate me if I don't send this patch soon. Signed-off-by: Nelson Castillo --- arch/arm/mach-s3c2410/Kconfig | 1 + arch/arm/mach-s3c2442/Kconfig | 1 + 2 files changed, 2 insertions(+) (limited to 'arch') diff --git a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig index f4f7af180aa..02f406bea08 100644 --- a/arch/arm/mach-s3c2410/Kconfig +++ b/arch/arm/mach-s3c2410/Kconfig @@ -155,6 +155,7 @@ config MACH_NEO1973_GTA01 select PCF50606_WATCHDOG select POWER_SUPPLY select BATTERY_GTA01 + select S3C24XX_ADC help Say Y here if you are using the FIC Neo1973 GSM Phone diff --git a/arch/arm/mach-s3c2442/Kconfig b/arch/arm/mach-s3c2442/Kconfig index aa184ba7586..13fb5e190b4 100644 --- a/arch/arm/mach-s3c2442/Kconfig +++ b/arch/arm/mach-s3c2442/Kconfig @@ -36,6 +36,7 @@ config MACH_NEO1973_GTA02 select S3C_PWM select FIQ select S3C_DEV_USB_HOST + select S3C24XX_ADC help Say Y here if you are using the FIC Neo1973 GSM Phone -- cgit v1.2.3 From 9c3fe7498950875215cdd2c3bb6b0bef70570be0 Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Wed, 23 Sep 2009 02:44:08 -0500 Subject: Fix wrong commit I'm quite sorry I sent the commit that crashes GTA01. The fix is quite short. Fixing is easier than reverting and fixing conflicts. Signed-off-by: Nelson Castillo --- arch/arm/mach-s3c2410/mach-gta01.c | 5 +---- arch/arm/mach-s3c2442/mach-gta02.c | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-s3c2410/mach-gta01.c b/arch/arm/mach-s3c2410/mach-gta01.c index 339eb845744..21726956ff6 100644 --- a/arch/arm/mach-s3c2410/mach-gta01.c +++ b/arch/arm/mach-s3c2410/mach-gta01.c @@ -560,6 +560,7 @@ static struct platform_device *gta01_devices[] __initdata = { &s3c_device_sdi, &s3c_device_usbgadget, &s3c_device_nand, + &s3c_device_adc, &s3c_device_ts, }; @@ -993,10 +994,6 @@ static void __init gta01_machine_init(void) printk(KERN_DEBUG "Enabled GSM wakeup IRQ %d (rc=%d)\n", GTA01_IRQ_MODEM, rc); -#ifdef CONFIG_S3C24XX_ADC - platform_device_register(&s3c_device_adc); -#endif - pm_power_off = >a01_power_off; } diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c index 346c2298b08..380effad4d4 100644 --- a/arch/arm/mach-s3c2442/mach-gta02.c +++ b/arch/arm/mach-s3c2442/mach-gta02.c @@ -1561,6 +1561,7 @@ static struct platform_device *gta02_devices[] __initdata = { &s3c_device_usbgadget, &s3c_device_nand, >a02_nor_flash, + &s3c_device_adc, &s3c24xx_pwm_device, >a02_led_dev, @@ -1717,9 +1718,6 @@ static void __init gta02_machine_init(void) gta02_vibrator_dev.dev.parent = &s3c24xx_pwm_device.dev; platform_device_register(>a02_vibrator_dev); #endif -#ifdef CONFIG_S3C24XX_ADC - platform_device_register(&s3c_device_adc); -#endif } void DEBUG_LED(int n) -- cgit v1.2.3