From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Douglas Anderson <dianders@chromium.org>,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Robert Foss <rfoss@kernel.org>, Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Linus Walleij <linus.walleij@linaro.org>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Greg KH <gregkh@linuxfoundation.org>,
dri-devel@lists.freedesktop.org,
linux-renesas-soc@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] drm/bridge: ti-sn65dsi86: Fix multiple instances
Date: Tue, 10 Dec 2024 16:28:19 +0200 [thread overview]
Message-ID: <20241210142819.GK573@pendragon.ideasonboard.com> (raw)
In-Reply-To: <7a68a0e3f927e26edca6040067fb653eb06efb79.1733840089.git.geert+renesas@glider.be>
On Tue, Dec 10, 2024 at 03:18:46PM +0100, Geert Uytterhoeven wrote:
> Each bridge instance creates up to four auxiliary devices with different
> names. However, their IDs are always zero, causing duplicate filename
> errors when a system has multiple bridges:
>
> sysfs: cannot create duplicate filename '/bus/auxiliary/devices/ti_sn65dsi86.gpio.0'
>
> Fix this by using a unique instance ID per bridge instance. The
> instance ID is derived from the I2C adapter number and the bridge's I2C
> address, to support multiple instances on the same bus.
>
> Fixes: bf73537f411b0d4f ("drm/bridge: ti-sn65dsi86: Break GPIO and MIPI-to-eDP bridge into sub-drivers")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> On the White Hawk development board:
>
> /sys/bus/auxiliary/devices/
> |-- ti_sn65dsi86.aux.1068
> |-- ti_sn65dsi86.aux.4140
> |-- ti_sn65dsi86.bridge.1068
> |-- ti_sn65dsi86.bridge.4140
> |-- ti_sn65dsi86.gpio.1068
> |-- ti_sn65dsi86.gpio.4140
> |-- ti_sn65dsi86.pwm.1068
> `-- ti_sn65dsi86.pwm.4140
>
> Discussion after v1:
> - https://lore.kernel.org/8c2df6a903f87d4932586b25f1d3bd548fe8e6d1.1729180470.git.geert+renesas@glider.be
>
> Notes:
> - While the bridge supports only two possible I2C addresses, I2C
> translators may be present, increasing the address space. Hence the
> instance ID calculation assumes 10-bit addressing. Perhaps it makes
> sense to introduce a global I2C helper function for this?
>
> - I think this is the simplest solution. If/when the auxiliary bus
> receives support à la PLATFORM_DEVID_AUTO, the driver can be
> updated.
As I'd like to get a proper solution for this I'm not going to ack this
patch, but I won't nack it either.
> v2:
> - Use I2C adapter/address instead of ida_alloc().
> ---
> drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> index 9e31f750fd889745..fb452d1b46995673 100644
> --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c
> @@ -480,6 +480,7 @@ static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata,
> const char *name)
> {
> struct device *dev = pdata->dev;
> + const struct i2c_client *client = to_i2c_client(dev);
> struct auxiliary_device *aux;
> int ret;
>
> @@ -488,6 +489,7 @@ static int ti_sn65dsi86_add_aux_device(struct ti_sn65dsi86 *pdata,
> return -ENOMEM;
>
> aux->name = name;
> + aux->id = (client->adapter->nr << 10) | client->addr;
> aux->dev.parent = dev;
> aux->dev.release = ti_sn65dsi86_aux_device_release;
> device_set_of_node_from_dev(&aux->dev, dev);
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2024-12-10 14:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 14:18 [PATCH v2] drm/bridge: ti-sn65dsi86: Fix multiple instances Geert Uytterhoeven
2024-12-10 14:28 ` Laurent Pinchart [this message]
2024-12-10 17:08 ` Doug Anderson
2024-12-11 8:27 ` Geert Uytterhoeven
2025-01-07 17:21 ` Doug Anderson
2025-01-07 17:39 ` Geert Uytterhoeven
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=20241210142819.GK573@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=andrzej.hajda@intel.com \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=linus.walleij@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=simona@ffwll.ch \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
--cc=wsa+renesas@sang-engineering.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