Ingenic DRM bridge_atomic_enable proposal
Subsystems (5)
v5 cover Ingenic DRM bridge_atomic_enable proposal
Hello,
v5 :
- this set doesn't include the nv3052c bindings doc anymore, as it's already applied
- nv3052c panel driver : removed empty lines, proceed to turn it off even is sleeping in fails instead of stopping there
- abt panel : switched to REGCACHE_FLAT so we can disable sleep mode in .enable with regmap_set_bits() instead of doing it at init time
- ingenic-drm-drv : added ingenic_drm_bridge_atomic_disable to balance out ingenic_drm_bridge_atomic_enable
Tested working on the rg350m and rg280m
Christophe Branchereau (3):
drm/ingenic : add ingenic_drm_bridge_atomic_enable and disable drm/panel: Add panel driver for NewVision NV3052C based LCDs drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and
.disable
drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 34 +- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 +- .../gpu/drm/panel/panel-newvision-nv3052c.c | 484 ++++++++++++++++++ 6 files changed, 572 insertions(+), 18 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-newvision-nv3052c.c
Signature · 1 line
2.35.1
PATCH v5 1/3 drm/ingenic : add ingenic_drm_bridge_atomic_enable and disable
ingenic_drm_bridge_atomic_enable allows the CRTC to be enabled after panels have slept out, and before their display is turned on, solving a graphical bug on the newvision nv3502c.
Also add ingenic_drm_bridge_atomic_disable to balance it out.
--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 34 +++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +23 -11
@@ -226,6 +226,18 @@ static int ingenic_drm_update_pixclk(struct notifier_block *nb, } } +static void ingenic_drm_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) +{ +struct ingenic_drm *priv =drm_device_get_priv (bridge->dev); + +regmap_write (priv->map,JZ_REG_LCD_STATE ,0 ); + +regmap_update_bits (priv->map,JZ_REG_LCD_CTRL , +JZ_LCD_CTRL_ENABLE |JZ_LCD_CTRL_DISABLE , +JZ_LCD_CTRL_ENABLE ); +} +static void ingenic_drm_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state) {
@@ -237,28 +249,20 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,if (WARN_ON (IS_ERR (priv_state)))return ; -regmap_write (priv->map,JZ_REG_LCD_STATE ,0 ); -/* Set addresses of our DMA descriptor chains */ next_id = priv_state->use_palette ?HWDESC_PALETTE :0 ;regmap_write (priv->map,JZ_REG_LCD_DA0 ,dma_hwdesc_addr (priv, next_id));regmap_write (priv->map,JZ_REG_LCD_DA1 ,dma_hwdesc_addr (priv,1 )); -regmap_update_bits (priv->map,JZ_REG_LCD_CTRL , -JZ_LCD_CTRL_ENABLE |JZ_LCD_CTRL_DISABLE , -JZ_LCD_CTRL_ENABLE ); -drm_crtc_vblank_on (crtc); } -static void ingenic_drm_crtc_atomic_disable (struct drm_crtc *crtc, -struct drm_atomic_state *state) +static void ingenic_drm_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) { -struct ingenic_drm *priv =drm_crtc_get_priv (crtc); +struct ingenic_drm *priv =drm_device_get_priv (bridge->dev);unsigned int var; -drm_crtc_vblank_off (crtc); -regmap_update_bits (priv->map,JZ_REG_LCD_CTRL ,JZ_LCD_CTRL_DISABLE ,JZ_LCD_CTRL_DISABLE );
@@ -267,6 +271,12 @@ static void ingenic_drm_crtc_atomic_disable(struct drm_crtc *crtc, 1000, 0); } +static void ingenic_drm_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +drm_crtc_vblank_off (crtc); +} +static void ingenic_drm_crtc_update_timings (struct ingenic_drm *priv,struct drm_display_mode *mode) {
@@ -968,6 +978,8 @@ static const struct drm_encoder_helper_funcs ingenic_drm_encoder_helper_funcs =static const struct drm_bridge_funcs ingenic_drm_bridge_funcs = { .attach = ingenic_drm_bridge_attach, + .atomic_enable = ingenic_drm_bridge_atomic_enable, + .atomic_disable = ingenic_drm_bridge_atomic_disable, .atomic_check = ingenic_drm_bridge_atomic_check, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
Signature · 1 line
2.35.1
Re: [PATCH v5 1/3] drm/ingenic : add ingenic_drm_bridge_atomic_enable and disable
On 2022-03-21 14:36, Christophe Branchereau wrote:
Hi Christophe,
looks good to me.
Cheers,
Artur
Quoted 96 lines
ingenic_drm_bridge_atomic_enableallows the CRTC to be enabled after panels have slept out, and before their display is turned on, solving a graphical bug on the newvision nv3502c.Also add
ingenic_drm_bridge_atomic_disableto balance it out.Signed-off-by Christophe Branchereau <[email protected]>--- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 34 +++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-)drivers/gpu/drm/ingenic/ingenic-drm-drv.c +12
-0@@ -226,6 +226,18 @@ static int ingenic_drm_update_pixclk(struct notifier_block *nb, } } +static void ingenic_drm_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) +{ +struct ingenic_drm *priv =drm_device_get_priv (bridge->dev); + +regmap_write (priv->map,JZ_REG_LCD_STATE ,0 ); + +regmap_update_bits (priv->map,JZ_REG_LCD_CTRL , +JZ_LCD_CTRL_ENABLE |JZ_LCD_CTRL_DISABLE , +JZ_LCD_CTRL_ENABLE ); +} + static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3
-11struct drm_atomic_state *state) {@@ -237,28 +249,20 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc, if (WARN_ON(IS_ERR(priv_state))) return; -regmap_write (priv->map,JZ_REG_LCD_STATE ,0 ); -/* Set addresses of our DMA descriptor chains */ next_id = priv_state->use_palette ?HWDESC_PALETTE :0 ;regmap_write (priv->map,JZ_REG_LCD_DA0 ,dma_hwdesc_addr (priv, next_id));regmap_write (priv->map,JZ_REG_LCD_DA1 ,dma_hwdesc_addr (priv,1 )); -regmap_update_bits (priv->map,JZ_REG_LCD_CTRL , -JZ_LCD_CTRL_ENABLE |JZ_LCD_CTRL_DISABLE , -JZ_LCD_CTRL_ENABLE ); -drm_crtc_vblank_on (crtc); } -static void ingenic_drm_crtc_atomic_disable (struct drm_crtc *crtc, - struct drm_atomic_state *state) +static void ingenic_drm_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_bridge_state *old_bridge_state) { -struct ingenic_drm *priv =drm_crtc_get_priv (crtc); +struct ingenic_drm *priv =drm_device_get_priv (bridge->dev);unsigned int var; -drm_crtc_vblank_off (crtc); -drivers/gpu/drm/ingenic/ingenic-drm-drv.c +6
-0regmap_update_bits (priv->map,JZ_REG_LCD_CTRL ,JZ_LCD_CTRL_DISABLE ,JZ_LCD_CTRL_DISABLE );@@ -267,6 +271,12 @@ static void ingenic_drm_crtc_atomic_disable(struct drm_crtc *crtc, 1000, 0); } +static void ingenic_drm_crtc_atomic_disable (struct drm_crtc *crtc, +struct drm_atomic_state *state) +{ +drm_crtc_vblank_off (crtc); +} +static void ingenic_drm_crtc_update_timings (struct ingenic_drm *priv,struct drm_display_mode *mode){
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +0
-0@@ -968,6 +978,8 @@ static const struct drm_encoder_helper_funcs
ingenic_drm_encoder_helper_funcs=static const struct
drm_bridge_funcsingenic_drm_bridge_funcs= {drivers/gpu/drm/ingenic/ingenic-drm-drv.c +2
-0.attach = ingenic_drm_bridge_attach, + .atomic_enable = ingenic_drm_bridge_atomic_enable, + .atomic_disable = ingenic_drm_bridge_atomic_disable, .atomic_check = ingenic_drm_bridge_atomic_check, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
PATCH v5 2/3 drm/panel: Add panel driver for NewVision NV3052C based LCDs
In reply to Christophe BranchereauThis driver supports the NewVision NV3052C based LCDs. Right now, it only supports the LeadTek LTK035C5444T 2.4" 640x480 TFT LCD panel, which can be found in the Anbernic RG-350M handheld console.
--- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-newvision-nv3052c.c | 484 ++++++++++++++++++ 3 files changed, 494 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-newvision-nv3052c.c
drivers/gpu/drm/panel/Kconfig +9 -0
@@ -283,6 +283,15 @@ config DRM_PANEL_NEC_NL8048HL11 panel (found on the Zoom2/3/3630 SDP boards). To compile this driver as a module, choose M here. +config DRM_PANEL_NEWVISION_NV3052C + tristate "NewVision NV3052C RGB/SPI panel" + depends on OF && SPI + depends on BACKLIGHT_CLASS_DEVICE + select DRM_MIPI_DBI + help + Say Y here if you want to enable support for the panels built + around the NewVision NV3052C display controller. + config DRM_PANEL_NOVATEK_NT35510 tristate "Novatek NT35510 RGB panel driver" depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829) += panel-leadtek-ltk500hd1829.o obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o +obj-$(CONFIG_DRM_PANEL_NEWVISION_NV3052C) += panel-newvision-nv3052c.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35510) += panel-novatek-nt35510.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35560) += panel-novatek-nt35560.o obj-$(CONFIG_DRM_PANEL_NOVATEK_NT35950) += panel-novatek-nt35950.o
drivers/gpu/drm/panel/panel-newvision-nv3052c.c new file +484 -0
484 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH v5 2/3] drm/panel: Add panel driver for NewVision NV3052C based LCDs
Hi Christophe
Quoted 5 lines · Christophe Branchereau
This driver supports the NewVision NV3052C based LCDs. Right now, it only supports the LeadTek LTK035C5444T 2.4" 640x480 TFT LCD panel, which can be found in the Anbernic RG-350M handheld console.
Signed-off-by Christophe Branchereau <[email protected]>
Please add:
from the previous review round.
Sam
PATCH v5 3/3 drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable
In reply to Christophe BranchereauFollowing the introduction of bridge_atomic_enable in the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists.
Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
--- drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +++++++++++++++++-- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 ++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-)
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +28 -3
@@ -140,7 +140,7 @@ static const struct reg_sequence y030xx067a_init_sequence[] = { { 0x03, REG03_VPOSITION(0x0a) }, { 0x04, REG04_HPOSITION1(0xd2) }, { 0x05, REG05_CLIP | REG05_NVM_VREFRESH | REG05_SLBRCHARGE(0x2) }, - { 0x06, REG06_XPSAVE | REG06_NT }, + { 0x06, REG06_NT }, { 0x07, 0 }, { 0x08, REG08_PANEL(0x1) | REG08_CLOCK_DIV(0x2) }, { 0x09, REG09_SUB_BRIGHT_R(0x20) },
@@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ; err_disable_regulator:
@@ -202,6 +200,30 @@ static int y030xx067a_unprepare(struct drm_panel *panel)return 0 ; } +static int y030xx067a_enable (struct drm_panel *panel) +{ + +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_set_bits (priv->map,0x06 ,REG06_XPSAVE ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int y030xx067a_disable (struct drm_panel *panel) +{ +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_clear_bits (priv->map,0x06 ,REG06_XPSAVE ); + +return 0 ; +} +static int y030xx067a_get_modes (struct drm_panel *panel,struct drm_connector *connector) {
@@ -239,6 +261,8 @@ static int y030xx067a_get_modes(struct drm_panel *panel,static const struct drm_panel_funcs y030xx067a_funcs = { .prepare = y030xx067a_prepare, .unprepare = y030xx067a_unprepare, + .enable = y030xx067a_enable, + .disable = y030xx067a_disable, .get_modes = y030xx067a_get_modes, };
@@ -246,6 +270,7 @@ static const struct regmap_config y030xx067a_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0x15, + .cache_type = REGCACHE_FLAT, };static int y030xx067a_probe (struct spi_device *spi)
drivers/gpu/drm/panel/panel-innolux-ej030na.c +27 -4
@@ -80,8 +80,6 @@ static const struct reg_sequence ej030na_init_sequence[] = { { 0x47, 0x08 }, { 0x48, 0x0f }, { 0x49, 0x0f }, - - { 0x2b, 0x01 }, };static int ej030na_prepare (struct drm_panel *panel)
@@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ; err_disable_regulator:
@@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel *panel)return 0 ; } +static int ej030na_enable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby off */ +regmap_write (priv->map,0x2b ,0x01 ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int ej030na_disable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby on */ +regmap_write (priv->map,0x2b ,0x00 ); + +return 0 ; +} +static int ej030na_get_modes (struct drm_panel *panel,struct drm_connector *connector) {
@@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel *panel,static const struct drm_panel_funcs ej030na_funcs = { .prepare = ej030na_prepare, .unprepare = ej030na_unprepare, + .enable = ej030na_enable, + .disable = ej030na_disable, .get_modes = ej030na_get_modes, };
Signature · 1 line
2.35.1
Paul Cercueil
maintainerRe: [PATCH v5 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable
Hi Christophe,
Quoted 8 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists.Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
Signed-off-by Christophe Branchereau <[email protected]>
Didn't Sam acked it?
Quoted 74 lines
--- drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +++++++++++++++++-- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 ++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-)drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-1@@ -140,7 +140,7 @@ static const struct reg_sequence y030xx067a_init_sequence[] = { { 0x03, REG03_VPOSITION(0x0a) }, { 0x04, REG04_HPOSITION1(0xd2) }, { 0x05, REG05_CLIP | REG05_NVM_VREFRESH | REG05_SLBRCHARGE(0x2) }, - { 0x06, REG06_XPSAVE | REG06_NT }, + { 0x06, REG06_NT }, { 0x07, 0 }, { 0x08, REG08_PANEL(0x1) | REG08_CLOCK_DIV(0x2) },drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-2{ 0x09, REG09_SUB_BRIGHT_R(0x20) },@@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-abt-y030xx067a.c +24
-0@@ -202,6 +200,30 @@ static int y030xx067a_unprepare(struct drm_panel *panel)return 0 ; } +static int y030xx067a_enable (struct drm_panel *panel) +{ + +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_set_bits (priv->map,0x06 ,REG06_XPSAVE ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int y030xx067a_disable (struct drm_panel *panel) +{ +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_clear_bits (priv->map,0x06 ,REG06_XPSAVE ); + +return 0 ; +} +static int y030xx067a_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +2
-0@@ -239,6 +261,8 @@ static int y030xx067a_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs y030xx067a_funcs = { .prepare = y030xx067a_prepare, .unprepare = y030xx067a_unprepare, + .enable = y030xx067a_enable, + .disable = y030xx067a_disable, .get_modes = y030xx067a_get_modes, };
drivers/gpu/drm/panel/panel-abt-y030xx067a.c static const struct regmap_config · line 274
Quoted 5 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-0@@ -246,6 +270,7 @@ static const struct regmap_config y030xx067a_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0x15, + .cache_type = REGCACHE_FLAT,
I understand that this is added because the panel registers are write-only and read as zero, and it is needed for regmap_{clear,set}_bits to work.
This information should definitely be added to the commit message.
If you can add it inline here, and I'll update the commit message when applying the patch.
Cheers,
-Paul
Quoted 73 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-0};static int
y030xx067a_probe(struct spi_device *spi)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -80,8 +80,6 @@ static const struct reg_sequence ej030na_init_sequence[] = { {0x47 ,0x08 }, {0x48 ,0x0f }, {0x49 ,0x0f }, - - {0x2b ,0x01 }, };static int
ej030na_prepare(struct drm_panel *panel)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-innolux-ej030na.c +25
-0@@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel *panel)return 0 ; } +static int ej030na_enable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby off */ +regmap_write (priv->map,0x2b ,0x01 ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int ej030na_disable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby on */ +regmap_write (priv->map,0x2b ,0x00 ); + +return 0 ; +} +static int ej030na_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-innolux-ej030na.c +2
-1@@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs ej030na_funcs = { .prepare = ej030na_prepare, .unprepare = ej030na_unprepare, + .enable = ej030na_enable, + .disable = ej030na_disable, .get_modes = ej030na_get_modes, }; --2.35.1
Re: [PATCH v5 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable
Following the introduction of bridge_atomic_enable in the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists. Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
As we're moving the "sleep in" command out of the init sequence into .enable for the ABT, we need to switch the regmap cache to REGCACHE_FLAT to be able to use regmap_set_bits, given this panel registers are write-ony and read as 0.
Quoted 185 lines · Paul Cercueil
Hi Christophe,
Quoted 8 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists.Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
Signed-off-by Christophe Branchereau <[email protected]>Didn't Sam acked it?
Quoted 75 lines
--- drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +++++++++++++++++-- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 ++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-)drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-1@@ -140,7 +140,7 @@ static const struct reg_sequence y030xx067a_init_sequence[] = { { 0x03, REG03_VPOSITION(0x0a) }, { 0x04, REG04_HPOSITION1(0xd2) }, { 0x05, REG05_CLIP | REG05_NVM_VREFRESH | REG05_SLBRCHARGE(0x2) }, - { 0x06, REG06_XPSAVE | REG06_NT }, + { 0x06, REG06_NT }, { 0x07, 0 }, { 0x08, REG08_PANEL(0x1) | REG08_CLOCK_DIV(0x2) },{ 0x09, REG09_SUB_BRIGHT_R(0x20) },drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-2@@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-abt-y030xx067a.c +24
-0@@ -202,6 +200,30 @@ static int y030xx067a_unprepare(struct drm_panel *panel)return 0 ; } +static int y030xx067a_enable (struct drm_panel *panel) +{ + +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_set_bits (priv->map,0x06 ,REG06_XPSAVE ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int y030xx067a_disable (struct drm_panel *panel) +{ +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_clear_bits (priv->map,0x06 ,REG06_XPSAVE ); + +return 0 ; +} +static int y030xx067a_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +2
-0@@ -239,6 +261,8 @@ static int y030xx067a_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs y030xx067a_funcs = { .prepare = y030xx067a_prepare, .unprepare = y030xx067a_unprepare, + .enable = y030xx067a_enable, + .disable = y030xx067a_disable, .get_modes = y030xx067a_get_modes, };drivers/gpu/drm/panel/panel-abt-y030xx067a.c static const struct regmap_config · line 274
Quoted 5 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-0@@ -246,6 +270,7 @@ static const struct regmap_config y030xx067a_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0x15, + .cache_type = REGCACHE_FLAT,I understand that this is added because the panel registers are write-only and read as zero, and it is needed for regmap_{clear,set}_bits to work.
This information should definitely be added to the commit message.
If you can add it inline here, and I'll update the commit message when applying the patch.
Cheers,
-PaulQuoted 74 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-0};static int
y030xx067a_probe(struct spi_device *spi)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -80,8 +80,6 @@ static const struct reg_sequence ej030na_init_sequence[] = { {0x47 ,0x08 }, {0x48 ,0x0f }, {0x49 ,0x0f }, - - {0x2b ,0x01 }, };static int
ej030na_prepare(struct drm_panel *panel)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-innolux-ej030na.c +25
-0@@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel *panel)return 0 ; } +static int ej030na_enable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby off */ +regmap_write (priv->map,0x2b ,0x01 ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int ej030na_disable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby on */ +regmap_write (priv->map,0x2b ,0x00 ); + +return 0 ; +} +static int ej030na_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-innolux-ej030na.c +2
-1@@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs ej030na_funcs = { .prepare = ej030na_prepare, .unprepare = ej030na_unprepare, + .enable = ej030na_enable, + .disable = ej030na_disable, .get_modes = ej030na_get_modes, }; --2.35.1
Re: [PATCH v5 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable
Sorry I meant "sleep out" not "sleep in" obviously
Quoted 197 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists. Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.As we're moving the "sleep in" command out of the init sequence into .enable for the ABT, we need to switch the regmap cache to
REGCACHE_FLATto be able to useregmap_set_bits, given this panel registers are write-ony and read as 0.Quoted 185 lines · Paul Cercueil
Hi Christophe,
Quoted 8 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists.Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
Signed-off-by Christophe Branchereau <[email protected]>Didn't Sam acked it?
Quoted 75 lines
--- drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +++++++++++++++++-- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 ++++++++++++++++--- 2 files changed, 55 insertions(+), 7 deletions(-)drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-1@@ -140,7 +140,7 @@ static const struct reg_sequence y030xx067a_init_sequence[] = { { 0x03, REG03_VPOSITION(0x0a) }, { 0x04, REG04_HPOSITION1(0xd2) }, { 0x05, REG05_CLIP | REG05_NVM_VREFRESH | REG05_SLBRCHARGE(0x2) }, - { 0x06, REG06_XPSAVE | REG06_NT }, + { 0x06, REG06_NT }, { 0x07, 0 }, { 0x08, REG08_PANEL(0x1) | REG08_CLOCK_DIV(0x2) },{ 0x09, REG09_SUB_BRIGHT_R(0x20) },drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-2@@ -183,8 +183,6 @@ static int y030xx067a_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-abt-y030xx067a.c +24
-0@@ -202,6 +200,30 @@ static int y030xx067a_unprepare(struct drm_panel *panel)return 0 ; } +static int y030xx067a_enable (struct drm_panel *panel) +{ + +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_set_bits (priv->map,0x06 ,REG06_XPSAVE ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int y030xx067a_disable (struct drm_panel *panel) +{ +struct y030xx067a *priv =to_y030xx067a (panel); + +regmap_clear_bits (priv->map,0x06 ,REG06_XPSAVE ); + +return 0 ; +} +static int y030xx067a_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +2
-0@@ -239,6 +261,8 @@ static int y030xx067a_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs y030xx067a_funcs = { .prepare = y030xx067a_prepare, .unprepare = y030xx067a_unprepare, + .enable = y030xx067a_enable, + .disable = y030xx067a_disable, .get_modes = y030xx067a_get_modes, };drivers/gpu/drm/panel/panel-abt-y030xx067a.c static const struct regmap_config · line 274
Quoted 5 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +1
-0@@ -246,6 +270,7 @@ static const struct regmap_config y030xx067a_regmap_config = { .reg_bits = 8, .val_bits = 8, .max_register = 0x15, + .cache_type = REGCACHE_FLAT,I understand that this is added because the panel registers are write-only and read as zero, and it is needed for regmap_{clear,set}_bits to work.
This information should definitely be added to the commit message.
If you can add it inline here, and I'll update the commit message when applying the patch.
Cheers,
-PaulQuoted 74 lines
drivers/gpu/drm/panel/panel-abt-y030xx067a.c +0
-0};static int
y030xx067a_probe(struct spi_device *spi)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -80,8 +80,6 @@ static const struct reg_sequence ej030na_init_sequence[] = { {0x47 ,0x08 }, {0x48 ,0x0f }, {0x49 ,0x0f }, - - {0x2b ,0x01 }, };static int
ej030na_prepare(struct drm_panel *panel)drivers/gpu/drm/panel/panel-innolux-ej030na.c +0
-2@@ -109,8 +107,6 @@ static int ej030na_prepare(struct drm_panel *panel) goto err_disable_regulator; } -msleep (120 ); -return 0 ;
err_disable_regulator:drivers/gpu/drm/panel/panel-innolux-ej030na.c +25
-0@@ -128,6 +124,31 @@ static int ej030na_unprepare(struct drm_panel *panel)return 0 ; } +static int ej030na_enable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby off */ +regmap_write (priv->map,0x2b ,0x01 ); + +if (panel->backlight) { +/* Wait for the picture to be ready before enabling backlight */ +msleep (120 ); + } + +return 0 ; +} + +static int ej030na_disable (struct drm_panel *panel) +{ +struct ej030na *priv =to_ej030na (panel); + +/* standby on */ +regmap_write (priv->map,0x2b ,0x00 ); + +return 0 ; +} +static int ej030na_get_modes (struct drm_panel *panel,struct drm_connector *connector){
drivers/gpu/drm/panel/panel-innolux-ej030na.c +2
-1@@ -165,6 +186,8 @@ static int ej030na_get_modes(struct drm_panel *panel, static const struct drm_panel_funcs ej030na_funcs = { .prepare = ej030na_prepare, .unprepare = ej030na_unprepare, + .enable = ej030na_enable, + .disable = ej030na_disable, .get_modes = ej030na_get_modes, }; --2.35.1
Sam Ravnborg
Acked-byRe: [PATCH v5 3/3] drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and .disable
Hi Christophe,
Quoted 31 lines · Christophe Branchereau
Sorry I meant "sleep out" not "sleep in" obviously
Quoted 27 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists. Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.As we're moving the "sleep in" command out of the init sequence into .enable for the ABT, we need to switch the regmap cache to
REGCACHE_FLATto be able to useregmap_set_bits, given this panel registers are write-ony and read as 0.Quoted 15 lines · Paul Cercueil
Hi Christophe,
Quoted 8 lines · Christophe Branchereau
Following the introduction of
bridge_atomic_enablein the ingenic drm driver, the crtc is enabled between .prepare and .enable, if it exists.Add it so the backlight is only enabled after the crtc is, to avoid graphical issues.
Signed-off-by Christophe Branchereau <[email protected]>Didn't Sam acked it?
No, that was the new driver, already replied.
For these changes - with the updated changelog:
Hi Christophe,
Merged to drm-misc-next.
Thanks,
-Paul
Quoted 37 lines · Christophe Branchereau
Hello,
v5 :
- this set doesn't include the nv3052c bindings doc anymore, as it's already applied
- nv3052c panel driver : removed empty lines, proceed to turn it off even is sleeping in fails instead of stopping there
- abt panel : switched to
REGCACHE_FLATso we can disable sleep mode in .enable withregmap_set_bits()instead of doing it at init time- ingenic-drm-drv : added
ingenic_drm_bridge_atomic_disableto balance outingenic_drm_bridge_atomic_enableTested working on the rg350m and rg280m
Christophe Branchereau (3):
drm/ingenic : addingenic_drm_bridge_atomic_enableand disable drm/panel: Add panel driver for NewVision NV3052C based LCDs drm/panel : innolux-ej030na and abt-y030xx067a : add .enable and
.disabledrivers/gpu/drm/ingenic/ingenic-drm-drv.c | 34 +- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-abt-y030xx067a.c | 31 +- drivers/gpu/drm/panel/panel-innolux-ej030na.c | 31 +- .../gpu/drm/panel/panel-newvision-nv3052c.c | 484 ++++++++++++++++++ 6 files changed, 572 insertions(+), 18 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-newvision-nv3052c.c--
2.35.1