drm/panel: Pull some code out into common helpers
Subsystems (3)
cover drm/panel: Pull some code out into common helpers
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Sean
Sean Paul (3):
drm/panel: Pull common panel code out into helpers drm/panel: sharp-lq101r1sx01: Use panel-common helpers drm/panel: panel-sharp-ls043t1le01: Use panel-common helpers
drivers/gpu/drm/panel/Kconfig | 22 +++- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-common.c | 149 ++++++++++++++++++++++++ drivers/gpu/drm/panel/panel-common.h | 44 +++++++ drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 ++++--------- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 70 +++-------- drivers/gpu/drm/panel/panel-simple.c | 112 +++--------------- 7 files changed, 269 insertions(+), 208 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-common.c create mode 100644 drivers/gpu/drm/panel/panel-common.h
Signature · 6 lines
2.12.0.367.g23dc2f6d3c-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 1/3 drm/panel: Pull common panel code out into helpers
This patch pulls the regulator/backlight/enable_gpio code out of panel-simple and creates a new panel-common helper with it. This helper will be useful to the more complicated drivers which cannot use panel-simple.
--- drivers/gpu/drm/panel/Kconfig | 20 +++-- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-common.c | 149 +++++++++++++++++++++++++++++++++++ drivers/gpu/drm/panel/panel-common.h | 44 +++++++++++ drivers/gpu/drm/panel/panel-simple.c | 112 ++++---------------------- 5 files changed, 225 insertions(+), 101 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-common.c create mode 100644 drivers/gpu/drm/panel/panel-common.h
drivers/gpu/drm/panel/Kconfig +15 -5
@@ -7,16 +7,26 @@ config DRM_PANEL menu "Display Panels" depends on DRM && DRM_PANEL +config DRM_PANEL_COMMON + bool + depends on OF + depends on BACKLIGHT_CLASS_DEVICE + select VIDEOMODE_HELPERS + help + Common DRM panel helpers for panels using a regulator and a GPIO to + be powered up. Optionally a backlight can be attached so that it can + be automatically turned off when the panel goes into a low power + state. + config DRM_PANEL_SIMPLE tristate "support for simple panels" depends on OF - depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_COMMON select VIDEOMODE_HELPERS help - DRM panel driver for dumb panels that need at most a regulator and - a GPIO to be powered up. Optionally a backlight can be attached so - that it can be automatically turned off when the panel goes into a - low power state. + DRM panel driver for dumb panels that are not more complicated than + what the common helpers provide for power on/off. Allows for mode + probing via ddc bus, or using fixed modes. config DRM_PANEL_JDI_LT070ME05000 tristate "JDI LT070ME05000 WUXGA DSI panel"
drivers/gpu/drm/panel/Makefile +1 -0
@@ -1,3 +1,4 @@ +obj-$(CONFIG_DRM_PANEL_COMMON) += panel-common.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
drivers/gpu/drm/panel/panel-common.c new file +149 -0
149 lines not on this page · raw message
drivers/gpu/drm/panel/panel-common.h new file +44 -0
44 lines not on this page · raw message
drivers/gpu/drm/panel/panel-simple.c +16 -96
195 lines not on this page · raw message
Signature · 6 lines
2.12.0.367.g23dc2f6d3c-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH 1/3] drm/panel: Pull common panel code out into helpers
Hi Sean,
Something small that stood out while skimming through the design.
drivers/gpu/drm/panel/panel-simple.c struct panel_desc { · line 82
Quoted 7 lines · Sean Paul
struct panel_simple { struct drm_panel base;drivers/gpu/drm/panel/panel-simple.c +2
-0+struct panel_common common; +bool prepared;bool enabled;
There two should go ?
drivers/gpu/drm/panel/panel-simple.c struct panel_desc { · line 88
Quoted 7 lines
const struct panel_desc *desc;drivers/gpu/drm/panel/panel-simple.c +0
-2-struct backlight_device *backlight; -struct regulator *supply;struct i2c_adapter *ddc;struct gpio_desc *enable_gpio;
This should go as well ?
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 2/3 drm/panel: sharp-lq101r1sx01: Use panel-common helpers
In reply to Sean PaulInstead of duplicating common code from panel-simple, use the panel-common helpers.
--- drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 +++++++------------------ 2 files changed, 24 insertions(+), 56 deletions(-)
drivers/gpu/drm/panel/Kconfig +1 -0
@@ -73,6 +73,7 @@ config DRM_PANEL_SHARP_LQ101R1SX01 depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_COMMON help Say Y here if you want to enable support for Sharp LQ101R1SX01 TFT-LCD modules. The panel has a 2560x1600 resolution and uses
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +23 -56
164 lines not on this page · raw message
Signature · 6 lines
2.12.0.367.g23dc2f6d3c-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH 2/3] drm/panel: sharp-lq101r1sx01: Use panel-common helpers
Quoted 101 lines · Sean Paul
Instead of duplicating common code from panel-simple, use the panel-common helpers.
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 +++++++------------------ 2 files changed, 24 insertions(+), 56 deletions(-)drivers/gpu/drm/panel/Kconfig +1
-0@@ -73,6 +73,7 @@ config DRM_PANEL_SHARP_LQ101R1SX01 depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_COMMON help Say Y here if you want to enable support for Sharp LQ101R1SX01 TFT-LCD modules. The panel has a 2560x1600 resolution and usesdrivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +9
-24@@ -6,11 +6,8 @@* published by the Free Software Foundation. */ -#include <linux/backlight.h> -#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/regulator/consumer.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> @@ -19,17 +16,17 @@#include <video/mipi_display.h> +#include "panel-common.h" +struct sharp_panel {struct drm_panel base; +struct panel_common common; +/* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */ struct mipi_dsi_device *link1;struct mipi_dsi_device *link2; -struct backlight_device *backlight; -struct regulator *supply; -bool prepared; -bool enabled;const struct drm_display_mode *mode; };@@ -93,17 +90,7 @@ static int sharp_panel_disable(struct drm_panel *panel) {struct sharp_panel *sharp =to_sharp_panel (panel); -if (!sharp->enabled) -return 0 ; - -if (sharp->backlight) { - sharp->backlight->props.power =FB_BLANK_POWERDOWN ; -backlight_update_status (sharp->backlight); - } - - sharp->enabled = false; - -return 0 ; +return panel_common_disable (&sharp->common,0 ); }static int sharp_panel_unprepare (struct drm_panel *panel)@@ -126,11 +113,13 @@ static int sharp_panel_unprepare(struct drm_panel *panel)msleep (120 ); -regulator_disable (sharp->supply); + err =panel_common_unprepare (&sharp->common,0 ); +if (err <0 ) +dev_err (panel->dev,"failed common unprepare: %d\n" , err); sharp->prepared = false; -return 0 ; +return err; } static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,@@ -176,17 +165,15 @@ static int sharp_panel_prepare(struct drm_panel *panel)if (sharp->prepared)return 0 ; - err =regulator_enable (sharp->supply); -if (err <0 ) -return err; -
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c static int sharp_panel_prepare(struct drm_panel *panel) · line 176
Quoted 10 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +3
-1/* * According to the datasheet, the panel needs around 10 ms to fully * power up. At least another 120 ms is required before exiting sleep * mode to make sure the panel is ready. Throw in another 20 ms for * good measure. */ -msleep (150 ); + err =panel_common_prepare (&sharp->common,150 ); +if (err <0 ) +return err;
Aside: I like how 120 + 20 = 150, because always round up your delays :)
Quoted 47 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +3
-19err =mipi_dsi_dcs_exit_sleep_mode (sharp->link1);if (err <0 ) {@@ -252,7 +239,7 @@ static int sharp_panel_prepare(struct drm_panel *panel)return 0 ; poweroff: -regulator_disable (sharp->supply); +panel_common_unprepare (&sharp->common,0 );return err; }@@ -260,17 +247,7 @@ static int sharp_panel_enable(struct drm_panel *panel) {struct sharp_panel *sharp =to_sharp_panel (panel); -if (sharp->enabled) -return 0 ; - -if (sharp->backlight) { - sharp->backlight->props.power =FB_BLANK_UNBLANK ; -backlight_update_status (sharp->backlight); - } - - sharp->enabled = true; - -return 0 ; +return panel_common_enable (&sharp->common,0 ); }static const struct drm_display_mode default_mode = {@@ -324,23 +301,15 @@ MODULE_DEVICE_TABLE(of, sharp_of_match);static int sharp_panel_add (struct sharp_panel *sharp) { -struct device_node *np;int err; sharp->mode = &default_mode; + sharp->prepared = false; - sharp->supply =devm_regulator_get (&sharp->link1->dev,"power" ); -if (IS_ERR (sharp->supply)) -return PTR_ERR (sharp->supply); - - np =of_parse_phandle (sharp->link1->dev.of_node,"backlight" ,0 ); -if (np) {
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c MODULE_DEVICE_TABLE(of, sharp_of_match); · line 312
Quoted 10 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +4
-6- sharp->backlight =of_find_backlight_by_node (np); -of_node_put (np); - -if (!sharp->backlight) -return -EPROBE_DEFER ; - } + err =panel_common_init (&sharp->link1->dev, &sharp->common,"supply" , +"gpio" ,"backlight" ); +if (err <0 ) +return err;
Looks like you've incidentally changed the regulator name from "power" to "supply". Seems like it should be a called out in the commit message, if intentional.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH 2/3] drm/panel: sharp-lq101r1sx01: Use panel-common helpers
Quoted 99 lines · Eric Anholt
Quoted 97 lines · Sean Paul
Instead of duplicating common code from panel-simple, use the panel-common helpers.
Signed-off-by Sean Paul <[email protected]>--- drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 +++++++------------------ 2 files changed, 24 insertions(+), 56 deletions(-)drivers/gpu/drm/panel/Kconfig +1
-0@@ -73,6 +73,7 @@ config DRM_PANEL_SHARP_LQ101R1SX01 depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_COMMON help Say Y here if you want to enable support for Sharp LQ101R1SX01 TFT-LCD modules. The panel has a 2560x1600 resolution and usesdrivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +9
-20@@ -6,11 +6,8 @@* published by the Free Software Foundation. */ -#include <linux/backlight.h> -#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/regulator/consumer.h> #include <drm/drmP.h> #include <drm/drm_crtc.h> @@ -19,17 +16,17 @@#include <video/mipi_display.h> +#include "panel-common.h" +struct sharp_panel {struct drm_panel base; +struct panel_common common; +/* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */ struct mipi_dsi_device *link1;struct mipi_dsi_device *link2; -struct backlight_device *backlight; -struct regulator *supply; -bool prepared; -bool enabled;const struct drm_display_mode *mode; };@@ -93,17 +90,7 @@ static int sharp_panel_disable(struct drm_panel *panel) {struct sharp_panel *sharp =to_sharp_panel (panel); -if (!sharp->enabled) -return 0 ; - -if (sharp->backlight) { - sharp->backlight->props.power =FB_BLANK_POWERDOWN ; -backlight_update_status (sharp->backlight); - } - - sharp->enabled = false; - -return 0 ; +return panel_common_disable (&sharp->common,0 ); }static int sharp_panel_unprepare (struct drm_panel *panel)@@ -126,11 +113,13 @@ static int sharp_panel_unprepare(struct drm_panel *panel)msleep (120 ); -regulator_disable (sharp->supply); + err =panel_common_unprepare (&sharp->common,0 ); +if (err <0 ) +dev_err (panel->dev,"failed common unprepare: %d\n" , err); sharp->prepared = false; -return 0 ; +return err; } static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,@@ -176,17 +165,15 @@ static int sharp_panel_prepare(struct drm_panel *panel)if (sharp->prepared)return 0 ;
Quoted 16 lines
Quoted 4 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +0
-4- err =regulator_enable (sharp->supply); -if (err <0 ) -return err; -drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c static int sharp_panel_prepare(struct drm_panel *panel) · line 176
Quoted 10 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +3
-1/* * According to the datasheet, the panel needs around 10 ms to fully * power up. At least another 120 ms is required before exiting sleep * mode to make sure the panel is ready. Throw in another 20 ms for * good measure. */ -msleep (150 ); + err =panel_common_prepare (&sharp->common,150 ); +if (err <0 ) +return err;Aside: I like how 120 + 20 = 150, because always round up your delays :)
You missed the initial 10ms to "fully power up", so it's 10 + 120 + 20 = 150 That said, you can never have enough fudge in your delays :-)
Quoted 54 lines
Quoted 54 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +3
-25err =mipi_dsi_dcs_exit_sleep_mode (sharp->link1);if (err <0 ) {@@ -252,7 +239,7 @@ static int sharp_panel_prepare(struct drm_panel *panel)return 0 ; poweroff: -regulator_disable (sharp->supply); +panel_common_unprepare (&sharp->common,0 );return err; }@@ -260,17 +247,7 @@ static int sharp_panel_enable(struct drm_panel *panel) {struct sharp_panel *sharp =to_sharp_panel (panel); -if (sharp->enabled) -return 0 ; - -if (sharp->backlight) { - sharp->backlight->props.power =FB_BLANK_UNBLANK ; -backlight_update_status (sharp->backlight); - } - - sharp->enabled = true; - -return 0 ; +return panel_common_enable (&sharp->common,0 ); }static const struct drm_display_mode default_mode = {@@ -324,23 +301,15 @@ MODULE_DEVICE_TABLE(of, sharp_of_match);static int sharp_panel_add (struct sharp_panel *sharp) { -struct device_node *np;int err; sharp->mode = &default_mode; + sharp->prepared = false; - sharp->supply =devm_regulator_get (&sharp->link1->dev,"power" ); -if (IS_ERR (sharp->supply)) -return PTR_ERR (sharp->supply); - - np =of_parse_phandle (sharp->link1->dev.of_node,"backlight" ,0 ); -if (np) { - sharp->backlight =of_find_backlight_by_node (np); -of_node_put (np); - -if (!sharp->backlight) -return -EPROBE_DEFER ; - }
Quoted 8 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c MODULE_DEVICE_TABLE(of, sharp_of_match); · line 312
Quoted 4 lines
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +4
-0+ err =panel_common_init (&sharp->link1->dev, &sharp->common,"supply" , +"gpio" ,"backlight" ); +if (err <0 ) +return err;Looks like you've incidentally changed the regulator name from "power" to "supply". Seems like it should be a called out in the commit message, if intentional.
Oh my, yes I did, thanks for catching that. I'll fix this up locally and wait for Thierry to weigh in before posting a v2.
Sean
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
RFC PATCH 3/3 drm/panel: panel-sharp-ls043t1le01: Use panel-common helpers
In reply to Sean PaulInstead of duplicating common code from panel-simple, use the panel-common helpers.
--- drivers/gpu/drm/panel/Kconfig | 1 + drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 70 +++++++------------------ 2 files changed, 20 insertions(+), 51 deletions(-)
drivers/gpu/drm/panel/Kconfig +1 -0
@@ -88,6 +88,7 @@ config DRM_PANEL_SHARP_LS043T1LE01 depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_COMMON help Say Y here if you want to enable support for Sharp LS043T1LE01 qHD (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +19 -51
156 lines not on this page · raw message
Signature · 6 lines
2.12.0.367.g23dc2f6d3c-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [RFC PATCH 3/3] drm/panel: panel-sharp-ls043t1le01: Use panel-common helpers
Quoted 5 lines · Sean Paul
static const struct
drm_display_modedefault_mode= {drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +0
-0@@ -259,14 +238,14 @@ static const struct drm_panel_funcs sharp_nt_panel_funcs = {static int sharp_nt_panel_add (struct sharp_nt_panel *sharp_nt) {struct device *dev = &sharp_nt->dsi->dev;
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c static const struct drm_panel_funcs sharp_nt_panel_funcs = { · line 246
Quoted 10 lines
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +2
-4-struct device_node *np;int ret; sharp_nt->mode = &default_mode; - sharp_nt->supply =devm_regulator_get (dev,"avdd" ); -if (IS_ERR (sharp_nt->supply)) -return PTR_ERR (sharp_nt->supply); + ret =panel_common_init (dev, &sharp_nt->common,"avdd" ,"" , +"backlight" );
Skimming through the GPIO APi documentation does not say what will happen if we have an empty string for the con_id.
Might be better to pass NULL [for either supply, gpio or backlight name] and omit the setup of the component ?
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Sean Paul
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
Quoted 8 lines
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Adding Noralf to see if this might be useful for tinydrm.
Sean
Quoted 18 lines
Sean
Sean Paul (3):
drm/panel: Pull common panel code out into helpers drm/panel: sharp-lq101r1sx01: Use panel-common helpers drm/panel: panel-sharp-ls043t1le01: Use panel-common helpersdrivers/gpu/drm/panel/Kconfig | 22 +++- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-common.c | 149 ++++++++++++++++++++++++ drivers/gpu/drm/panel/panel-common.h | 44 +++++++ drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 ++++--------- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 70 +++-------- drivers/gpu/drm/panel/panel-simple.c | 112 +++--------------- 7 files changed, 269 insertions(+), 208 deletions(-) create mode 100644 drivers/gpu/drm/panel/panel-common.c create mode 100644 drivers/gpu/drm/panel/panel-common.h
Quoted 3 lines
--
2.12.0.367.g23dc2f6d3c-goog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Den 17.03.2017 15.17, skrev Sean Paul:
Quoted 9 lines · Sean Paul
Quoted 8 lines
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
Quoted 8 lines
Quoted 4 lines
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Cc Noralf Trønnes <[email protected]>Cc Daniel Vetter <[email protected]>Adding Noralf to see if this might be useful for tinydrm.
tinydrm _can_ use panel_common, but it can also use drm_panel which we decided against, so I don't know where the architectural lines go.
Most controllers/panels supported by tinydrm will have these fields:
struct mipi_dbi {
...
bool enabled;
...
struct gpio_desc *reset;
...
struct backlight_device *backlight;
struct regulator *regulator;
};Noralf.
Quoted 24 lines
Sean
Quoted 21 lines
Sean
Sean Paul (3):
drm/panel: Pull common panel code out into helpers drm/panel: sharp-lq101r1sx01: Use panel-common helpers drm/panel: panel-sharp-ls043t1le01: Use panel-common helpersdrivers/gpu/drm/panel/Kconfig | 22 +++- drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-common.c | 149 ++++++++++++++++++++++++ drivers/gpu/drm/panel/panel-common.h | 44 +++++++ drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 79 ++++--------- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 70 +++-------- drivers/gpu/drm/panel/panel-simple.c | 112 +++--------------- 7 files changed, 269 insertions(+), 208 deletions(-)create mode 100644
drivers/gpu/drm/panel/panel-common.ccreate mode 100644drivers/gpu/drm/panel/panel-common.h--
2.12.0.367.g23dc2f6d3c-goog
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Sean Paul
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
I've been looking at doing another panel driver for one with a little SPI sequence at bringup, and this series seems like it would be nice to have for that.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Sean,
Quoted 4 lines · Sean Paul
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
Quoted 8 lines
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Fwiw I think that the idea is good, but I'm wondering on the following architectural questions:
- Shouldn't prepared and enabled be part of struct drm_panel ?
- Would it be better to subclass struct panel_common around struct drm_panel ?
I might be threading the thin line of "midlayer vs helpers" here, so please let me know if I've got it wrong.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 11 lines · Emil Velikov
Hi Sean,
Quoted 8 lines · Sean Paul
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
Quoted 6 lines
Quoted 4 lines
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Fwiw I think that the idea is good, but I'm wondering on the following architectural questions:
Hey Emil,
Thanks for your feedback!
Quoted 1 line
- Shouldn't prepared and enabled be part of struct
drm_panel?
I don't think so. Not all panels need to worry about keeping track of the prepared/enabled state.
Quoted 4 lines
- Would it be better to subclass struct
panel_commonaround structdrm_panel?I might be threading the thin line of "midlayer vs helpers" here, so please let me know if I've got it wrong.
Yeah, you could do either. I was going for something more akin to the helpers we already have. If you went the subclass route, the drivers would need to subclass panel_common, which would subclass drm_panel. I figured it was too much unraveling to get at the important bits in the hooks that provide a drm_panel pointer. Nothing that a few to_* helpers couldn't solve, though.
I was also thinking we could subclass panel_common if there's an opportunity to get something like mipi_dcs_panel_common to reduce the copypasta amongst mipi panels which execute a common dcs recipe.
Sean
Quoted 3 lines
Thanks
Emil
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Sean Paul
Quoted 11 lines · Emil Velikov
Hi Sean,
Quoted 8 lines · Sean Paul
This series pulls out the power-sequencing code from panel-simple into a panel-common helper library. This allows drivers that cannot leverage panel-simple to share some code.
I've converted the 2 sharp mipi drivers, and Chris Zhong's driver on the list can also be converted. I haven't checked any other drivers, but I suspect we'll see the same code blocks there too.
Quoted 6 lines
Quoted 4 lines
I'm sure there's more we can pull out of the various drivers, but this seems like a good place to start talking about how to share common panel code across drivers.
Fwiw I think that the idea is good, but I'm wondering on the following architectural questions:
Quoted 9 lines
Hey Emil,
Thanks for your feedback!Quoted 1 line
- Shouldn't prepared and enabled be part of struct
drm_panel?I don't think so. Not all panels need to worry about keeping track of the prepared/enabled state.
You're correct - I did not notice those before. Yet, seems like adding the trivial prepared/enabled check will be beneficial to them ?
Unrelated tidbits/ideas, while skimming through:
- lg-lg4573
struct lg4573::vm - never set/used.
Might want a prepare/unprepare hook to manage power on/off
- panasonic-vvx10f034n00
struct wuxga_nt_panel::mode - set but unused
- sharp-ls043t1le01
struct sharp_nt_panel::mode - set but unused
Quoted 11 lines
Quoted 4 lines
- Would it be better to subclass struct
panel_commonaround structdrm_panel?I might be threading the thin line of "midlayer vs helpers" here, so please let me know if I've got it wrong.
Yeah, you could do either. I was going for something more akin to the helpers we already have. If you went the subclass route, the drivers would need to subclass
panel_common, which would subclassdrm_panel. I figured it was too much unraveling to get at the important bits in the hooks that provide adrm_panelpointer. Nothing that a few to_* helpers couldn't solve, though.
Quoted 4 lines
I was also thinking we could subclass
panel_commonif there's an opportunity to get something likemipi_dcs_panel_commonto reduce the copypasta amongst mipi panels which execute a common dcs recipe.
Indeed - wrapping panel_common around drm_panel might not be that good of idea.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel