PMIC based Panel and Backlight Control
Subsystems (2)
cover PMIC based Panel and Backlight Control
Hi All,
For quite some time this problem is there in front of us and I am trying to have a closure on how to go about doing this. This patch set is a crude implementation to trigger the discussion.
Daniel sometime back suggested to look at drm_panel for doing this but I was not able to figure out how the panel driver will be loaded because PMIC probe success does not really imply that we need to load a PMIC based panel driver. It all depends on the OEM design if there is a DSI panel. Even then there is a possibility of SoC being usde for panel control. All this decission can be made from the VBT information. Hence as of now I have kept this inside i915 to init, if from VBT we know that PMIC controls the panel enable/disable. Maybe drm_panel is not needed and we can have it internal to i915.
Similar problem is there for backlight control over PMIC as well. For that probably we need to have independant backlight class driver, but this panel driver can also control backlight if needed.
Also currently this needs PMIC register read/write capability which is not there in upstream yet. For my testing I used the crude implementation for the same from a patch attached in -
https://bugs.freedesktop.org/show_bug.cgi?id=85977
Requesting your comments to converge on best way of implementing this.
Regards
Shobhit
Shobhit Kumar (4):
drm/i915: Define a common data structure for Panel Info drm/i915: Add a drm_panel over INTEL_SOC_PMIC drm/i915/Kconfig: By default select DRM_PANEL drm/i915: Enable PMIC panel control as drm_panel for DSI
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_drv.h | 14 +++ drivers/gpu/drm/i915/intel_dsi.c | 20 +++- drivers/gpu/drm/i915/intel_dsi.h | 13 +-- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 11 +- drivers/gpu/drm/i915/intel_panel_pmic.c | 157 +++++++++++++++++++++++++++++ 7 files changed, 202 insertions(+), 15 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_panel_pmic.c
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 1/4 drm/i915: Define a common data structure for Panel Info
As of now this includes only PPS and BLC delays. New things can be added as and when needed
--- drivers/gpu/drm/i915/intel_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/intel_dsi.h | 7 +------ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_drv.h +11 -0
@@ -731,6 +731,17 @@ struct intel_load_detect_pipe {int dpms_mode; }; +struct panel_info { +/* all delays in ms */ +u16 backlight_off_delay; +u16 backlight_on_delay; +u16 panel_on_delay; +u16 panel_off_delay; +u16 panel_pwr_cycle_delay; + +/* Other panel specififc stuff */ +}; +static inline struct intel_encoder *intel_attached_encoder (struct drm_connector *connector) {
drivers/gpu/drm/i915/intel_dsi.h +1 -6
@@ -129,12 +129,7 @@ struct intel_dsi {u32 pclk;u16 burst_mode_ratio; -/* all delays in ms */ -u16 backlight_off_delay; -u16 backlight_on_delay; -u16 panel_on_delay; -u16 panel_off_delay; -u16 panel_pwr_cycle_delay; +struct panel_info pinfo; };/* XXX: Transitional before dual port configuration */
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +5 -5
@@ -550,11 +550,11 @@ static bool generic_init(struct intel_dsi_device *dsi)/* delays in VBT are in unit of 100us, so need to convert * here in ms * Delay (100us) * 100 /1000 = Delay / 10 (ms) */ - intel_dsi->backlight_off_delay = pps->bl_disable_delay /10 ; - intel_dsi->backlight_on_delay = pps->bl_enable_delay /10 ; - intel_dsi->panel_on_delay = pps->panel_on_delay /10 ; - intel_dsi->panel_off_delay = pps->panel_off_delay /10 ; - intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ; + intel_dsi->pinfo.backlight_off_delay = pps->bl_disable_delay /10 ; + intel_dsi->pinfo.backlight_on_delay = pps->bl_enable_delay /10 ; + intel_dsi->pinfo.panel_on_delay = pps->panel_on_delay /10 ; + intel_dsi->pinfo.panel_off_delay = pps->panel_off_delay /10 ; + intel_dsi->pinfo.panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ;return true; }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 1/4] drm/i915: Define a common data structure for Panel Info
Quoted 15 lines · Shobhit Kumar
As of now this includes only PPS and BLC delays. New things can be added as and when needed
Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/intel_dsi.h | 7 +------ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h struct intel_load_detect_pipe { · line 734
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -731,6 +731,17 @@ struct intel_load_detect_pipe {int dpms_mode; }; +struct panel_info {
intel_panel_info please.
-Daniel
Quoted 59 lines
drivers/gpu/drm/i915/intel_drv.h +10
-0+/* all delays in ms */ +u16 backlight_off_delay; +u16 backlight_on_delay; +u16 panel_on_delay; +u16 panel_off_delay; +u16 panel_pwr_cycle_delay; + +/* Other panel specififc stuff */ +}; +static inline struct intel_encoder *intel_attached_encoder (struct drm_connector *connector) {drivers/gpu/drm/i915/intel_dsi.h +1
-6@@ -129,12 +129,7 @@ struct intel_dsi {u32 pclk;u16 burst_mode_ratio; -/* all delays in ms */ -u16 backlight_off_delay; -u16 backlight_on_delay; -u16 panel_on_delay; -u16 panel_off_delay; -u16 panel_pwr_cycle_delay; +struct panel_info pinfo; };/* XXX: Transitional before dual port configuration */ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +5
-5@@ -550,11 +550,11 @@ static bool generic_init(struct intel_dsi_device *dsi)/* delays in VBT are in unit of 100us, so need to convert * here in ms * Delay (100us) * 100 /1000 = Delay / 10 (ms) */ - intel_dsi->backlight_off_delay = pps->bl_disable_delay /10 ; - intel_dsi->backlight_on_delay = pps->bl_enable_delay /10 ; - intel_dsi->panel_on_delay = pps->panel_on_delay /10 ; - intel_dsi->panel_off_delay = pps->panel_off_delay /10 ; - intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ; + intel_dsi->pinfo.backlight_off_delay = pps->bl_disable_delay /10 ; + intel_dsi->pinfo.backlight_on_delay = pps->bl_enable_delay /10 ; + intel_dsi->pinfo.panel_on_delay = pps->panel_on_delay /10 ; + intel_dsi->pinfo.panel_off_delay = pps->panel_off_delay /10 ; + intel_dsi->pinfo.panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ;return true; }Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 1/4] drm/i915: Define a common data structure for Panel Info
Quoted 24 lines · Daniel Vetter
Quoted 15 lines · Shobhit Kumar
As of now this includes only PPS and BLC delays. New things can be added as and when needed
Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/intel_dsi.h | 7 +------ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_drv.h +0
-0drivers/gpu/drm/i915/intel_drv.h struct intel_load_detect_pipe { · line 734
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -731,6 +731,17 @@ struct intel_load_detect_pipe {int dpms_mode; }; +struct panel_info {
intel_panel_infoplease.
-Daniel
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_load_detect_pipe { · line 740
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +6
-0+/* all delays in ms */ +u16 backlight_off_delay; +u16 backlight_on_delay; +u16 panel_on_delay; +u16 panel_off_delay; +u16 panel_pwr_cycle_delay;
struct intel_dp already has
int panel_power_up_delay; int panel_power_down_delay; int panel_power_cycle_delay; int backlight_on_delay; int backlight_off_delay;
so I think it would be good to abstract the delays into a separate struct with these names.
BR,
Jani.
Quoted 58 lines
Quoted 53 lines
drivers/gpu/drm/i915/intel_drv.h +4
-0+ +/* Other panel specififc stuff */ +}; +static inline struct intel_encoder *intel_attached_encoder (struct drm_connector *connector) {drivers/gpu/drm/i915/intel_dsi.h +1
-6@@ -129,12 +129,7 @@ struct intel_dsi {u32 pclk;u16 burst_mode_ratio; -/* all delays in ms */ -u16 backlight_off_delay; -u16 backlight_on_delay; -u16 panel_on_delay; -u16 panel_off_delay; -u16 panel_pwr_cycle_delay; +struct panel_info pinfo; };/* XXX: Transitional before dual port configuration */ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +5
-5@@ -550,11 +550,11 @@ static bool generic_init(struct intel_dsi_device *dsi)/* delays in VBT are in unit of 100us, so need to convert * here in ms * Delay (100us) * 100 /1000 = Delay / 10 (ms) */ - intel_dsi->backlight_off_delay = pps->bl_disable_delay /10 ; - intel_dsi->backlight_on_delay = pps->bl_enable_delay /10 ; - intel_dsi->panel_on_delay = pps->panel_on_delay /10 ; - intel_dsi->panel_off_delay = pps->panel_off_delay /10 ; - intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ; + intel_dsi->pinfo.backlight_off_delay = pps->bl_disable_delay /10 ; + intel_dsi->pinfo.backlight_on_delay = pps->bl_enable_delay /10 ; + intel_dsi->pinfo.panel_on_delay = pps->panel_on_delay /10 ; + intel_dsi->pinfo.panel_off_delay = pps->panel_off_delay /10 ; + intel_dsi->pinfo.panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ;return true; }Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [RFC 1/4] drm/i915: Define a common data structure for Panel Info
Quoted 34 lines · Jani Nikula
Quoted 24 lines · Daniel Vetter
Quoted 15 lines · Shobhit Kumar
As of now this includes only PPS and BLC delays. New things can be added as and when needed
Signed-off-by Shobhit Kumar <[email protected]>--- drivers/gpu/drm/i915/intel_drv.h | 11 +++++++++++ drivers/gpu/drm/i915/intel_dsi.h | 7 +------ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 10 +++++----- 3 files changed, 17 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/intel_drv.h +0
-0drivers/gpu/drm/i915/intel_drv.h struct intel_load_detect_pipe { · line 734
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -731,6 +731,17 @@ struct intel_load_detect_pipe {int dpms_mode; }; +struct panel_info {
intel_panel_infoplease.
-DanielQuoted 6 lines
drivers/gpu/drm/i915/intel_drv.h struct intel_load_detect_pipe { · line 740
Quoted 6 lines
drivers/gpu/drm/i915/intel_drv.h +6
-0+/* all delays in ms */ +u16 backlight_off_delay; +u16 backlight_on_delay; +u16 panel_on_delay; +u16 panel_off_delay; +u16 panel_pwr_cycle_delay;struct
intel_dpalready has
Quoted 8 lines
int panel_power_up_delay; int panel_power_down_delay; int panel_power_cycle_delay; int backlight_on_delay; int backlight_off_delay;so I think it would be good to abstract the delays into a separate struct with these names.
intel_dsi already had the names that I used. I can change to the ones used by eDP.
Regards
Shobhit
Quoted 64 lines
BR,
Jani.Quoted 58 lines
Quoted 49 lines
drivers/gpu/drm/i915/intel_drv.h +4
-0+ +/* Other panel specififc stuff */ +}; +static inline struct intel_encoder *intel_attached_encoder (struct drm_connector *connector) {drivers/gpu/drm/i915/intel_dsi.h +1
-6@@ -129,12 +129,7 @@ struct intel_dsi {u32 pclk;u16 burst_mode_ratio; -/* all delays in ms */ -u16 backlight_off_delay; -u16 backlight_on_delay; -u16 panel_on_delay; -u16 panel_off_delay; -u16 panel_pwr_cycle_delay; +struct panel_info pinfo; };/* XXX: Transitional before dual port configuration */ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +5
-6@@ -550,11 +550,11 @@ static bool generic_init(struct intel_dsi_device *dsi)/* delays in VBT are in unit of 100us, so need to convert * here in ms * Delay (100us) * 100 /1000 = Delay / 10 (ms) */ - intel_dsi->backlight_off_delay = pps->bl_disable_delay /10 ; - intel_dsi->backlight_on_delay = pps->bl_enable_delay /10 ; - intel_dsi->panel_on_delay = pps->panel_on_delay /10 ; - intel_dsi->panel_off_delay = pps->panel_off_delay /10 ; - intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ; + intel_dsi->pinfo.backlight_off_delay = pps->bl_disable_delay /10 ; + intel_dsi->pinfo.backlight_on_delay = pps->bl_enable_delay /10 ; + intel_dsi->pinfo.panel_on_delay = pps->panel_on_delay /10 ; + intel_dsi->pinfo.panel_off_delay = pps->panel_off_delay /10 ; + intel_dsi->pinfo.panel_pwr_cycle_delay = pps->panel_power_cycle_delay /10 ;return true; } --1.9.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 2/4 drm/i915: Add a drm_panel over INTEL_SOC_PMIC
In reply to Shobhit KumarThis driver just add PANEL_ENABLE/DISABLE control using drm_panel framework.
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/intel_drv.h | 3 + drivers/gpu/drm/i915/intel_panel_pmic.c | 157 ++++++++++++++++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 drivers/gpu/drm/i915/intel_panel_pmic.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -79,6 +79,7 @@ i915-y += dvo_ch7017.o \ intel_i2c.o \ intel_lvds.o \ intel_panel.o \ + intel_panel_pmic.o \ intel_sdvo.o \ intel_tv.o
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1142,6 +1142,9 @@ extern struct drm_display_mode *intel_find_panel_downclock(void intel_backlight_register (struct drm_device *dev);void intel_backlight_unregister (struct drm_device *dev); +/* intel_panel_soc_pmic.c */ +struct drm_panel *intel_panel_pmic_init (struct device *dev, +struct panel_info *info);/* intel_psr.c */ void intel_psr_enable (struct intel_dp *intel_dp);
drivers/gpu/drm/i915/intel_panel_pmic.c new file +157 -0
157 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 3/4 drm/i915/Kconfig: By default select DRM_PANEL
In reply to Shobhit KumarThis will be needed for enabling drm_panel driver over pmic
--- drivers/gpu/drm/i915/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -18,6 +18,7 @@ config DRM_I915 select INPUT if ACPI select ACPI_VIDEO if ACPI select ACPI_BUTTON if ACPI + select DRM_PANEL help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
RFC 4/4 drm/i915: Enable PMIC panel control as drm_panel for DSI
In reply to Shobhit KumarThis initialize the drm_panel based on PMIC driver and uses drm_panel_* for controlling the panel enable/disable states
--- drivers/gpu/drm/i915/intel_dsi.c | 20 ++++++++++++++++---- drivers/gpu/drm/i915/intel_dsi.h | 6 ++++++ drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 1 + 3 files changed, 23 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +16 -4
@@ -26,6 +26,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_edid.h> +#include <drm/drm_panel.h> #include <drm/i915_drm.h> #include <linux/slab.h> #include "i915_drv.h"
@@ -230,6 +231,8 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)DRM_DEBUG_KMS ("\n" ); +drm_panel_enable (intel_dsi->panel); +/* Disable DPOunit clock gating, can stall pipe * and we need DPLL REFA always enabled */ tmp =I915_READ (DPLL (pipe));
@@ -247,8 +250,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)/* put device in ready state */ intel_dsi_device_ready (encoder); -msleep (intel_dsi->panel_on_delay); -if (intel_dsi->dev.dev_ops->panel_reset) intel_dsi->dev.dev_ops->panel_reset (&intel_dsi->dev);
@@ -390,8 +391,7 @@ static void intel_dsi_post_disable(struct intel_encoder *encoder)if (intel_dsi->dev.dev_ops->disable_panel_power) intel_dsi->dev.dev_ops->disable_panel_power (&intel_dsi->dev); -msleep (intel_dsi->panel_off_delay); -msleep (intel_dsi->panel_pwr_cycle_delay); +drm_panel_disable (intel_dsi->panel); } static bool intel_dsi_get_hw_state(struct intel_encoder *encoder,
@@ -896,6 +896,18 @@ void intel_dsi_init(struct drm_device *dev) fixed_mode->type |=DRM_MODE_TYPE_PREFERRED ;intel_panel_init (&intel_connector->panel, fixed_mode,NULL ); +/* Initialize the PMIC based drm_panel if available on the platform */ +if (intel_dsi->pps_blc ==PPS_BLC_PMIC ) { + intel_dsi->panel =intel_panel_pmic_init (dev->dev, + &intel_dsi->pinfo); +if (!intel_dsi->panel) { +DRM_ERROR ("Panel init fail !! EN/DISABLE will not work leaking power !!\n" ); +return ; + } + +drm_panel_attach (intel_dsi->panel, connector); + } +return ; err:
drivers/gpu/drm/i915/intel_dsi.h +6 -0
@@ -33,6 +33,9 @@#define DSI_DUAL_LINK_FRONT_BACK 1#define DSI_DUAL_LINK_PIXEL_ALT 2 +#define PPS_BLC_PMIC 0 +#define PPS_BLC_SOC 1 +struct intel_dsi_device {unsigned int panel_id;const char *name;
@@ -83,6 +86,8 @@ struct intel_dsi {struct intel_connector *attached_connector; +struct drm_panel *panel; +/* bit mask of ports being driven */ u16 ports;
@@ -116,6 +121,7 @@ struct intel_dsi {u32 dphy_reg;u32 video_frmt_cfg_bits;u16 lp_byte_clk; +u8 pps_blc;/* timeouts in byte clocks */ u16 lp_rx_timeout;
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
@@ -297,6 +297,7 @@ static bool generic_init(struct intel_dsi_device *dsi) intel_dsi->pixel_format = mipi_config->videomode_color_format <<7 ; intel_dsi->dual_link = mipi_config->dual_link; intel_dsi->pixel_overlap = mipi_config->pixel_overlap; + intel_dsi->pps_blc = mipi_config->pwm_blc;if (intel_dsi->dual_link) intel_dsi->ports = ((1 <<PORT_A ) | (1 <<PORT_C ));
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx