Re: [PATCH 2/3] drm/panel: Add support for s6e63j0x03 panel driver
Hi Andrzej, Thanks for your review. On 06/12/2017 10:16 PM, Andrzej Hajda wrote: Hi Hoegeun, Nice to see patches completing support for mainlined platforms. On 09.06.2017 06:59, Hoegeun Kwon wrote: This patch adds MIPI-DSI based S6E63J0X03 AMOLED LCD panel driver which uses mipi_dsi bus to communicate with panel. The panel has 320×320 resolution in 1.63" physical panel. This panel is used in Samsung Galaxy Gear 2. Signed-off-by: Inki DaeSigned-off-by: Hyungwon Hwang Signed-off-by: Hoegeun Kwon --- drivers/gpu/drm/panel/Kconfig| 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c | 491 +++ 3 files changed, 499 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c ... + +static int s6e63j0x03_enable(struct drm_panel *panel) +{ + struct s6e63j0x03 *ctx = panel_to_s6e63j0x03(panel); + struct backlight_device *bl_dev = ctx->bl_dev; + u8 seq[] = { MIPI_DCS_SET_DISPLAY_ON }; + int ret; + + ret = s6e63j0x03_dcs_write_seq(ctx, seq, ARRAY_SIZE(seq)); + if (ret > 0) + bl_dev->props.power = FB_BLANK_UNBLANK; + + return 0; +} For many (maybe most) panels power on sequence is as follows: 0. Enable power supplies and gpios. 1. Initialization, including MIPI_DCS_EXIT_SLEEP_MODE 2. Wait for 120ms, to avoid display glitches. 3. Unblanking and adjusting display, including MIPI_DCS_SET_DISPLAY_ON. And power-off: 4. MIPI_DCS_SET_DISPLAY_OFF 5. MIPI_DCS_ENTER_SLEEP_MODE 6. Wait for 120ms 7. Disable power supplies and gpios. I suppose waiting for 120ms is a good indicator what should be put into prepare/enable/disable/unprepare phase. In my opinion it should be as follows: Prepare: 0, 1 Enable: 2, 3 Disable: 4,5,6 Unprepare: 7 What do you think about it? Could you arrange the code this way and test if it works correctly? Maybe you/other developers have some opinions about it? I agree with you. I will send ver2 patch with the above style. And modify it to use as mipi_dsi_dcs_*. + +static const struct drm_display_mode default_mode = { + .clock = 4644, + .hdisplay = 320, + .hsync_start = 320 + 1, + .hsync_end = 320 + 1 + 1, + .htotal = 320 + 1 + 1 + 1, + .vdisplay = 320, + .vsync_start = 320 + 150, + .vsync_end = 320 + 150 + 1, + .vtotal = 320 + 150 + 1 + 2, + .vrefresh = 30, + .flags = 0, +}; clock should be equal vtotal*htotal*vrefresh, it is little higher? what is the reason? What is actual refresh rate? The actual refresh rate is 30.43Hz So I will modfiy the clock Hz to 4649. ((323 * 473 )* 30.43) / 1000 = 4649 Best regards, Hoegeun ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/panel: Add support for s6e63j0x03 panel driver
Hi Hoegeun, Nice to see patches completing support for mainlined platforms. On 09.06.2017 06:59, Hoegeun Kwon wrote: > This patch adds MIPI-DSI based S6E63J0X03 AMOLED LCD panel driver > which uses mipi_dsi bus to communicate with panel. The panel has > 320×320 resolution in 1.63" physical panel. This panel is used in > Samsung Galaxy Gear 2. > > Signed-off-by: Inki Dae> Signed-off-by: Hyungwon Hwang > Signed-off-by: Hoegeun Kwon > --- > drivers/gpu/drm/panel/Kconfig| 7 + > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c | 491 > +++ > 3 files changed, 499 insertions(+) > create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 3e29a99..e47e56d 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -68,6 +68,13 @@ config DRM_PANEL_SAMSUNG_S6E3HA2 > depends on DRM_MIPI_DSI > select VIDEOMODE_HELPERS > > +config DRM_PANEL_SAMSUNG_S6E63J0X03 > + tristate "Samsung S6E63J0X03 DSI video mode panel" I suspect it is command mode panel, isn't? > + depends on OF > + depends on DRM_MIPI_DSI > + depends on BACKLIGHT_CLASS_DEVICE > + select VIDEOMODE_HELPERS > + > config DRM_PANEL_SAMSUNG_S6E8AA0 > tristate "Samsung S6E8AA0 DSI video mode panel" > depends on OF > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 292b3c7..f028269 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o > obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += > panel-panasonic-vvx10f034n00.o > obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o > +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o > obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o > obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o > obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o > diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c > b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c > new file mode 100644 > index 000..bf70a20 > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c > @@ -0,0 +1,491 @@ > +/* > + * MIPI-DSI based S6E63J0X03 AMOLED lcd 1.63 inch panel driver. > + * > + * Copyright (c) 2014 Samsung Electronics Co., Ltd Maybe range 2014-2017 would be better. > + * > + * Inki Dae, > + * Hoegeun Kwon, No comma after name. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include > +#include > +#include > +#include > +#include Probably linux/gpio/consumer.h should be used here. > +#include > +#include > + > +#define MCS_LEVEL2_KEY 0xf0 > +#define MCS_MTP_KEY 0xf1 > +#define MCS_MTP_SET3 0xd4 > + > +#define MIN_BRIGHTNESS 0 > +#define MAX_BRIGHTNESS 100 > +#define DEFAULT_BRIGHTNESS 80 > + > +#define NUM_GAMMA_STEPS 9 > +#define GAMMA_CMD_CNT28 > + > +struct s6e63j0x03 { > + struct device *dev; > + struct drm_panel panel; > + struct backlight_device *bl_dev; > + > + struct regulator_bulk_data supplies[2]; > + struct gpio_desc *reset_gpio; > +}; > + > +static const unsigned char gamma_tbl[NUM_GAMMA_STEPS][GAMMA_CMD_CNT] = { > + { /* Gamma 10 */ > + MCS_MTP_SET3, > + 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x52, 0x6b, 0x6f, 0x26, > + 0x28, 0x2d, 0x28, 0x26, 0x27, 0x33, 0x34, 0x32, 0x36, 0x36, > + 0x35, 0x00, 0xab, 0x00, 0xae, 0x00, 0xbf > + }, > + { /* gamma 30 */ > + MCS_MTP_SET3, > + 0x00, 0x00, 0x00, 0x70, 0x7f, 0x7f, 0x4e, 0x64, 0x69, 0x26, > + 0x27, 0x2a, 0x28, 0x29, 0x27, 0x31, 0x32, 0x31, 0x35, 0x34, > + 0x35, 0x00, 0xc4, 0x00, 0xca, 0x00, 0xdc > + }, > + { /* gamma 60 */ > + MCS_MTP_SET3, > + 0x00, 0x00, 0x00, 0x65, 0x7b, 0x7d, 0x5f, 0x67, 0x68, 0x2a, > + 0x28, 0x29, 0x28, 0x2a, 0x27, 0x31, 0x2f, 0x30, 0x34, 0x33, > + 0x34, 0x00, 0xd9, 0x00, 0xe4, 0x00, 0xf5 > + }, > + { /* gamma 90 */ > + MCS_MTP_SET3, > + 0x00, 0x00, 0x00, 0x4d, 0x6f, 0x71, 0x67, 0x6a, 0x6c, 0x29, > + 0x28, 0x28, 0x28, 0x29, 0x27, 0x30, 0x2e, 0x30, 0x32, 0x31, > + 0x31, 0x00, 0xea, 0x00, 0xf6, 0x01, 0x09 > + }, > + {
[PATCH 2/3] drm/panel: Add support for s6e63j0x03 panel driver
This patch adds MIPI-DSI based S6E63J0X03 AMOLED LCD panel driver which uses mipi_dsi bus to communicate with panel. The panel has 320×320 resolution in 1.63" physical panel. This panel is used in Samsung Galaxy Gear 2. Signed-off-by: Inki DaeSigned-off-by: Hyungwon Hwang Signed-off-by: Hoegeun Kwon --- drivers/gpu/drm/panel/Kconfig| 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c | 491 +++ 3 files changed, 499 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 3e29a99..e47e56d 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -68,6 +68,13 @@ config DRM_PANEL_SAMSUNG_S6E3HA2 depends on DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_SAMSUNG_S6E63J0X03 + tristate "Samsung S6E63J0X03 DSI video mode panel" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + config DRM_PANEL_SAMSUNG_S6E8AA0 tristate "Samsung S6E8AA0 DSI video mode panel" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 292b3c7..f028269 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -5,6 +5,7 @@ obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o obj-$(CONFIG_DRM_PANEL_PANASONIC_VVX10F034N00) += panel-panasonic-vvx10f034n00.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E3HA2) += panel-samsung-s6e3ha2.o +obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E63J0X03) += panel-samsung-s6e63j0x03.o obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c new file mode 100644 index 000..bf70a20 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c @@ -0,0 +1,491 @@ +/* + * MIPI-DSI based S6E63J0X03 AMOLED lcd 1.63 inch panel driver. + * + * Copyright (c) 2014 Samsung Electronics Co., Ltd + * + * Inki Dae, + * Hoegeun Kwon, + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define MCS_LEVEL2_KEY 0xf0 +#define MCS_MTP_KEY0xf1 +#define MCS_MTP_SET3 0xd4 + +#define MIN_BRIGHTNESS 0 +#define MAX_BRIGHTNESS 100 +#define DEFAULT_BRIGHTNESS 80 + +#define NUM_GAMMA_STEPS9 +#define GAMMA_CMD_CNT 28 + +struct s6e63j0x03 { + struct device *dev; + struct drm_panel panel; + struct backlight_device *bl_dev; + + struct regulator_bulk_data supplies[2]; + struct gpio_desc *reset_gpio; +}; + +static const unsigned char gamma_tbl[NUM_GAMMA_STEPS][GAMMA_CMD_CNT] = { + { /* Gamma 10 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x52, 0x6b, 0x6f, 0x26, + 0x28, 0x2d, 0x28, 0x26, 0x27, 0x33, 0x34, 0x32, 0x36, 0x36, + 0x35, 0x00, 0xab, 0x00, 0xae, 0x00, 0xbf + }, + { /* gamma 30 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x70, 0x7f, 0x7f, 0x4e, 0x64, 0x69, 0x26, + 0x27, 0x2a, 0x28, 0x29, 0x27, 0x31, 0x32, 0x31, 0x35, 0x34, + 0x35, 0x00, 0xc4, 0x00, 0xca, 0x00, 0xdc + }, + { /* gamma 60 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x65, 0x7b, 0x7d, 0x5f, 0x67, 0x68, 0x2a, + 0x28, 0x29, 0x28, 0x2a, 0x27, 0x31, 0x2f, 0x30, 0x34, 0x33, + 0x34, 0x00, 0xd9, 0x00, 0xe4, 0x00, 0xf5 + }, + { /* gamma 90 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x4d, 0x6f, 0x71, 0x67, 0x6a, 0x6c, 0x29, + 0x28, 0x28, 0x28, 0x29, 0x27, 0x30, 0x2e, 0x30, 0x32, 0x31, + 0x31, 0x00, 0xea, 0x00, 0xf6, 0x01, 0x09 + }, + { /* gamma 120 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x3d, 0x66, 0x68, 0x69, 0x69, 0x69, 0x28, + 0x28, 0x27, 0x28, 0x28, 0x27, 0x30, 0x2e, 0x2f, 0x31, 0x31, + 0x30, 0x00, 0xf9, 0x01, 0x05, 0x01, 0x1b + }, + { /* gamma 150 */ + MCS_MTP_SET3, + 0x00, 0x00, 0x00, 0x31, 0x51, 0x53, 0x66, 0x66, 0x67, 0x28, + 0x29, 0x27, 0x28, 0x27, 0x27, 0x2e,