adc: update adc driver: request_irq-->request_threaded_irq
authorkfx <kfx@rock-chips.com>
Sat, 28 Jul 2012 07:54:21 +0000 (15:54 +0800)
committerkfx <kfx@rock-chips.com>
Sat, 28 Jul 2012 07:54:21 +0000 (15:54 +0800)
drivers/adc/core.c
drivers/adc/plat/rk28_adc.c
drivers/adc/plat/rk29_adc.c
drivers/adc/plat/rk30_adc.c

index f31dc08899f4eda3a64fc48d4381bf4b9e9d35f0..04531911b722b12a39601792ff5ba80533c5f734 100755 (executable)
@@ -145,16 +145,17 @@ static void adc_finished(struct adc_host *adc, int result)
 }
 void adc_core_irq_handle(struct adc_host *adc)
 {
+        unsigned long flags;
         int result = 0;
 
-       spin_lock(&adc->lock);
+       spin_lock_irqsave(&adc->lock, flags);
         result = adc->ops->read(adc);
 
         adc_finished(adc, result);
 
         if(!list_empty(&adc->req_head))
                 schedule_work(&adc->work);
-       spin_unlock(&adc->lock);
+       spin_unlock_irqrestore(&adc->lock, flags);
 }
 
 int adc_host_read(struct adc_client *client, enum read_type type)
index 859d56fdb2a341427e06c43a44519a2937690ac2..29d4b3ce57f6d13f3a445e468f5c29d3abebc4ae 100755 (executable)
@@ -94,7 +94,7 @@ static int rk28_adc_probe(struct platform_device *pdev)
                goto err_alloc;\r
        }\r
 \r
-       ret = request_irq(dev->irq, rk28_adc_irq, 0, pdev->name, dev);\r
+        ret = request_threaded_irq(dev->irq, NULL, rk28_adc_irq, IRQF_ONESHOT, pdev->name, dev);\r
        if (ret < 0) {\r
                dev_err(&pdev->dev, "failed to attach adc irq\n");\r
                goto err_alloc;\r
index bf511ca8b4252079610bdbee3b829c853038cdfc..63f91fb1c1d08c954170749124a3f79daef95e23 100755 (executable)
@@ -123,7 +123,7 @@ static int rk29_adc_probe(struct platform_device *pdev)
                goto err_alloc;\r
        }\r
 \r
-       ret = request_irq(dev->irq, rk29_adc_irq, 0, pdev->name, dev);\r
+        ret = request_threaded_irq(dev->irq, NULL, rk29_adc_irq, IRQF_ONESHOT, pdev->name, dev);\r
        if (ret < 0) {\r
                dev_err(&pdev->dev, "failed to attach adc irq\n");\r
                goto err_alloc;\r
index fbfb26a940b537323271876fa42a5cb41f1357f7..3a8a03638c62266f9ec76896a85d673003aa7261 100755 (executable)
@@ -45,6 +45,7 @@ static void rk30_adc_stop(struct adc_host *adc)
        struct rk30_adc_device *dev  = adc_priv(adc);\r
        \r
        adc_writel(0, dev->regs + ADC_CTRL);\r
+        udelay(SAMPLE_RATE);\r
 }\r
 static int rk30_adc_read(struct adc_host *adc)\r
 {\r
@@ -75,10 +76,7 @@ struct adc_test_data {
 };\r
 static void callback(struct adc_client *client, void *param, int result)\r
 {\r
-        if(result < 70)\r
-               dev_info(client->adc->dev, "[chn%d] async_read = %d\n", client->chn, result);\r
-        else\r
-               dev_dbg(client->adc->dev, "[chn%d] async_read = %d\n", client->chn, result);\r
+       dev_dbg(client->adc->dev, "[chn%d] async_read = %d\n", client->chn, result);\r
        return;\r
 }\r
 static void adc_timer(unsigned long data)\r
@@ -86,7 +84,7 @@ static void adc_timer(unsigned long data)
         struct adc_test_data *test=(struct adc_test_data *)data;\r
        \r
        queue_work(adc_wq, &test->timer_work);\r
-       add_timer(&test->timer);\r
+        mod_timer(&test->timer, jiffies+msecs_to_jiffies(20));\r
 }\r
 static void adc_timer_work(struct work_struct *work)\r
 {      \r
@@ -95,10 +93,7 @@ static void adc_timer_work(struct work_struct *work)
                                                timer_work);\r
        adc_async_read(test->client);\r
        sync_read = adc_sync_read(test->client);\r
-        if(sync_read < 70)\r
-               dev_info(test->client->adc->dev, "[chn%d] sync_read = %d\n", test->client->chn, sync_read);\r
-        else\r
-               dev_dbg(test->client->adc->dev, "[chn%d] sync_read = %d\n", test->client->chn, sync_read);\r
+       dev_dbg(test->client->adc->dev, "[chn%d] sync_read = %d\n", test->client->chn, sync_read);\r
 }\r
 \r
 static int rk30_adc_test(void)\r
@@ -112,8 +107,7 @@ static int rk30_adc_test(void)
                test[i]->client = adc_register(i, callback, NULL);\r
                INIT_WORK(&test[i]->timer_work, adc_timer_work);\r
                setup_timer(&test[i]->timer, adc_timer, (unsigned long)test[i]);\r
-               test[i]->timer.expires  = jiffies + 1;\r
-               add_timer(&test[i]->timer);\r
+                mod_timer(&test[i]->timer, jiffies+msecs_to_jiffies(20));\r
         }\r
        \r
        return 0;\r
@@ -141,7 +135,7 @@ static int rk30_adc_probe(struct platform_device *pdev)
                goto err_alloc;\r
        }\r
 \r
-       ret = request_irq(dev->irq, rk30_adc_irq, 0, pdev->name, dev);\r
+       ret = request_threaded_irq(dev->irq, NULL, rk30_adc_irq, IRQF_ONESHOT, pdev->name, dev);\r
        if (ret < 0) {\r
                dev_err(&pdev->dev, "failed to attach adc irq\n");\r
                goto err_alloc;\r