From: Neil Armstrong <neil.armstrong@linaro.org>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Dave Stevenson <dave.stevenson@raspberrypi.com>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Robert Foss <rfoss@kernel.org>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Douglas Anderson <dianders@chromium.org>,
Rob Clark <robdclark@gmail.com>,
Abhinav Kumar <quic_abhinavk@quicinc.com>,
Sean Paul <sean@poorly.run>,
Marijn Suijten <marijn.suijten@somainline.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Jessica Zhang <quic_jesszhan@quicinc.com>
Cc: Marek Vasut <marex@denx.de>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org
Subject: Re: [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state
Date: Mon, 23 Oct 2023 09:35:04 +0200 [thread overview]
Message-ID: <d941462e-1ac8-4dce-bd09-ddb99d79578a@linaro.org> (raw)
In-Reply-To: <20231016165355.1327217-4-dmitry.baryshkov@linaro.org>
On 16/10/2023 18:53, Dmitry Baryshkov wrote:
> The MIPI DSI links do not fully fall into the DRM callbacks model. The
> drm_bridge_funcs abstraction. Instead of having just two states (off and
> on) the DSI hosts have separate LP-11 state. In this state the host is
> on, but the video stream is not yet enabled.
>
> Introduce API that allows DSI bridges / panels to control the DSI host
> power up state.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 31 +++++++++++++++++++++++++++++++
> include/drm/drm_mipi_dsi.h | 29 +++++++++++++++++++++++++----
> 2 files changed, 56 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 14201f73aab1..c467162cb7d8 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -428,6 +428,37 @@ int devm_mipi_dsi_attach(struct device *dev,
> }
> EXPORT_SYMBOL_GPL(devm_mipi_dsi_attach);
>
> +bool mipi_dsi_host_power_control_available(struct mipi_dsi_host *host)
> +{
> + const struct mipi_dsi_host_ops *ops = host->ops;
> +
> + return ops && ops->power_up;
> +}
> +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_control_available);
> +
> +int mipi_dsi_host_power_up(struct mipi_dsi_host *host)
> +{
> + const struct mipi_dsi_host_ops *ops = host->ops;
> +
> + if (!mipi_dsi_host_power_control_available(host))
> + return -EOPNOTSUPP;
> +
> + return ops->power_up ? ops->power_up(host) : 0;
> +}
> +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_up);
> +
> +void mipi_dsi_host_power_down(struct mipi_dsi_host *host)
> +{
> + const struct mipi_dsi_host_ops *ops = host->ops;
> +
> + if (!mipi_dsi_host_power_control_available(host))
> + return;
> +
> + if (ops->power_down)
> + ops->power_down(host);
> +}
> +EXPORT_SYMBOL_GPL(mipi_dsi_host_power_down);
> +
> static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi,
> struct mipi_dsi_msg *msg)
> {
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 167742e579e3..e503c3e4d057 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -68,6 +68,8 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
> * @attach: attach DSI device to DSI host
> * @detach: detach DSI device from DSI host
> * @transfer: transmit a DSI packet
> + * @power_up: enable DSI link and bring it to the LP-11 state
> + * @power_down: fully disable DSI link
> *
> * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg
> * structures. This structure contains information about the type of packet
> @@ -81,10 +83,18 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
> * function will seldomly return anything other than the number of bytes
> * contained in the transmit buffer on success.
> *
> - * Also note that those callbacks can be called no matter the state the
> - * host is in. Drivers that need the underlying device to be powered to
> - * perform these operations will first need to make sure it's been
> - * properly enabled.
> + * Note: currently there are two modes of DSI power control. Legacy drivers
> + * will call those callbacks no matter the state the host is in. DSI host
> + * drivers that need the underlying device to be powered to perform these
> + * operations will first need to make sure it's been properly enabled.
> + *
> + * Newer drivers will set the @MIPI_DSI_MANUAL_POWERUP flag to indicate that
> + * they will call @mipi_dsi_power_up() and @mipi_dsi_power_down() to control
> + * the link state of the DSI host or they will set @MIPI_DSI_AUTO_POWERUP to
> + * indicate that the driver is fine with the link being powered up in DSI
> + * host's (atomic_)pre_enable() callback and then being disabled in the
> + * (atomic_)post_disable() callback. The transfer callback must only be called
> + * if the DSI host has been powered up and was not brought down.
> *
> * Note: some hosts (sunxi) can not send LP commands between HS video
> * packets. Thus all DSI transfers sent in LP mode should be limited to the
> @@ -97,6 +107,8 @@ struct mipi_dsi_host_ops {
> struct mipi_dsi_device *dsi);
> ssize_t (*transfer)(struct mipi_dsi_host *host,
> const struct mipi_dsi_msg *msg);
> + int (*power_up)(struct mipi_dsi_host *host);
> + void (*power_down)(struct mipi_dsi_host *host);
> };
>
> /**
> @@ -143,6 +155,10 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
> #define MIPI_DSI_MODE_LPM BIT(11)
> /* transmit data ending at the same time for all lanes within one hsync */
> #define MIPI_DSI_HS_PKT_END_ALIGNED BIT(12)
> +/* DSI peripheral driver manually controls DSI link powerup */
> +#define MIPI_DSI_MANUAL_POWERUP BIT(13)
> +/* DSI peripheral driver is fine with automatic DSI link power control */
> +#define MIPI_DSI_AUTO_POWERUP BIT(14)
What happens if none of the bits are in the flags ?
Can't we implement "opportunistic power-up" on the first DSI command sent?
If a bridge/panel sends a DSI command, and if it happens before the DSI host enable, then
the DSI host will "pre-enable" the host and put the link in LP-11.
This would be simpler and would work whatever the pre_enable order.
But this won't work for the tc358767, except if we add a dummy DSI host command
which powers up the DSI link.
This won't fix the PS8640 either who also needs a disabled DSI link to initialize.
Neil
>
> enum mipi_dsi_pixel_format {
> MIPI_DSI_FMT_RGB888,
> @@ -235,6 +251,11 @@ void mipi_dsi_device_unregister(struct mipi_dsi_device *dsi);
> struct mipi_dsi_device *
> devm_mipi_dsi_device_register_full(struct device *dev, struct mipi_dsi_host *host,
> const struct mipi_dsi_device_info *info);
> +
> +bool mipi_dsi_host_power_control_available(struct mipi_dsi_host *host);
> +int mipi_dsi_host_power_up(struct mipi_dsi_host *host);
> +void mipi_dsi_host_power_down(struct mipi_dsi_host *host);
> +
> struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np);
> int mipi_dsi_attach(struct mipi_dsi_device *dsi);
> int mipi_dsi_detach(struct mipi_dsi_device *dsi);
next prev parent reply other threads:[~2023-10-23 7:35 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 16:53 [RFC PATCH 00/10] drm/mipi-dsi: another attempt at sorting out DSI link powerup Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 01/10] Revert "drm/bridge: tc358762: Split register programming from pre-enable to enable" Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 02/10] drm/mipi-dsi: document DSI hosts limitations Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state Dmitry Baryshkov
2023-10-19 9:26 ` Maxime Ripard
2023-10-19 11:19 ` Dmitry Baryshkov
2023-10-19 11:42 ` Alexander Stein
2023-10-22 10:49 ` Dmitry Baryshkov
2023-10-23 6:52 ` Alexander Stein
2023-10-23 7:34 ` Dmitry Baryshkov
2023-10-23 8:14 ` Alexander Stein
2023-10-23 8:40 ` Dmitry Baryshkov
2023-10-25 12:44 ` Maxime Ripard
2023-10-25 15:16 ` Dmitry Baryshkov
2023-10-26 8:04 ` Maxime Ripard
2023-10-26 8:41 ` Dmitry Baryshkov
2023-11-07 10:57 ` Maxime Ripard
2023-11-07 11:22 ` Greg Kroah-Hartman
2023-11-07 12:18 ` Maxime Ripard
2023-11-07 15:26 ` Greg Kroah-Hartman
2023-11-08 15:34 ` Maxime Ripard
2023-11-08 15:58 ` Laurent Pinchart
2023-11-29 8:57 ` Neil Armstrong
2023-11-27 16:06 ` Michael Walle
2023-11-28 16:49 ` Dmitry Baryshkov
2023-11-28 16:55 ` Michael Walle
2023-11-28 17:12 ` Dmitry Baryshkov
2023-11-28 19:50 ` Michael Walle
2023-11-28 20:23 ` Dmitry Baryshkov
2023-11-28 22:17 ` Michael Walle
2023-11-28 22:20 ` Michael Walle
2023-11-28 22:21 ` Dmitry Baryshkov
2023-11-28 22:44 ` Michael Walle
2023-10-23 7:35 ` Neil Armstrong [this message]
2023-10-23 7:40 ` Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 04/10] drm/msm/dsi: use dsi_mgr_bridge_power_off in dsi_mgr_bridge_post_disable Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 05/10] drm/msm/dsi: implement manual power control Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 06/10] drm/bridge: tc358762: add support for manual DSI " Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 07/10] drm/bridge: ps8640: require " Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 08/10] drm/bridge: lt9611: mark for automatic " Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 09/10] drm/bridge: lt9611uxc: implement " Dmitry Baryshkov
2023-10-16 16:53 ` [RFC PATCH 10/10] drm/msm/dsi: drop (again) the ps8640 workaround Dmitry Baryshkov
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=d941462e-1ac8-4dce-bd09-ddb99d79578a@linaro.org \
--to=neil.armstrong@linaro.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=daniel@ffwll.ch \
--cc=dave.stevenson@raspberrypi.com \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=marex@denx.de \
--cc=marijn.suijten@somainline.org \
--cc=mripard@kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_jesszhan@quicinc.com \
--cc=rfoss@kernel.org \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®