From: Sam Ravnborg <sam@ravnborg.org>
To: Paul Cercueil <paul@crapouillou.net>
Cc: "Thierry Reding" <thierry.reding@gmail.com>,
"David Airlie" <airlied@linux.ie>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Rob Herring" <robh+dt@kernel.org>,
"Andrzej Hajda" <a.hajda@samsung.com>,
"Neil Armstrong" <narmstrong@baylibre.com>,
"Laurent Pinchart" <Laurent.pinchart@ideasonboard.com>,
"Jonas Karlman" <jonas@kwiboo.se>,
"Jernej Skrabec" <jernej.skrabec@siol.net>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"Noralf Trønnes" <noralf@tronnes.org>,
od@zcrc.me, dri-devel@lists.freedesktop.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] drm: dsi: Let host and device specify supported bus
Date: Mon, 27 Jul 2020 22:03:20 +0200 [thread overview]
Message-ID: <20200727200320.GA1014103@ravnborg.org> (raw)
In-Reply-To: <20200727164613.19744-3-paul@crapouillou.net>
Hi Paul.
On Mon, Jul 27, 2020 at 06:46:09PM +0200, Paul Cercueil wrote:
> The current MIPI DSI framework can very well be used to support MIPI DBI
> panels. In order to add support for the various bus types supported by
> DBI, the DRM panel drivers should specify the bus type they will use,
> and the DSI host drivers should specify the bus types they are
> compatible with.
>
> The DSI host driver can then use the information provided by the DBI/DSI
> device driver, such as the bus type and the number of lanes, to
> configure its hardware properly.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 9 +++++++++
> include/drm/drm_mipi_dsi.h | 12 ++++++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 5dd475e82995..11ef885de765 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -281,6 +281,9 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
> {
> struct device_node *node;
>
> + if (WARN_ON_ONCE(!host->bus_types))
> + host->bus_types = MIPI_DEVICE_TYPE_DSI;
> +
So all 14 users need to specify bus_types.
Seems doable.
> for_each_available_child_of_node(host->dev->of_node, node) {
> /* skip nodes without reg property */
> if (!of_find_property(node, "reg", NULL))
> @@ -323,6 +326,12 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi)
> {
> const struct mipi_dsi_host_ops *ops = dsi->host->ops;
>
> + if (WARN_ON_ONCE(!dsi->bus_type))
> + dsi->bus_type = MIPI_DEVICE_TYPE_DSI;
We have ~50 users of mipi_dsi_attach() - doable. But a bit more work.
> +
> + if (!(dsi->bus_type & dsi->host->bus_types))
> + return -EINVAL;
> +
> if (!ops || !ops->attach)
> return -ENOSYS;
>
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 360e6377e84b..65d2961fc054 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -63,6 +63,14 @@ struct mipi_dsi_packet {
> int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
> const struct mipi_dsi_msg *msg);
>
> +/* MIPI bus types */
If you define this as an enum then kernel-doc syntax will be picked up.
See for example: enum drm_driver_feature
> +#define MIPI_DEVICE_TYPE_DSI BIT(0)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE1 BIT(1)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE2 BIT(2)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE3 BIT(3)
> +#define MIPI_DEVICE_TYPE_DBI_M6800 BIT(4)
> +#define MIPI_DEVICE_TYPE_DBI_I8080 BIT(5)
> +
> /**
> * struct mipi_dsi_host_ops - DSI bus operations
> * @attach: attach DSI device to DSI host
> @@ -94,11 +102,13 @@ struct mipi_dsi_host_ops {
> * struct mipi_dsi_host - DSI host device
> * @dev: driver model device node for this DSI host
> * @ops: DSI host operations
> + * @bus_types: Bitmask of supported MIPI bus types
Please add some kind of reference to MIPI_DEVICE_TYPE_* - so the reader
knows for sure this is the bits used here.
> * @list: list management
> */
> struct mipi_dsi_host {
> struct device *dev;
> const struct mipi_dsi_host_ops *ops;
> + unsigned int bus_types;
Use u32. Shorter and we know this is 32 bits wide.
> struct list_head list;
> };
>
> @@ -162,6 +172,7 @@ struct mipi_dsi_device_info {
> * @host: DSI host for this peripheral
> * @dev: driver model device node for this peripheral
> * @name: DSI peripheral chip type
> + * @bus_type: MIPI bus type (MIPI_DEVICE_TYPE_DSI/...)
> * @channel: virtual channel assigned to the peripheral
> * @format: pixel format for video mode
> * @lanes: number of active data lanes
> @@ -178,6 +189,7 @@ struct mipi_dsi_device {
> struct device dev;
>
> char name[DSI_DEV_NAME_SIZE];
> + unsigned int bus_type;
Use u32.
> unsigned int channel;
> unsigned int lanes;
> enum mipi_dsi_pixel_format format;
> --
> 2.27.0
WARNING: multiple messages have this Message-ID (diff)
From: Sam Ravnborg <sam@ravnborg.org>
To: Paul Cercueil <paul@crapouillou.net>
Cc: devicetree@vger.kernel.org,
Jernej Skrabec <jernej.skrabec@siol.net>,
od@zcrc.me, Thomas Zimmermann <tzimmermann@suse.de>,
Neil Armstrong <narmstrong@baylibre.com>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, Jonas Karlman <jonas@kwiboo.se>,
linux-kernel@vger.kernel.org, Andrzej Hajda <a.hajda@samsung.com>,
Rob Herring <robh+dt@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: Re: [PATCH 2/6] drm: dsi: Let host and device specify supported bus
Date: Mon, 27 Jul 2020 22:03:20 +0200 [thread overview]
Message-ID: <20200727200320.GA1014103@ravnborg.org> (raw)
In-Reply-To: <20200727164613.19744-3-paul@crapouillou.net>
Hi Paul.
On Mon, Jul 27, 2020 at 06:46:09PM +0200, Paul Cercueil wrote:
> The current MIPI DSI framework can very well be used to support MIPI DBI
> panels. In order to add support for the various bus types supported by
> DBI, the DRM panel drivers should specify the bus type they will use,
> and the DSI host drivers should specify the bus types they are
> compatible with.
>
> The DSI host driver can then use the information provided by the DBI/DSI
> device driver, such as the bus type and the number of lanes, to
> configure its hardware properly.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/gpu/drm/drm_mipi_dsi.c | 9 +++++++++
> include/drm/drm_mipi_dsi.h | 12 ++++++++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 5dd475e82995..11ef885de765 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -281,6 +281,9 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
> {
> struct device_node *node;
>
> + if (WARN_ON_ONCE(!host->bus_types))
> + host->bus_types = MIPI_DEVICE_TYPE_DSI;
> +
So all 14 users need to specify bus_types.
Seems doable.
> for_each_available_child_of_node(host->dev->of_node, node) {
> /* skip nodes without reg property */
> if (!of_find_property(node, "reg", NULL))
> @@ -323,6 +326,12 @@ int mipi_dsi_attach(struct mipi_dsi_device *dsi)
> {
> const struct mipi_dsi_host_ops *ops = dsi->host->ops;
>
> + if (WARN_ON_ONCE(!dsi->bus_type))
> + dsi->bus_type = MIPI_DEVICE_TYPE_DSI;
We have ~50 users of mipi_dsi_attach() - doable. But a bit more work.
> +
> + if (!(dsi->bus_type & dsi->host->bus_types))
> + return -EINVAL;
> +
> if (!ops || !ops->attach)
> return -ENOSYS;
>
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 360e6377e84b..65d2961fc054 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -63,6 +63,14 @@ struct mipi_dsi_packet {
> int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
> const struct mipi_dsi_msg *msg);
>
> +/* MIPI bus types */
If you define this as an enum then kernel-doc syntax will be picked up.
See for example: enum drm_driver_feature
> +#define MIPI_DEVICE_TYPE_DSI BIT(0)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE1 BIT(1)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE2 BIT(2)
> +#define MIPI_DEVICE_TYPE_DBI_SPI_MODE3 BIT(3)
> +#define MIPI_DEVICE_TYPE_DBI_M6800 BIT(4)
> +#define MIPI_DEVICE_TYPE_DBI_I8080 BIT(5)
> +
> /**
> * struct mipi_dsi_host_ops - DSI bus operations
> * @attach: attach DSI device to DSI host
> @@ -94,11 +102,13 @@ struct mipi_dsi_host_ops {
> * struct mipi_dsi_host - DSI host device
> * @dev: driver model device node for this DSI host
> * @ops: DSI host operations
> + * @bus_types: Bitmask of supported MIPI bus types
Please add some kind of reference to MIPI_DEVICE_TYPE_* - so the reader
knows for sure this is the bits used here.
> * @list: list management
> */
> struct mipi_dsi_host {
> struct device *dev;
> const struct mipi_dsi_host_ops *ops;
> + unsigned int bus_types;
Use u32. Shorter and we know this is 32 bits wide.
> struct list_head list;
> };
>
> @@ -162,6 +172,7 @@ struct mipi_dsi_device_info {
> * @host: DSI host for this peripheral
> * @dev: driver model device node for this peripheral
> * @name: DSI peripheral chip type
> + * @bus_type: MIPI bus type (MIPI_DEVICE_TYPE_DSI/...)
> * @channel: virtual channel assigned to the peripheral
> * @format: pixel format for video mode
> * @lanes: number of active data lanes
> @@ -178,6 +189,7 @@ struct mipi_dsi_device {
> struct device dev;
>
> char name[DSI_DEV_NAME_SIZE];
> + unsigned int bus_type;
Use u32.
> unsigned int channel;
> unsigned int lanes;
> enum mipi_dsi_pixel_format format;
> --
> 2.27.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-07-27 20:03 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 16:46 [PATCH 0/6] DBI/DSI, panel drivers, and tinyDRM compat Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-27 16:46 ` [PATCH 1/6] dt-bindings: display: Document NewVision NV3052C DT node Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-27 19:10 ` Sam Ravnborg
2020-07-27 19:10 ` Sam Ravnborg
2020-07-27 19:24 ` Maarten ter Huurne
2020-07-27 19:24 ` Maarten ter Huurne
2020-07-29 17:10 ` Laurent Pinchart
2020-07-29 17:10 ` Laurent Pinchart
2020-07-27 16:46 ` [PATCH 2/6] drm: dsi: Let host and device specify supported bus Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-27 17:02 ` Laurent Pinchart
2020-07-27 17:02 ` Laurent Pinchart
2020-07-27 17:59 ` Paul Cercueil
2020-07-27 17:59 ` Paul Cercueil
2020-07-27 20:03 ` Sam Ravnborg [this message]
2020-07-27 20:03 ` Sam Ravnborg
2020-07-27 16:46 ` [PATCH 3/6] drm/bridge: Add SPI DBI host driver Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-27 17:06 ` Laurent Pinchart
2020-07-27 17:06 ` Laurent Pinchart
2020-07-27 17:54 ` Paul Cercueil
2020-07-27 17:54 ` Paul Cercueil
2020-07-27 20:31 ` Sam Ravnborg
2020-07-27 20:31 ` Sam Ravnborg
2020-07-27 21:10 ` Paul Cercueil
2020-07-27 21:10 ` Paul Cercueil
2020-07-27 16:46 ` [PATCH 4/6] drm/panel: Add panel driver for NewVision NV3052C based LCDs Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-30 19:50 ` Sam Ravnborg
2020-07-30 19:50 ` Sam Ravnborg
2020-07-27 16:46 ` [PATCH 5/6] drm/tiny: Add TinyDRM for DSI/DBI panels Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
2020-07-27 16:46 ` [PATCH 6/6] drm/panel: Add Ilitek ILI9341 DBI panel driver Paul Cercueil
2020-07-27 16:46 ` Paul Cercueil
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=20200727200320.GA1014103@ravnborg.org \
--to=sam@ravnborg.org \
--cc=Laurent.pinchart@ideasonboard.com \
--cc=a.hajda@samsung.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@siol.net \
--cc=jonas@kwiboo.se \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=narmstrong@baylibre.com \
--cc=noralf@tronnes.org \
--cc=od@zcrc.me \
--cc=paul@crapouillou.net \
--cc=robh+dt@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tzimmermann@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.