OMAPDSS: TPO-TD03MTEA1: add vdd regulator
[pandora-kernel.git] / drivers / video / omap2 / displays / panel-tpo-td043mtea1.c
index be89801..0c6aca1 100644 (file)
@@ -53,6 +53,7 @@ static const u16 tpo_td043_def_gamma[12] = {
 struct tpo_td043_device {
        struct spi_device *spi;
        struct regulator *vcc_reg;
+       struct regulator *vdd_reg;
        int nreset_gpio;
        u16 gamma[12];
        u32 mode;
@@ -260,12 +261,16 @@ static const struct omap_video_timings tpo_td043_timings = {
 
        .pixel_clock    = 36000,
 
+       /* note:
+        * hbp+hsw must be 215
+        * if vbp+vsw < 32, the panel tears at the bottom
+        * if vbp+vsw > 35, it wraps from the top */
        .hsw            = 1,
-       .hfp            = 68,
+       .hfp            = 150,
        .hbp            = 214,
 
        .vsw            = 1,
-       .vfp            = 39,
+       .vfp            = 0,
        .vbp            = 34,
 };
 
@@ -277,6 +282,7 @@ static int tpo_td043_power_on(struct tpo_td043_device *tpo_td043)
                return 0;
 
        regulator_enable(tpo_td043->vcc_reg);
+       regulator_enable(tpo_td043->vdd_reg);
 
        /* wait for regulator to stabilize */
        msleep(160);
@@ -315,6 +321,7 @@ static void tpo_td043_power_off(struct tpo_td043_device *tpo_td043)
 
        tpo_td043_write(tpo_td043->spi, 3, TPO_R03_VAL_STANDBY);
 
+       regulator_disable(tpo_td043->vdd_reg);
        regulator_disable(tpo_td043->vcc_reg);
 
        tpo_td043->powered_on = 0;
@@ -435,6 +442,13 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev)
                goto fail_regulator;
        }
 
+       tpo_td043->vdd_reg = regulator_get(&dssdev->dev, "vdd");
+       if (IS_ERR(tpo_td043->vdd_reg)) {
+               dev_err(&dssdev->dev, "failed to get LCD VDD regulator\n");
+               ret = PTR_ERR(tpo_td043->vdd_reg);
+               goto fail_vdd_regulator;
+       }
+
        if (gpio_is_valid(nreset_gpio)) {
                ret = gpio_request(nreset_gpio, "lcd reset");
                if (ret < 0) {
@@ -458,6 +472,8 @@ static int tpo_td043_probe(struct omap_dss_device *dssdev)
 fail_gpio_direction:
        gpio_free(nreset_gpio);
 fail_gpio_req:
+       regulator_put(tpo_td043->vdd_reg);
+fail_vdd_regulator:
        regulator_put(tpo_td043->vcc_reg);
 fail_regulator:
        kfree(tpo_td043);
@@ -472,6 +488,7 @@ static void tpo_td043_remove(struct omap_dss_device *dssdev)
        dev_dbg(&dssdev->dev, "remove\n");
 
        sysfs_remove_group(&dssdev->dev.kobj, &tpo_td043_attr_group);
+       regulator_put(tpo_td043->vdd_reg);
        regulator_put(tpo_td043->vcc_reg);
        if (gpio_is_valid(nreset_gpio))
                gpio_free(nreset_gpio);