-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Bcf: Fix sensor shell example #64693
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
Bcf: Fix sensor shell example #64693
Conversation
4915e84 to
a6d3465
Compare
|
I think it would make a lot more sense if this was written as a generic "GPIO controlled I2C bus switch" rather than pointing out a specific general purpose analog switch IC. How about rewording the whole thing so it sounds generic? |
Just to confirm you are talking about the driver right (not the dt-bindings)? |
Well the whole thing, binding name and compatible, driver name, function prefixes, board definition etc. I the board dts should not have been submitted as is in the first place - we normally don't take trees with off-tree bindings but this slipped through I guess. |
Well, |
Yeah I think it should be changed, you could add multiple compatibles if you really want to but I don't really see a point, it's a generic analog switch, what's the point of having a driver referring to it by part number? It would still describe the actual hardware. |
Well, the linux kernel actually does pretty much require the part thing (even in cases where hardware is not important is running some sort of special firmware), but I digress. I am not familiar enough to say if there is or will be other parts that work exactly the same as this, but I am happy to make the changes if that's what upstream expects. |
At some extent, it's not like you'd expect stuff like a
Dual channel SPST analog switches? I would lay towards a "yes". :-) |
Ok. does |
An analog switch can be used for many different things, your driver is specifically about switching an i2c line using a gpio based switch regardless of how the thing is implemented so I would go with something like |
a6d3465 to
23fd8dd
Compare
fabiobaltieri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool,few comments, from the design standpoint, I'd be tempted to suggest that this should be on-bus: i2c and be instantiated as a child of the i2c device. That would place it in the right point in the i2c hierarchy, the only problem is that doing that would force you to assign a dummy address to the device, so I'm not too sure about it. @teburd what do you think?
23fd8dd to
10d8c5d
Compare
Generic GPIO enabled analog switch to isolate devices from an I2C bus Signed-off-by: Vaishnav Achath <[email protected]> Signed-off-by: Ayush Singh <[email protected]>
64b7eb9 to
157ccf1
Compare
I'm re-running with debug logging |
drivers/i2c/gpio_i2c_switch.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a pretty long timeout, can you make it configurable via the Kconfig maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked to the orignial authors and it seems the reason for the abnormally long timeout was that they weren't sure about the other delays at the time. I have now made it dependent on the transfer delay (2 * delay + 100us). Should it still be configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the dependency is on the MCU and switch, so a configuration option makes sense with a default definition provided by the platform. For the base configuration, it should be provided and not given a default as it is platform usage dependent.
c31e562 to
028ab6b
Compare
drivers/i2c/gpio_i2c_switch.c
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey thinking about the logic, is this wait needed? I understand the one before the transaction if the switch has any settling time, but then why would you wait BEFORE setting it back? This should be placed after gpio_i2c_switch_disable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it can be removed. I have also reduced the gpio toggle delay to 1 us after checking the data sheet according to which the max on/off time is 12.9 ns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe there was a delay in case there was any propagation time through the controller. The intent was to avoid cutting the bus off before the transaction is completed at the hardware. As long as we are past the ACK, all should be good and no wait after the transaction before flipping the I/O is needed. And, as it seems, the delay time from flipping the I/O and having it propagate to the switch before new I2C transfers can happen seems negligable. Thanks for going through all this effort to clean up the hacks and sorry it slipped through the initial upstream submission.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of cousre, it's a good addition, sure there's more board around that could need this. Also now that I look at it again I realized I missed a misuse of the GPIO API :-) let me put together a quick followup for that.
028ab6b to
d70568a
Compare
d70568a to
05cade0
Compare
Add drivers for gpio_i2c_switch which is present in beagleconnect freedom Signed-off-by: Vaishnav Achath <[email protected]> Signed-off-by: Ayush Singh <[email protected]>
05cade0 to
908cce0
Compare
zephyrproject-rtos#64881 breaks zephyrproject-rtos#64693 Instead of reverting, I thought it might be better to move the whole switch to i2c. Signed-off-by: Ayush Singh <[email protected]>
…m board" This reverts commit 3769938. Now that gpio_i2c_switch is upstream, this hack should be removed. This had the unintended effect of disabling the on-board sensors. The issue was that the board was merged before this driver was upstream, resulting in the issue this commit "fixed". This revert also does not move the bus driver under the controller used by the driver as the sensor bus I2C driver is not an I2C peripheral. See: * zephyrproject-rtos#64881 * zephyrproject-rtos#64693 * zephyrproject-rtos#65031 Signed-off-by: Jason Kridner <[email protected]>
…m board" This reverts commit 3769938. Now that gpio_i2c_switch is upstream, this hack should be removed. This had the unintended effect of disabling the on-board sensors. The issue was that the board was merged before this driver was upstream, resulting in the issue this commit "fixed". This revert also does not move the bus driver under the controller used by the driver as the sensor bus I2C driver is not an I2C peripheral. See: * #64881 * #64693 * #65031 Signed-off-by: Jason Kridner <[email protected]>
…m board" This reverts commit 3769938. Now that gpio_i2c_switch is upstream, this hack should be removed. This had the unintended effect of disabling the on-board sensors. The issue was that the board was merged before this driver was upstream, resulting in the issue this commit "fixed". This revert also does not move the bus driver under the controller used by the driver as the sensor bus I2C driver is not an I2C peripheral. See: * zephyrproject-rtos/zephyr#64881 * zephyrproject-rtos/zephyr#64693 * zephyrproject-rtos/zephyr#65031 (cherry picked from commit 547a75d) Original-Signed-off-by: Jason Kridner <[email protected]> GitOrigin-RevId: 547a75d Change-Id: Ib6a6a0f71d249bc19a312d469f6e41224b70524b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5119865 Reviewed-by: Yuval Peress <[email protected]> Tested-by: Yuval Peress <[email protected]> Commit-Queue: Yuval Peress <[email protected]> Tested-by: ChromeOS Prod (Robot) <[email protected]>
The following commits adds support for
samples/sensor/sensor_shellfor beagleconnect freedom.Currently, it seems
hdc2010-humiditysensor does not show up onsensor infocommand but works fine withsensor getso help on that will be appreciated.