[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOoeyxV-dzrJNJ83Y55SKc0rBqcFk2jPM1Z2T+hPF+QFGz3GRA@mail.gmail.com>
Date: Mon, 21 Apr 2025 19:00:15 +0800
From: Ming Yu <a0282524688@...il.com>
To: Lee Jones <lee@...nel.org>
Cc: tmyu0@...oton.com, linus.walleij@...aro.org, brgl@...ev.pl,
andi.shyti@...nel.org, mkl@...gutronix.de, mailhol.vincent@...adoo.fr,
andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, wim@...ux-watchdog.org,
linux@...ck-us.net, jdelvare@...e.com, alexandre.belloni@...tlin.com,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-can@...r.kernel.org, netdev@...r.kernel.org,
linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org,
linux-rtc@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH v8 1/7] mfd: Add core driver for Nuvoton NCT6694
Lee Jones <lee@...nel.org> 於 2025年4月10日 週四 下午4:21寫道:
>
> On Mon, 07 Apr 2025, Ming Yu wrote:
>
> > Lee Jones <lee@...nel.org> 於 2025年4月4日 週五 下午10:21寫道:
> > >
> > > > ...
> > > > > > > > + MFD_CELL_BASIC("gpio-nct6694", NULL, NULL, 0, 0x1),
> > > > > > >
> > > > > > > IDs are usually given in base-10.
> > > > > > >
> > > > > >
> > > > > > Fix it in v9.
> > > > > >
> > > > > > > Why are you manually adding the device IDs?
> > > > > > >
> > > > > > > PLATFORM_DEVID_AUTO doesn't work for you?
> > > > > > >
> > > > > >
> > > > > > I need to manage these IDs to ensure that child devices can be
> > > > > > properly utilized within their respective modules.
> > > > >
> > > > > How? Please explain.
> > > > >
> > > > > This numbering looks sequential and arbitrary.
> > > > >
> > > > > What does PLATFORM_DEVID_AUTO do differently such that it is not useful?
> > > > >
> > > >
> > > > As far as I know, PLATFORM_DEVID_AUTO assigns dynamic IDs to devices,
> > > > but I need fixed IDs.
> > > > For example, the GPIO driver relies on these IDs to determine the
> > > > group, allowing the firmware to identify which GPIO group to operate
> > > > on through the API.
> > >
> > > PLATFORM_DEVID_AUTO will allocate IDs 0 through 16, the same as you've
> > > done here. These lines do not have any differentiating attributes, so
> > > either way we are not allocating specific IDs to specific pieces of the
> > > H/W. I still do not understand why you need to allocate them manually.
> > >
> >
> > I'm using PLATFORM_DEVID_AUTO to allocate child device IDs with
> > MFD_CELL_NAME(), like this:
> >
> > static const struct mfd_cell nct6694_dev[] = {
> > MFD_CELL_NAME("nct6694-gpio"),
> > MFD_CELL_NAME("nct6694-gpio"),
> > ......
> > MFD_CELL_NAME("nct6694-gpio"),
> > MFD_CELL_NAME("nct6694-i2c"),
> > MFD_CELL_NAME("nct6694-i2c"),
> > ......
> > MFD_CELL_NAME("nct6694-i2c"),
> > ......
> > };
> >
> > For example, the device IDs retrieved in gpio-nct6694.c is 1~16, and
> > i2c-nct6694.c is 17~22. Does this mean each driver should
> > independently handle its dynamically assigned IDs?
> > Additionally, I originally referred to cgbc-core.c with i2c-cgbc.c,
> > and ab8500-core.c with pwm-ab8500.c for associating child devices. Do
> > you think this approach is appropriate in my case?
>
> Yes, if you _need_ the ranges to start from 0, then you will have to
> call mfd_add_devices() separately on those ranges. Otherwise one range
> will follow directly on to another range.
>
> But wait, you're using mfd_add_hotplug_devices(), which means you are
> using PLATFORM_DEVID_AUTO. So your .id values that you've added are
> being ignored anyway. Thus, if you have tested that this works, you
> don't need them anyway, right?
>
Yes, it uses PLATFORM_DEVID_AUTO, but in my implementation, the
sub-devices use cell->id instead of platform_device->id, so it doesn't
affect the current behavior.
However, if you think there's a better approach or that this should be
changed for consistency or correctness, I'm happy to update it, please
let me know your recommendation.
Thanks,
Ming
Powered by blists - more mailing lists