return 1;
}
+static int max17135_v3p3_enable(struct regulator_dev *reg)
+{
+ struct max17135 *max17135 = rdev_get_drvdata(reg);
+
+ gpio_set_value(max17135->gpio_pmic_v3p3, 1);
+ return 0;
+}
+
+static int max17135_v3p3_disable(struct regulator_dev *reg)
+{
+ struct max17135 *max17135 = rdev_get_drvdata(reg);
+
+ gpio_set_value(max17135->gpio_pmic_v3p3, 0);
+ return 0;
+}
+
+static int max17135_v3p3_is_enabled(struct regulator_dev *reg)
+{
+ struct max17135 *max17135 = rdev_get_drvdata(reg);
+ int gpio = gpio_get_value(max17135->gpio_pmic_v3p3);
+
+ if (gpio == 0)
+ return 0;
+ else
+ return 1;
+}
+
/*
* Regulator operations
*/
static struct regulator_ops max17135_vpos_ops = {
};
+static struct regulator_ops max17135_v3p3_ops = {
+ .enable = max17135_v3p3_enable,
+ .disable = max17135_v3p3_disable,
+ .is_enabled = max17135_v3p3_is_enabled,
+};
+
+
/*
* Regulator descriptors
*/
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
},
+{
+ .name = "V3P3",
+ .id = MAX17135_V3P3,
+ .ops = &max17135_v3p3_ops,
+ .type = REGULATOR_VOLTAGE,
+ .owner = THIS_MODULE,
+},
};
static void max17135_setup_timings(struct max17135 *max17135)
struct clk *epdc_clk_pix;
struct regulator *display_regulator;
struct regulator *vcom_regulator;
+ struct regulator *v3p3_regulator;
bool fw_default_load;
/* FB elements related to EPDC updates */
fb_data->updates_active = true;
+ /* Enable the v3p3 regulator */
+ ret = regulator_enable(fb_data->v3p3_regulator);
+ if (IS_ERR((void *)ret)) {
+ dev_err(fb_data->dev, "Unable to enable V3P3 regulator."
+ "err = 0x%x\n", ret);
+ mutex_unlock(&fb_data->power_mutex);
+ return;
+ }
+
+ msleep(1);
+
/* Enable pins used by EPDC */
if (fb_data->pdata->enable_pins)
fb_data->pdata->enable_pins();
if (fb_data->pdata->disable_pins)
fb_data->pdata->disable_pins();
+ /* turn off the V3p3 */
+ regulator_disable(fb_data->v3p3_regulator);
+
fb_data->power_state = POWER_STATE_OFF;
fb_data->powering_down = false;
ret = -ENODEV;
goto out_irq;
}
+ fb_data->v3p3_regulator = regulator_get(NULL, "V3P3");
+ if (IS_ERR(fb_data->v3p3_regulator)) {
+ regulator_put(fb_data->vcom_regulator);
+ regulator_put(fb_data->display_regulator);
+ dev_err(&pdev->dev, "Unable to get V3P3 regulator."
+ "err = 0x%x\n", (int)fb_data->vcom_regulator);
+ ret = -ENODEV;
+ goto out_irq;
+ }
if (device_create_file(info->dev, &fb_attrs[0]))
dev_err(&pdev->dev, "Unable to create file from fb_attrs\n");
regulator_put(fb_data->display_regulator);
regulator_put(fb_data->vcom_regulator);
+ regulator_put(fb_data->v3p3_regulator);
unregister_framebuffer(&fb_data->info);
free_irq(fb_data->epdc_irq, fb_data);