From: Shawn Guo <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Daniel Vetter <daniel-/w4YWyX8dFk@public.gmane.org>
Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Vetter <daniel.vetter-/w4YWyX8dFk@public.gmane.org>,
Baoyou Xie <xie.baoyou-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Jun Nie <jun.nie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 2/2] drm: zte: add initial vou drm driver
Date: Thu, 29 Sep 2016 16:42:47 -0700 [thread overview]
Message-ID: <20160929234246.GA18734@x250> (raw)
In-Reply-To: <20160925205809.GR20761-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
On Sun, Sep 25, 2016 at 10:58:09PM +0200, Daniel Vetter wrote:
> On Sat, Sep 24, 2016 at 10:26:25PM +0800, Shawn Guo wrote:
> > It adds the initial ZTE VOU display controller DRM driver. There are
> > still some features to be added, like overlay plane, scaling, and more
> > output devices support. But it's already useful with dual CRTCs and
> > HDMI monitor working.
> >
> > It's been tested on Debian Jessie LXDE desktop with modesetting driver.
> >
> > Signed-off-by: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>
> I've done a very quick read-through, looks real pretty. A few comments
> below and in-line.
Thanks much for looking at it.
> For testing, have you tried to run i-g-t validation tests per our
> documentation? See https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#validating-changes-with-igt
Sorry for my ignorance on that. I'm on business travel right now, and
will give it a try once I get back to the hardware.
> > drivers/gpu/drm/Kconfig | 2 +
> > drivers/gpu/drm/Makefile | 1 +
> > drivers/gpu/drm/zte/Kconfig | 8 +
> > drivers/gpu/drm/zte/Makefile | 8 +
> > drivers/gpu/drm/zte/zx_crtc.c | 691 +++++++++++++++++++++++++++++++++++++++
> > drivers/gpu/drm/zte/zx_crtc.h | 47 +++
> > drivers/gpu/drm/zte/zx_drm_drv.c | 258 +++++++++++++++
> > drivers/gpu/drm/zte/zx_drm_drv.h | 22 ++
> > drivers/gpu/drm/zte/zx_hdmi.c | 540 ++++++++++++++++++++++++++++++
> > drivers/gpu/drm/zte/zx_plane.c | 362 ++++++++++++++++++++
> > drivers/gpu/drm/zte/zx_plane.h | 26 ++
> > 11 files changed, 1965 insertions(+)
> > create mode 100644 drivers/gpu/drm/zte/Kconfig
> > create mode 100644 drivers/gpu/drm/zte/Makefile
> > create mode 100644 drivers/gpu/drm/zte/zx_crtc.c
> > create mode 100644 drivers/gpu/drm/zte/zx_crtc.h
> > create mode 100644 drivers/gpu/drm/zte/zx_drm_drv.c
> > create mode 100644 drivers/gpu/drm/zte/zx_drm_drv.h
> > create mode 100644 drivers/gpu/drm/zte/zx_hdmi.c
> > create mode 100644 drivers/gpu/drm/zte/zx_plane.c
> > create mode 100644 drivers/gpu/drm/zte/zx_plane.h
>
> New entry in MAINTAINERS listening you (and probably dri-devel as the m-l)
> is missing.
Okay. I will add a patch to do that in the next version.
> > +static int zx_drm_bind(struct device *dev)
> > +{
> > + struct drm_device *drm;
> > + struct zx_drm_private *priv;
> > + int ret;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + drm = drm_dev_alloc(&zx_drm_driver, dev);
> > + if (!drm)
> > + return -ENOMEM;
> > +
> > + drm->dev_private = priv;
> > + dev_set_drvdata(dev, drm);
> > +
> > + drm_mode_config_init(drm);
> > + drm->mode_config.min_width = 16;
> > + drm->mode_config.min_height = 16;
> > + drm->mode_config.max_width = 4096;
> > + drm->mode_config.max_height = 4096;
> > + drm->mode_config.funcs = &zx_drm_mode_config_funcs;
> > +
> > + ret = drm_dev_register(drm, 0);
>
> drm_dev_register should be the last function call in your bind function.
> Similar for unbind, drm_dev_register should be called first.
>
> As a consequence of that you can remove the drm_connector_(un)register
> calls, those are only needed for hotplugged connectors like dp mst. But
> with correct ordering of drm_dev_(un)register that function will also take
> care of connector registration and unregistration.
Aha, that's the trick to save the call to drm_connector_register() from
connector driver. Thanks for the info.
> > +static int zx_hdmi_get_edid_block(void *data, u8 *buf, unsigned int block,
> > + size_t len)
> > +{
> > + struct zx_hdmi *hdmi = data;
> > + int retry = 0;
> > + int ret = 0;
> > + int i = 0;
> > + u8 val;
> > +
> > + /* Enable DDC master access */
> > + val = hdmi_readb(hdmi, TPI_DDC_MASTER_EN);
> > + val |= HW_DDC_MASTER;
> > + hdmi_writeb(hdmi, TPI_DDC_MASTER_EN, val);
> > +
> > + hdmi_writeb(hdmi, ZX_DDC_ADDR, 0xa0);
> > + hdmi_writeb(hdmi, ZX_DDC_OFFSET, block * EDID_LENGTH);
> > + /* Bits [9:8] of bytes */
> > + hdmi_writeb(hdmi, ZX_DDC_DIN_CNT2, (len >> 8) & 0xff);
> > + /* Bits [7:0] of bytes */
> > + hdmi_writeb(hdmi, ZX_DDC_DIN_CNT1, len & 0xff);
> > +
> > + /* Clear FIFO */
> > + val = hdmi_readb(hdmi, ZX_DDC_CMD);
> > + val &= ~DDC_CMD_MASK;
> > + val |= DDC_CMD_CLEAR_FIFO;
> > + hdmi_writeb(hdmi, ZX_DDC_CMD, val);
> > +
> > + /* Kick off the read */
> > + val = hdmi_readb(hdmi, ZX_DDC_CMD);
> > + val &= ~DDC_CMD_MASK;
> > + val |= DDC_CMD_SEQUENTIAL_READ;
> > + hdmi_writeb(hdmi, ZX_DDC_CMD, val);
>
> It looks like the ZX_DDC register range implements a hw i2c engine (since
> you specifiy port and offsets and everything). Please implement it as an
> i2c_adapter driver and use the normal drm_get_edid function.
Okay. I will give it a try to see if it works.
> > +static int zx_gl_plane_atomic_check(struct drm_plane *plane,
> > + struct drm_plane_state *state)
> > +{
> > + u32 src_w, src_h;
> > +
> > + src_w = state->src_w >> 16;
> > + src_h = state->src_h >> 16;
> > +
> > + /* TODO: support scaling of the plane source */
> > + if ((src_w != state->crtc_w) || (src_h != state->crtc_h))
> > + return -EINVAL;
>
> This is generally not enough checking. You probably need a call to
> drm_plane_helper_check_state.
Okay, will do.
Shawn
--
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:[~2016-09-29 23:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-24 14:26 [PATCH v2 0/2] Add initial ZTE VOU DRM/KMS driver Shawn Guo
2016-09-24 14:26 ` [PATCH v2 1/2] dt-bindings: add bindings doc for ZTE VOU display controller Shawn Guo
[not found] ` <1474727185-24180-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-03 17:44 ` Rob Herring
2016-10-09 7:49 ` Shawn Guo
2016-10-10 21:48 ` Rob Herring
2016-09-24 14:26 ` [PATCH v2 2/2] drm: zte: add initial vou drm driver Shawn Guo
2016-09-25 20:58 ` Daniel Vetter
[not found] ` <20160925205809.GR20761-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-09-29 23:42 ` Shawn Guo [this message]
2016-09-27 15:48 ` Sean Paul
2016-09-30 1:43 ` Shawn Guo
[not found] ` <1474727185-24180-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-09-30 12:34 ` Emil Velikov
[not found] ` <CACvgo51feNJYrHaKT+M06Z7kOUqzYo1Uv_TAHdLhNXPtRUwsvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-01 0:22 ` Shawn Guo
2016-10-03 10:36 ` Emil Velikov
[not found] ` <CACvgo53A7BpVWHgkFrZsjWnw_uW6xDmKRsrxF=46HOEWQ43BxA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-03 13:49 ` Daniel Vetter
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=20160929234246.GA18734@x250 \
--to=shawnguo-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=daniel-/w4YWyX8dFk@public.gmane.org \
--cc=daniel.vetter-/w4YWyX8dFk@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=jun.nie-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=xie.baoyou-Th6q7B73Y6EnDS1+zs4M5A@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).