dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Shawn Guo <shawnguo@kernel.org>
To: Sean Paul <seanpaul@chromium.org>
Cc: Xin Zhou <zhou.xin8@zte.com.cn>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Baoyou Xie <xie.baoyou@zte.com.cn>,
	dri-devel@lists.freedesktop.org, Jun Nie <jun.nie@linaro.org>
Subject: Re: [PATCH 4/4] drm: zte: add VGA driver support
Date: Wed, 5 Apr 2017 14:08:52 +0800	[thread overview]
Message-ID: <20170405060850.GF3394@dragon> (raw)
In-Reply-To: <20170404173239.b2mb45xqfaszuee3@art_vandelay>

On Tue, Apr 04, 2017 at 01:32:39PM -0400, Sean Paul wrote:
> On Tue, Apr 04, 2017 at 09:47:38PM +0800, Shawn Guo wrote:
> > On Mon, Apr 03, 2017 at 11:23:51AM +0200, Daniel Vetter wrote:
> > > > +static int zx_vga_ddc_register(struct zx_vga *vga)
> > > > +{
> > > > +	struct device *dev = vga->dev;
> > > > +	struct i2c_adapter *adap;
> > > > +	struct zx_vga_i2c *ddc;
> > > > +	int ret;
> > > > +
> > > > +	ddc = devm_kzalloc(dev, sizeof(*ddc), GFP_KERNEL);
> > > > +	if (!ddc)
> > > > +		return -ENOMEM;
> > > > +
> > > > +	vga->ddc = ddc;
> > > > +	mutex_init(&ddc->lock);
> > > > +
> > > > +	adap = &ddc->adap;
> > > > +	adap->owner = THIS_MODULE;
> > > > +	adap->class = I2C_CLASS_DDC;
> > > > +	adap->dev.parent = dev;
> > > > +	adap->algo = &zx_vga_algorithm;
> > > > +	snprintf(adap->name, sizeof(adap->name), "zx vga i2c");
> > > > +
> > > > +	ret = i2c_add_adapter(adap);
> > > > +	if (ret) {
> > > > +		DRM_DEV_ERROR(dev, "failed to add I2C adapter: %d\n", ret);
> > > > +		return ret;
> > > > +	}
> > > > +
> > > > +	i2c_set_adapdata(adap, vga);
> > > 
> > > Since this really isn't a full-featured i2c adapter but a specialized
> > > "give me the edid" thing I think you should look into drm_do_get_edid and
> > > _not_ expose the i2c thing. That should simplify your code a lot, and
> > > avoid any kind of synchronization issues between userspace i2c access and
> > > your driver's access (which you atm don't handle at all).
> > 
> > I'm a bit confused here.  Could you give me some more details on how to
> > know it's a full-featured I2C bus or specialized "give me the edid" one?
> > My understanding is that the ZTE hardware for reading HDMI and VGA EDID
> > are different but pretty similar.  But in HDMI driver review [1], you
> > gave the opposite comment, asking to change to I2C adapter from
> > drm_do_get_edid().  I'm wondering how you see that the hardware in HDMI
> > is a full-featured I2C bus, while the one in VGA is a specialized bus?
> 
> That was my suggestion :-)

It was Daniel's too.  He commented as below under function
zx_hdmi_get_edid_block().

"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."

Shawn

> 
> At the time, it seemed like the hardware implemented a fully fledged i2c bus, so
> I suggested you made it generic. In retrospect, since it can only read from one
> address, the original implementation was fine.
> 
> Given the HDMI adapter is implemented the same way, I'm inclined to favor this
> version, but Daniel might disagree with me.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-04-05  6:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 12:15 [PATCH 0/4] Add ZTE VGA driver support Shawn Guo
2017-03-21 12:15 ` [PATCH 1/4] drm: zte: do not enable clock auto-gating by default Shawn Guo
2017-04-04 17:48   ` Sean Paul
2017-03-21 12:15 ` [PATCH 2/4] drm: zte: move CSC register definitions into a common header Shawn Guo
2017-04-04 17:47   ` Sean Paul
2017-03-21 12:15 ` [PATCH 3/4] dt: add bindings for ZTE VGA device Shawn Guo
2017-03-21 12:15 ` [PATCH 4/4] drm: zte: add VGA driver support Shawn Guo
2017-04-03  9:23   ` Daniel Vetter
2017-04-04 13:47     ` Shawn Guo
2017-04-04 17:32       ` Sean Paul
2017-04-05  6:08         ` Shawn Guo [this message]
2017-04-05  6:25           ` Daniel Vetter
2017-04-04 17:46   ` Sean Paul
2017-04-05 14:08     ` Shawn Guo

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=20170405060850.GF3394@dragon \
    --to=shawnguo@kernel.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jun.nie@linaro.org \
    --cc=seanpaul@chromium.org \
    --cc=xie.baoyou@zte.com.cn \
    --cc=zhou.xin8@zte.com.cn \
    /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).