Message ID | 1406316130-4744-2-git-send-email-ajaykumar.rs@samsung.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
On Sat, Jul 26, 2014 at 12:52:03AM +0530, Ajay Kumar wrote: > Most of the panels need an init sequence as mentioned below: > -- poweron LCD unit/LCD_EN > -- start video data > -- poweron LED unit/BACKLIGHT_EN > And, a de-init sequence as mentioned below: > -- poweroff LED unit/BACKLIGHT_EN > -- stop video data > -- poweroff LCD unit/LCD_EN > With existing callbacks for drm panel, we cannot accomodate such panels, > since only two callbacks, i.e "panel_enable" and panel_disable are supported. > > This patch adds: > -- "prepare" callback which can be called before > the actual video data is on, and then call the "enable" > callback after the video data is available. > > -- "unprepare" callback which can be called after > the video data is off, and use "disable" callback > to do something before switching off the video data. > > Now, we can easily map the above scenario as shown below: > poweron LCD unit/LCD_EN = "prepare" callback > poweron LED unit/BACKLIGHT_EN = "enable" callback > poweroff LED unit/BACKLIGHT_EN = "disable" callback > poweroff LCD unit/LCD_EN = "unprepare" callback > > Also, a helper function for get_modes is added. > > Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> > --- > include/drm/drm_panel.h | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) I had already decided to apply an earlier version that you posted (I think the only difference was that it didn't have the inline implementation for drm_panel_get_modes() yet), reworded the commit message a little (to be less specific about LED, LCD and backlight units) and added some kerneldoc for struct drm_panel_funcs. What I propose is to merge that patch (I'll hopefully push it today so that it shows up in tomorrow's linux-next) and then apply a separate patch to add drm_panel_get_modes(). Do you have any objections to that? Thierry
On Wed, Jul 30, 2014 at 3:30 PM, Thierry Reding <thierry.reding@gmail.com> wrote: > On Sat, Jul 26, 2014 at 12:52:03AM +0530, Ajay Kumar wrote: >> Most of the panels need an init sequence as mentioned below: >> -- poweron LCD unit/LCD_EN >> -- start video data >> -- poweron LED unit/BACKLIGHT_EN >> And, a de-init sequence as mentioned below: >> -- poweroff LED unit/BACKLIGHT_EN >> -- stop video data >> -- poweroff LCD unit/LCD_EN >> With existing callbacks for drm panel, we cannot accomodate such panels, >> since only two callbacks, i.e "panel_enable" and panel_disable are supported. >> >> This patch adds: >> -- "prepare" callback which can be called before >> the actual video data is on, and then call the "enable" >> callback after the video data is available. >> >> -- "unprepare" callback which can be called after >> the video data is off, and use "disable" callback >> to do something before switching off the video data. >> >> Now, we can easily map the above scenario as shown below: >> poweron LCD unit/LCD_EN = "prepare" callback >> poweron LED unit/BACKLIGHT_EN = "enable" callback >> poweroff LED unit/BACKLIGHT_EN = "disable" callback >> poweroff LCD unit/LCD_EN = "unprepare" callback >> >> Also, a helper function for get_modes is added. >> >> Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> >> --- >> include/drm/drm_panel.h | 26 ++++++++++++++++++++++++++ >> 1 file changed, 26 insertions(+) > > I had already decided to apply an earlier version that you posted (I > think the only difference was that it didn't have the inline > implementation for drm_panel_get_modes() yet), reworded the commit > message a little (to be less specific about LED, LCD and backlight > units) and added some kerneldoc for struct drm_panel_funcs. > > What I propose is to merge that patch (I'll hopefully push it today so > that it shows up in tomorrow's linux-next) and then apply a separate > patch to add drm_panel_get_modes(). > > Do you have any objections to that? I am okay with that. drm_panel_get_modes() will come as a separate patch. Ajay
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index c2ab77a..efc63cc 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -31,7 +31,9 @@ struct drm_device; struct drm_panel; struct drm_panel_funcs { + int (*unprepare)(struct drm_panel *panel); int (*disable)(struct drm_panel *panel); + int (*prepare)(struct drm_panel *panel); int (*enable)(struct drm_panel *panel); int (*get_modes)(struct drm_panel *panel); }; @@ -46,6 +48,14 @@ struct drm_panel { struct list_head list; }; +static inline int drm_panel_unprepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->unprepare) + return panel->funcs->unprepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_disable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->disable) @@ -54,6 +64,14 @@ static inline int drm_panel_disable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_prepare(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->prepare) + return panel->funcs->prepare(panel); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_enable(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->enable) @@ -62,6 +80,14 @@ static inline int drm_panel_enable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_get_modes(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->get_modes) + return panel->funcs->get_modes(panel); + + return 0; +} + void drm_panel_init(struct drm_panel *panel); int drm_panel_add(struct drm_panel *panel);
Most of the panels need an init sequence as mentioned below: -- poweron LCD unit/LCD_EN -- start video data -- poweron LED unit/BACKLIGHT_EN And, a de-init sequence as mentioned below: -- poweroff LED unit/BACKLIGHT_EN -- stop video data -- poweroff LCD unit/LCD_EN With existing callbacks for drm panel, we cannot accomodate such panels, since only two callbacks, i.e "panel_enable" and panel_disable are supported. This patch adds: -- "prepare" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available. -- "unprepare" callback which can be called after the video data is off, and use "disable" callback to do something before switching off the video data. Now, we can easily map the above scenario as shown below: poweron LCD unit/LCD_EN = "prepare" callback poweron LED unit/BACKLIGHT_EN = "enable" callback poweroff LED unit/BACKLIGHT_EN = "disable" callback poweroff LCD unit/LCD_EN = "unprepare" callback Also, a helper function for get_modes is added. Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> --- include/drm/drm_panel.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)