Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several devices of same type on same bus - how to address? #6450

Closed
webhive opened this issue Mar 4, 2018 · 4 comments
Closed

Several devices of same type on same bus - how to address? #6450

webhive opened this issue Mar 4, 2018 · 4 comments

Comments

@webhive
Copy link

webhive commented Mar 4, 2018

Hello! I am trying to implement device driver, but researching samples found what drivers model assumed we have single device of any type. For example HTS221 on I2C bus. What if I need to add several devices on same bus. We have only single HTS221_GPIO_DEV_NAME.

Reviewed several device drivers Kfiles - most have device name and device address. Looks like no way now to assign several addresses to same bus.

May be I am wrong and dont understand something. Anyway any help could be good.

@MaureenHelm
Copy link
Member

Most or all of the sensor drivers assume only one instance, but could be refactored to support multiple instances. The uart and i2c drivers are better about supporting multiple instances, since it is much more common to need multiple uarts than it is to need multiple humidity sensors.

@lodup29
Copy link
Contributor

lodup29 commented Jun 30, 2021

@MaureenHelm I believe that the I2C driver model also suffers from the same issue as reported by @webhive. Yet, more than one instance of the same driver seems like a very comme use case on a given I2C bus.

@MaureenHelm
Copy link
Member

@MaureenHelm I believe that the I2C driver model also suffers from the same issue as reported by @webhive. Yet, more than one instance of the same driver seems like a very comme use case on a given I2C bus.

Is there a specific I2C driver you're looking at? We refactored a lot of drivers to support multiple instances last year, and have been enforcing it on new drivers since then.

https://docs.zephyrproject.org/latest/guides/dts/howtos.html#write-device-drivers-using-devicetree-apis

@symstopje
Copy link

@MaureenHelm does tmp116 driver support multiple instances? how to check if driver supports multiple?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants