Commit 84ebcdfc authored by Mis012's avatar Mis012

DISPLAY WORKSgit add . (FIXME: cleanup)

parent e9111d47
......@@ -278,10 +278,7 @@
compatible = "samsung,s6e88a0-ams452ef01";
//vddp-supply = </*??*/>;
iovcc-supply = <&pm8916_l6>;
enable-gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
extra-power-gpios = <&msmgpio 9 GPIO_ACTIVE_HIGH>;
reset-gpios = <&msmgpio 25 GPIO_ACTIVE_HIGH>;
port {
......
......@@ -38,9 +38,8 @@ struct s6e88a0_panel {
struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)];
struct gpio_desc *enable_gpio;
struct gpio_desc *extra_power_gpio;
struct gpio_desc *reset_gpio;
struct gpio_desc *dcdc_en_gpio;
struct backlight_device *backlight;
bool prepared;
......@@ -57,11 +56,9 @@ static inline struct s6e88a0_panel *to_s6e88a0_panel(struct drm_panel *panel)
static int s6e88a0_panel_init(struct s6e88a0_panel *s6e88a0)
{
struct mipi_dsi_device *dsi = s6e88a0->dsi;
struct device *dev = &s6e88a0->dsi->dev;
int ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
ret = mipi_dsi_dcs_soft_reset(dsi);
if (ret < 0)
return ret;
......@@ -77,33 +74,26 @@ static int s6e88a0_panel_on(struct s6e88a0_panel *s6e88a0)
struct device *dev = &s6e88a0->dsi->dev;
int ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
msleep(5);
ret = mipi_dsi_dcs_write(dsi, 0xf0, (u8[]){ 0x5a, 0x5a }, 2);
if (ret < 0) {
dev_err(dev, "failed on dsc command `f0 5a 5a` ('tesk key on') : %d\n", ret);
return ret;
}
printk("`f0 5a 5a` ('tesk key on')\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_write(dsi, 0xcc, (u8[]){ 0x4c }, 1);
if (ret < 0) {
dev_err(dev, "failed on dsc command `0xcc 0x4c` (whatever it is) : %d\n", ret);
return ret;
}
printk("`0xcc 0x4c` (whatever it is)\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_EXIT_SLEEP_MODE, (u8[]){ 0x00 }, 1);
//ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
if (ret < 0) {
dev_err(dev, "failed exiting sleep mode : %d\n", ret);
dev_err(dev, "failed to exit sleep mode : %d\n", ret);
return ret;
}
printk("exiting sleep mode\n");
msleep(120);
......@@ -116,68 +106,52 @@ static int s6e88a0_panel_on(struct s6e88a0_panel *s6e88a0)
dev_err(dev, "failed on setting 'brightness (and) gama' : %d\n", ret);
return ret;
}
msleep(10); //FIXME needed or not?
printk("setting 'brightness (and) gama'\n");
ret = mipi_dsi_dcs_write(dsi, 0xb2, (u8[]){ 0x40, 0x0a, 0x17, 0x00, 0x0a }, 5);
if (ret < 0) {
dev_err(dev, "failed on dsc command `b2 40 0a 17 00 0a` ('aid set') : %d\n", ret);
return ret;
}
msleep(10); //FIXME needed or not?
printk("`b2 40 0a 17 00 0a` ('aid set')'\n");
ret = mipi_dsi_dcs_write(dsi, 0xb6, (u8[]){ 0x2c, 0x0b }, 2);
if (ret < 0) {
dev_err(dev, "failed on dsc command `b6 2c 0b` ('elvss') : %d\n", ret);
return ret;
}
printk("`b6 2c 0b` ('elvss')\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_POWER_SAVE, (u8[]){ 0x00 }, 1);
if (ret < 0) {
dev_err(dev, "failed on MIPI_DCS_WRITE_POWER_SAVE command : %d\n", ret);
return ret;
}
printk("MIPI_DCS_WRITE_POWER_SAVE\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_write(dsi, 0xf7, (u8[]){ 0x03 }, 1);
if (ret < 0) {
dev_err(dev, "failed on dsc command `f7 03` ('gamma update') : %d\n", ret);
return ret;
}
printk("`f7 03` ('gamma update')\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_write(dsi, 0xf0, (u8[]){ 0xa5, 0xa5 }, 2);
if (ret < 0) {
dev_err(dev, "failed on dsc command `f0 a5 a5` ('tesk key off') : %d\n", ret);
return ret;
}
printk("`f0 a5 a5` ('tesk key off')\n");
msleep(10); //FIXME needed or not?
ret = mipi_dsi_dcs_set_display_on(dsi);
if (ret < 0) {
dev_err(dev, "failed to set display on: %d\n", ret);
return ret;
}
printk("set display on\n");
msleep(40); //just in case FIXME
return 0;
}
static void s6e88a0_panel_off(struct s6e88a0_panel *s6e88a0) //CORRECT [FIXME - remove this comment]
static void s6e88a0_panel_off(struct s6e88a0_panel *s6e88a0)
{
struct mipi_dsi_device *dsi = s6e88a0->dsi;
struct device *dev = &s6e88a0->dsi->dev; //-Wunused-variable FIXME
int ret;
struct device *dev = &s6e88a0->dsi->dev;
dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
int ret;
ret = mipi_dsi_dcs_set_display_off(dsi);
if (ret < 0)
......@@ -219,11 +193,9 @@ static int s6e88a0_panel_unprepare(struct drm_panel *panel)
if (ret < 0)
dev_err(dev, "regulator disable failed, %d\n", ret);
gpiod_set_value(s6e88a0->enable_gpio, 0);
gpiod_set_value(s6e88a0->extra_power_gpio, 0);
gpiod_set_value(s6e88a0->reset_gpio, 1);
//gpiod_set_value(s6e88a0->dcdc_en_gpio, 0);
gpiod_set_value(s6e88a0->reset_gpio, 0);
s6e88a0->prepared = false;
......@@ -238,6 +210,10 @@ static int s6e88a0_panel_prepare(struct drm_panel *panel)
if (s6e88a0->prepared)
return 0;
gpiod_set_value(s6e88a0->extra_power_gpio, 0); //just a try, maybe it was already on and needs a power cycle?
gpiod_set_value(s6e88a0->reset_gpio, 0); // -||-
ret = regulator_bulk_enable(ARRAY_SIZE(s6e88a0->supplies), s6e88a0->supplies);
if (ret < 0) {
......@@ -247,13 +223,17 @@ static int s6e88a0_panel_prepare(struct drm_panel *panel)
msleep(20);
//gpiod_set_value(s6e88a0->dcdc_en_gpio, 1);
//usleep_range(10, 20);
gpiod_set_value(s6e88a0->reset_gpio, 1);
msleep(5);
gpiod_set_value(s6e88a0->reset_gpio, 0);
usleep_range(10, 20);
msleep(1);
gpiod_set_value(s6e88a0->reset_gpio, 1);
msleep(10);
msleep(100);
gpiod_set_value(s6e88a0->enable_gpio, 1);
gpiod_set_value(s6e88a0->extra_power_gpio, 1);
usleep_range(10, 20);
ret = s6e88a0_panel_init(s6e88a0);
......@@ -277,11 +257,9 @@ static int s6e88a0_panel_prepare(struct drm_panel *panel)
if (ret < 0)
dev_err(dev, "regulator disable failed, %d\n", ret);
gpiod_set_value(s6e88a0->enable_gpio, 0);
gpiod_set_value(s6e88a0->extra_power_gpio, 0);
gpiod_set_value(s6e88a0->reset_gpio, 1);
//gpiod_set_value(s6e88a0->dcdc_en_gpio, 0);
gpiod_set_value(s6e88a0->reset_gpio, 0);
return ret;
}
......@@ -300,7 +278,7 @@ static int s6e88a0_panel_enable(struct drm_panel *panel)
return 0;
}
static const struct drm_display_mode default_mode = { //CHANGED [FIXME - remove this comment]
static const struct drm_display_mode default_mode = {
.clock = 38494,
.hdisplay = 540,
.hsync_start = 540 + 88,
......@@ -332,14 +310,14 @@ static int s6e88a0_panel_get_modes(struct drm_panel *panel)
drm_mode_probed_add(panel->connector, mode);
panel->connector->display_info.width_mm = 56; //CHANGED [FIXME - remove this comment]
panel->connector->display_info.height_mm = 100; //CHANGED [FIXME - remove this comment]
panel->connector->display_info.width_mm = 56;
panel->connector->display_info.height_mm = 100;
return 1;
}
static int dsi_dcs_bl_get_brightness(struct backlight_device *bl)
{/*
static int dsi_dcs_bl_get_brightness(struct backlight_device *bl) //probably needs custom stuff (steal from s6e8aa0)
{
struct mipi_dsi_device *dsi = bl_get_data(bl);
int ret;
u16 brightness = bl->props.brightness;
......@@ -352,13 +330,13 @@ static int dsi_dcs_bl_get_brightness(struct backlight_device *bl)
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
return brightness & 0xff;*/
return brightness & 0xff;
return 0;
}
static int dsi_dcs_bl_update_status(struct backlight_device *bl)
{/*
static int dsi_dcs_bl_update_status(struct backlight_device *bl) //probably needs custom stuff (steal from s6e8aa0)
{
struct mipi_dsi_device *dsi = bl_get_data(bl);
int ret;
......@@ -369,7 +347,7 @@ static int dsi_dcs_bl_update_status(struct backlight_device *bl)
return ret;
dsi->mode_flags |= MIPI_DSI_MODE_LPM;
*/
return 0;
}
......@@ -425,10 +403,10 @@ static int s6e88a0_panel_add(struct s6e88a0_panel *s6e88a0)
return ret;
}
s6e88a0->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(s6e88a0->enable_gpio)) {
ret = PTR_ERR(s6e88a0->enable_gpio);
dev_err(dev, "cannot get enable-gpio %d\n", ret);
s6e88a0->extra_power_gpio = devm_gpiod_get(dev, "extra-power", GPIOD_OUT_HIGH);
if (IS_ERR(s6e88a0->extra_power_gpio)) {
ret = PTR_ERR(s6e88a0->extra_power_gpio);
dev_err(dev, "cannot get extra-power-gpio %d\n", ret);
return ret;
}
......@@ -439,13 +417,6 @@ static int s6e88a0_panel_add(struct s6e88a0_panel *s6e88a0)
return ret;
}
/*s6e88a0->dcdc_en_gpio = devm_gpiod_get(dev, "dcdc-en", GPIOD_OUT_LOW);
if (IS_ERR(s6e88a0->dcdc_en_gpio)) {
ret = PTR_ERR(s6e88a0->dcdc_en_gpio);
dev_err(dev, "cannot get dcdc-en-gpio %d\n", ret);
return ret;
}*/
s6e88a0->backlight = drm_panel_create_dsi_backlight(s6e88a0->dsi);
if (IS_ERR(s6e88a0->backlight)) {
ret = PTR_ERR(s6e88a0->backlight);
......@@ -473,9 +444,9 @@ static int s6e88a0_panel_probe(struct mipi_dsi_device *dsi)
struct s6e88a0_panel *s6e88a0;
int ret;
dsi->lanes = 2; //CHANGED [FIXME - remove this comment]
dsi->format = MIPI_DSI_FMT_RGB888; //CORRECT [FIXME - remove this comment]
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS; //CHANGED [FIXME - remove this comment]
dsi->lanes = 2;
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO/* | MIPI_DSI_CLOCK_NON_CONTINUOUS*/;
s6e88a0 = devm_kzalloc(&dsi->dev, sizeof(*s6e88a0), GFP_KERNEL);
if (!s6e88a0)
......@@ -529,7 +500,6 @@ static struct mipi_dsi_driver s6e88a0_panel_driver = {
};
module_mipi_dsi_driver(s6e88a0_panel_driver);
MODULE_AUTHOR("Sumit Semwal <[email protected]>"); //FIXME
MODULE_AUTHOR("Vinay Simha BN <[email protected]>"); //FIXME
MODULE_DESCRIPTION("s6e88a0 ams452ef01 QHD"); //FIXME qHD vs QHD?
MODULE_AUTHOR("Michael Srba <[email protected]>");
MODULE_DESCRIPTION("s6e88a0 ams452ef01 qHD");
MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment