dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Meng Yi <meng.yi@nxp.com>,
	emil.l.velikov@gmail.com, thierry.reding@gmail.com,
	Alison Wang <alison.wang@nxp.com>,
	Xiubo Li <lixiubo@cmss.chinamobile.com>
Cc: Jianwei Wang <jianwei.wang.chn@gmail.com>,
	dri-devel@lists.freedesktop.org,
	maxime.ripard@free-electrons.com,
	alexander.stein@systec-electronic.com
Subject: Re: [PATCH 1/2] drm/fsl-dcu: Add HDMI driver for freescale DCU
Date: Mon, 16 May 2016 14:45:02 +0200	[thread overview]
Message-ID: <20160516144502.0cb6a7e0@bbrezillon> (raw)
In-Reply-To: <1463301285-48584-1-git-send-email-meng.yi@nxp.com>

Hi Meng,

On Sun, 15 May 2016 16:34:44 +0800
Meng Yi <meng.yi@nxp.com> wrote:

> This driver add the basic functions for Encoder, and link the Encoder to
> appropriate DRM bridge.
> This driver is depend on sii9022 driver(drm_bridge approach),which is
> sent by Boris Brezillon to community but not merged.
> https://patchwork.kernel.org/patch/8600921/

Not sure I understand why it depends on the sii902x driver I posted.
The code I see here seems capable of interfacing with any kind of
drm_bridge, not only the sii9022 one.

> 
> Signed-off-by: Alison Wang <alison.wang@nxp.com>
> Signed-off-by: Xiubo Li <lixiubo@cmss.chinamobile.com>
> Signed-off-by: Jianwei Wang <jianwei.wang.chn@gmail.com>
> Signed-off-by: Meng Yi <meng.yi@nxp.com>
> ---
>  drivers/gpu/drm/fsl-dcu/Makefile             |   1 +
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c   | 194 +++++++++++++++++++++++++++
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_kms.c    |  29 ++++
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_output.h |   4 +
>  4 files changed, 228 insertions(+)
>  create mode 100644 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/Makefile b/drivers/gpu/drm/fsl-dcu/Makefile
> index b35a292..12e2245 100644
> --- a/drivers/gpu/drm/fsl-dcu/Makefile
> +++ b/drivers/gpu/drm/fsl-dcu/Makefile
> @@ -1,6 +1,7 @@
>  fsl-dcu-drm-y := fsl_dcu_drm_drv.o \
>  		 fsl_dcu_drm_kms.o \
>  		 fsl_dcu_drm_rgb.o \
> +		 fsl_dcu_drm_hdmi.o \
>  		 fsl_dcu_drm_plane.o \
>  		 fsl_dcu_drm_crtc.o \
>  		 fsl_dcu_drm_fbdev.o \
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c
> new file mode 100644
> index 0000000..76441c7
> --- /dev/null
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_hdmi.c
> @@ -0,0 +1,194 @@
> +/*
> + * Copyright 2015 Freescale Semiconductor, Inc.
> + *
> + * Freescale DCU drm device driver
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +
> +#include <linux/console.h>
> +#include <linux/delay.h>
> +#include <linux/errno.h>
> +#include <linux/fb.h>
> +#include <linux/fsl_devices.h>
> +#include <linux/i2c.h>
> +#include <linux/init.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/backlight.h>
> +#include <linux/of_graph.h>
> +#include <video/videomode.h>
> +#include <video/of_display_timing.h>
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_atomic_helper.h>
> +#include <drm/drm_encoder_slave.h>
> +#include <drm/drm_crtc_helper.h>
> +#include <drm/drm_edid.h>
> +
> +#include "fsl_dcu_drm_drv.h"
> +#include "fsl_dcu_drm_output.h"
> +
> +static void
> +fsl_dcu_drm_hdmienc_mode_set(struct drm_encoder *encoder,
> +					 struct drm_display_mode *mode,
> +					 struct drm_display_mode *adjusted_mode)
> +{
> +}
> +
> +static int
> +fsl_dcu_drm_hdmienc_atomic_check(struct drm_encoder *encoder,
> +				 struct drm_crtc_state *crtc_state,
> +				 struct drm_connector_state *conn_state)
> +{
> +	return 0;
> +}
> +
> +static void
> +fsl_dcu_drm_hdmienc_disable(struct drm_encoder *encoder)
> +{
> +}
> +
> +static void
> +fsl_dcu_drm_hdmienc_enable(struct drm_encoder *encoder)
> +{
> +}
> +
> +static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
> +	.atomic_check = fsl_dcu_drm_hdmienc_atomic_check,
> +	.disable = fsl_dcu_drm_hdmienc_disable,
> +	.enable = fsl_dcu_drm_hdmienc_enable,
> +	.mode_set = fsl_dcu_drm_hdmienc_mode_set,
> +};
> +
> +static void fsl_dcu_drm_hdmienc_destroy(struct drm_encoder *encoder)
> +{
> +	drm_encoder_cleanup(encoder);
> +}
> +
> +void fsl_dcu_drm_hdmienc_reset(struct drm_encoder *encoder)
> +{
> +}
> +
> +static const struct drm_encoder_funcs encoder_funcs = {
> +	.reset = fsl_dcu_drm_hdmienc_reset,
> +	.destroy = fsl_dcu_drm_hdmienc_destroy,
> +};
> +
> +int fsl_dcu_drm_hdmienc_create(struct fsl_dcu_drm_device *fsl_dev,
> +			       struct drm_crtc *crtc)
> +{
> +	struct drm_encoder *encoder;
> +	int ret;
> +
> +	do {
> +		encoder = devm_kzalloc(fsl_dev->dev,
> +					sizeof(struct drm_encoder), GFP_KERNEL);
> +		encoder->possible_crtcs = 1;
> +		ret = drm_encoder_init(fsl_dev->drm, encoder, &encoder_funcs,
> +				       DRM_MODE_ENCODER_TMDS, NULL);

Just sharing my understanding of the DRM bridge infrastructure, and
I'll let Daniel (and other experimented DRM/KMS developers) correct me
if I'm wrong.

The Sil9022 is a bridge taking its pixel stream from an RGB encoder
(also known as ENCODER_NONE), and converting it into a TDMS (HDMI or
DVI) stream. So, your encoder on the fsl-dcu side is not an HDMI
encoder but an RGB (ENCODER_NONE) encoder.
Switching to this approach will let you support any kind of bridge
(RGB->DVI, RGB->TDMS, RGB->LVDS, ...) without having to add boilerplate
code for each of them.

Regards,

Boris

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-05-16 12:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-15  8:34 [PATCH 1/2] drm/fsl-dcu: Add HDMI driver for freescale DCU Meng Yi
2016-05-15  8:34 ` [PATCH 2/2] Add DT binding doc for DCU for ls1021a-twr Meng Yi
2016-05-16 12:45 ` Boris Brezillon [this message]
2016-05-16 13:56   ` [PATCH 1/2] drm/fsl-dcu: Add HDMI driver for freescale DCU Meng Yi
2016-06-10  2:35 ` Stefan Agner
2016-06-12  1:55   ` Meng Yi
2016-06-12 22:00     ` Stefan Agner

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=20160516144502.0cb6a7e0@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=alison.wang@nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=jianwei.wang.chn@gmail.com \
    --cc=lixiubo@cmss.chinamobile.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=meng.yi@nxp.com \
    --cc=thierry.reding@gmail.com \
    /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