From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Tomi Valkeinen <tomi.valkeinen-l0cyMroinI0@public.gmane.org>
Cc: David Airlie <airlied-cv59FeDIM0c@public.gmane.org>,
Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Archit Taneja <architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Neil Webb <neilw-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
Richard Sproul <sproul-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
Simon Hatliff <hatliff-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Cyprian Wronka <cwronka-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
Alan Douglas <adouglas-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org>,
Jyri Sarha <jsarha-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH v3 1/2] drm/bridge: Add Cadence DSI driver
Date: Wed, 20 Sep 2017 14:32:41 +0200 [thread overview]
Message-ID: <20170920143241.44a20bc6@bbrezillon> (raw)
In-Reply-To: <27834b62-664f-d403-6396-2339cb4fda1c-l0cyMroinI0@public.gmane.org>
On Wed, 20 Sep 2017 14:55:02 +0300
Tomi Valkeinen <tomi.valkeinen-l0cyMroinI0@public.gmane.org> wrote:
> Hi Boris,
>
>
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
>
> On 31/08/17 18:55, Boris Brezillon wrote:
> > Add a driver for Cadence DPI -> DSI bridge.
> >
> > This driver only support a subset of Cadence DSI bridge capabilities.
> >
> > Here is a non-exhaustive list of missing features:
> > * burst mode
> > * dynamic configuration of the DPHY based on the
> > * support for additional input interfaces (SDI input)
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> > ---
> > Changes in v3:
> > - replace magic values by real timing calculation. The DPHY PLL clock
> > is still hardcoded since we don't have a working DPHY block yet, and
> > this is the piece of HW we need to dynamically configure the PLL
> > rate based on the display refresh rate and the resolution.
> > - parse DSI devices represented with the OF-graph. This is needed to
> > support DSI devices controlled through an external bus like I2C or
> > SPI.
> > - use the DRM panel-bridge infrastructure to simplify the DRM panel
> > logic
> >
> > Changes in v2:
> > - rebase on v4.12-rc1 and adapt to driver to the drm_bridge API changes
> > - return the correct error when devm_clk_get(sysclk) fails
> > - add missing depends on OF and select DRM_PANEL in the Kconfig entry
> > ---
> > drivers/gpu/drm/bridge/Kconfig | 9 +
> > drivers/gpu/drm/bridge/Makefile | 1 +
> > drivers/gpu/drm/bridge/cdns-dsi.c | 1090 +++++++++++++++++++++++++++++++++++++
> > 3 files changed, 1100 insertions(+)
> > create mode 100644 drivers/gpu/drm/bridge/cdns-dsi.c
>
> We need some power management. At the moment the clocks are kept always
> enabled. Those need to be turned off when the IP is not used.
I can try to move the clk_prepare_enable/disable_unprepare() calls in
the bridge->enable/disable() hooks, but I'm not sure the DSI regs
content is kept when I disable dsi_p_clk.
>
> > +static irqreturn_t cdns_dsi_interrupt(int irq, void *data)
> > +{
> > + struct cdns_dsi *dsi = data;
> > + irqreturn_t ret = IRQ_NONE;
> > + u32 flag, ctl;
> > +
> > + flag = readl(dsi->regs + DIRECT_CMD_STS_FLAG);
> > + if (flag) {
> > + ctl = readl(dsi->regs + DIRECT_CMD_STS_CTL);
> > + ctl &= ~flag;
> > + writel(ctl, dsi->regs + DIRECT_CMD_STS_CTL);
>
> I presume it's the enable/disable bit in STS_CTL that prevents the
> interrupt from triggering again, instead of the status flag?
Yep.
> Just making
> sure, because I think on some IPs the status flag has been the one that
> triggers the interrupt.
>
> > + complete(&dsi->direct_cmd_comp);
> > + ret = IRQ_HANDLED;
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +static ssize_t cdns_dsi_transfer(struct mipi_dsi_host *host,
> > + const struct mipi_dsi_msg *msg)
> > +{
> > + struct cdns_dsi *dsi = to_cdns_dsi(host);
> > + u32 cmd, sts, val, wait = WRITE_COMPLETED, ctl = 0;
> > + struct mipi_dsi_packet packet;
> > + int ret, i, tx_len, rx_len;
> > +
> > + ret = mipi_dsi_create_packet(&packet, msg);
> > + if (ret)
> > + return ret;
> > +
> > + tx_len = msg->tx_buf ? msg->tx_len : 0;
> > + rx_len = msg->rx_buf ? msg->rx_len : 0;
> > +
> > + /* For read operations, the maximum TX len is 2. */
>
> Hmm, why is that?
I don't know, that's what is stated in the spec.
Excerpt from the CMD_SIZE field description:
"
For read operations, any value
written which is larger than 2
bytes will be ignored and the
command payload will be truncated
to 2 bytes.
"
>
> > + if (rx_len && tx_len > 2)
> > + return -ENOTSUPP;
> > +
> > + /* TX len is limited by the CMD FIFO depth. */
> > + if (tx_len > dsi->direct_cmd_fifo_depth)
> > + return -ENOTSUPP;
> > +
> > + /* RX len is limited by the RX FIFO depth. */
> > + if (rx_len > dsi->rx_fifo_depth)
> > + return -ENOTSUPP;
> > +
> > + cmd = CMD_SIZE(tx_len) | CMD_VCHAN_ID(msg->channel) |
> > + CMD_DATATYPE(msg->type);
> > +
> > + if (msg->flags & MIPI_DSI_MSG_USE_LPM)
> > + cmd |= CMD_LP_EN;
> > +
> > + if (mipi_dsi_packet_format_is_long(msg->type))
> > + cmd |= CMD_LONG;
> > +
> > + if (rx_len) {
> > + cmd |= READ_CMD;
> > + wait = READ_COMPLETED_WITH_ERR | READ_COMPLETED;
> > + ctl = READ_EN | BTA_EN;
> > + } else if (msg->flags & MIPI_DSI_MSG_REQ_ACK) {
> > + cmd |= BTA_REQ;
> > + wait = ACK_WITH_ERR_RCVD | ACK_RCVD;
> > + ctl = BTA_EN;
> > + }
>
> It's been a while since I worked with DSI, but... Shouldn't there be a
> check somewhere that the packet(s) can fit into the blanking intervals?
Hm, I'm not sure. DSI commands are usually sent when the encoder/bridge
is not transmitting video, so in this case we don't have any constraint
on the packet length. Also, it seems other drivers are not checking the
vblank timing constraint when sending commands so either it's handled in
HW and the controller is able to report invalid lengths or no one cared
enough to take this case into account.
Anyway, I'll ask Cadence engineers to know how they deal with this
video+command situation.
Thanks,
Boris
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-09-20 12:32 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170831155543epcas2p3003246c8d124c032c513a5fed2792992@epcas2p3.samsung.com>
2017-08-31 15:55 ` [PATCH v3 1/2] drm/bridge: Add Cadence DSI driver Boris Brezillon
2017-08-31 15:55 ` [PATCH v3 2/2] dt-bindings: drm/bridge: Document Cadence DSI bridge bindings Boris Brezillon
[not found] ` <20170831155519.3704-2-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2017-09-01 6:28 ` Andrzej Hajda
[not found] ` <3371dbd2-9539-d746-0982-71112d5d98a0-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-01 7:06 ` Boris Brezillon
2017-09-01 7:26 ` Andrzej Hajda
2017-09-12 16:03 ` Rob Herring
[not found] ` <20170831155519.3704-1-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2017-08-31 17:03 ` [PATCH v3 1/2] drm/bridge: Add Cadence DSI driver Eric Anholt
2017-09-01 6:20 ` Boris Brezillon
2017-09-01 18:32 ` Eric Anholt
2017-09-01 7:51 ` Andrzej Hajda
[not found] ` <6404fb07-9c42-78bf-f76e-e7aa1abf5549-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-01 8:09 ` Boris Brezillon
2017-09-07 9:36 ` Archit Taneja
2017-09-18 9:06 ` Boris Brezillon
[not found] ` <c17e158a-3e37-8ae6-e31c-7ed89429166a-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-10-11 9:26 ` Boris Brezillon
2017-10-11 10:13 ` Archit Taneja
2017-09-19 12:59 ` Tomi Valkeinen
2017-09-19 13:25 ` Boris Brezillon
2017-09-19 13:38 ` Tomi Valkeinen
2017-09-19 13:48 ` Boris Brezillon
2017-09-19 14:25 ` Tomi Valkeinen
[not found] ` <6cbad342-aac8-d0d4-1d82-26aef33f0e82-l0cyMroinI0@public.gmane.org>
2017-09-20 12:08 ` Boris Brezillon
2017-09-20 11:55 ` Tomi Valkeinen
[not found] ` <27834b62-664f-d403-6396-2339cb4fda1c-l0cyMroinI0@public.gmane.org>
2017-09-20 12:32 ` Boris Brezillon [this message]
2017-09-20 12:42 ` Tomi Valkeinen
2017-09-20 12:59 ` Boris Brezillon
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=20170920143241.44a20bc6@bbrezillon \
--to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=adouglas-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
--cc=airlied-cv59FeDIM0c@public.gmane.org \
--cc=architt-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=cwronka-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=hatliff-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=jsarha-l0cyMroinI0@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=neilw-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sproul-vna1KIf7WgpBDgjK7y7TUQ@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=tomi.valkeinen-l0cyMroinI0@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).