This series adds the support for the eDP panel that needs the backlight
controlling over the DP AUX channel using DPCD registers of the panel
as per the VESA's standard.
This series also adds support for the Samsung eDP AMOLED panel that
needs DP AUX to control the backlight, and introduces new delays in the
@panel_desc.delay to support this panel.
This patch series depends on the following two series:
- Doug's series [1], exposed the DP AUX channel to the panel-simple.
- Lyude's series [2], introduced new drm helper functions for DPCD
backlight.
This series is the logical successor to the series [3].
Changes in v1:
- Created dpcd backlight helper with very basic functionality, added
backlight registration in the ti-sn65dsi86 bridge driver.
Changes in v2:
- Created a new DisplayPort aux backlight driver and moved the code from
drm_dp_aux_backlight.c (v1) to the new driver.
Changes in v3:
- Fixed module compilation (kernel test bot).
Changes in v4:
- Added basic DPCD backlight support in panel-simple.
- Added support for a new Samsung panel ATNA33XC20 that needs DPCD
backlight controlling and has a requirement of delays between enable
GPIO and regulator.
Changes in v5:
Addressed review suggestions from Douglas:
- Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
- Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
- panel-simple probe() calls drm_panel_dp_aux_backlight() to create
backlight when the backlight phandle is not specified in panel DT
and DP AUX channel is present.
- Added check for drm_edp_backlight_supported() before registering.
- Removed the @uses_dpcd_backlight flag from panel_desc as this
should be auto-detected.
- Updated comments/descriptions.
Changes in v6:
- Rebased
- Updated wanrning messages, fixed word wrapping in comments.
- Fixed ordering of memory allocation
Changes in v7:
- Updated the disable_to_power_off and power_to_enable panel delays
as discovered at <https://crrev.com/c/2966167> (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
- Added a new patch #4 to fix the warnings for eDP panel description (Sam Ravnborg)
[1] https://lore.kernel.org/dri-devel/20210525000159.3384921-1-dianders@chromium.org/
[2] https://lore.kernel.org/dri-devel/20210514181504.565252-1-lyude@redhat.com/
[3] https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajeevny@codeaurora.org/
Rajeev Nandan (6):
drm/panel: add basic DP AUX backlight support
drm/panel-simple: Support DP AUX backlight
drm/panel-simple: Support for delays between GPIO & regulator
drm/panel-simple: Update validation warnings for eDP panel description
dt-bindings: display: simple: Add Samsung ATNA33XC20
drm/panel-simple: Add Samsung ATNA33XC20
.../bindings/display/panel/panel-simple.yaml | 2 +
drivers/gpu/drm/drm_panel.c | 108 +++++++++++++++++++++
drivers/gpu/drm/panel/panel-simple.c | 73 +++++++++++++-
include/drm/drm_panel.h | 15 ++-
4 files changed, 190 insertions(+), 8 deletions(-)
--
2.7.4
Some panels support backlight control over DP AUX channel using
VESA's standard backlight control interface.
Using new DRM eDP backlight helpers, add support to create and
register a backlight for those panels in drm_panel to simplify
the panel drivers.
The panel driver with access to "struct drm_dp_aux" can create and
register a backlight device using following code snippet in its
probe() function:
err = drm_panel_dp_aux_backlight(panel, aux);
if (err)
return err;
Then drm_panel will handle backlight_(enable|disable) calls
similar to the case when drm_panel_of_backlight() is used.
Currently, we are not supporting one feature where the source
device can combine the backlight brightness levels set through
DP AUX and the BL_PWM_DIM eDP connector pin. Since it's not
required for the basic backlight controls, it can be added later.
Signed-off-by: Rajeev Nandan <redacted>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
---
Changes in v5:
- New
Changes in v6:
- Fixed ordering of memory allocation (Douglas)
- Updated word wrapping in a comment (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
drivers/gpu/drm/drm_panel.c | 108 ++++++++++++++++++++++++++++++++++++++++++++
include/drm/drm_panel.h | 15 ++++--
2 files changed, 119 insertions(+), 4 deletions(-)
@@ -342,6 +350,106 @@ int drm_panel_of_backlight(struct drm_panel *panel)return0;}EXPORT_SYMBOL(drm_panel_of_backlight);++staticintdp_aux_backlight_update_status(structbacklight_device*bd)+{+structdp_aux_backlight*bl=bl_get_data(bd);+u16brightness=backlight_get_brightness(bd);+intret=0;++if(!backlight_is_blank(bd)){+if(!bl->enabled){+drm_edp_backlight_enable(bl->aux,&bl->info,brightness);+bl->enabled=true;+return0;+}+ret=drm_edp_backlight_set_level(bl->aux,&bl->info,brightness);+}else{+if(bl->enabled){+drm_edp_backlight_disable(bl->aux,&bl->info);+bl->enabled=false;+}+}++returnret;+}++staticconststructbacklight_opsdp_aux_bl_ops={+.update_status=dp_aux_backlight_update_status,+};++/**+*drm_panel_dp_aux_backlight-createanduseDPAUXbacklight+*@panel:DRMpanel+*@aux:TheDPAUXchanneltouse+*+*Usethisfunctiontocreateandhandlebacklightifyourpanel+*supportsbacklightcontroloverDPAUXchannelusingDPCD+*registersasperVESA'sstandardbacklightcontrolinterface.+*+*Whenthepanelisenabledbacklightwillbeenabledaftera+*successfulcallto&drm_panel_funcs.enable()+*+*Whenthepanelisdisabledbacklightwillbedisabledbeforethe+*callto&drm_panel_funcs.disable().+*+*Atypicalimplementationforapaneldriversupportingbacklight+*controloverDPAUXwillcallthisfunctionatprobetime.+*Backlightwillthenbehandledtransparentlywithoutrequiring+*anyinterventionfromthedriver.+*+*drm_panel_dp_aux_backlight()mustbecalledafterthecalltodrm_panel_init().+*+*Return:0onsuccessoranegativeerrorcodeonfailure.+*/+intdrm_panel_dp_aux_backlight(structdrm_panel*panel,structdrm_dp_aux*aux)+{+structdp_aux_backlight*bl;+structbacklight_propertiesprops={0};+u16current_level;+u8current_mode;+u8edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];+intret;++if(!panel||!panel->dev||!aux)+return-EINVAL;++ret=drm_dp_dpcd_read(aux,DP_EDP_DPCD_REV,edp_dpcd,+EDP_DISPLAY_CTL_CAP_SIZE);+if(ret<0)+returnret;++if(!drm_edp_backlight_supported(edp_dpcd)){+DRM_DEV_INFO(panel->dev,"DP AUX backlight is not supported\n");+return0;+}++bl=devm_kzalloc(panel->dev,sizeof(*bl),GFP_KERNEL);+if(!bl)+return-ENOMEM;++bl->aux=aux;++ret=drm_edp_backlight_init(aux,&bl->info,0,edp_dpcd,+¤t_level,¤t_mode);+if(ret<0)+returnret;++props.type=BACKLIGHT_RAW;+props.brightness=current_level;+props.max_brightness=bl->info.max;++bl->base=devm_backlight_device_register(panel->dev,"dp_aux_backlight",+panel->dev,bl,+&dp_aux_bl_ops,&props);+if(IS_ERR(bl->base))+returnPTR_ERR(bl->base);++panel->backlight=bl->base;++return0;+}+EXPORT_SYMBOL(drm_panel_dp_aux_backlight);#endifMODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
If there is no backlight specified in the device tree and the panel
has access to the DP AUX channel then create a DP AUX backlight if
supported by the panel.
Signed-off-by: Rajeev Nandan <redacted>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---
(no changes since v5)
This patch depends on the previous patch (2/5) of this series.
Changes in v4:
- New
Changes in v5:
- Address review comments and move backlight functions to drm_panel.c (Douglas)
- Create and register DP AUX backlight if there is no backlight specified in the
device tree and panel has the DP AUX channel. (Douglas)
- The new drm_panel_dp_aux_backlight() will do the drm_edp_backlight_supported() check.
drivers/gpu/drm/panel/panel-simple.c | 6 ++++++
1 file changed, 6 insertions(+)
From: Doug Anderson <dianders@chromium.org> Date: 2021-07-09 14:01:15
Hi,
On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan [off-list ref] wrote:
This series adds the support for the eDP panel that needs the backlight
controlling over the DP AUX channel using DPCD registers of the panel
as per the VESA's standard.
This series also adds support for the Samsung eDP AMOLED panel that
needs DP AUX to control the backlight, and introduces new delays in the
@panel_desc.delay to support this panel.
This patch series depends on the following two series:
- Doug's series [1], exposed the DP AUX channel to the panel-simple.
- Lyude's series [2], introduced new drm helper functions for DPCD
backlight.
This series is the logical successor to the series [3].
Changes in v1:
- Created dpcd backlight helper with very basic functionality, added
backlight registration in the ti-sn65dsi86 bridge driver.
Changes in v2:
- Created a new DisplayPort aux backlight driver and moved the code from
drm_dp_aux_backlight.c (v1) to the new driver.
Changes in v3:
- Fixed module compilation (kernel test bot).
Changes in v4:
- Added basic DPCD backlight support in panel-simple.
- Added support for a new Samsung panel ATNA33XC20 that needs DPCD
backlight controlling and has a requirement of delays between enable
GPIO and regulator.
Changes in v5:
Addressed review suggestions from Douglas:
- Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
- Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
- panel-simple probe() calls drm_panel_dp_aux_backlight() to create
backlight when the backlight phandle is not specified in panel DT
and DP AUX channel is present.
- Added check for drm_edp_backlight_supported() before registering.
- Removed the @uses_dpcd_backlight flag from panel_desc as this
should be auto-detected.
- Updated comments/descriptions.
Changes in v6:
- Rebased
- Updated wanrning messages, fixed word wrapping in comments.
- Fixed ordering of memory allocation
Changes in v7:
- Updated the disable_to_power_off and power_to_enable panel delays
as discovered at <https://crrev.com/c/2966167> (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
- Added a new patch #4 to fix the warnings for eDP panel description (Sam Ravnborg)
[1] https://lore.kernel.org/dri-devel/20210525000159.3384921-1-dianders@chromium.org/
[2] https://lore.kernel.org/dri-devel/20210514181504.565252-1-lyude@redhat.com/
[3] https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajeevny@codeaurora.org/
Rajeev Nandan (6):
drm/panel: add basic DP AUX backlight support
drm/panel-simple: Support DP AUX backlight
drm/panel-simple: Support for delays between GPIO & regulator
drm/panel-simple: Update validation warnings for eDP panel description
dt-bindings: display: simple: Add Samsung ATNA33XC20
drm/panel-simple: Add Samsung ATNA33XC20
.../bindings/display/panel/panel-simple.yaml | 2 +
drivers/gpu/drm/drm_panel.c | 108 +++++++++++++++++++++
drivers/gpu/drm/panel/panel-simple.c | 73 +++++++++++++-
include/drm/drm_panel.h | 15 ++-
4 files changed, 190 insertions(+), 8 deletions(-)
Pushed to drm-misc-next.
4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
panel description
18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
bfd451403d70 drm/panel-simple: Support DP AUX backlight
10f7b40e4f30 drm/panel: add basic DP AUX backlight support
-Doug
From: Ville Syrjälä <hidden> Date: 2021-07-09 20:41:12
On Fri, Jul 09, 2021 at 06:54:05AM -0700, Doug Anderson wrote:
Hi,
On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan [off-list ref] wrote:
quoted
This series adds the support for the eDP panel that needs the backlight
controlling over the DP AUX channel using DPCD registers of the panel
as per the VESA's standard.
This series also adds support for the Samsung eDP AMOLED panel that
needs DP AUX to control the backlight, and introduces new delays in the
@panel_desc.delay to support this panel.
This patch series depends on the following two series:
- Doug's series [1], exposed the DP AUX channel to the panel-simple.
- Lyude's series [2], introduced new drm helper functions for DPCD
backlight.
This series is the logical successor to the series [3].
Changes in v1:
- Created dpcd backlight helper with very basic functionality, added
backlight registration in the ti-sn65dsi86 bridge driver.
Changes in v2:
- Created a new DisplayPort aux backlight driver and moved the code from
drm_dp_aux_backlight.c (v1) to the new driver.
Changes in v3:
- Fixed module compilation (kernel test bot).
Changes in v4:
- Added basic DPCD backlight support in panel-simple.
- Added support for a new Samsung panel ATNA33XC20 that needs DPCD
backlight controlling and has a requirement of delays between enable
GPIO and regulator.
Changes in v5:
Addressed review suggestions from Douglas:
- Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
- Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
- panel-simple probe() calls drm_panel_dp_aux_backlight() to create
backlight when the backlight phandle is not specified in panel DT
and DP AUX channel is present.
- Added check for drm_edp_backlight_supported() before registering.
- Removed the @uses_dpcd_backlight flag from panel_desc as this
should be auto-detected.
- Updated comments/descriptions.
Changes in v6:
- Rebased
- Updated wanrning messages, fixed word wrapping in comments.
- Fixed ordering of memory allocation
Changes in v7:
- Updated the disable_to_power_off and power_to_enable panel delays
as discovered at <https://crrev.com/c/2966167> (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
- Added a new patch #4 to fix the warnings for eDP panel description (Sam Ravnborg)
[1] https://lore.kernel.org/dri-devel/20210525000159.3384921-1-dianders@chromium.org/
[2] https://lore.kernel.org/dri-devel/20210514181504.565252-1-lyude@redhat.com/
[3] https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajeevny@codeaurora.org/
Rajeev Nandan (6):
drm/panel: add basic DP AUX backlight support
drm/panel-simple: Support DP AUX backlight
drm/panel-simple: Support for delays between GPIO & regulator
drm/panel-simple: Update validation warnings for eDP panel description
dt-bindings: display: simple: Add Samsung ATNA33XC20
drm/panel-simple: Add Samsung ATNA33XC20
.../bindings/display/panel/panel-simple.yaml | 2 +
drivers/gpu/drm/drm_panel.c | 108 +++++++++++++++++++++
drivers/gpu/drm/panel/panel-simple.c | 73 +++++++++++++-
include/drm/drm_panel.h | 15 ++-
4 files changed, 190 insertions(+), 8 deletions(-)
Pushed to drm-misc-next.
4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
panel description
18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
bfd451403d70 drm/panel-simple: Support DP AUX backlight
10f7b40e4f30 drm/panel: add basic DP AUX backlight support
depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper
Looks to be due to drm_edp_backlight_enable().
--
Ville Syrjälä
Intel
From: Doug Anderson <dianders@chromium.org> Date: 2021-07-09 22:38:47
Hi,
On Fri, Jul 9, 2021 at 1:41 PM Ville Syrjälä
[off-list ref] wrote:
On Fri, Jul 09, 2021 at 06:54:05AM -0700, Doug Anderson wrote:
quoted
Hi,
On Sat, Jun 26, 2021 at 9:52 AM Rajeev Nandan [off-list ref] wrote:
quoted
This series adds the support for the eDP panel that needs the backlight
controlling over the DP AUX channel using DPCD registers of the panel
as per the VESA's standard.
This series also adds support for the Samsung eDP AMOLED panel that
needs DP AUX to control the backlight, and introduces new delays in the
@panel_desc.delay to support this panel.
This patch series depends on the following two series:
- Doug's series [1], exposed the DP AUX channel to the panel-simple.
- Lyude's series [2], introduced new drm helper functions for DPCD
backlight.
This series is the logical successor to the series [3].
Changes in v1:
- Created dpcd backlight helper with very basic functionality, added
backlight registration in the ti-sn65dsi86 bridge driver.
Changes in v2:
- Created a new DisplayPort aux backlight driver and moved the code from
drm_dp_aux_backlight.c (v1) to the new driver.
Changes in v3:
- Fixed module compilation (kernel test bot).
Changes in v4:
- Added basic DPCD backlight support in panel-simple.
- Added support for a new Samsung panel ATNA33XC20 that needs DPCD
backlight controlling and has a requirement of delays between enable
GPIO and regulator.
Changes in v5:
Addressed review suggestions from Douglas:
- Created a new API drm_panel_dp_aux_backlight() in drm_panel.c
- Moved DP AUX backlight functions from panel-simple.c to drm_panel.c
- panel-simple probe() calls drm_panel_dp_aux_backlight() to create
backlight when the backlight phandle is not specified in panel DT
and DP AUX channel is present.
- Added check for drm_edp_backlight_supported() before registering.
- Removed the @uses_dpcd_backlight flag from panel_desc as this
should be auto-detected.
- Updated comments/descriptions.
Changes in v6:
- Rebased
- Updated wanrning messages, fixed word wrapping in comments.
- Fixed ordering of memory allocation
Changes in v7:
- Updated the disable_to_power_off and power_to_enable panel delays
as discovered at <https://crrev.com/c/2966167> (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
- Added a new patch #4 to fix the warnings for eDP panel description (Sam Ravnborg)
[1] https://lore.kernel.org/dri-devel/20210525000159.3384921-1-dianders@chromium.org/
[2] https://lore.kernel.org/dri-devel/20210514181504.565252-1-lyude@redhat.com/
[3] https://lore.kernel.org/dri-devel/1619416756-3533-1-git-send-email-rajeevny@codeaurora.org/
Rajeev Nandan (6):
drm/panel: add basic DP AUX backlight support
drm/panel-simple: Support DP AUX backlight
drm/panel-simple: Support for delays between GPIO & regulator
drm/panel-simple: Update validation warnings for eDP panel description
dt-bindings: display: simple: Add Samsung ATNA33XC20
drm/panel-simple: Add Samsung ATNA33XC20
.../bindings/display/panel/panel-simple.yaml | 2 +
drivers/gpu/drm/drm_panel.c | 108 +++++++++++++++++++++
drivers/gpu/drm/panel/panel-simple.c | 73 +++++++++++++-
include/drm/drm_panel.h | 15 ++-
4 files changed, 190 insertions(+), 8 deletions(-)
Pushed to drm-misc-next.
4bfe6c8f7c23 drm/panel-simple: Add Samsung ATNA33XC20
c20dec193584 dt-bindings: display: simple: Add Samsung ATNA33XC20
13aceea56fd5 drm/panel-simple: Update validation warnings for eDP
panel description
18a1488bf1e1 drm/panel-simple: Support for delays between GPIO & regulator
bfd451403d70 drm/panel-simple: Support DP AUX backlight
10f7b40e4f30 drm/panel: add basic DP AUX backlight support
depmod: ERROR: Cycle detected: drm_kms_helper -> drm -> drm_kms_helper
Looks to be due to drm_edp_backlight_enable().
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2021-07-12 09:41:41
Am 26.06.21 um 18:51 schrieb Rajeev Nandan:
quoted hunk
Some panels support backlight control over DP AUX channel using
VESA's standard backlight control interface.
Using new DRM eDP backlight helpers, add support to create and
register a backlight for those panels in drm_panel to simplify
the panel drivers.
The panel driver with access to "struct drm_dp_aux" can create and
register a backlight device using following code snippet in its
probe() function:
err = drm_panel_dp_aux_backlight(panel, aux);
if (err)
return err;
Then drm_panel will handle backlight_(enable|disable) calls
similar to the case when drm_panel_of_backlight() is used.
Currently, we are not supporting one feature where the source
device can combine the backlight brightness levels set through
DP AUX and the BL_PWM_DIM eDP connector pin. Since it's not
required for the basic backlight controls, it can be added later.
Signed-off-by: Rajeev Nandan <redacted>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
---
Changes in v5:
- New
Changes in v6:
- Fixed ordering of memory allocation (Douglas)
- Updated word wrapping in a comment (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status (Sam Ravnborg)
drivers/gpu/drm/drm_panel.c | 108 ++++++++++++++++++++++++++++++++++++++++++++
include/drm/drm_panel.h | 15 ++++--
2 files changed, 119 insertions(+), 4 deletions(-)
@@ -342,6 +350,106 @@ int drm_panel_of_backlight(struct drm_panel *panel)return0;}EXPORT_SYMBOL(drm_panel_of_backlight);++staticintdp_aux_backlight_update_status(structbacklight_device*bd)+{+structdp_aux_backlight*bl=bl_get_data(bd);+u16brightness=backlight_get_brightness(bd);+intret=0;++if(!backlight_is_blank(bd)){+if(!bl->enabled){+drm_edp_backlight_enable(bl->aux,&bl->info,brightness);+bl->enabled=true;+return0;+}+ret=drm_edp_backlight_set_level(bl->aux,&bl->info,brightness);+}else{+if(bl->enabled){+drm_edp_backlight_disable(bl->aux,&bl->info);+bl->enabled=false;+}+}++returnret;+}++staticconststructbacklight_opsdp_aux_bl_ops={+.update_status=dp_aux_backlight_update_status,+};++/**+*drm_panel_dp_aux_backlight-createanduseDPAUXbacklight+*@panel:DRMpanel+*@aux:TheDPAUXchanneltouse+*+*Usethisfunctiontocreateandhandlebacklightifyourpanel+*supportsbacklightcontroloverDPAUXchannelusingDPCD+*registersasperVESA'sstandardbacklightcontrolinterface.+*+*Whenthepanelisenabledbacklightwillbeenabledaftera+*successfulcallto&drm_panel_funcs.enable()+*+*Whenthepanelisdisabledbacklightwillbedisabledbeforethe+*callto&drm_panel_funcs.disable().+*+*Atypicalimplementationforapaneldriversupportingbacklight+*controloverDPAUXwillcallthisfunctionatprobetime.+*Backlightwillthenbehandledtransparentlywithoutrequiring+*anyinterventionfromthedriver.+*+*drm_panel_dp_aux_backlight()mustbecalledafterthecalltodrm_panel_init().+*+*Return:0onsuccessoranegativeerrorcodeonfailure.+*/+intdrm_panel_dp_aux_backlight(structdrm_panel*panel,structdrm_dp_aux*aux)+{+structdp_aux_backlight*bl;+structbacklight_propertiesprops={0};+u16current_level;+u8current_mode;+u8edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];+intret;++if(!panel||!panel->dev||!aux)+return-EINVAL;++ret=drm_dp_dpcd_read(aux,DP_EDP_DPCD_REV,edp_dpcd,+EDP_DISPLAY_CTL_CAP_SIZE);
This creates a cyclic dependency between drm_kms_helper-ko and drm.ko.
drm_panel.c is in the latter, while drm_dp_dpcd_read() in
drm_dp_helper.c is in the former. Please fix.
Best regards
Thomas
From: Thomas Zimmermann <tzimmermann@suse.de> Date: 2021-07-12 09:45:18
Hi
Am 12.07.21 um 11:41 schrieb Thomas Zimmermann:
Am 26.06.21 um 18:51 schrieb Rajeev Nandan:
quoted
Some panels support backlight control over DP AUX channel using
VESA's standard backlight control interface.
Using new DRM eDP backlight helpers, add support to create and
register a backlight for those panels in drm_panel to simplify
the panel drivers.
The panel driver with access to "struct drm_dp_aux" can create and
register a backlight device using following code snippet in its
probe() function:
err = drm_panel_dp_aux_backlight(panel, aux);
if (err)
return err;
Then drm_panel will handle backlight_(enable|disable) calls
similar to the case when drm_panel_of_backlight() is used.
Currently, we are not supporting one feature where the source
device can combine the backlight brightness levels set through
DP AUX and the BL_PWM_DIM eDP connector pin. Since it's not
required for the basic backlight controls, it can be added later.
Signed-off-by: Rajeev Nandan <redacted>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Lyude Paul <lyude@redhat.com>
---
Changes in v5:
- New
Changes in v6:
- Fixed ordering of memory allocation (Douglas)
- Updated word wrapping in a comment (Douglas)
Changes in v8:
- Now using backlight_is_blank() to get the backlight blank status
(Sam Ravnborg)
drivers/gpu/drm/drm_panel.c | 108
++++++++++++++++++++++++++++++++++++++++++++
include/drm/drm_panel.h | 15 ++++--
2 files changed, 119 insertions(+), 4 deletions(-)
@@ -342,6 +350,106 @@ int drm_panel_of_backlight(struct drm_panel *panel)
return 0;
}
EXPORT_SYMBOL(drm_panel_of_backlight);
+
+static int dp_aux_backlight_update_status(struct backlight_device *bd)
+{
+ struct dp_aux_backlight *bl = bl_get_data(bd);
+ u16 brightness = backlight_get_brightness(bd);
+ int ret = 0;
+
+ if (!backlight_is_blank(bd)) {
+ if (!bl->enabled) {
+ drm_edp_backlight_enable(bl->aux, &bl->info, brightness);
+ bl->enabled = true;
+ return 0;
+ }
+ ret = drm_edp_backlight_set_level(bl->aux, &bl->info,
brightness);
+ } else {
+ if (bl->enabled) {
+ drm_edp_backlight_disable(bl->aux, &bl->info);
+ bl->enabled = false;
+ }
+ }
+
+ return ret;
+}
+
+static const struct backlight_ops dp_aux_bl_ops = {
+ .update_status = dp_aux_backlight_update_status,
+};
+
+/**
+ * drm_panel_dp_aux_backlight - create and use DP AUX backlight
+ * @panel: DRM panel
+ * @aux: The DP AUX channel to use
+ *
+ * Use this function to create and handle backlight if your panel
+ * supports backlight control over DP AUX channel using DPCD
+ * registers as per VESA's standard backlight control interface.
+ *
+ * When the panel is enabled backlight will be enabled after a
+ * successful call to &drm_panel_funcs.enable()
+ *
+ * When the panel is disabled backlight will be disabled before the
+ * call to &drm_panel_funcs.disable().
+ *
+ * A typical implementation for a panel driver supporting backlight
+ * control over DP AUX will call this function at probe time.
+ * Backlight will then be handled transparently without requiring
+ * any intervention from the driver.
+ *
+ * drm_panel_dp_aux_backlight() must be called after the call to
drm_panel_init().
+ *
+ * Return: 0 on success or a negative error code on failure.
+ */
+int drm_panel_dp_aux_backlight(struct drm_panel *panel, struct
drm_dp_aux *aux)
+{
+ struct dp_aux_backlight *bl;
+ struct backlight_properties props = { 0 };
+ u16 current_level;
+ u8 current_mode;
+ u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
+ int ret;
+
+ if (!panel || !panel->dev || !aux)
+ return -EINVAL;
+
+ ret = drm_dp_dpcd_read(aux, DP_EDP_DPCD_REV, edp_dpcd,
+ EDP_DISPLAY_CTL_CAP_SIZE);
This creates a cyclic dependency between drm_kms_helper-ko and drm.ko.
drm_panel.c is in the latter, while drm_dp_dpcd_read() in
drm_dp_helper.c is in the former. Please fix.
FYI, build DRM as modules and the error shows up during make module_install.
Best regards
Thomas
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer
From: Doug Anderson <dianders@chromium.org> Date: 2021-07-12 13:46:01
Hi,
On Mon, Jul 12, 2021 at 2:41 AM Thomas Zimmermann [off-list ref] wrote:
quoted
+ ret = drm_dp_dpcd_read(aux, DP_EDP_DPCD_REV, edp_dpcd,
+ EDP_DISPLAY_CTL_CAP_SIZE);
This creates a cyclic dependency between drm_kms_helper-ko and drm.ko.
drm_panel.c is in the latter, while drm_dp_dpcd_read() in
drm_dp_helper.c is in the former. Please fix.
From: Doug Anderson <dianders@chromium.org> Date: 2021-07-12 15:04:11
Hi,
On Mon, Jul 12, 2021 at 6:39 AM Doug Anderson [off-list ref] wrote:
Hi,
On Mon, Jul 12, 2021 at 2:41 AM Thomas Zimmermann [off-list ref] wrote:
quoted
quoted
+ ret = drm_dp_dpcd_read(aux, DP_EDP_DPCD_REV, edp_dpcd,
+ EDP_DISPLAY_CTL_CAP_SIZE);
This creates a cyclic dependency between drm_kms_helper-ko and drm.ko.
drm_panel.c is in the latter, while drm_dp_dpcd_read() in
drm_dp_helper.c is in the former. Please fix.