From: Daniel Vetter <daniel@ffwll.ch>
To: Jitao Shi <jitao.shi@mediatek.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Sam Ravnborg <sam@ravnborg.org>, David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Matthias Brugger <matthias.bgg@gmail.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com,
yingjoe.chen@mediatek.com, eddie.huang@mediatek.com,
cawa.cheng@mediatek.com, bibby.hsieh@mediatek.com,
ck.hu@mediatek.com, stonea168@163.com
Subject: Re: [PATCH v2 1/3] drm/panel: seperate panel power control from panel prepare/unprepare
Date: Tue, 10 Aug 2021 12:18:37 +0200 [thread overview]
Message-ID: <YRJSfdsAv9gZCO2R@phenom.ffwll.local> (raw)
In-Reply-To: <20210808125218.63029-2-jitao.shi@mediatek.com>
On Sun, Aug 08, 2021 at 08:52:16PM +0800, Jitao Shi wrote:
> Some dsi panels require the dsi lanes keeping low before panel power
> on. So seperate the panel power control and the communication with panel.
>
> And put the power control in drm_panel_prepare_power and
> drm_panel_unprepare_power. Put the communication with panel in
> drm_panel_prepare and drm_panel_unprepare.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
This solves your problem, but it breaks the panel standard for everyone
else since you're not converting them over.
There needs to be more thought here in how to make this all compatible.
Also I think we need very precise spec for how this is supposed to work
with DSI panels, and then making sure existing drivers mostly follow this.
Hacking up a shared interface that's used by lots of drivers just to then
fix a bug in one user and one implementation is not good.
-Daniel
> ---
> drivers/gpu/drm/bridge/panel.c | 17 +++++++++++++++
> drivers/gpu/drm/drm_panel.c | 38 ++++++++++++++++++++++++++++++++++
> include/drm/drm_bridge.h | 2 ++
> include/drm/drm_panel.h | 17 +++++++++++++++
> 4 files changed, 74 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c
> index c916f4b8907e..3a846ac8e24c 100644
> --- a/drivers/gpu/drm/bridge/panel.c
> +++ b/drivers/gpu/drm/bridge/panel.c
> @@ -137,6 +137,23 @@ static int panel_bridge_get_modes(struct drm_bridge *bridge,
> return drm_panel_get_modes(panel_bridge->panel, connector);
> }
>
> +int panel_bridge_prepare_power(struct drm_bridge *bridge)
> +{
> + struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
> +
> + return drm_panel_prepare_power(panel_bridge->panel);
> +}
> +EXPORT_SYMBOL(panel_bridge_prepare_power);
> +
> +int panel_bridge_unprepare_power(struct drm_bridge *bridge)
> +{
> + struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge);
> +
> + return drm_panel_unprepare_power(panel_bridge->panel);
> +}
> +EXPORT_SYMBOL(panel_bridge_unprepare_power);
> +
> +
> static const struct drm_bridge_funcs panel_bridge_bridge_funcs = {
> .attach = panel_bridge_attach,
> .detach = panel_bridge_detach,
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..7bb5185db17d 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -115,6 +115,24 @@ int drm_panel_prepare(struct drm_panel *panel)
> }
> EXPORT_SYMBOL(drm_panel_prepare);
>
> +/**
> + * drm_panel_prepare_power - power on a panel's power
> + * @panel: DRM panel
> + *
> + * Calling this function will enable power and deassert any reset signals to
> + * the panel.
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int drm_panel_prepare_power(struct drm_panel *panel)
> +{
> + if (panel && panel->funcs && panel->funcs->prepare_power)
> + return panel->funcs->prepare_power(panel);
> +
> + return panel ? -ENOSYS : -EINVAL;
> +}
> +EXPORT_SYMBOL(drm_panel_prepare_power);
> +
> /**
> * drm_panel_unprepare - power off a panel
> * @panel: DRM panel
> @@ -138,6 +156,26 @@ int drm_panel_unprepare(struct drm_panel *panel)
> }
> EXPORT_SYMBOL(drm_panel_unprepare);
>
> +/**
> + * drm_panel_unprepare_power - power off a panel
> + * @panel: DRM panel
> + *
> + * Calling this function will completely power off a panel (assert the panel's
> + * reset, turn off power supplies, ...). After this function has completed, it
> + * is usually no longer possible to communicate with the panel until another
> + * call to drm_panel_prepare_power and drm_panel_prepare().
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +int drm_panel_unprepare_power(struct drm_panel *panel)
> +{
> + if (panel && panel->funcs && panel->funcs->unprepare_power)
> + return panel->funcs->unprepare_power(panel);
> +
> + return panel ? -ENOSYS : -EINVAL;
> +}
> +EXPORT_SYMBOL(drm_panel_unprepare_power);
> +
> /**
> * drm_panel_enable - enable a panel
> * @panel: DRM panel
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 2195daa289d2..cc94c9da47d8 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -892,6 +892,8 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev,
> struct drm_panel *panel,
> u32 connector_type);
> struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge);
> +int panel_bridge_prepare_power(struct drm_bridge *bridge);
> +int panel_bridge_unprepare_power(struct drm_bridge *bridge);
> #endif
>
> #endif
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 33605c3f0eba..48e83712ad44 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -68,6 +68,13 @@ enum drm_panel_orientation;
> * functionality to enable/disable backlight.
> */
> struct drm_panel_funcs {
> + /**
> + * @prepare_power:
> + *
> + * Turn on panel power.
> + */
> + int (*prepare_power)(struct drm_panel *panel);
> +
> /**
> * @prepare:
> *
> @@ -115,6 +122,13 @@ struct drm_panel_funcs {
> int (*get_modes)(struct drm_panel *panel,
> struct drm_connector *connector);
>
> + /**
> + * @unprepare_power:
> + *
> + * Turn off panel_power.
> + */
> + int (*unprepare_power)(struct drm_panel *panel);
> +
> /**
> * @get_timings:
> *
> @@ -180,6 +194,9 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
> void drm_panel_add(struct drm_panel *panel);
> void drm_panel_remove(struct drm_panel *panel);
>
> +int drm_panel_prepare_power(struct drm_panel *panel);
> +int drm_panel_unprepare_power(struct drm_panel *panel);
> +
> int drm_panel_prepare(struct drm_panel *panel);
> int drm_panel_unprepare(struct drm_panel *panel);
>
> --
> 2.25.1
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2021-08-10 10:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-08 12:52 [PATCH v2 0/3] seperate panel power control from panel prepare/unprepare Jitao Shi
2021-08-08 12:52 ` [PATCH v2 1/3] drm/panel: " Jitao Shi
2021-08-10 10:18 ` Daniel Vetter [this message]
2021-08-08 12:52 ` [PATCH v2 2/3] drm/panel: boe-tv101wum-n16 seperate the panel power control Jitao Shi
2021-08-08 12:52 ` [PATCH v2 3/3] drm/mediatek: fine tune the dsi panel's power sequence Jitao Shi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YRJSfdsAv9gZCO2R@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=bibby.hsieh@mediatek.com \
--cc=cawa.cheng@mediatek.com \
--cc=ck.hu@mediatek.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eddie.huang@mediatek.com \
--cc=jitao.shi@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=sam@ravnborg.org \
--cc=srv_heupstream@mediatek.com \
--cc=stonea168@163.com \
--cc=thierry.reding@gmail.com \
--cc=yingjoe.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox