s3c24xx-adc: resume convertions interrupted by going to suspend
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
Fix for a bug that shows when the s3c2410 TS driver requests
a conversion from the s3c-adc driver and the machine goes into suspend.
In this case the touchscreen stops working.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3c24xx-adc-resume-convertions-interrupted-by-going-.patch
Type: text/x-patch
Size: 3617 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091020/e97caad8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091020/e97caad8/attachment.sig>
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
? ????????? ?? 20 ??????? 2009 17:19:30 ????? Vasily Khoruzhick ???????:
Quoted 3 lines
Fix for a bug that shows when the s3c2410 TS driver requests a conversion from the s3c-adc driver and the machine goes into suspend. In this case the touchscreen stops working.
Does anyone on maillist interested in this bugfix? I got no response for 2 days...
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091022/3eabe1d6/attachment.sig>
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
Quoted 2 lines · Vasily Khoruzhick
Does anyone on maillist interested in this bugfix? I got no response for 2 days...
Two days isn't an unreasonable length of time to wait - it would be worth chasing up if it takes more than a week or two but a few days is nothing to worry about, people have days off and other work to do.
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
In reply to Vasily KhoruzhickQuoted 7 lines · Vasily Khoruzhick
?? ?????????????????? ???? 20 ?????????????? 2009 17:19:30 ?????????? Vasily Khoruzhick ??????????????:
Quoted 3 lines
Fix for a bug that shows when the s3c2410 TS driver requests a conversion from the s3c-adc driver and the machine goes into suspend. In this case the touchscreen stops working.
Does anyone on maillist interested in this bugfix? I got no response for 2 days...
I've been in and out of bed feeling ill, I can't sit on this list 24x7 looking at bugfixes.
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
? ????????? ?? 22 ??????? 2009 21:59:54 ?? ????????:
Quoted 6 lines · Vasily Khoruzhick
Quoted 2 lines
Does anyone on maillist interested in this bugfix? I got no response for 2 days...
I've been in and out of bed feeling ill, I can't sit on this list 24x7 looking at bugfixes.
Sorry for impatience, I just want to make sure that my patch wasn't ignored or lost.
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091023/4f1f13de/attachment.sig>
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
In reply to Vasily KhoruzhickQuoted 6 lines · Vasily Khoruzhick
? ????????? ?? 20 ??????? 2009 17:19:30 ????? Vasily Khoruzhick ???????:
Quoted 3 lines
Fix for a bug that shows when the s3c2410 TS driver requests a conversion from the s3c-adc driver and the machine goes into suspend. In this case the touchscreen stops working.
Review struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev,
Quoted 8 lines
(quoted diff) +1
-0@@ -224,6 +225,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, client->is_ts = is_ts; client->select_cb = select; client->convert_cb = conv; + client->selected = 0;
You don't need to clear client->selected. kzalloc takes care of this.
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
? ????????? ?? 24 ??????? 2009 09:59:25 ????? Nelson Castillo ???????:
Quoted 5 lines
Quoted 5 lines
(quoted diff) +0
-0@@ -224,6 +225,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, client->is_ts = is_ts;
Quoted 7 lines
Review
Quoted 5 lines
(quoted diff) +0
-0client->select_cb = select;client->convert_cb = conv;(quoted diff) +1
-0+ client->selected = 0;You don't need to clear
client->selected. kzalloc takes care of this.
Ok, here's a fixed version.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s3c24xx-adc-resume-convertions-interrupted-by-going-.patch
Type: text/x-patch
Size: 3397 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091029/d4ae5fc6/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091029/d4ae5fc6/attachment.sig>
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
? ????????? ?? 29 ??????? 2009 09:49:20 ????? Vasily Khoruzhick ???????:
Quoted 8 lines
? ????????? ?? 24 ??????? 2009 09:59:25 ????? Nelson Castillo ???????:
Quoted 7 lines
Quoted 7 lines
(quoted diff) +0
-0@@ -224,6 +225,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, client->is_ts = is_ts; client->select_cb = select;
Quoted 7 lines
Quoted 5 lines
Review
Quoted 3 lines
client->convert_cb = conv;(quoted diff) +1
-0+ client->selected = 0;You don't need to clear
client->selected. kzalloc takes care of this.Ok, here's a fixed version.
Any chance to get review/comments on this patch?
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091104/077489aa/attachment.sig>
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
In reply to Vasily KhoruzhickQuoted 3 lines · Vasily Khoruzhick
Fix for a bug that shows when the s3c2410 TS driver requests a conversion from the s3c-adc driver and the machine goes into suspend. In this case the touchscreen stops working.
Ok, thanks for pointing this out.
Quoted 31 lines
From
ff091bbc781c7182611be3de3e9b3a078d770336Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <[email protected]>
Date: Tue, 20 Oct 2009 17:14:26 +0300
Subject: [PATCH] s3c24xx-adc: resume convertions interrupted by going to suspendSigned-off-by Vasily Khoruzhick <[email protected]>--- arch/arm/plat-s3c24xx/adc.c | 47 ++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 7 deletions(-)arch/arm/plat-s3c24xx/adc.c +2
-0@@ -46,6 +46,7 @@ struct s3c_adc_client {int result;unsigned char is_ts;unsigned char channel; +unsigned int selected;void (*select_cb)(struct s3c_adc_client *c,unsigned selected); void (*convert_cb)(struct s3c_adc_client *c,@@ -67,6 +68,7 @@ struct adc_device { };static struct adc_device *adc_dev; +static struct work_struct resume_work;static LIST_HEAD (adc_pending);
arch/arm/plat-s3c24xx/adc.c static inline void s3c_adc_select(struct adc_device *adc, · line 93
Quoted 8 lines
arch/arm/plat-s3c24xx/adc.c +4
-1@@ -85,7 +87,10 @@ static inline void s3c_adc_select(struct adc_device *adc, {unsigned con =readl (adc->regs +S3C2410_ADCCON ); - client->select_cb (client,1 ); +if (!client->selected) { + client->selected =1 ; + client->select_cb (client,1 ); + }
You seem to have added something other than just a bugfix to this patch, you've changed the behaviour of the select callback. Is this really necessary for the function of the fix or something that dropped in by accident?
Quoted 77 lines
arch/arm/plat-s3c24xx/adc.c +27
-6con &= ~S3C2410_ADCCON_MUXMASK ; con &= ~S3C2410_ADCCON_STDBM ;@@ -109,13 +114,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); adc->cur = next;@@ -224,6 +225,7 @@ struct s3c_adc_client *s3c_adc_register(struct platform_device *pdev, client->is_ts = is_ts; client->select_cb = select; client->convert_cb = conv; + client->selected =0 ;return client; }@@ -278,13 +280,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 (client,1 );s3c_adc_convert (adc); }else {local_irq_save (flags); - (client->select_cb)(client,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)(client,0 ); +s3c_adc_try (adc);local_irq_restore (flags); }@@ -389,18 +398,42 @@ 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 ; } +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);
arch/arm/plat-s3c24xx/adc.c static int s3c_adc_suspend(struct platform_device *pdev, pm_message_t state) · line 436
Quoted 10 lines
arch/arm/plat-s3c24xx/adc.c +7
-0writel (adc->prescale |S3C2410_ADCCON_PRSCEN , adc->regs +S3C2410_ADCCON ); +/* 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" ); + }
Is the work being used here to avoid trying to do things that may sleep? IIRC, none of the calls should need to sleep.
I was just wondering whether it would be better to abort any calls in progress before sleep and get the clients themselves to restart once they themselves have been resumed. We may end up with the case where the callbacks are being triggered before the client has been resumed.
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
PATCH 1/1 s3c24xx-adc: resume convertions interrupted by going to suspend
? ????????? ?? 22 ??????? 2009 22:05:24 ????? Ben Dooks ???????:
Quoted 10 lines
Review
Quoted 5 lines
(quoted diff) +4
-1- client->select_cb(client, 1); + if (!client->selected) { + client->selected = 1; + client->select_cb(client, 1); + }You seem to have added something other than just a bugfix to this patch, you've changed the behaviour of the select callback. Is this really necessary for the function of the fix or something that dropped in by accident?
No, select callback behaviour is not changed, this check is necessary to avoid calling select callback when client was already selected (for example, after resuming from suspend)
Quoted 4 lines
Quoted 4 lines
(quoted diff) +2
-0writel(adc->prescale | S3C2410_ADCCON_PRSCEN, adc->regs + S3C2410_ADCCON); + /* Schedule task if there are clients pending. */ + if (!list_empty(&adc_pending) || adc_dev->ts_pend) {
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +5
-0+ INIT_WORK(&resume_work, adc_resume_work); + if (!schedule_work(&resume_work)) + dev_err(&pdev->dev, + "Failed to schedule adc_resume work!\n"); + }Is the work being used here to avoid trying to do things that may sleep? IIRC, none of the calls should need to sleep.
It's used to prevent calling callbacks (that may sleep) in atomic context (AFAIK resume handler is in atomic context)
Quoted 4 lines
I was just wondering whether it would be better to abort any calls in progress before sleep and get the clients themselves to restart once they themselves have been resumed. We may end up with the case where the callbacks are being triggered before the client has been resumed.
Maybe, but sometimes it's tricky to abort waiting for callback in client driver. Anyway, resume_work will be called only after all drivers has been resumed, so situation when callbacks are being triggered before the client has been resumed is impossible.
Regards,
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20091023/d2de15d2/attachment.sig>