Skip to contentSkip to conversation

ARM: SAMSUNG: Add locking sequence for nomal mode

PATCH New Huisung Kang 1 participant 1 message Feb 11, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: SAMSUNG: Add locking sequence for nomal mode

From: Dongsoo Ha <[email protected]>

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.

---
 arch/arm/plat-samsung/adc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/plat-samsung/adc.c +5 -1
@@ -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