}
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)
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
};\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
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
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
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
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