Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[My apology - this editor apparently removes all the blank spaces, thus messing up the simple diagram. Just note there're two dashed lines each representing an I2C bus. And there're two I2C devices mentioned: dev-1 and dev-m, representing 'm' devices on the 2nd I2C bus]
There is an I2C bus master on the CPU. It's already UP and running, and shows up as /dev/i2c-0. There is another micro-controller (uC) connected to the CPU, and it implements another I2C bus. The driver (.ko and .so) running on CPU is already available for this I2C bus. Hanging off it is a bunch of I2C devices we already supported on a different platform.
We want to reuse much of these I2C device drivers and application codes. Where should we make change to integrate the .ko and .so to port these drivers over with minimal code changes, and without destroying the /dev/i2c-0 functionalities?
By the same token, and hopefully, public domain utilities like i2cget, i2cset could also be used to access this 2nd i2c bus.
Last edited by rksyeung; 07-25-2018 at 09:17 PM.
Reason: Clarify system diagram
Configure your Linux system to add the second I2C bus and then use the applications code you have. You do not need to port a driver.
Maybe there is misunderstanding. We already have a lot of codes, drivers and applications, sitting on all the I2C devices from another platform. This new platform copies a lot of those hardware design, except the I2C controller is replaced. If we try to simply use the new driver directly, we could be changing a lot of codes, as the signatures of the drivers are different. Alternative is to write wrappers.
The new I2C driver (.ko and .so) is released by the vendor providing us the CPU module. I'm thinking about "plug and play" - plugging in the new I2C driver somewhere, and the rest of the I2C dependent codes simply work. I've been looking into the I2C driver architecture, in which they talk about Client, Core, Adaptor, Bus, Class, Algorithm etc., along the line of the Linux Kernel Driver Model. At this point, I've a feeling we may need to look into defining wrapping for the bus/algorithm objects.
To answer your specific question - this 3rd party driver is proven to work on Linux (YP), as we run its demo code, and had implemented some i2cget/i2cset utilities on top of it.
Thoughts?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.