Merge branch 'upstream-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linvil...
[deliverable/linux.git] / arch / arm / common / locomo.c
index 1b7eaab02b9ec66263b0c66cd15e4522ab72f06f..d31b1cb7eea0d83ed2cb632ed07b42d593aad3c7 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 */
@@ -1103,14 +1124,14 @@ static int locomo_bus_remove(struct device *dev)
 struct bus_type locomo_bus_type = {
        .name           = "locomo-bus",
        .match          = locomo_match,
+       .probe          = locomo_bus_probe,
+       .remove         = locomo_bus_remove,
        .suspend        = locomo_bus_suspend,
        .resume         = locomo_bus_resume,
 };
 
 int locomo_driver_register(struct locomo_driver *driver)
 {
-       driver->drv.probe = locomo_bus_probe;
-       driver->drv.remove = locomo_bus_remove;
        driver->drv.bus = &locomo_bus_type;
        return driver_register(&driver->drv);
 }
This page took 0.026965 seconds and 5 git commands to generate.