From f6ed8a40eae91bde1ccd3466f12decbfd2be8943 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sat, 24 Oct 2009 03:04:55 -0500 Subject: s3c24xx: introduce s3c-adc delay Without this patch we cannot make the s3c2410/s3c2440 touchscreen driver work. This will be done in a different way in upstream kernel. 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/arm/plat-s3c24xx') diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index ee1baf11ad9..a30a5311abf 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; }; @@ -264,6 +265,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) { @@ -303,6 +305,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"); @@ -358,6 +361,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 b8e204011799a2328eebd3e2f86b5710f7e1fcee Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Sat, 24 Oct 2009 03:04:40 -0500 Subject: Add s3c2410ts Add the ts and the relevant files. Signed-off-by: Nelson Castillo --- arch/arm/plat-s3c24xx/devs.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'arch/arm/plat-s3c24xx') diff --git a/arch/arm/plat-s3c24xx/devs.c b/arch/arm/plat-s3c24xx/devs.c index 4eb378c89a3..a89286b4a12 100644 --- a/arch/arm/plat-s3c24xx/devs.c +++ b/arch/arm/plat-s3c24xx/devs.c @@ -28,6 +28,8 @@ #include #include +#include + #include #include @@ -199,6 +201,24 @@ struct platform_device s3c_device_nand = { EXPORT_SYMBOL(s3c_device_nand); +/* Touchscreen */ + +struct platform_device s3c_device_ts = { + .name = "s3c2410-ts", + .id = -1, + .dev.parent = &s3c_device_adc.dev, +}; + +static struct s3c2410_ts_mach_info s3c2410ts_info; + +void set_s3c2410ts_info(const struct s3c2410_ts_mach_info *hard_s3c2410ts_info) +{ + memcpy(&s3c2410ts_info, hard_s3c2410ts_info, + sizeof(struct s3c2410_ts_mach_info)); + s3c_device_ts.dev.platform_data = &s3c2410ts_info; +} +EXPORT_SYMBOL(set_s3c2410ts_info); + /* USB Device (Gadget)*/ static struct resource s3c_usbgadget_resource[] = { -- cgit v1.2.3 From f858d8fceb8519604ab7b1221724d5ad4ede7b29 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick Date: Sat, 24 Oct 2009 03:05:02 -0500 Subject: Fix resume conversions This patch fixes a bug where the TS might stop working after suspend/resume. This patch is under upstream review and it seems it will change a lot. Signed-off-by: Vasily Khoruzhick Signed-off-by: Nelson Castillo --- arch/arm/plat-s3c24xx/adc.c | 46 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 7 deletions(-) (limited to 'arch/arm/plat-s3c24xx') diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index a30a5311abf..d3e53c6352d 100644 --- a/arch/arm/plat-s3c24xx/adc.c +++ b/arch/arm/plat-s3c24xx/adc.c @@ -43,6 +43,7 @@ struct s3c_adc_client { unsigned int nr_samples; unsigned char is_ts; unsigned char channel; + unsigned int selected; void (*select_cb)(unsigned selected); void (*convert_cb)(unsigned val1, unsigned val2, @@ -65,6 +66,8 @@ struct adc_device { static struct adc_device *adc_dev; +static struct work_struct resume_work; + static LIST_HEAD(adc_pending); #define adc_dbg(_adc, msg...) dev_dbg(&(_adc)->pdev->dev, msg) @@ -82,7 +85,10 @@ static inline void s3c_adc_select(struct adc_device *adc, { unsigned con = readl(adc->regs + S3C2410_ADCCON); - client->select_cb(1); + if (!client->selected) { + client->selected = 1; + client->select_cb(1); + } con &= ~S3C2410_ADCCON_MUXMASK; con &= ~S3C2410_ADCCON_STDBM; @@ -106,12 +112,9 @@ static void s3c_adc_try(struct adc_device *adc) { struct s3c_adc_client *next = adc->ts_pend; - if (!next && !list_empty(&adc_pending)) { + if (!next && !list_empty(&adc_pending)) next = list_first_entry(&adc_pending, struct s3c_adc_client, pend); - list_del(&next->pend); - } else - adc->ts_pend = NULL; if (next) { adc_dbg(adc, "new client is %p\n", next); @@ -235,14 +238,20 @@ static irqreturn_t s3c_adc_irq(int irq, void *pw) if (client->nr_samples > 0) { /* fire another conversion for this */ - + client->selected = 1; client->select_cb(1); s3c_adc_convert(adc); } else { local_irq_save(flags); - (client->select_cb)(0); + client->selected = 0; + if (!adc->cur->is_ts) + list_del(&adc->cur->pend); + else + adc->ts_pend = NULL; adc->cur = NULL; + (client->select_cb)(0); + s3c_adc_try(adc); local_irq_restore(flags); } @@ -349,20 +358,43 @@ static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state) writel(con, adc->regs + S3C2410_ADCCON); clk_disable(adc->clk); + disable_irq(IRQ_ADC); + if (!list_empty(&adc_pending) || adc->ts_pend) + dev_info(&pdev->dev, "We still have adc clients pending\n"); return 0; } +/* It seems this is not needed. This is under upstream review now. */ +static void adc_resume_work(struct work_struct *work) +{ + if (!adc_dev) /* Have no ADC here */ + return; + + if (!list_empty(&adc_pending) || adc_dev->ts_pend) + /* We still have adc clients pending */ + s3c_adc_try(adc_dev); +} + static int s3c_adc_resume(struct platform_device *pdev) { struct adc_device *adc = platform_get_drvdata(pdev); + enable_irq(IRQ_ADC); clk_enable(adc->clk); writel(adc->prescale | S3C2410_ADCCON_PRSCEN, adc->regs + S3C2410_ADCCON); writel(adc->delay, adc->regs + S3C2410_ADCDLY); + /* Schedule task if there are clients pending. */ + if (!list_empty(&adc_pending) || adc_dev->ts_pend) { + INIT_WORK(&resume_work, adc_resume_work); + if (!schedule_work(&resume_work)) + dev_err(&pdev->dev, + "Failed to schedule adc_resume work!\n"); + } + return 0; } -- cgit v1.2.3 From 36a5e8676f2d19482cd4d9837c12d24c58882f8a Mon Sep 17 00:00:00 2001 From: Nelson Castillo Date: Sat, 24 Oct 2009 14:25:45 -0500 Subject: touchscreen patches for om-gta02-2.6.31 On Sat, Oct 24, 2009 at 3:04 AM, Nelson Castillo wrote: > Hi there. I finally made this work. I tested with: cat /dev/input/touchscreen0 | hexdump > > I wonder why it didn't work with X... This rootfs works with other drivers I've tested (even with the upstream kernel). Problem found. Patch attached. From: Nelson Castillo Date: Sat, 24 Oct 2009 14:12:58 -0500 Subject: [PATCH] Add auto-pst Without these lines the TS doesn't work. I didn't check who the author of the lines is. Signed-off-by: Nelson Castillo --- arch/arm/plat-s3c24xx/adc.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/arm/plat-s3c24xx') diff --git a/arch/arm/plat-s3c24xx/adc.c b/arch/arm/plat-s3c24xx/adc.c index d3e53c6352d..9cff2320e11 100644 --- a/arch/arm/plat-s3c24xx/adc.c +++ b/arch/arm/plat-s3c24xx/adc.c @@ -72,10 +72,18 @@ 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); } -- cgit v1.2.3