Skip to contentSkip to conversation

collie: enable frontlight

PATCH In review Pavel Machek 2 participants 4 messages Nov 1, 2005 – Nov 6, 2005 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 collie: enable frontlight

Enable frontlight on collie, so that display can be actually read indoors.

---
commit dc507abbd6658927bdef7a521c4aa16c511ec62f tree 666babf57b70cdf7fbac66c96defc9be4eb2518a parent 8d04f63101774a56e80ef76b4d40ab782541dd94 author <pavel@amd.(none)> Wed, 02 Nov 2005 00:20:26 +0100 committer <pavel@amd.(none)> Wed, 02 Nov 2005 00:20:26 +0100

 arch/arm/common/locomo.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/common/locomo.c +22 -0
@@ -631,6 +631,23 @@ static int locomo_resume(struct device *
 }
 #endif
 
+static spinlock_t fl_lock = SPIN_LOCK_UNLOCKED;
+
+#define LCM_ALC_EN	0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&fl_lock, flags);
+	locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	udelay(100);
+	locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+	locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	spin_unlock_irqrestore(&fl_lock, flags);
+}
+
+
 /**
  *	locomo_probe - probe for a single LoCoMo chip.
  *	@phys_addr: physical address of device.
@@ -690,6 +707,11 @@ __locomo_probe(struct device *me, struct
 	/* FrontLight */
 	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
 	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+
+	/* Same constants can be used for collie and poodle
+	   (depending on CONFIG options in original sharp code)? */
+	frontlight_set(lchip, 163, 0, 148);
+
 	/* Longtime timer */
 	locomo_writel(0, lchip->base + LOCOMO_LTINT);
 	/* SPI */
Signature · 1 line
Thanks, Sharp!
#1 lore raw
Quoted 6 lines · Pavel Machek
arch/arm/common/locomo.c +5 -0
+static spinlock_t fl_lock = SPIN_LOCK_UNLOCKED;
+
+#define LCM_ALC_EN	0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)

arch/arm/common/locomo.c static int locomo_resume(struct device * · line 648

Quoted 10 lines
arch/arm/common/locomo.c +10 -0
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&fl_lock, flags);
+	locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	udelay(100);
+	locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+	locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	spin_unlock_irqrestore(&fl_lock, flags);
+}

ick, a 100 microsecond glitch, quite unnecessary. Why not use a semaphore here, if any locking is actually needed? (It's called from device probe - there's higher-level serialisation, no?)

#2 lore raw

Hi!

Quoted 11 lines
Quoted 11 lines
arch/arm/common/locomo.c +11 -0
+static spinlock_t fl_lock = SPIN_LOCK_UNLOCKED;
+
+#define LCM_ALC_EN	0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&fl_lock, flags);
+	locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	udelay(100);
Quoted 8 lines

arch/arm/common/locomo.c static int locomo_resume(struct device * · line 648

Quoted 4 lines
arch/arm/common/locomo.c +4 -0
+	locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+	locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	spin_unlock_irqrestore(&fl_lock, flags);
+}

ick, a 100 microsecond glitch, quite unnecessary. Why not use a semaphore here, if any locking is actually needed? (It's called from device probe - there's higher-level serialisation, no?)

Suspend (locomo_suspend) touches frontlight registers, too, and it does it under spinlock => converting to semaphore would not too simple. As it is only one glitch during probe, it should not hurt that much...
Pavel

Signature · 1 line
Thanks, Sharp!
#3 lore raw
In reply to Andrew Morton

Hi!

Quoted 13 lines
Quoted 12 lines · Pavel Machek
arch/arm/common/locomo.c +11 -0
+static spinlock_t fl_lock = SPIN_LOCK_UNLOCKED;
+
+#define LCM_ALC_EN	0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&fl_lock, flags);
+	locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	udelay(100);
Quoted 8 lines

arch/arm/common/locomo.c static int locomo_resume(struct device * · line 648

Quoted 4 lines
arch/arm/common/locomo.c +4 -0
+	locomo_writel(duty, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
+	locomo_writel(bpwf | LCM_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	spin_unlock_irqrestore(&fl_lock, flags);
+}

ick, a 100 microsecond glitch, quite unnecessary. Why not use a semaphore here, if any locking is actually needed? (It's called from device probe - there's higher-level serialisation, no?)

Oops, I see; I invented my own lock when I should have used lchip->lock. Fixed locally, I'll push it up eventually.

Pavel

Signature · 1 line
Thanks, Sharp!