mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
fbdev/ssd1307fb: add support to enable VBAT
SSD1306 needs VBAT when it is wired in charge pump configuration. This patch adds support to the driver to enable VBAT regulator at init time. Cc: Rob Herring <[email protected]> Cc: Maxime Ripard <[email protected]> Cc: Benoît Cousson <[email protected]> Signed-off-by: Tomi Valkeinen <[email protected]> Reviewed-by: Roger Quadros <[email protected]> Signed-off-by: Jyri Sarha <[email protected]> Signed-off-by: Bartlomiej Zolnierkiewicz <[email protected]>
This commit is contained in:
parent
fdde1a8148
commit
ba14301e03
2 changed files with 20 additions and 1 deletions
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/of_gpio.h>
|
||||
#include <linux/pwm.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#define SSD1307FB_DATA 0x40
|
||||
#define SSD1307FB_COMMAND 0x80
|
||||
|
|
@ -74,6 +75,7 @@ struct ssd1307fb_par {
|
|||
struct pwm_device *pwm;
|
||||
u32 pwm_period;
|
||||
struct gpio_desc *reset;
|
||||
struct regulator *vbat_reg;
|
||||
u32 seg_remap;
|
||||
u32 vcomh;
|
||||
u32 width;
|
||||
|
|
@ -574,6 +576,14 @@ static int ssd1307fb_probe(struct i2c_client *client,
|
|||
goto fb_alloc_error;
|
||||
}
|
||||
|
||||
par->vbat_reg = devm_regulator_get_optional(&client->dev, "vbat");
|
||||
if (IS_ERR(par->vbat_reg)) {
|
||||
dev_err(&client->dev, "failed to get VBAT regulator: %ld\n",
|
||||
PTR_ERR(par->vbat_reg));
|
||||
ret = PTR_ERR(par->vbat_reg);
|
||||
goto fb_alloc_error;
|
||||
}
|
||||
|
||||
if (of_property_read_u32(node, "solomon,width", &par->width))
|
||||
par->width = 96;
|
||||
|
||||
|
|
@ -658,9 +668,15 @@ static int ssd1307fb_probe(struct i2c_client *client,
|
|||
udelay(4);
|
||||
}
|
||||
|
||||
ret = regulator_enable(par->vbat_reg);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "failed to enable VBAT: %d\n", ret);
|
||||
goto reset_oled_error;
|
||||
}
|
||||
|
||||
ret = ssd1307fb_init(par);
|
||||
if (ret)
|
||||
goto reset_oled_error;
|
||||
goto regulator_enable_error;
|
||||
|
||||
ret = register_framebuffer(info);
|
||||
if (ret) {
|
||||
|
|
@ -693,6 +709,8 @@ panel_init_error:
|
|||
pwm_disable(par->pwm);
|
||||
pwm_put(par->pwm);
|
||||
};
|
||||
regulator_enable_error:
|
||||
regulator_disable(par->vbat_reg);
|
||||
reset_oled_error:
|
||||
fb_deferred_io_cleanup(info);
|
||||
fb_alloc_error:
|
||||
|
|
|
|||
Loading…
Reference in a new issue