drm/panel: Remove unnecessary enabled/prepared state
Subsystems (3)
cover drm/panel: Remove unnecessary enabled/prepared state
A number of panel drivers track enabled/prepared state (I suspect to protect regulator refcounts). However, the atomic framework already ensures that prepare/unprepare and enable/disable calls are balanced. This series removes all independent tracking from the drivers and adds a WARNING to the core in case someone uses a panel with a legacy driver.
Sean Paul (10):
drm/panel: Keep track of enabled/prepared
drm/panel: vvx10f034n00: Remove enabled/prepared state drm/panel: lt070me05000: Remove enabled/prepared state drm/panel: lq101r1sx01: Remove enabled/prepared state drm/panel: otm8009a: Remove enabled state
drm/panel: otm8009a: Properly sequence [un]prepare with backlight drm/panel: 43wvf1g: Remove enabled/prepared state drm/panel: simple: Remove enabled/prepared state drm/panel: p079zca: Remove enabled/prepared state drm/panel: ls043t1le01: Remove enabled/prepared state
drivers/gpu/drm/drm_panel.c | 2 + drivers/gpu/drm/panel/panel-innolux-p079zca.c | 23 --------- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 23 --------- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 59 +++++++++++----------- .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 22 -------- drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 24 --------- drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 23 --------- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 23 --------- drivers/gpu/drm/panel/panel-simple.c | 24 --------- include/drm/drm_panel.h | 38 ++++++++++++-- 10 files changed, 65 insertions(+), 196 deletions(-)
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/10 drm/panel: Keep track of enabled/prepared
This patch adds state tracking to the drm_panel functions which keep track of enabled and prepared. If the calls are unbalanced, a WARNING is issued.
The motivation for this change is that a number of panel drivers (including panel-simple) all do this to protect their regulator refcounts. The atomic framework ensures the calls are balanced, and there aren't any panel drivers being used by legacy drivers. As such, these checks are useless, but let's add a WARNING just in case something crazy happens (like a legacy driver using a panel).
Less code == better.
--- drivers/gpu/drm/drm_panel.c | 2 ++ include/drm/drm_panel.h | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_panel.c +2 -0
@@ -48,6 +48,8 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel) {INIT_LIST_HEAD (&panel->list); + panel->enabled = false; + panel->prepared = false; }EXPORT_SYMBOL (drm_panel_init);
include/drm/drm_panel.h +34 -4
@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/bug.h> #include <linux/errno.h> #include <linux/list.h>
@@ -84,6 +85,8 @@ struct drm_panel_funcs {* @dev: parent device of the panel * @funcs: operations that can be performed on the panel * @list: panel entry in registry +* @enabled: keeps track of the panel enabled status +* @prepared: keeps track of the panel prepared status */ struct drm_panel {struct drm_device *drm;
@@ -93,6 +96,9 @@ struct drm_panel {const struct drm_panel_funcs *funcs;struct list_head list; + +bool enabled; +bool prepared; };/**
@@ -104,12 +110,18 @@ struct drm_panel {* is usually no longer possible to communicate with the panel until another * call to drm_panel_prepare(). * +* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->unprepare) +if (panel && panel->funcs && panel->funcs->unprepare) { +WARN_ON (!panel->prepared); + panel->prepared = false;return panel->funcs->unprepare (panel); + }return panel ? -ENOSYS : -EINVAL ; }
@@ -122,12 +134,18 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)* drivers. For smart panels it should still be possible to communicate with * the integrated circuitry via any command bus after this call. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_disable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->disable) +if (panel && panel->funcs && panel->funcs->disable) { +WARN_ON (!panel->enabled); + panel->enabled = false;return panel->funcs->disable (panel); + }return panel ? -ENOSYS : -EINVAL ; }
@@ -140,12 +158,18 @@ static inline int drm_panel_disable(struct drm_panel *panel)* the panel. After this has completed it is possible to communicate with any * integrated circuitry via a command bus. * +* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_prepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->prepare) +if (panel && panel->funcs && panel->funcs->prepare) { +WARN_ON (panel->prepared); + panel->prepared = true;return panel->funcs->prepare (panel); + }return panel ? -ENOSYS : -EINVAL ; }
@@ -158,12 +182,18 @@ static inline int drm_panel_prepare(struct drm_panel *panel)* and the backlight to be enabled. Content will be visible on screen after * this call completes. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_enable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->enable) +if (panel && panel->funcs && panel->funcs->enable) { +WARN_ON (panel->enabled); + panel->enabled = true;return panel->funcs->enable (panel); + }return panel ? -ENOSYS : -EINVAL ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/10] drm/panel: Keep track of enabled/prepared
Quoted 11 lines · Sean Paul
This patch adds state tracking to the
drm_panelfunctions which keep track of enabled and prepared. If the calls are unbalanced, a WARNING is issued.The motivation for this change is that a number of panel drivers (including panel-simple) all do this to protect their regulator refcounts. The atomic framework ensures the calls are balanced, and there aren't any panel drivers being used by legacy drivers. As such, these checks are useless, but let's add a WARNING just in case something crazy happens (like a legacy driver using a panel).
Quoted 3 lines
Less code == better.
Signed-off-by Sean Paul <[email protected]>
I wonder if the tracking is needed at all, panels power states are usually the same as states of encoders they are connected to. But it is just remark to consider, no strong opposition :)
Quoted 53 lines
--- drivers/gpu/drm/drm_panel.c | 2 ++ include/drm/drm_panel.h | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_panel.c +2
-0@@ -48,6 +48,8 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel) {INIT_LIST_HEAD (&panel->list); + panel->enabled = false; + panel->prepared = false; }EXPORT_SYMBOL (drm_panel_init);include/drm/drm_panel.h +6
-0@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/bug.h> #include <linux/errno.h> #include <linux/list.h> @@ -84,6 +85,8 @@ struct drm_panel_funcs {* @dev: parent device of the panel * @funcs: operations that can be performed on the panel * @list: panel entry in registry +* @enabled: keeps track of the panel enabled status +* @prepared: keeps track of the panel prepared status */ struct drm_panel {struct drm_device *drm;@@ -93,6 +96,9 @@ struct drm_panel {const struct drm_panel_funcs *funcs;struct list_head list; + +bool enabled; +bool prepared; };/** @@ -104,12 +110,18 @@ struct drm_panel {* is usually no longer possible to communicate with the panel until another * call to drm_panel_prepare(). *
include/drm/drm_panel.h struct drm_panel { · line 121
Quoted 10 lines
include/drm/drm_panel.h +5
-1+* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->unprepare) +if (panel && panel->funcs && panel->funcs->unprepare) { +WARN_ON (!panel->prepared);
WARN_ON(!panel->prepared || panel->enabled);
Similar double checks should be used in other places.
include/drm/drm_panel.h struct drm_panel { · line 123
Quoted 2 lines
include/drm/drm_panel.h +1
-0+ panel->prepared = false;return panel->funcs->unprepare (panel);
ret = panel->funcs->unprepare(panel);
if (!ret)
panel->prepared = false;
return ret;
Again this pattern should be repeated in other places.
Different thing is meaning of unsuccessful unprepare/disable? But this is other issue.
include/drm/drm_panel.h struct drm_panel { · line 126
Quoted 3 lines
include/drm/drm_panel.h +1
-0+ }return panel ? -ENOSYS : -EINVAL ;
I think tracking should be performed also for no-op case.
Regards
Andrzej
Quoted 51 lines
include/drm/drm_panel.h +17
-2}@@ -122,12 +134,18 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)* drivers. For smart panels it should still be possible to communicate with * the integrated circuitry via any command bus after this call. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_disable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->disable) +if (panel && panel->funcs && panel->funcs->disable) { +WARN_ON (!panel->enabled); + panel->enabled = false;return panel->funcs->disable (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -140,12 +158,18 @@ static inline int drm_panel_disable(struct drm_panel *panel)* the panel. After this has completed it is possible to communicate with any * integrated circuitry via a command bus. * +* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_prepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->prepare) +if (panel && panel->funcs && panel->funcs->prepare) { +WARN_ON (panel->prepared); + panel->prepared = true;return panel->funcs->prepare (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -158,12 +182,18 @@ static inline int drm_panel_prepare(struct drm_panel *panel)* and the backlight to be enabled. Content will be visible on screen after * this call completes. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_enable (struct drm_panel *panel)
include/drm/drm_panel.h static inline int drm_panel_prepare(struct drm_panel *panel) · line 199
Quoted 10 lines
include/drm/drm_panel.h +4
-1{ -if (panel && panel->funcs && panel->funcs->enable) +if (panel && panel->funcs && panel->funcs->enable) { +WARN_ON (panel->enabled); + panel->enabled = true;return panel->funcs->enable (panel); + }return panel ? -ENOSYS : -EINVAL ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/10] drm/panel: Keep track of enabled/prepared
Quoted 61 lines · Andrzej Hajda
Quoted 11 lines · Sean Paul
This patch adds state tracking to the
drm_panelfunctions which keep track of enabled and prepared. If the calls are unbalanced, a WARNING is issued.The motivation for this change is that a number of panel drivers (including panel-simple) all do this to protect their regulator refcounts. The atomic framework ensures the calls are balanced, and there aren't any panel drivers being used by legacy drivers. As such, these checks are useless, but let's add a WARNING just in case something crazy happens (like a legacy driver using a panel).
Quoted 3 lines
Less code == better.
Signed-off-by Sean Paul <[email protected]>I wonder if the tracking is needed at all, panels power states are usually the same as states of encoders they are connected to. But it is just remark to consider, no strong opposition :)
Quoted 42 lines
--- drivers/gpu/drm/drm_panel.c | 2 ++ include/drm/drm_panel.h | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_panel.c +2
-0@@ -48,6 +48,8 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel) {INIT_LIST_HEAD (&panel->list); + panel->enabled = false; + panel->prepared = false; }EXPORT_SYMBOL (drm_panel_init);include/drm/drm_panel.h +3
-0@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/bug.h> #include <linux/errno.h> #include <linux/list.h> @@ -84,6 +85,8 @@ struct drm_panel_funcs {* @dev: parent device of the panel * @funcs: operations that can be performed on the panel * @list: panel entry in registry +* @enabled: keeps track of the panel enabled status +* @prepared: keeps track of the panel prepared status */ struct drm_panel {struct drm_device *drm;@@ -93,6 +96,9 @@ struct drm_panel {const struct drm_panel_funcs *funcs;
Quoted 4 lines
include/drm/drm_panel.h struct drm_panel { · line 101
Quoted 4 lines
include/drm/drm_panel.h +3
-0struct list_head list; + +bool enabled; +bool prepared;
I think better would be to use enum {disabled, prepared, enabled} here, the checks will be more readable, and will fit better to panel state machine :), just to consider.
Regards
Andrzej
Quoted 100 lines
Quoted 7 lines
include/drm/drm_panel.h +0
-0};/** @@ -104,12 +110,18 @@ struct drm_panel {* is usually no longer possible to communicate with the panel until another * call to drm_panel_prepare(). * include/drm/drm_panel.h struct drm_panel { · line 121
Quoted 10 lines
include/drm/drm_panel.h +5
-1+* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->unprepare) +if (panel && panel->funcs && panel->funcs->unprepare) { +WARN_ON (!panel->prepared);
WARN_ON(!panel->prepared || panel->enabled);Similar double checks should be used in other places.
include/drm/drm_panel.h struct drm_panel { · line 123
Quoted 2 lines
include/drm/drm_panel.h +1
-0+ panel->prepared = false;return panel->funcs->unprepare (panel);ret =
panel->funcs->unprepare(panel);
if (!ret)panel->prepared = false;return ret;
Again this pattern should be repeated in other places.
Different thing is meaning of unsuccessful unprepare/disable? But this is other issue.
include/drm/drm_panel.h struct drm_panel { · line 126
Quoted 3 lines
include/drm/drm_panel.h +1
-0+ }return panel ? -ENOSYS : -EINVAL ;I think tracking should be performed also for no-op case.
Regards
AndrzejQuoted 59 lines
include/drm/drm_panel.h +21
-3}@@ -122,12 +134,18 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)* drivers. For smart panels it should still be possible to communicate with * the integrated circuitry via any command bus after this call. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_disable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->disable) +if (panel && panel->funcs && panel->funcs->disable) { +WARN_ON (!panel->enabled); + panel->enabled = false;return panel->funcs->disable (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -140,12 +158,18 @@ static inline int drm_panel_disable(struct drm_panel *panel)* the panel. After this has completed it is possible to communicate with any * integrated circuitry via a command bus. * +* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_prepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->prepare) +if (panel && panel->funcs && panel->funcs->prepare) { +WARN_ON (panel->prepared); + panel->prepared = true;return panel->funcs->prepare (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -158,12 +182,18 @@ static inline int drm_panel_prepare(struct drm_panel *panel)* and the backlight to be enabled. Content will be visible on screen after * this call completes. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_enable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->enable) +if (panel && panel->funcs && panel->funcs->enable) { +WARN_ON (panel->enabled); + panel->enabled = true;return panel->funcs->enable (panel); + }
Quoted 3 lines
include/drm/drm_panel.h static inline int drm_panel_prepare(struct drm_panel *panel) · line 199
Quoted 2 lines
include/drm/drm_panel.h +0
-0return panel ? -ENOSYS : -EINVAL ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/10] drm/panel: Keep track of enabled/prepared
In reply to Andrzej HajdaQuoted 86 lines · Andrzej Hajda
Quoted 11 lines · Sean Paul
This patch adds state tracking to the
drm_panelfunctions which keep track of enabled and prepared. If the calls are unbalanced, a WARNING is issued.The motivation for this change is that a number of panel drivers (including panel-simple) all do this to protect their regulator refcounts. The atomic framework ensures the calls are balanced, and there aren't any panel drivers being used by legacy drivers. As such, these checks are useless, but let's add a WARNING just in case something crazy happens (like a legacy driver using a panel).
Quoted 3 lines
Less code == better.
Signed-off-by Sean Paul <[email protected]>I wonder if the tracking is needed at all, panels power states are usually the same as states of encoders they are connected to. But it is just remark to consider, no strong opposition :)
Quoted 53 lines
--- drivers/gpu/drm/drm_panel.c | 2 ++ include/drm/drm_panel.h | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_panel.c +2
-0@@ -48,6 +48,8 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel) {INIT_LIST_HEAD (&panel->list); + panel->enabled = false; + panel->prepared = false; }EXPORT_SYMBOL (drm_panel_init);include/drm/drm_panel.h +6
-0@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/bug.h> #include <linux/errno.h> #include <linux/list.h> @@ -84,6 +85,8 @@ struct drm_panel_funcs {* @dev: parent device of the panel * @funcs: operations that can be performed on the panel * @list: panel entry in registry +* @enabled: keeps track of the panel enabled status +* @prepared: keeps track of the panel prepared status */ struct drm_panel {struct drm_device *drm;@@ -93,6 +96,9 @@ struct drm_panel {const struct drm_panel_funcs *funcs;struct list_head list; + +bool enabled; +bool prepared; };/** @@ -104,12 +110,18 @@ struct drm_panel {* is usually no longer possible to communicate with the panel until another * call to drm_panel_prepare(). * include/drm/drm_panel.h struct drm_panel { · line 121
Quoted 10 lines
include/drm/drm_panel.h +5
-1+* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->unprepare) +if (panel && panel->funcs && panel->funcs->unprepare) { +WARN_ON (!panel->prepared);
WARN_ON(!panel->prepared || panel->enabled);
Quoted 1 line
Similar double checks should be used in other places.
I like this idea! I feel like I've seen enough drivers that didn't balance prepare/unprepare and enable/disable because for their one panel they supported it didn't matter.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 01/10] drm/panel: Keep track of enabled/prepared
In reply to Andrzej HajdaQuoted 12 lines · Andrzej Hajda
Quoted 11 lines · Sean Paul
This patch adds state tracking to the
drm_panelfunctions which keep track of enabled and prepared. If the calls are unbalanced, a WARNING is issued.The motivation for this change is that a number of panel drivers (including panel-simple) all do this to protect their regulator refcounts. The atomic framework ensures the calls are balanced, and there aren't any panel drivers being used by legacy drivers. As such, these checks are useless, but let's add a WARNING just in case something crazy happens (like a legacy driver using a panel).
Quoted 7 lines
Quoted 3 lines
Less code == better.
Signed-off-by Sean Paul <[email protected]>I wonder if the tracking is needed at all, panels power states are usually the same as states of encoders they are connected to. But it is just remark to consider, no strong opposition :)
The tracking is just so that the drm-panel wrappers can appropriately WARN_ON for drivers which get this wrong. Which I think makes sense, since drm-panel needs to be glued into the driver manually in many cases (anyone not using panel-bridge really).
I'd ack the entire series, but I'm still suffering from jetlag so this is probably not a good idea yet. If it's not yet reviewed, feel free to ping me in a few days ...
-Daniel
Quoted 158 lines
Quoted 54 lines
--- drivers/gpu/drm/drm_panel.c | 2 ++ include/drm/drm_panel.h | 38 ++++++++++++++++++++++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-)drivers/gpu/drm/drm_panel.c +2
-0@@ -48,6 +48,8 @@ static LIST_HEAD(panel_list);void drm_panel_init (struct drm_panel *panel) {INIT_LIST_HEAD (&panel->list); + panel->enabled = false; + panel->prepared = false; }EXPORT_SYMBOL (drm_panel_init);include/drm/drm_panel.h +6
-0@@ -24,6 +24,7 @@#ifndef __DRM_PANEL_H__#define __DRM_PANEL_H__ +#include <linux/bug.h> #include <linux/errno.h> #include <linux/list.h> @@ -84,6 +85,8 @@ struct drm_panel_funcs {* @dev: parent device of the panel * @funcs: operations that can be performed on the panel * @list: panel entry in registry +* @enabled: keeps track of the panel enabled status +* @prepared: keeps track of the panel prepared status */ struct drm_panel {struct drm_device *drm;@@ -93,6 +96,9 @@ struct drm_panel {const struct drm_panel_funcs *funcs;struct list_head list; + +bool enabled; +bool prepared; };/** @@ -104,12 +110,18 @@ struct drm_panel {* is usually no longer possible to communicate with the panel until another * call to drm_panel_prepare(). * include/drm/drm_panel.h struct drm_panel { · line 121
Quoted 10 lines
include/drm/drm_panel.h +5
-1+* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_unprepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->unprepare) +if (panel && panel->funcs && panel->funcs->unprepare) { +WARN_ON (!panel->prepared);
WARN_ON(!panel->prepared || panel->enabled);Similar double checks should be used in other places.
include/drm/drm_panel.h struct drm_panel { · line 123
Quoted 2 lines
include/drm/drm_panel.h +1
-0+ panel->prepared = false;return panel->funcs->unprepare (panel);ret =
panel->funcs->unprepare(panel);
if (!ret)panel->prepared = false;return ret;
Again this pattern should be repeated in other places.
Different thing is meaning of unsuccessful unprepare/disable? But this is other issue.
include/drm/drm_panel.h struct drm_panel { · line 126
Quoted 3 lines
include/drm/drm_panel.h +1
-0+ }return panel ? -ENOSYS : -EINVAL ;I think tracking should be performed also for no-op case.
Regards
AndrzejQuoted 51 lines
include/drm/drm_panel.h +17
-2}@@ -122,12 +134,18 @@ static inline int drm_panel_unprepare(struct drm_panel *panel)* drivers. For smart panels it should still be possible to communicate with * the integrated circuitry via any command bus after this call. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_disable (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->disable) +if (panel && panel->funcs && panel->funcs->disable) { +WARN_ON (!panel->enabled); + panel->enabled = false;return panel->funcs->disable (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -140,12 +158,18 @@ static inline int drm_panel_disable(struct drm_panel *panel)* the panel. After this has completed it is possible to communicate with any * integrated circuitry via a command bus. * +* Atomic framework should ensure that prepare/unprepare are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_prepare (struct drm_panel *panel) { -if (panel && panel->funcs && panel->funcs->prepare) +if (panel && panel->funcs && panel->funcs->prepare) { +WARN_ON (panel->prepared); + panel->prepared = true;return panel->funcs->prepare (panel); + }return panel ? -ENOSYS : -EINVAL ; }@@ -158,12 +182,18 @@ static inline int drm_panel_prepare(struct drm_panel *panel)* and the backlight to be enabled. Content will be visible on screen after * this call completes. * +* Atomic framework should ensure that enable/disable are properly balanced. +* If this is not the case, a WARNING will be issued. +* * Return: 0 on success or a negative error code on failure. */ static inline int drm_panel_enable (struct drm_panel *panel)include/drm/drm_panel.h static inline int drm_panel_prepare(struct drm_panel *panel) · line 199
Quoted 10 lines
include/drm/drm_panel.h +4
-1{ -if (panel && panel->funcs && panel->funcs->enable) +if (panel && panel->funcs && panel->funcs->enable) { +WARN_ON (panel->enabled); + panel->enabled = true;return panel->funcs->enable (panel); + }return panel ? -ENOSYS : -EINVAL ; }_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/10 drm/panel: vvx10f034n00: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced.
--- .../gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +0 -22
@@ -44,9 +44,6 @@ struct wuxga_nt_panel {struct backlight_device *backlight;struct regulator *supply; -bool prepared; -bool enabled; -ktime_t earliest_wake;const struct drm_display_mode *mode;
@@ -73,9 +70,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel) {struct wuxga_nt_panel *wuxga_nt =to_wuxga_nt_panel (panel); -if (!wuxga_nt->enabled) -return 0 ; -mipi_dsi_shutdown_peripheral (wuxga_nt->dsi);if (wuxga_nt->backlight) {
@@ -84,8 +78,6 @@ static int wuxga_nt_panel_disable(struct drm_panel *panel)backlight_update_status (wuxga_nt->backlight); } - wuxga_nt->enabled = false; -return 0 ; }
@@ -93,12 +85,8 @@ static int wuxga_nt_panel_unprepare(struct drm_panel *panel) {struct wuxga_nt_panel *wuxga_nt =to_wuxga_nt_panel (panel); -if (!wuxga_nt->prepared) -return 0 ; -regulator_disable (wuxga_nt->supply); wuxga_nt->earliest_wake =ktime_add_ms (ktime_get_real (),MIN_POFF_MS ); - wuxga_nt->prepared = false;return 0 ; }
@@ -109,9 +97,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel)int ret;s64 enablewait; -if (wuxga_nt->prepared) -return 0 ; -/* * If the user re-enabled the panel before the required off-time then * we need to wait the remaining period before re-enabling regulator
@@ -141,8 +126,6 @@ static int wuxga_nt_panel_prepare(struct drm_panel *panel) goto poweroff; } - wuxga_nt->prepared = true; -return 0 ; poweroff:
@@ -155,17 +138,12 @@ static int wuxga_nt_panel_enable(struct drm_panel *panel) {struct wuxga_nt_panel *wuxga_nt =to_wuxga_nt_panel (panel); -if (wuxga_nt->enabled) -return 0 ; -if (wuxga_nt->backlight) { wuxga_nt->backlight->props.power =FB_BLANK_UNBLANK ; wuxga_nt->backlight->props.state &= ~BL_CORE_FBBLANK ;backlight_update_status (wuxga_nt->backlight); } - wuxga_nt->enabled = true; -return 0 ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/10 drm/panel: lt070me05000: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced.
--- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 23 ----------------------- 1 file changed, 23 deletions(-)
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +0 -23
@@ -50,9 +50,6 @@ struct jdi_panel {struct gpio_desc *dcdc_en_gpio;struct backlight_device *backlight; -bool prepared; -bool enabled; -const struct drm_display_mode *mode; };
@@ -189,14 +186,9 @@ static int jdi_panel_disable(struct drm_panel *panel) {struct jdi_panel *jdi =to_jdi_panel (panel); -if (!jdi->enabled) -return 0 ; - jdi->backlight->props.power =FB_BLANK_POWERDOWN ;backlight_update_status (jdi->backlight); - jdi->enabled = false; -return 0 ; }
@@ -206,9 +198,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel)struct device *dev = &jdi->dsi->dev;int ret; -if (!jdi->prepared) -return 0 ; -jdi_panel_off (jdi); ret =regulator_bulk_disable (ARRAY_SIZE (jdi->supplies), jdi->supplies);
@@ -221,8 +210,6 @@ static int jdi_panel_unprepare(struct drm_panel *panel)gpiod_set_value (jdi->dcdc_en_gpio,0 ); - jdi->prepared = false; -return 0 ; }
@@ -232,9 +219,6 @@ static int jdi_panel_prepare(struct drm_panel *panel)struct device *dev = &jdi->dsi->dev;int ret; -if (jdi->prepared) -return 0 ; - ret =regulator_bulk_enable (ARRAY_SIZE (jdi->supplies), jdi->supplies);if (ret <0 ) {dev_err (dev,"regulator enable failed, %d\n" , ret);
@@ -264,8 +248,6 @@ static int jdi_panel_prepare(struct drm_panel *panel) goto poweroff; } - jdi->prepared = true; -return 0 ; poweroff:
@@ -286,14 +268,9 @@ static int jdi_panel_enable(struct drm_panel *panel) {struct jdi_panel *jdi =to_jdi_panel (panel); -if (jdi->enabled) -return 0 ; - jdi->backlight->props.power =FB_BLANK_UNBLANK ;backlight_update_status (jdi->backlight); - jdi->enabled = true; -return 0 ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/10 drm/panel: lq101r1sx01: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced.
--- drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 23 ----------------------- 1 file changed, 23 deletions(-)
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +0 -23
@@ -28,9 +28,6 @@ struct sharp_panel {struct backlight_device *backlight;struct regulator *supply; -bool prepared; -bool enabled; -const struct drm_display_mode *mode; };
@@ -93,16 +90,11 @@ 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 ; }
@@ -111,9 +103,6 @@ static int sharp_panel_unprepare(struct drm_panel *panel)struct sharp_panel *sharp =to_sharp_panel (panel);int err; -if (!sharp->prepared) -return 0 ; -sharp_wait_frames (sharp,4 ); err =mipi_dsi_dcs_set_display_off (sharp->link1);
@@ -128,8 +117,6 @@ static int sharp_panel_unprepare(struct drm_panel *panel)regulator_disable (sharp->supply); - sharp->prepared = false; -return 0 ; }
@@ -173,9 +160,6 @@ static int sharp_panel_prepare(struct drm_panel *panel)u8 format =MIPI_DCS_PIXEL_FMT_24BIT ;int err; -if (sharp->prepared) -return 0 ; - err =regulator_enable (sharp->supply);if (err <0 )return err;
@@ -244,8 +228,6 @@ static int sharp_panel_prepare(struct drm_panel *panel) goto poweroff; } - sharp->prepared = true; -/* wait for 6 frames before continuing */ sharp_wait_frames (sharp,6 );
@@ -260,16 +242,11 @@ 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 ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/10 drm/panel: otm8009a: Remove enabled state
In reply to Sean PaulIt's not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced.
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 16 ---------------- 1 file changed, 16 deletions(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +0 -16
@@ -63,7 +63,6 @@ struct otm8009a {struct backlight_device *bl_dev;struct gpio_desc *reset_gpio;bool prepared; -bool enabled; };static const struct drm_display_mode default_mode = {
@@ -243,9 +242,6 @@ static int otm8009a_disable(struct drm_panel *panel)struct mipi_dsi_device *dsi =to_mipi_dsi_device (ctx->dev);int ret; -if (!ctx->enabled) -return 0 ;/* This is not an issue so we return 0 here */ -/* Power off the backlight. Note: end-user still controls brightness */ ctx->bl_dev->props.power =FB_BLANK_POWERDOWN ; ret =backlight_update_status (ctx->bl_dev);
@@ -262,8 +258,6 @@ static int otm8009a_disable(struct drm_panel *panel)msleep (120 ); - ctx->enabled = false; -return 0 ; }
@@ -316,15 +310,6 @@ static int otm8009a_prepare(struct drm_panel *panel)return 0 ; } -static int otm8009a_enable (struct drm_panel *panel) -{ -struct otm8009a *ctx =panel_to_otm8009a (panel); - - ctx->enabled = true; - -return 0 ; -} -static int otm8009a_get_modes (struct drm_panel *panel) {struct drm_display_mode *mode;
@@ -352,7 +337,6 @@ static const struct drm_panel_funcs otm8009a_drm_funcs = { .disable = otm8009a_disable, .unprepare = otm8009a_unprepare, .prepare = otm8009a_prepare, - .enable = otm8009a_enable, .get_modes = otm8009a_get_modes, };
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/10 drm/panel: otm8009a: Properly sequence [un]prepare with backlight
In reply to Sean PaulI noticed while removing the enabled flag that backlight update checks prepared in such a way that could race with hardware turning on/off. This patch adds a mutex to ensure these races don't happen.
In addition to the lock, this patch also renames prepared to initialized to better reflect what it means when used in the backlight hook.
--- drivers/gpu/drm/panel/panel-orisetech-otm8009a.c | 43 ++++++++++++++++-------- 1 file changed, 29 insertions(+), 14 deletions(-)
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c +29 -14
@@ -11,6 +11,7 @@#include <drm/drm_panel.h> #include <linux/backlight.h> #include <linux/gpio/consumer.h> +#include <linux/mutex.h> #include <video/mipi_display.h> #define DRV_NAME "orisetech_otm8009a"
@@ -62,7 +63,9 @@ struct otm8009a {struct drm_panel panel;struct backlight_device *bl_dev;struct gpio_desc *reset_gpio; -bool prepared; + +struct mutex lock; +bool initialized; };static const struct drm_display_mode default_mode = {
@@ -265,26 +268,30 @@ static int otm8009a_unprepare(struct drm_panel *panel) {struct otm8009a *ctx =panel_to_otm8009a (panel); -if (!ctx->prepared) -return 0 ; +mutex_lock (&ctx->lock); +if (!ctx->initialized) + goto out;if (ctx->reset_gpio) {gpiod_set_value_cansleep (ctx->reset_gpio,1 );msleep (20 ); } - ctx->prepared = false; + ctx->initialized = false; +out: +mutex_unlock (&ctx->lock);return 0 ; }static int otm8009a_prepare (struct drm_panel *panel) {struct otm8009a *ctx =panel_to_otm8009a (panel); -int ret; +int ret =0 ; -if (ctx->prepared) -return 0 ; +mutex_lock (&ctx->lock); +if (ctx->initialized) + goto out;if (ctx->reset_gpio) {gpiod_set_value_cansleep (ctx->reset_gpio,0 );
@@ -296,18 +303,20 @@ static int otm8009a_prepare(struct drm_panel *panel) ret =otm8009a_init_sequence (ctx);if (ret) -return ret; + goto out; - ctx->prepared = true; + ctx->initialized = true;/* * Power on the backlight. Note: end-user still controls brightness -* Note: ctx->prepared must be true before updating the backlight. +* Note: ctx->initialized must be true before updating the backlight. */ ctx->bl_dev->props.power =FB_BLANK_UNBLANK ;backlight_update_status (ctx->bl_dev); -return 0 ; +out: +mutex_unlock (&ctx->lock); +return ret; }static int otm8009a_get_modes (struct drm_panel *panel)
@@ -348,10 +357,13 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd) {struct otm8009a *ctx =bl_get_data (bd);u8 data[2 ]; +int ret =0 ; -if (!ctx->prepared) { +mutex_lock (&ctx->lock); +if (!ctx->initialized) {DRM_DEBUG ("lcd not ready yet for setting its backlight!\n" ); -return -ENXIO ; + ret = -ENXIO ; + goto out; }if (bd->props.power <=FB_BLANK_NORMAL ) {
@@ -375,7 +387,9 @@ static int otm8009a_backlight_update_status(struct backlight_device *bd) data[0 ] =MIPI_DCS_WRITE_CONTROL_DISPLAY ;otm8009a_dcs_write_buf (ctx, data,ARRAY_SIZE (data)); -return 0 ; +out: +mutex_unlock (&ctx->lock); +return ret; }static const struct backlight_ops otm8009a_backlight_ops = {
@@ -401,6 +415,7 @@ static int otm8009a_probe(struct mipi_dsi_device *dsi)mipi_dsi_set_drvdata (dsi, ctx); ctx->dev = dev; +mutex_init (&ctx->lock); dsi->lanes =2 ; dsi->format =MIPI_DSI_FMT_RGB888 ;
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/10 drm/panel: 43wvf1g: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced
--- drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 24 ------------------------ 1 file changed, 24 deletions(-)
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +0 -24
@@ -44,8 +44,6 @@ struct seiko_panel_desc {struct seiko_panel {struct drm_panel base; -bool prepared; -bool enabled;const struct seiko_panel_desc *desc;struct backlight_device *backlight;struct regulator *dvdd;
@@ -126,17 +124,12 @@ static int seiko_panel_disable(struct drm_panel *panel) {struct seiko_panel *p =to_seiko_panel (panel); -if (!p->enabled) -return 0 ; -if (p->backlight) { p->backlight->props.power =FB_BLANK_POWERDOWN ; p->backlight->props.state |=BL_CORE_FBBLANK ;backlight_update_status (p->backlight); } - p->enabled = false; -return 0 ; }
@@ -144,9 +137,6 @@ static int seiko_panel_unprepare(struct drm_panel *panel) {struct seiko_panel *p =to_seiko_panel (panel); -if (!p->prepared) -return 0 ; -regulator_disable (p->avdd);/* Add a 100ms delay as per the panel datasheet */
@@ -154,8 +144,6 @@ static int seiko_panel_unprepare(struct drm_panel *panel)regulator_disable (p->dvdd); - p->prepared = false; -return 0 ; }
@@ -164,9 +152,6 @@ static int seiko_panel_prepare(struct drm_panel *panel)struct seiko_panel *p =to_seiko_panel (panel);int err; -if (p->prepared) -return 0 ; - err =regulator_enable (p->dvdd);if (err <0 ) {dev_err (panel->dev,"failed to enable dvdd: %d\n" , err);
@@ -182,8 +167,6 @@ static int seiko_panel_prepare(struct drm_panel *panel) goto disable_dvdd; } - p->prepared = true; -return 0 ; disable_dvdd:
@@ -195,17 +178,12 @@ static int seiko_panel_enable(struct drm_panel *panel) {struct seiko_panel *p =to_seiko_panel (panel); -if (p->enabled) -return 0 ; -if (p->backlight) { p->backlight->props.state &= ~BL_CORE_FBBLANK ; p->backlight->props.power =FB_BLANK_UNBLANK ;backlight_update_status (p->backlight); } - p->enabled = true; -return 0 ; }
@@ -254,8 +232,6 @@ static int seiko_panel_probe(struct device *dev,if (!panel)return -ENOMEM ; - panel->enabled = false; - panel->prepared = false; panel->desc = desc; panel->dvdd =devm_regulator_get (dev,"dvdd" );
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/10 drm/panel: simple: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced
--- drivers/gpu/drm/panel/panel-simple.c | 24 ------------------------ 1 file changed, 24 deletions(-)
drivers/gpu/drm/panel/panel-simple.c +0 -24
@@ -77,8 +77,6 @@ struct panel_desc {struct panel_simple {struct drm_panel base; -bool prepared; -bool enabled;const struct panel_desc *desc;
@@ -163,9 +161,6 @@ static int panel_simple_disable(struct drm_panel *panel) {struct panel_simple *p =to_panel_simple (panel); -if (!p->enabled) -return 0 ; -if (p->backlight) { p->backlight->props.power =FB_BLANK_POWERDOWN ; p->backlight->props.state |=BL_CORE_FBBLANK ;
@@ -175,8 +170,6 @@ static int panel_simple_disable(struct drm_panel *panel)if (p->desc->delay.disable)msleep (p->desc->delay.disable); - p->enabled = false; -return 0 ; }
@@ -184,9 +177,6 @@ static int panel_simple_unprepare(struct drm_panel *panel) {struct panel_simple *p =to_panel_simple (panel); -if (!p->prepared) -return 0 ; -gpiod_set_value_cansleep (p->enable_gpio,0 );regulator_disable (p->supply);
@@ -194,8 +184,6 @@ static int panel_simple_unprepare(struct drm_panel *panel)if (p->desc->delay.unprepare)msleep (p->desc->delay.unprepare); - p->prepared = false; -return 0 ; }
@@ -204,9 +192,6 @@ static int panel_simple_prepare(struct drm_panel *panel)struct panel_simple *p =to_panel_simple (panel);int err; -if (p->prepared) -return 0 ; - err =regulator_enable (p->supply);if (err <0 ) {dev_err (panel->dev,"failed to enable supply: %d\n" , err);
@@ -218,8 +203,6 @@ static int panel_simple_prepare(struct drm_panel *panel)if (p->desc->delay.prepare)msleep (p->desc->delay.prepare); - p->prepared = true; -return 0 ; }
@@ -227,9 +210,6 @@ static int panel_simple_enable(struct drm_panel *panel) {struct panel_simple *p =to_panel_simple (panel); -if (p->enabled) -return 0 ; -if (p->desc->delay.enable)msleep (p->desc->delay.enable);
@@ -239,8 +219,6 @@ static int panel_simple_enable(struct drm_panel *panel)backlight_update_status (p->backlight); } - p->enabled = true; -return 0 ; }
@@ -301,8 +279,6 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)if (!panel)return -ENOMEM ; - panel->enabled = false; - panel->prepared = false; panel->desc = desc; panel->supply =devm_regulator_get (dev,"power" );
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/10 drm/panel: p079zca: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced
--- drivers/gpu/drm/panel/panel-innolux-p079zca.c | 23 ----------------------- 1 file changed, 23 deletions(-)
drivers/gpu/drm/panel/panel-innolux-p079zca.c +0 -23
@@ -27,9 +27,6 @@ struct innolux_panel {struct backlight_device *backlight;struct regulator *supply;struct gpio_desc *enable_gpio; - -bool prepared; -bool enabled; };static inline struct innolux_panel *to_innolux_panel (struct drm_panel *panel)
@@ -42,9 +39,6 @@ static int innolux_panel_disable(struct drm_panel *panel)struct innolux_panel *innolux =to_innolux_panel (panel);int err; -if (!innolux->enabled) -return 0 ; - innolux->backlight->props.power =FB_BLANK_POWERDOWN ;backlight_update_status (innolux->backlight);
@@ -53,8 +47,6 @@ static int innolux_panel_disable(struct drm_panel *panel)DRM_DEV_ERROR (panel->dev,"failed to set display off: %d\n" , err); - innolux->enabled = false; -return 0 ; }
@@ -63,9 +55,6 @@ static int innolux_panel_unprepare(struct drm_panel *panel)struct innolux_panel *innolux =to_innolux_panel (panel);int err; -if (!innolux->prepared) -return 0 ; - err =mipi_dsi_dcs_enter_sleep_mode (innolux->link);if (err <0 ) { DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
@@ -82,8 +71,6 @@ static int innolux_panel_unprepare(struct drm_panel *panel)if (err <0 )return err; - innolux->prepared = false; -return 0 ; }
@@ -92,9 +79,6 @@ static int innolux_panel_prepare(struct drm_panel *panel)struct innolux_panel *innolux =to_innolux_panel (panel);int err, regulator_err; -if (innolux->prepared) -return 0 ; -gpiod_set_value_cansleep (innolux->enable_gpio,0 ); err =regulator_enable (innolux->supply);
@@ -129,8 +113,6 @@ static int innolux_panel_prepare(struct drm_panel *panel)/* T7: 5ms */ usleep_range (5000 ,6000 ); - innolux->prepared = true; -return 0 ; poweroff:
@@ -148,9 +130,6 @@ static int innolux_panel_enable(struct drm_panel *panel)struct innolux_panel *innolux =to_innolux_panel (panel);int ret; -if (innolux->enabled) -return 0 ; - innolux->backlight->props.power =FB_BLANK_UNBLANK ; ret =backlight_update_status (innolux->backlight);if (ret) {
@@ -159,8 +138,6 @@ static int innolux_panel_enable(struct drm_panel *panel)return ret; } - innolux->enabled = true; -return 0 ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 10/10 drm/panel: ls043t1le01: Remove enabled/prepared state
In reply to Sean PaulThey're not necessary for atomic drivers, and drm_panel will WARN if the calls are unbalanced
--- drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 23 ----------------------- 1 file changed, 23 deletions(-)
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +0 -23
@@ -39,9 +39,6 @@ struct sharp_nt_panel {struct regulator *supply;struct gpio_desc *reset_gpio; -bool prepared; -bool enabled; -const struct drm_display_mode *mode; };
@@ -114,16 +111,11 @@ static int sharp_nt_panel_disable(struct drm_panel *panel) {struct sharp_nt_panel *sharp_nt =to_sharp_nt_panel (panel); -if (!sharp_nt->enabled) -return 0 ; -if (sharp_nt->backlight) { sharp_nt->backlight->props.power =FB_BLANK_POWERDOWN ;backlight_update_status (sharp_nt->backlight); } - sharp_nt->enabled = false; -return 0 ; }
@@ -132,9 +124,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)struct sharp_nt_panel *sharp_nt =to_sharp_nt_panel (panel);int ret; -if (!sharp_nt->prepared) -return 0 ; - ret =sharp_nt_panel_off (sharp_nt);if (ret <0 ) {dev_err (panel->dev,"failed to set panel off: %d\n" , ret);
@@ -145,8 +134,6 @@ static int sharp_nt_panel_unprepare(struct drm_panel *panel)if (sharp_nt->reset_gpio)gpiod_set_value (sharp_nt->reset_gpio,0 ); - sharp_nt->prepared = false; -return 0 ; }
@@ -155,9 +142,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel)struct sharp_nt_panel *sharp_nt =to_sharp_nt_panel (panel);int ret; -if (sharp_nt->prepared) -return 0 ; - ret =regulator_enable (sharp_nt->supply);if (ret <0 )return ret;
@@ -185,8 +169,6 @@ static int sharp_nt_panel_prepare(struct drm_panel *panel) goto poweroff; } - sharp_nt->prepared = true; -return 0 ; poweroff:
@@ -200,16 +182,11 @@ static int sharp_nt_panel_enable(struct drm_panel *panel) {struct sharp_nt_panel *sharp_nt =to_sharp_nt_panel (panel); -if (sharp_nt->enabled) -return 0 ; -if (sharp_nt->backlight) { sharp_nt->backlight->props.power =FB_BLANK_UNBLANK ;backlight_update_status (sharp_nt->backlight); } - sharp_nt->enabled = true; -return 0 ; }
Signature · 6 lines
2.14.1.821.g8fa685d3b7-goog _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel