Multiple Instances of Drivers


Pushpal Sidhu
 

I have a question about the current plan to allow multiple instances
of a driver.

For example, say we have two sx1509b devices as opposed to the
currently supported single instance:
&i2c0 {
status = "ok";
clock-frequency = <I2C_BITRATE_FAST>;

sx1509b: sx1509b@3e {
compatible = "semtech,sx1509b";
reg = <0x3e>;
label = "GPIO_P0";
};

sx1509b: sx1509b@3f {
compatible = "semtech,sx1509b";
reg = <0x3f>;
label = "GPIO_P1";
};
};

Only the one one whose .fixup defines CONFIG_GPIO_SX1509B_* gets an
instance, while the other doesn't. To add two devices, I would have to
hack the driver + fixup to define the correct configuration
information.

I just want to know the current plan to address this and how drivers
need to be written going forward. I couldn't find an issue that
address this, but I could easily have missed it and am just "looking
in the other pocket for my keys".

- Pushpal


Tomasz Bursztyka
 

Hi,

There is already an on-going work on how devices (aka driver instance)
are generated.

See issue:
https://github.com/zephyrproject-rtos/zephyr/issues/6293

Especially, check for b0661 and erwango PRs

Br,


Tomasz

I have a question about the current plan to allow multiple instances
of a driver.

For example, say we have two sx1509b devices as opposed to the
currently supported single instance:
&i2c0 {
status = "ok";
clock-frequency = <I2C_BITRATE_FAST>;

sx1509b: sx1509b@3e {
compatible = "semtech,sx1509b";
reg = <0x3e>;
label = "GPIO_P0";
};

sx1509b: sx1509b@3f {
compatible = "semtech,sx1509b";
reg = <0x3f>;
label = "GPIO_P1";
};
};

Only the one one whose .fixup defines CONFIG_GPIO_SX1509B_* gets an
instance, while the other doesn't. To add two devices, I would have
to
hack the driver + fixup to define the correct configuration
information.

I just want to know the current plan to address this and how drivers
need to be written going forward. I couldn't find an issue that
address this, but I could easily have missed it and am just "looking
in the other pocket for my keys".

- Pushpal



Pushpal Sidhu
 

Tomasz,

Thanks for pointing me to that. Pretty much exactly what I was looking
/ hoping for.

- Pushpal

On Thu, May 17, 2018 at 11:59 PM, Tomasz Bursztyka
<tomasz.bursztyka@...> wrote:
Hi,

There is already an on-going work on how devices (aka driver instance)
are generated.

See issue:
https://github.com/zephyrproject-rtos/zephyr/issues/6293

Especially, check for b0661 and erwango PRs

Br,


Tomasz

I have a question about the current plan to allow multiple instances
of a driver.

For example, say we have two sx1509b devices as opposed to the
currently supported single instance:
&i2c0 {
status = "ok";
clock-frequency = <I2C_BITRATE_FAST>;

sx1509b: sx1509b@3e {
compatible = "semtech,sx1509b";
reg = <0x3e>;
label = "GPIO_P0";
};

sx1509b: sx1509b@3f {
compatible = "semtech,sx1509b";
reg = <0x3f>;
label = "GPIO_P1";
};
};

Only the one one whose .fixup defines CONFIG_GPIO_SX1509B_* gets an
instance, while the other doesn't. To add two devices, I would have
to
hack the driver + fixup to define the correct configuration
information.

I just want to know the current plan to address this and how drivers
need to be written going forward. I couldn't find an issue that
address this, but I could easily have missed it and am just "looking
in the other pocket for my keys".

- Pushpal