[PATCH] backlight: LOCOMO Backlight Driver updates
[sfrench/cifs-2.6.git] / arch / arm / common / locomo.c
index a7dc1370695bd870988967b9eecbee08e5f8e1a0..0dafba3a701d605d80ad34e3c87bf1fb8da5627b 100644 (file)
@@ -629,21 +629,6 @@ 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.
@@ -698,14 +683,10 @@ __locomo_probe(struct device *me, struct resource *mem, int irq)
                        , lchip->base + LOCOMO_GPD);
        locomo_writel(0, lchip->base + LOCOMO_GIE);
 
-       /* FrontLight */
+       /* 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 */
@@ -1062,6 +1043,30 @@ void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int
        spin_unlock_irqrestore(&lchip->lock, flags);
 }
 
+/*
+ *     Frontlight control
+ */
+
+static struct locomo *locomo_chip_driver(struct locomo_dev *ldev);
+
+void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf)
+{
+       unsigned long flags;
+       struct locomo *lchip = locomo_chip_driver(dev);
+
+       if (vr)
+               locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 1);
+       else
+               locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 0);
+
+       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 | LOCOMO_ALC_EN, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+       spin_unlock_irqrestore(&lchip->lock, flags);
+}
+
 /*
  *     LoCoMo "Register Access Bus."
  *