public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Anholt <eric@anholt.net>
To: dri-devel@lists.freedesktop.org,
	Archit Taneja <architt@codeaurora.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/6] drm: Allow DSI devices to be registered before the host registers.
Date: Wed, 19 Jul 2017 13:31:47 -0700	[thread overview]
Message-ID: <87pocwdv7w.fsf@eliezer.anholt.net> (raw)
In-Reply-To: <20170718210510.12229-4-eric@anholt.net>

[-- Attachment #1: Type: text/plain, Size: 2621 bytes --]

Eric Anholt <eric@anholt.net> writes:

> When a mipi_dsi_host is registered, the DT is walked to find any child
> nodes with compatible strings.  Those get registered as DSI devices,
> and most DSI panel drivers are mipi_dsi_drivers that attach to those nodes.
>
> There is one special case currently, the adv7533 bridge, where the
> bridge probes on I2C, and during the bridge attach step it looks up
> the mipi_dsi_host and registers the mipi_dsi_device (for its own stub
> mipi_dsi_driver).
>
> For the Raspberry Pi panel, though, we also need to attach on I2C (our
> control bus), but don't have a bridge driver.  The lack of a bridge's
> attach() step like adv7533 uses means that we aren't able to delay the
> mipi_dsi_device creation until the mipi_dsi_host is present.
>
> To fix this, we extend mipi_dsi_device_register_full() to allow being
> called with a NULL host, which puts the device on a queue waiting for
> a host to appear.  When a new host is registered, we fill in the host
> value and finish the device creation process.
>
> v2: Cleanly error out if one attempts to mipi_dsi_attach() without a
>     host.  Fix handling of DSI with multiple devices, and OF node
>     refcounting.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 63 ++++++++++++++++++++++++++++++++++--------
>  include/drm/drm_mipi_dsi.h     |  3 ++
>  2 files changed, 54 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index 1160a579e0dc..77d439254da6 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c

> @@ -295,6 +308,27 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
>  
>  	mutex_lock(&host_lock);
>  	list_add_tail(&host->list, &host_list);
> +
> +	/* If any DSI devices were registered under our OF node, then
> +	 * connect our host to it and probe them now.
> +	 */
> +	list_for_each_entry_safe(dsi, temp, &unattached_device_list, list) {
> +		struct device_node *host_node = of_get_parent(dsi->dev.of_node);
> +
> +		if (!of_node_cmp(host_node->name, "ports"))
> +			host_node = of_get_next_parent(host_node);
> +
> +		if (host_node == host->dev->of_node) {
> +			dsi->host = host;
> +			dsi->dev.parent = host->dev;
> +			device_initialize(&dsi->dev);
> +
> +			mipi_dsi_device_add(dsi);
> +			list_del_init(&dsi->list);
> +		}
> +
> +		of_node_put(host_node);
> +	}

Kbuild test caught that of_get_next_parent() isn't defined for
!CONFIG_OF, so I've put this loop under IS_ENABLED(CONFIG_OF) for v3.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-07-19 20:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 21:05 [PATCH v5 1/6] drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math Eric Anholt
2017-07-18 21:05 ` [PATCH v5 2/6] drm/bridge: Add a devm_ allocator for panel bridge Eric Anholt
2017-07-19  8:58   ` Philippe CORNU
2017-07-26 22:43     ` Eric Anholt
2017-08-04 13:46   ` Laurent Pinchart
2017-08-04 14:57     ` Laurent Pinchart
2017-08-04 20:43     ` Eric Anholt
2017-08-04 21:25       ` Laurent Pinchart
2017-08-04 22:19       ` Ilia Mirkin
2017-08-05 10:59         ` Noralf Trønnes
2017-08-05 14:47           ` Noralf Trønnes
2017-08-07  9:25           ` Daniel Vetter
2017-08-07 10:22             ` Laurent Pinchart
2017-08-07 14:37               ` Noralf Trønnes
2017-08-07 14:59               ` Daniel Vetter
2017-08-07 21:54                 ` Laurent Pinchart
2017-07-18 21:05 ` [PATCH v5 3/6] drm/vc4: Delay DSI host registration until the panel has probed Eric Anholt
2017-08-04  9:04   ` Boris Brezillon
2017-07-18 21:05 ` [PATCH v5 4/6] drm: Allow DSI devices to be registered before the host registers Eric Anholt
2017-07-19 20:31   ` Eric Anholt [this message]
2017-07-18 21:05 ` [PATCH v5 5/6] dt-bindings: Document the Raspberry Pi Touchscreen nodes Eric Anholt
2017-07-18 21:05 ` [PATCH v5 6/6] drm/panel: Add support for the Raspberry Pi 7" Touchscreen Eric Anholt
2017-08-04  8:53 ` [PATCH v5 1/6] drm/vc4: Avoid using vrefresh==0 mode in DSI htotal math Boris Brezillon
2017-08-04 21:15   ` Eric Anholt
2017-08-09 14:42     ` Boris Brezillon

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=87pocwdv7w.fsf@eliezer.anholt.net \
    --to=eric@anholt.net \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --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