Currently there are few pair of functions which are called during the panel enable/disable sequence. To improve the granularity, adding few more wrapper functions so that the functions are more specific on what they are doing. Cc: Thierry Reding <thierry.reding@xxxxxxxxx> Cc: David Airlie <airlied@xxxxxxxx> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxxx> Cc: Jani Nikula <jani.nikula@xxxxxxxxx> Signed-off-by: Deepak M <m.deepak@xxxxxxxxx> Signed-off-by: Gaurav K Singh <gaurav.k.singh@xxxxxxxxx> --- include/drm/drm_panel.h | 92 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 77 insertions(+), 15 deletions(-) diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 13ff44b..dadbcea 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -33,23 +33,33 @@ struct display_timing; /** * struct drm_panel_funcs - perform operations on a given panel - * @disable: disable panel (turn off back light, etc.) - * @unprepare: turn off panel - * @prepare: turn on panel and perform set up - * @enable: enable panel (turn on back light, etc.) + * @disable: disable panel + * @unprepare: uninitialize the panel + * @prepare: initialze the panel + * @enable: enable panel * @get_modes: add modes to the connector that the panel is attached to and * return the number of modes added * @get_timings: copy display timings into the provided array and return * the number of display timings available + * @power_on: powering on the panel + * @power_off: powering off the panel + * @backlight_on: turning on backlight + * @backlight_off: turning off backlight + * + * The .power_on function is called to turn on the panel and wait for it to + * become ready. * * The .prepare() function is typically called before the display controller - * starts to transmit video data. Panel drivers can use this to turn the panel - * on and wait for it to become ready. If additional configuration is required - * (via a control bus such as I2C, SPI or DSI for example) this is a good time - * to do that. + * starts to transmit video data. Panels will be iniatilzed during this call. + * If additional configuration is required (via a control bus such as I2C, + * SPI or DSI for example) this is a good time to do that. Some panels expects + * to wait and also to send some cmds before enabling the panel. + * + * The .enable() will typically enable the panel, some DSI panels need + * additional operations to opearte in differnt modes other than initalizing. * - * After the display controller has started transmitting video data, it's safe - * to call the .enable() function. This will typically enable the backlight to + * The .backlight_on() After the display controller has started transmitting + * video data, it's safe to turn on the panel backlight, which will * make the image on screen visible. Some panels require a certain amount of * time or frames before the image is displayed. This function is responsible * for taking this into account before enabling the backlight to avoid visual @@ -57,13 +67,20 @@ struct display_timing; * * Before stopping video transmission from the display controller it can be * necessary to turn off the panel to avoid visual glitches. This is done in - * the .disable() function. Analogously to .enable() this typically involves - * turning off the backlight and waiting for some time to make sure no image - * is visible on the panel. It is then safe for the display controller to - * cease transmission of video data. + * the .backlight_off() function, this typically involves turning off the + * backlight and waiting for some time to make sure no image is visible + * on the panel. + * + * .disable() function will cease transmission of video data. + * + * .unprepare() function will typically uninitalize the panel. * * To save power when no video data is transmitted, a driver can power down - * the panel. This is the job of the .unprepare() function. + * the panel. This is the job of the .power_off() function. + * + * The below sequence can be followed while calling these ops + * Enable : power_on(), prepare(), enable(), backlight_on() + * Disable : backlight_off(), disable(), unprepare(), power_off() */ struct drm_panel_funcs { int (*disable)(struct drm_panel *panel); @@ -73,6 +90,10 @@ struct drm_panel_funcs { int (*get_modes)(struct drm_panel *panel); int (*get_timings)(struct drm_panel *panel, unsigned int num_timings, struct display_timing *timings); + int (*power_on)(struct drm_panel *panel); + int (*power_off)(struct drm_panel *panel); + int (*backlight_on)(struct drm_panel *panel); + int (*backlight_off)(struct drm_panel *panel); }; struct drm_panel { @@ -117,6 +138,47 @@ static inline int drm_panel_enable(struct drm_panel *panel) return panel ? -ENOSYS : -EINVAL; } +static inline int drm_panel_power_on(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->power_on) + return panel->funcs->power_on(panel); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_power_off(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->power_off) + return panel->funcs->power_off(panel); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_backlight_on(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->backlight_on) + return panel->funcs->backlight_on(panel); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_backlight_off(struct drm_panel *panel) +{ + if (panel && panel->funcs && panel->funcs->backlight_off) + return panel->funcs->backlight_off(panel); + + return panel ? -ENOSYS : -EINVAL; +} + +static inline int drm_panel_get_info(struct drm_panel *panel, + struct drm_connector *connector) +{ + if (connector && panel && panel->funcs && panel->funcs->get_info) + return panel->funcs->get_info(panel, connector); + + return panel ? -ENOSYS : -EINVAL; +} + static inline int drm_panel_get_modes(struct drm_panel *panel) { if (panel && panel->funcs && panel->funcs->get_modes) -- 1.9.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel