linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Heiko Stuebner <heiko@sntech.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Lee Jones <lee@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Alessandro Zummo <a.zummo@towertech.it>,
	linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@collabora.com,
	Diederik de Haas <didi.debian@cknow.org>,
	Vincent Legoll <vincent.legoll@gmail.com>
Subject: Re: [PATCH v8 08/14] mfd: rk8xx: add rk806 support
Date: Thu, 16 Nov 2023 12:30:04 +0100	[thread overview]
Message-ID: <20231116113004.o77ayzlzchwdygro@mercury.elektranox.org> (raw)
In-Reply-To: <0ba99820-ada8-4a42-af99-3b57f585bec8@linaro.org>


[-- Attachment #1.1: Type: text/plain, Size: 5720 bytes --]

Hi,

On Thu, Nov 16, 2023 at 09:41:03AM +0100, Neil Armstrong wrote:
> On 15/11/2023 19:00, Sebastian Reichel wrote:
> > On Wed, Nov 15, 2023 at 06:17:50PM +0100, Neil Armstrong wrote:
> > > On 04/05/2023 19:36, Sebastian Reichel wrote:
> > > > Add support for SPI connected rk806, which is used by the RK3588
> > > > evaluation boards. The PMIC is advertised to support I2C and SPI,
> > > > but the evaluation boards all use SPI. Thus only SPI support is
> > > > added here.
> > > > 
> > > > Acked-for-MFD-by: Lee Jones <lee@kernel.org>
> > > > Tested-by: Diederik de Haas <didi.debian@cknow.org> # Rock64, Quartz64 Model A + B
> > > > Tested-by: Vincent Legoll <vincent.legoll@gmail.com> # Pine64 QuartzPro64
> > > > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > > > ---
> > > >    drivers/mfd/Kconfig       |  14 ++
> > > >    drivers/mfd/Makefile      |   1 +
> > > >    drivers/mfd/rk8xx-core.c  |  69 ++++++-
> > > >    drivers/mfd/rk8xx-spi.c   | 124 ++++++++++++
> > > >    include/linux/mfd/rk808.h | 409 ++++++++++++++++++++++++++++++++++++++
> > > >    5 files changed, 614 insertions(+), 3 deletions(-)
> > > >    create mode 100644 drivers/mfd/rk8xx-spi.c
> > > > 
> > > 
> > > <snip>
> > > 
> > > > -	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
> > > > -			      cells, nr_cells, NULL, 0,
> > > > +	ret = devm_mfd_add_devices(dev, 0, cells, nr_cells, NULL, 0,
> > > >    			      regmap_irq_get_domain(rk808->irq_data));
> > > 
> > > It seems you replaced PLATFORM_DEVID_NONE by 0, triggering again the bug preventing
> > > having multiples RK pmics on the same system I fixed earlier at [1].
> > 
> > All cells have PLATFORM_DEVID_NONE specified and thus are registered
> > without an ID. I changed this bit to avoid overriding the
> > information, since I did not want to have PLATFORM_DEVID_NONE for
> > rk806.
> > 
> > > This gives (again):
> > > <4>[ 0.664107] sysfs: cannot create duplicate filename '/bus/platform/devices/rk808-clkout'
> > 
> > Which means, you do not want PLATFORM_DEVID_NONE (-1), but
> > PLATFORM_DEVID_AUTO (-2). The above path is the expected path
> > for PLATFORM_DEVID_NONE.
> > 
> > > <4>[ 0.664120] CPU: 3 PID: 97 Comm: kworker/u12:2 Not tainted 6.6.1 #1
> > > <4>[ 0.664131] Hardware name: Hardkernel ODROID-GO-Ultra (DT)
> > > <4>[ 0.664139] Workqueue: events_unbound deferred_probe_work_func
> > > <4>[ 0.664160] Call trace:
> > > <4>[ 0.664165] dump_backtrace+0x9c/0x11c
> > > <4>[ 0.664181] show_stack+0x18/0x24
> > > <4>[ 0.664193] dump_stack_lvl+0x78/0xc4
> > > <4>[ 0.664205] dump_stack+0x18/0x24
> > > <4>[ 0.664215] sysfs_warn_dup+0x64/0x80
> > > <4>[ 0.664227] sysfs_do_create_link_sd+0xf0/0xf8
> > > <4>[ 0.664239] sysfs_create_link+0x20/0x40
> > > <4>[ 0.664250] bus_add_device+0x114/0x160
> > > <4>[ 0.664259] device_add+0x3f0/0x7cc
> > > <4>[ 0.664267] platform_device_add+0x180/0x270
> > > <4>[ 0.664278] mfd_add_device+0x390/0x4a8
> > > <4>[ 0.664290] devm_mfd_add_devices+0xb0/0x150
> > > <4>[ 0.664301] rk8xx_probe+0x26c/0x410
> > > <4>[ 0.664312] rk8xx_i2c_probe+0x64/0x98
> > > <4>[ 0.664323] i2c_device_probe+0x104/0x2e8
> > > <4>[ 0.664333] really_probe+0x184/0x3c8
> > > <4>[ 0.664342] __driver_probe_device+0x7c/0x16c
> > > <4>[ 0.664351] driver_probe_device+0x3c/0x10c
> > > <4>[ 0.664360] __device_attach_driver+0xbc/0x158
> > > <4>[ 0.664369] bus_for_each_drv+0x80/0xdc
> > > <4>[ 0.664377] __device_attach+0x9c/0x1ac
> > > <4>[ 0.664386] device_initial_probe+0x14/0x20
> > > <4>[ 0.664395] bus_probe_device+0xac/0xb0
> > > <4>[ 0.664403] deferred_probe_work_func+0xa0/0xf4
> > > <4>[ 0.664412] process_one_work+0x1bc/0x378
> > > <4>[ 0.664421] worker_thread+0x1dc/0x3d4
> > > <4>[ 0.664429] kthread+0x104/0x118
> > > <4>[ 0.664440] ret_from_fork+0x10/0x20
> > > <3>[ 0.664494] rk8xx-i2c 0-001c: error -EEXIST: failed to add MFD devices
> > > <4>[ 0.666769] rk8xx-i2c: probe of 0-001c failed with error -17
> > 
> > I didn't notice when working on rk806, but after analyzing it now:
> > 
> > Your patch effectively set the cells to PLATFORM_DEVID_AUTO, because
> > you set all cells to PLATFORM_DEVID_NONE (-1) and additionally used
> > PLATFORM_DEVID_NONE (-1) for the devm_mfd_add_devices() call. But
> > that uses the sum of both IDs. Adding -1 to -1 is -2 and thus
> > PLATFORM_DEVID_AUTO. This is of course very confusing and just
> > worked by chance. There are two options:
> > 
> > 1. Modify all cells to use PLATFORM_DEVID_AUTO instead of
> > PLATFORM_DEVID_NONE
> > 2. Drop the .id from all cells and use PLATFORM_DEVID_AUTO in the
> > call to devm_mfd_add_devices()
> > 
> > Note, that switching from PLATFORM_DEVID_NONE to PLATFORM_DEVID_AUTO
> > modifies sysfs paths and thus might break people's scripts; that's why
> > I tried not to modify any existing platform. I will let you deal
> > with that, since I cannot even test any !rk806 platform supported by
> > this driver :)
> 
> Yes it will modify sysfs path, but it's a regression since this before this patch
> everything was registered with PLATFORM_DEVID_AUTO anyway,
> so I'll provide a fix adding back PLATFORM_DEVID_NONE to devm_mfd_add_devices
> in a first time...

If you just add back PLATFORM_DEVID_NONE to devm_mfd_add_devices(),
it will break rk806, since that correctly states PLATFORM_DEVID_AUTO
in its .id and that would become -3.

> > Also mfd_add_device should probably get special handling for
> > PLATFORM_DEVID_NONE, just like it already has special handling
> > for PLATFORM_DEVID_AUTO.
> 
> ... and yes thanks for the great analysis I'll provide a change
> cleaning the mess.

Thanks,

-- Sebastian

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

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2023-11-16 11:30 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 17:36 [PATCH v8 00/14] mfd/pinctrl/regulator: Add RK806 Support Sebastian Reichel
2023-05-04 17:36 ` [PATCH v8 01/14] clk: RK808: reduce 'struct rk808' usage Sebastian Reichel
2023-05-15 15:14   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 02/14] mfd: rk808: convert to device managed resources Sebastian Reichel
2023-05-15 15:17   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 03/14] mfd: rk808: use dev_err_probe Sebastian Reichel
2023-05-15 15:18   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 04/14] mfd: rk808: replace 'struct i2c_client' with 'struct device' Sebastian Reichel
2023-05-15 15:18   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 05/14] mfd: rk808: split into core and i2c Sebastian Reichel
2023-05-15 15:19   ` Lee Jones
     [not found]   ` <CGME20230516212700eucas1p1fbde1b6181c18d821e0796b6b6a4fa00@eucas1p1.samsung.com>
2023-05-16 21:26     ` Marek Szyprowski
2023-05-16 22:01       ` Sebastian Reichel
2023-06-30 11:34   ` Geert Uytterhoeven
2023-06-30 18:48     ` Sebastian Reichel
2023-07-04 13:08       ` Geert Uytterhoeven
2023-05-04 17:36 ` [PATCH v8 06/14] mfd: rk8xx-i2c: use device_get_match_data Sebastian Reichel
2023-05-15 15:19   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 07/14] dt-bindings: mfd: add rk806 binding Sebastian Reichel
2023-05-15 15:20   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 08/14] mfd: rk8xx: add rk806 support Sebastian Reichel
2023-05-15 15:20   ` Lee Jones
2023-11-15 17:17   ` Neil Armstrong
2023-11-15 18:00     ` Sebastian Reichel
2023-11-16  8:41       ` Neil Armstrong
2023-11-16 11:30         ` Sebastian Reichel [this message]
2023-05-04 17:36 ` [PATCH v8 09/14] pinctrl: rk805: add rk806 pinctrl support Sebastian Reichel
2023-05-15 15:21   ` Lee Jones
2023-05-04 17:36 ` [PATCH v8 10/14] regulator: expose regulator_find_closest_bigger Sebastian Reichel
2023-05-04 17:36 ` [PATCH v8 11/14] regulator: rk808: fix asynchronous probing Sebastian Reichel
2023-05-04 17:36 ` [PATCH v8 12/14] regulator: rk808: cleanup parent device usage Sebastian Reichel
2023-05-04 17:36 ` [PATCH v8 13/14] regulator: rk808: revert to synchronous probing Sebastian Reichel
2023-05-04 17:36 ` [PATCH v8 14/14] regulator: rk808: add rk806 support Sebastian Reichel
2023-05-15 15:24 ` [GIT PULL] Immutable branch between MFD, Clk, Input, Pinctrl, RTC, Power, Regulator and Sound due for the v6.5 merge window Lee Jones
2023-05-23 21:44 ` (subset) [PATCH v8 00/14] mfd/pinctrl/regulator: Add RK806 Support Mark Brown

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=20231116113004.o77ayzlzchwdygro@mercury.elektranox.org \
    --to=sebastian.reichel@collabora.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=didi.debian@cknow.org \
    --cc=heiko@sntech.de \
    --cc=kernel@collabora.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vincent.legoll@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;
as well as URLs for NNTP newsgroup(s).