LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 09-06-2016, 12:02 AM   #1
poplinux
Member
 
Registered: May 2012
Posts: 111

Rep: Reputation: Disabled
How to contorl I2C device or GPIO device in the kernel.


Dear Sir.

My env is see below
- Platform : x86 atom rangeley.
- linux kernel : 4.7.0

Linux kernel is already support I2C device driver and GPIO device driver.
And this device is successfully worked.

If i was loading the "i2c-i801.ko", created the "/dev/i2c-0" and can running.

If i was loading the "gpio-ich.ko", created the "/sys/class/gpio" and can running.

But my goal ls create the new kernel device driver.
And I must contorl i2c and gpio in the my new device driver.

Never use the file descriptor on user space. Just use the kernel APIs.

But I don't know "How to can get some descriptor for I2C, GPIO in kernel space".

Some kernel code use the special API(ex. get_deviceXXXX()).

Could you support some example code?

Thank you.
 
Old 09-06-2016, 07:11 AM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,405
Blog Entries: 13

Rep: Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495Reputation: 4495
Example code would be in the kernel within the kernel driver sources for GPIO and I2C.

That is your best reference.

And you may want to request that a moderator move your thread to the Linux Kernel forum.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] AT91 gpio device driver access Gobliins Linux - Embedded & Single-board computer 2 11-01-2013 04:56 AM
Can't detect i2c device Shum Linux - Hardware 0 05-27-2011 01:05 AM
I2C device driver mylinuxdna Linux - General 0 10-10-2005 02:16 AM
I2C to external device ojschubert Linux - Hardware 0 02-08-2005 01:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration