RE: [PATCH v4 02/10] drm/bridge: add common api for inno hdmi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alex, Laurent:

I want to make as few changes as possible on the current basis, and add bridge_fun, 


> -----Original Message-----
> From: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> Sent: 2024年5月21日 23:42
> To: Alex Bee <knaerzche@xxxxxxxxx>
> Cc: Keith Zhao <keith.zhao@xxxxxxxxxxxxxxxx>; andrzej.hajda@xxxxxxxxx;
> neil.armstrong@xxxxxxxxxx; rfoss@xxxxxxxxxx; jonas@xxxxxxxxx;
> jernej.skrabec@xxxxxxxxx; maarten.lankhorst@xxxxxxxxxxxxxxx;
> mripard@xxxxxxxxxx; tzimmermann@xxxxxxx; airlied@xxxxxxxxx;
> daniel@xxxxxxxx; robh@xxxxxxxxxx; krzk+dt@xxxxxxxxxx; conor+dt@xxxxxxxxxx;
> hjc@xxxxxxxxxxxxxx; heiko@xxxxxxxxx; andy.yan@xxxxxxxxxxxxxx; Xingyu Wu
> <xingyu.wu@xxxxxxxxxxxxxxxx>; p.zabel@xxxxxxxxxxxxxx; Jack Zhu
> <jack.zhu@xxxxxxxxxxxxxxxx>; Shengyang Chen
> <shengyang.chen@xxxxxxxxxxxxxxxx>; dri-devel@xxxxxxxxxxxxxxxxxxxxx;
> devicetree@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v4 02/10] drm/bridge: add common api for inno hdmi
> 
> On Tue, May 21, 2024 at 05:36:43PM +0200, Alex Bee wrote:
> > Hi Keith,
> >
> > thanks a lot for working on this. See some general remarks below
> >
> > Am 21.05.24 um 12:58 schrieb keith:
> > > Add INNO common api so that it can be used by vendor drivers which
> > > implement vendor specific extensions to Innosilicon HDMI.
> > >
> > > Signed-off-by: keith <keith.zhao@xxxxxxxxxxxxxxxx>
> > > ---
> > >   MAINTAINERS                                   |   2 +
> > >   drivers/gpu/drm/bridge/Kconfig                |   2 +
> > >   drivers/gpu/drm/bridge/Makefile               |   1 +
> > >   drivers/gpu/drm/bridge/innosilicon/Kconfig    |   6 +
> > >   drivers/gpu/drm/bridge/innosilicon/Makefile   |   2 +
> > >   .../gpu/drm/bridge/innosilicon/inno-hdmi.c    | 587
> ++++++++++++++++++
> > >   .../gpu/drm/bridge/innosilicon/inno-hdmi.h    |  97 +++
> > >   include/drm/bridge/inno_hdmi.h                |  69 ++
> > >   8 files changed, 766 insertions(+)
> > >   create mode 100644 drivers/gpu/drm/bridge/innosilicon/Kconfig
> > >   create mode 100644 drivers/gpu/drm/bridge/innosilicon/Makefile
> > >   create mode 100644 drivers/gpu/drm/bridge/innosilicon/inno-hdmi.c
> > >   create mode 100644 drivers/gpu/drm/bridge/innosilicon/inno-hdmi.h
> > >   create mode 100644 include/drm/bridge/inno_hdmi.h
> > >
> > ....
> >
> > > +	drm_encoder_helper_add(encoder, pdata->helper_private);
> > > +
> > > +	hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
> > > +
> > > +	drm_connector_helper_add(&hdmi->connector,
> > > +				 &inno_hdmi_connector_helper_funcs);
> > > +
> > > +	drmm_connector_init(drm, &hdmi->connector,
> > > +			    &inno_hdmi_connector_funcs,
> > > +			    DRM_MODE_CONNECTOR_HDMIA,
> > > +			    hdmi->ddc);
> > > +
> >
> > I really don't want to anticipate bridge maintainer's feedback, but
> > new bridge drivers must not contain connector creation. That must
> > happen somewhere else.
> 
> You're absolutely right :-) Connector creation should be handled by the
> drm_bridge_connector helper. The HDMI bridge driver should focus on the
> HDMI bridge itself.

static int inno_bridge_attach(struct drm_bridge *bridge,
				 enum drm_bridge_attach_flags flags)
{
	struct inno_hdmi *hdmi = bridge_to_inno(bridge);

	if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
		DRM_ERROR("Fix bridge driver to make connector optional!");
		return -EINVAL;
	}
	hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;

	drm_connector_helper_add(&hdmi->connector,
				 &inno_hdmi_connector_helper_funcs);

	drmm_connector_init(drm, &hdmi->connector,
			    &inno_hdmi_connector_funcs,
			    DRM_MODE_CONNECTOR_HDMIA,
			    hdmi->ddc);

	drm_connector_attach_encoder(&hdmi->connector, encoder);
}

static const struct drm_bridge_funcs inno_bridge_attach = {
	.attach = inno_bridge_attach,
};

Connector creation is handled by the drm_bridge_funcs ->attach.
Is it ok?

Regards
Keith
> 
> > Also I'm neither seeing any drm_brige struct nor drm_bridge_funcs,
> > which are both essential for a bridge driver. I don't think moving a
> > part of a driver to .../drm/bridge/ makes it a bridge driver.
> >
> > > +	drm_connector_attach_encoder(&hdmi->connector, encoder);
> > > +
> > > +	return 0;
> > > +}
> > > +
> > ....
> >
> 
> --
> Regards,
> 
> Laurent Pinchart




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux