Re: [PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver
Hi Thierry Thanks for the comments. I will fix these in v9. Thanks Abhinav On 2018-09-27 05:20, Thierry Reding wrote: On Thu, Sep 20, 2018 at 03:52:36PM -0700, Abhinav Kumar wrote: From: "abhin...@codeaurora.org" Add support for Truly NT35597 panel driver used in MSM reference platforms. This panel driver supports both single DSI and dual DSI modes. However, this patch series adds support only for dual DSI mode. Your lines are very short here. It's usually a good idea to keep the subject line short, but there's no need to wrap this early in the rest of the commit message. It's customary to use up to 72 characters. Changes in v8: - Remove video mode config and headers - Remove unused macros - Try to avoid multi-lines wherever possible - Fix comments locations and make it concise - Fix return points in probe function Signed-off-by: Archit Taneja Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 3 files changed, 684 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 6020c30..073ffa0 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V Say Y here if you want to enable support for the Sitronix ST7789V controller for 240x320 LCD panels +config DRM_PANEL_TRULY_NT35597_WQXGA + tristate "Truly WQXGA" + depends on OF + depends on DRM_MIPI_DSI + help + Say Y here if you want to enable support for Truly NT35597 WQXGA Dual DSI + Video Mode panel endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 5ccaaa9..80fd19f 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c new file mode 100644 index 000..c9e09e2 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c @@ -0,0 +1,676 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include The headers should be sorted alphabetically. + +static const char * const regulator_names[] = { + "vdda", + "vdispp", + "vdispn", +}; + +static unsigned long const regulator_enable_loads[] = { + 62000, + 10, + 10, +}; + +static unsigned long const regulator_disable_loads[] = { + 80, + 100, + 100, +}; + +struct nt35597_config { + u32 width_mm; + u32 height_mm; + const char *panel_name; + const void *panel_on_cmds; Why void *? You define the correct data structure a few lines further down, so you might as well just move that definition up and use the proper data structure here. Then there'd be no need to cast this to struct cmd_set * later on when you use it. + u32 num_on_cmds; + const struct drm_display_mode *dm; +}; + +struct truly_nt35597 { + struct device *dev; + struct drm_panel panel; + + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; + + struct gpio_desc *reset_gpio; + struct gpio_desc *mode_gpio; + + struct backlight_device *backlight; + + struct mipi_dsi_device *dsi[2]; + + const struct nt35597_config *config; + bool prepared; + bool enabled; +}; + +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) +{ + return container_of(panel, struct truly_nt35597, panel); +} + +struct cmd_set { + u8 commands[4]; + u8 size; +}; + +static struct cmd_set qcom_2k_panel_magic_cmds[] = { static const? + /* CMD2_P0 */ + { { 0xff, 0x20 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0x00, 0x01 }, 2 }, + { { 0x01, 0x55 }, 2 }, + { { 0x02, 0x45 }, 2 }, + { { 0x05, 0x40 }, 2 }, + { { 0x06, 0x19 }, 2 }, + { { 0x07, 0x1e }, 2 }, + { { 0x0b, 0x73 }, 2 }, + { { 0x0c, 0x73 }, 2 }, + { { 0x0e, 0xb0 }, 2 }, + { { 0x0f, 0xae }, 2 }, + { { 0x11, 0xb8 }, 2 }, + { { 0x13, 0x00 }, 2 }, + { { 0x58, 0x80 }, 2 }, + { { 0x59, 0x01 }, 2 }, + { { 0x5a, 0x00 }, 2 }, + { { 0x5b, 0x01 }, 2 }, + { { 0x5c, 0x80 }, 2 }, + { { 0x5d, 0x81 }, 2 }, +
Re: [PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver
On Thu, Sep 20, 2018 at 03:52:36PM -0700, Abhinav Kumar wrote: > From: "abhin...@codeaurora.org" > > Add support for Truly NT35597 panel driver used > in MSM reference platforms. > > This panel driver supports both single DSI and dual DSI > modes. > > However, this patch series adds support only for > dual DSI mode. Your lines are very short here. It's usually a good idea to keep the subject line short, but there's no need to wrap this early in the rest of the commit message. It's customary to use up to 72 characters. > > Changes in v8: > - Remove video mode config and headers > - Remove unused macros > - Try to avoid multi-lines wherever possible > - Fix comments locations and make it concise > - Fix return points in probe function > > Signed-off-by: Archit Taneja > Signed-off-by: Abhinav Kumar > --- > drivers/gpu/drm/panel/Kconfig | 7 + > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 > > 3 files changed, 684 insertions(+) > create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 6020c30..073ffa0 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V > Say Y here if you want to enable support for the Sitronix > ST7789V controller for 240x320 LCD panels > > +config DRM_PANEL_TRULY_NT35597_WQXGA > + tristate "Truly WQXGA" > + depends on OF > + depends on DRM_MIPI_DSI > + help > + Say Y here if you want to enable support for Truly NT35597 WQXGA Dual > DSI > + Video Mode panel > endmenu > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 5ccaaa9..80fd19f 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += > panel-seiko-43wvf1g.o > obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o > obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o > obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o > +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o > diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c > b/drivers/gpu/drm/panel/panel-truly-nt35597.c > new file mode 100644 > index 000..c9e09e2 > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c > @@ -0,0 +1,676 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2018, The Linux Foundation. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include The headers should be sorted alphabetically. > + > +static const char * const regulator_names[] = { > + "vdda", > + "vdispp", > + "vdispn", > +}; > + > +static unsigned long const regulator_enable_loads[] = { > + 62000, > + 10, > + 10, > +}; > + > +static unsigned long const regulator_disable_loads[] = { > + 80, > + 100, > + 100, > +}; > + > +struct nt35597_config { > + u32 width_mm; > + u32 height_mm; > + const char *panel_name; > + const void *panel_on_cmds; Why void *? You define the correct data structure a few lines further down, so you might as well just move that definition up and use the proper data structure here. Then there'd be no need to cast this to struct cmd_set * later on when you use it. > + u32 num_on_cmds; > + const struct drm_display_mode *dm; > +}; > + > +struct truly_nt35597 { > + struct device *dev; > + struct drm_panel panel; > + > + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; > + > + struct gpio_desc *reset_gpio; > + struct gpio_desc *mode_gpio; > + > + struct backlight_device *backlight; > + > + struct mipi_dsi_device *dsi[2]; > + > + const struct nt35597_config *config; > + bool prepared; > + bool enabled; > +}; > + > +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) > +{ > + return container_of(panel, struct truly_nt35597, panel); > +} > + > +struct cmd_set { > + u8 commands[4]; > + u8 size; > +}; > + > +static struct cmd_set qcom_2k_panel_magic_cmds[] = { static const? > + /* CMD2_P0 */ > + { { 0xff, 0x20 }, 2 }, > + { { 0xfb, 0x01 }, 2 }, > + { { 0x00, 0x01 }, 2 }, > + { { 0x01, 0x55 }, 2 }, > + { { 0x02, 0x45 }, 2 }, > + { { 0x05, 0x40 }, 2 }, > + { { 0x06, 0x19 }, 2 }, > + { { 0x07, 0x1e }, 2 }, > + { { 0x0b, 0x73 }, 2 }, > + { { 0x0c, 0x73 }, 2 }, > + { { 0x0e, 0xb0 }, 2 }, > + { { 0x0f, 0xae }, 2 }, > + { { 0x11, 0xb8 }, 2 }, > + { { 0x13, 0x00 }, 2 }, > + { { 0x58, 0x80 }, 2 }, > + { { 0x59, 0x01 }, 2 }, > + { { 0x5a, 0x00 }, 2 }, > + { { 0x5b, 0x01 }, 2 }, > + {
Re: [PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver
On Thu, Sep 20, 2018 at 03:52:36PM -0700, Abhinav Kumar wrote: > From: "abhin...@codeaurora.org" > > Add support for Truly NT35597 panel driver used > in MSM reference platforms. > > This panel driver supports both single DSI and dual DSI > modes. > > However, this patch series adds support only for > dual DSI mode. > > Changes in v8: > - Remove video mode config and headers > - Remove unused macros > - Try to avoid multi-lines wherever possible > - Fix comments locations and make it concise > - Fix return points in probe function > > Signed-off-by: Archit Taneja > Signed-off-by: Abhinav Kumar Adding Cc: robh...@kernel.org so Rob sees it in his patchwork queue. Sean > --- > drivers/gpu/drm/panel/Kconfig | 7 + > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 > > 3 files changed, 684 insertions(+) > create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 6020c30..073ffa0 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V > Say Y here if you want to enable support for the Sitronix > ST7789V controller for 240x320 LCD panels > > +config DRM_PANEL_TRULY_NT35597_WQXGA > + tristate "Truly WQXGA" > + depends on OF > + depends on DRM_MIPI_DSI > + help > + Say Y here if you want to enable support for Truly NT35597 WQXGA Dual > DSI > + Video Mode panel > endmenu > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 5ccaaa9..80fd19f 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += > panel-seiko-43wvf1g.o > obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o > obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o > obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o > +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o > diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c > b/drivers/gpu/drm/panel/panel-truly-nt35597.c > new file mode 100644 > index 000..c9e09e2 > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c > @@ -0,0 +1,676 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2018, The Linux Foundation. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > + > +static const char * const regulator_names[] = { > + "vdda", > + "vdispp", > + "vdispn", > +}; > + > +static unsigned long const regulator_enable_loads[] = { > + 62000, > + 10, > + 10, > +}; > + > +static unsigned long const regulator_disable_loads[] = { > + 80, > + 100, > + 100, > +}; > + > +struct nt35597_config { > + u32 width_mm; > + u32 height_mm; > + const char *panel_name; > + const void *panel_on_cmds; > + u32 num_on_cmds; > + const struct drm_display_mode *dm; > +}; > + > +struct truly_nt35597 { > + struct device *dev; > + struct drm_panel panel; > + > + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; > + > + struct gpio_desc *reset_gpio; > + struct gpio_desc *mode_gpio; > + > + struct backlight_device *backlight; > + > + struct mipi_dsi_device *dsi[2]; > + > + const struct nt35597_config *config; > + bool prepared; > + bool enabled; > +}; > + > +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) > +{ > + return container_of(panel, struct truly_nt35597, panel); > +} > + > +struct cmd_set { > + u8 commands[4]; > + u8 size; > +}; > + > +static struct cmd_set qcom_2k_panel_magic_cmds[] = { > + /* CMD2_P0 */ > + { { 0xff, 0x20 }, 2 }, > + { { 0xfb, 0x01 }, 2 }, > + { { 0x00, 0x01 }, 2 }, > + { { 0x01, 0x55 }, 2 }, > + { { 0x02, 0x45 }, 2 }, > + { { 0x05, 0x40 }, 2 }, > + { { 0x06, 0x19 }, 2 }, > + { { 0x07, 0x1e }, 2 }, > + { { 0x0b, 0x73 }, 2 }, > + { { 0x0c, 0x73 }, 2 }, > + { { 0x0e, 0xb0 }, 2 }, > + { { 0x0f, 0xae }, 2 }, > + { { 0x11, 0xb8 }, 2 }, > + { { 0x13, 0x00 }, 2 }, > + { { 0x58, 0x80 }, 2 }, > + { { 0x59, 0x01 }, 2 }, > + { { 0x5a, 0x00 }, 2 }, > + { { 0x5b, 0x01 }, 2 }, > + { { 0x5c, 0x80 }, 2 }, > + { { 0x5d, 0x81 }, 2 }, > + { { 0x5e, 0x00 }, 2 }, > + { { 0x5f, 0x01 }, 2 }, > + { { 0x72, 0x11 }, 2 }, > + { { 0x68, 0x03 }, 2 }, > + /* CMD2_P4 */ > + { { 0xFF, 0x24 }, 2 }, > + { { 0xFB, 0x01 }, 2 }, > + { { 0x00, 0x1C }, 2 }, > + { { 0x01, 0x0B }, 2 }, > + { { 0x02, 0x0C }, 2 }, > + { { 0x03, 0x01 }, 2 }, > + { { 0x04, 0x0F }, 2 }, > + { { 0x05, 0x10 }, 2
Re: [PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver
On Thu, Sep 20, 2018 at 03:52:36PM -0700, Abhinav Kumar wrote: > From: "abhin...@codeaurora.org" > > Add support for Truly NT35597 panel driver used > in MSM reference platforms. > > This panel driver supports both single DSI and dual DSI > modes. > > However, this patch series adds support only for > dual DSI mode. > > Changes in v8: > - Remove video mode config and headers > - Remove unused macros > - Try to avoid multi-lines wherever possible > - Fix comments locations and make it concise > - Fix return points in probe function Thanks for revising! Reviewed-by: Sean Paul > > Signed-off-by: Archit Taneja > Signed-off-by: Abhinav Kumar > --- > drivers/gpu/drm/panel/Kconfig | 7 + > drivers/gpu/drm/panel/Makefile | 1 + > drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 > > 3 files changed, 684 insertions(+) > create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c > > diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig > index 6020c30..073ffa0 100644 > --- a/drivers/gpu/drm/panel/Kconfig > +++ b/drivers/gpu/drm/panel/Kconfig > @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V > Say Y here if you want to enable support for the Sitronix > ST7789V controller for 240x320 LCD panels > > +config DRM_PANEL_TRULY_NT35597_WQXGA > + tristate "Truly WQXGA" > + depends on OF > + depends on DRM_MIPI_DSI > + help > + Say Y here if you want to enable support for Truly NT35597 WQXGA Dual > DSI > + Video Mode panel > endmenu > diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile > index 5ccaaa9..80fd19f 100644 > --- a/drivers/gpu/drm/panel/Makefile > +++ b/drivers/gpu/drm/panel/Makefile > @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += > panel-seiko-43wvf1g.o > obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o > obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o > obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o > +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o > diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c > b/drivers/gpu/drm/panel/panel-truly-nt35597.c > new file mode 100644 > index 000..c9e09e2 > --- /dev/null > +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c > @@ -0,0 +1,676 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (c) 2018, The Linux Foundation. All rights reserved. > + */ > + > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > +#include > + > +static const char * const regulator_names[] = { > + "vdda", > + "vdispp", > + "vdispn", > +}; > + > +static unsigned long const regulator_enable_loads[] = { > + 62000, > + 10, > + 10, > +}; > + > +static unsigned long const regulator_disable_loads[] = { > + 80, > + 100, > + 100, > +}; > + > +struct nt35597_config { > + u32 width_mm; > + u32 height_mm; > + const char *panel_name; > + const void *panel_on_cmds; > + u32 num_on_cmds; > + const struct drm_display_mode *dm; > +}; > + > +struct truly_nt35597 { > + struct device *dev; > + struct drm_panel panel; > + > + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; > + > + struct gpio_desc *reset_gpio; > + struct gpio_desc *mode_gpio; > + > + struct backlight_device *backlight; > + > + struct mipi_dsi_device *dsi[2]; > + > + const struct nt35597_config *config; > + bool prepared; > + bool enabled; > +}; > + > +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) > +{ > + return container_of(panel, struct truly_nt35597, panel); > +} > + > +struct cmd_set { > + u8 commands[4]; > + u8 size; > +}; > + > +static struct cmd_set qcom_2k_panel_magic_cmds[] = { > + /* CMD2_P0 */ > + { { 0xff, 0x20 }, 2 }, > + { { 0xfb, 0x01 }, 2 }, > + { { 0x00, 0x01 }, 2 }, > + { { 0x01, 0x55 }, 2 }, > + { { 0x02, 0x45 }, 2 }, > + { { 0x05, 0x40 }, 2 }, > + { { 0x06, 0x19 }, 2 }, > + { { 0x07, 0x1e }, 2 }, > + { { 0x0b, 0x73 }, 2 }, > + { { 0x0c, 0x73 }, 2 }, > + { { 0x0e, 0xb0 }, 2 }, > + { { 0x0f, 0xae }, 2 }, > + { { 0x11, 0xb8 }, 2 }, > + { { 0x13, 0x00 }, 2 }, > + { { 0x58, 0x80 }, 2 }, > + { { 0x59, 0x01 }, 2 }, > + { { 0x5a, 0x00 }, 2 }, > + { { 0x5b, 0x01 }, 2 }, > + { { 0x5c, 0x80 }, 2 }, > + { { 0x5d, 0x81 }, 2 }, > + { { 0x5e, 0x00 }, 2 }, > + { { 0x5f, 0x01 }, 2 }, > + { { 0x72, 0x11 }, 2 }, > + { { 0x68, 0x03 }, 2 }, > + /* CMD2_P4 */ > + { { 0xFF, 0x24 }, 2 }, > + { { 0xFB, 0x01 }, 2 }, > + { { 0x00, 0x1C }, 2 }, > + { { 0x01, 0x0B }, 2 }, > + { { 0x02, 0x0C }, 2 }, > + { { 0x03, 0x01 }, 2 }, > + { { 0x04, 0x0F }, 2 }, > + { { 0x05, 0x10 }, 2 }, > + { { 0x06, 0x10 },
[PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver
From: "abhin...@codeaurora.org" Add support for Truly NT35597 panel driver used in MSM reference platforms. This panel driver supports both single DSI and dual DSI modes. However, this patch series adds support only for dual DSI mode. Changes in v8: - Remove video mode config and headers - Remove unused macros - Try to avoid multi-lines wherever possible - Fix comments locations and make it concise - Fix return points in probe function Signed-off-by: Archit Taneja Signed-off-by: Abhinav Kumar --- drivers/gpu/drm/panel/Kconfig | 7 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 3 files changed, 684 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 6020c30..073ffa0 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V Say Y here if you want to enable support for the Sitronix ST7789V controller for 240x320 LCD panels +config DRM_PANEL_TRULY_NT35597_WQXGA + tristate "Truly WQXGA" + depends on OF + depends on DRM_MIPI_DSI + help + Say Y here if you want to enable support for Truly NT35597 WQXGA Dual DSI + Video Mode panel endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 5ccaaa9..80fd19f 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c b/drivers/gpu/drm/panel/panel-truly-nt35597.c new file mode 100644 index 000..c9e09e2 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c @@ -0,0 +1,676 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +static const char * const regulator_names[] = { + "vdda", + "vdispp", + "vdispn", +}; + +static unsigned long const regulator_enable_loads[] = { + 62000, + 10, + 10, +}; + +static unsigned long const regulator_disable_loads[] = { + 80, + 100, + 100, +}; + +struct nt35597_config { + u32 width_mm; + u32 height_mm; + const char *panel_name; + const void *panel_on_cmds; + u32 num_on_cmds; + const struct drm_display_mode *dm; +}; + +struct truly_nt35597 { + struct device *dev; + struct drm_panel panel; + + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)]; + + struct gpio_desc *reset_gpio; + struct gpio_desc *mode_gpio; + + struct backlight_device *backlight; + + struct mipi_dsi_device *dsi[2]; + + const struct nt35597_config *config; + bool prepared; + bool enabled; +}; + +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel) +{ + return container_of(panel, struct truly_nt35597, panel); +} + +struct cmd_set { + u8 commands[4]; + u8 size; +}; + +static struct cmd_set qcom_2k_panel_magic_cmds[] = { + /* CMD2_P0 */ + { { 0xff, 0x20 }, 2 }, + { { 0xfb, 0x01 }, 2 }, + { { 0x00, 0x01 }, 2 }, + { { 0x01, 0x55 }, 2 }, + { { 0x02, 0x45 }, 2 }, + { { 0x05, 0x40 }, 2 }, + { { 0x06, 0x19 }, 2 }, + { { 0x07, 0x1e }, 2 }, + { { 0x0b, 0x73 }, 2 }, + { { 0x0c, 0x73 }, 2 }, + { { 0x0e, 0xb0 }, 2 }, + { { 0x0f, 0xae }, 2 }, + { { 0x11, 0xb8 }, 2 }, + { { 0x13, 0x00 }, 2 }, + { { 0x58, 0x80 }, 2 }, + { { 0x59, 0x01 }, 2 }, + { { 0x5a, 0x00 }, 2 }, + { { 0x5b, 0x01 }, 2 }, + { { 0x5c, 0x80 }, 2 }, + { { 0x5d, 0x81 }, 2 }, + { { 0x5e, 0x00 }, 2 }, + { { 0x5f, 0x01 }, 2 }, + { { 0x72, 0x11 }, 2 }, + { { 0x68, 0x03 }, 2 }, + /* CMD2_P4 */ + { { 0xFF, 0x24 }, 2 }, + { { 0xFB, 0x01 }, 2 }, + { { 0x00, 0x1C }, 2 }, + { { 0x01, 0x0B }, 2 }, + { { 0x02, 0x0C }, 2 }, + { { 0x03, 0x01 }, 2 }, + { { 0x04, 0x0F }, 2 }, + { { 0x05, 0x10 }, 2 }, + { { 0x06, 0x10 }, 2 }, + { { 0x07, 0x10 }, 2 }, + { { 0x08, 0x89 }, 2 }, + { { 0x09, 0x8A }, 2 }, + { { 0x0A, 0x13 }, 2 }, + { { 0x0B, 0x13 }, 2 }, + { { 0x0C, 0x15 }, 2 }, + { { 0x0D, 0x15 }, 2 }, + { { 0x0E, 0x17 }, 2 }, + { { 0x0F, 0x17 }, 2 }, + { { 0x10, 0x1C }, 2