Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
[deliverable/linux.git] / arch / arm / common / locomo.c
index 159ad7ed7a40142c16093588fb0988963c675b29..23609400a8e2f2ca9a1253dce10ff20a1a391d1f 100644 (file)
@@ -629,6 +629,22 @@ static int locomo_resume(struct platform_device *dev)
 }
 #endif
 
+
+#define LCM_ALC_EN     0x8000
+
+void frontlight_set(struct locomo *lchip, int duty, int vr, int bpwf)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&lchip->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(&lchip->lock, flags);
+}
+
+
 /**
  *     locomo_probe - probe for a single LoCoMo chip.
  *     @phys_addr: physical address of device.
@@ -688,6 +704,11 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
        /* 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 */
@@ -767,6 +788,8 @@ static int locomo_probe(struct platform_device *dev)
        if (!mem)
                return -EINVAL;
        irq = platform_get_irq(dev, 0);
+       if (irq < 0)
+               return -ENXIO;
 
        return __locomo_probe(&dev->dev, mem, irq);
 }
This page took 0.023648 seconds and 5 git commands to generate.