Lee Jones <lee@xxxxxxxxxx> 於 2025年5月2日 週五 下午4:08寫道: > ... > > > > +static const struct mfd_cell nct6694_devs[] = { > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 0), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 1), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 2), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 3), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 4), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 5), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 6), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 7), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 8), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 9), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 10), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 11), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 12), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 13), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 14), > > > > + MFD_CELL_BASIC("nct6694-gpio", NULL, NULL, 0, 15), > > > > > > These are all identical. > > > > > > I thought you were going to use PLATFORM_DEVID_AUTO? In fact, you are > > > already using PLATFORM_DEVID_AUTO since you are calling > > > mfd_add_hotplug_devices(). So you don't need this IDs. > > > > > > MFD_CELL_NAME() should do. > > > > > > > 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. > > > > When using MFD_CELL_NAME(), the platform_device->id for the GPIO > > devices is assigned values from 1 to 16, and for the I2C devices from > > 1 to 6, but I need the ID offset to start from 0 instead. > > Oh no, don't do that. mfd_cell isn't supposed to be used outside of MFD. > > Just use the platform_device id-- if you really need to start from 0. > > As an aside, I'm surprised numbering starts from 1. > OK, I will use platform_device->id instead. However, I'm still unsure why the ID starts from1. Additionally, I noticed that when calling mfd_add_devices() separately, the IDs are also assigned consecutively (e.g., GPIO: 1~16, I2C: 17~22, ...). Do you have any recommendations on how I should implement this? Thanks, Ming