[PATCH] ARM: SAMSUNG: Add locking sequence for nomal mode

Huisung Kang hs1218.kang at samsung.com
Fri Feb 10 21:53:31 EST 2012


From: Dongsoo Ha <dsfine.ha at samsung.com>

ADC need to lock the data when read the data from register.
It is a complicated timing issue. Lock the data before start ADC and keep it.

Signed-off-by: Dongsoo Ha <dsfine.ha at samsung.com>
Signed-off-by: Huisung Kang <hs1218.kang at samsung.com>
---
 arch/arm/plat-samsung/adc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-samsung/adc.c b/arch/arm/plat-samsung/adc.c index fccc644..c68d56f 100644
--- a/arch/arm/plat-samsung/adc.c
+++ b/arch/arm/plat-samsung/adc.c
@@ -224,11 +224,16 @@ int s3c_adc_read(struct s3c_adc_client *client, unsigned int ch)  {
 	DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wake);
 	int ret;
+	unsigned long flags;
+
+	spin_lock_irqsave(&adc_dev->lock, flags);
 
 	client->convert_cb = s3c_convert_done;
 	client->wait = &wake;
 	client->result = -1;
 
+	spin_unlock_irqrestore(&adc_dev->lock, flags);
+
 	ret = s3c_adc_start(client, ch, 1);
 	if (ret < 0)
 		goto err;
--
1.7.1





More information about the linux-arm-kernel mailing list