From: varun mahajan <invincible_6-/E1597aS9LQxFYw1CcD5bw@public.gmane.org>
To: i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: New style I2C driver for KXSD9 accelerometer
Date: Sat, 20 Sep 2008 08:51:58 +0530 (IST) [thread overview]
Message-ID: <20125.80062.qm@web7902.mail.in.yahoo.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2123 bytes --]
Hi,
I m implementing a driver for accelerometer KXSD9 in linux kernel 2.6.24.7 for OMAP-3430. KXSD9 sensor will be connected to the i2c bus so it will be an i2c client.
I m implementing a new style driver, so following are the steps that I m following:
1. Putting the device info (busnum, address, irq) in the board specific initialization code. From this the i2c-core will create a client for my device when the corresponding bus adapter (i2c_adapter) is registered.
2. I m implementing the following i2c_driver for my device
struct i2c_driver KXSD9_i2c_driver =
{
.driver = {
.name = "KXSD9_driver",
},
.probe = KXSD9_probe, /* this will do the device initialization */
.remove = KXSD9_remove,
.shutdown = KXSD9_shutdown,
.suspend = KXSD9_suspend,
.resume = KXSD9_resume,
};
3. My requirement is that I need to export the file operations (specific ioctl commands) to the user space. I am not sure how it has to be done from this driver????
I thought of the following approach:
Registering a misc device to export the file operations
int __init KXSD9_driver_init()
{
/*Provide /dev interface to user space and export the file
operations */
misc_register(&KXSD9_misc_device);
/*Request the IRQ and install the interrupt handler*/
request_irq(.. KXSD9_IRQ . .);
/*Add the i2c_driver*/
i2c_add_driver(&KXSD9_i2c_driver);
}
Is this the correct way of doing it???????? Or the file operations should be exported using some other method in case of i2c_drivers????
Your reply will be highly helpful… Thanks in advance….
Varun
Download prohibited? No problem. CHAT from any browser, without download. Go to http://in.webmessenger.yahoo.com/
[-- Attachment #1.2: Type: text/html, Size: 8719 bytes --]
[-- Attachment #2: Type: text/plain, Size: 157 bytes --]
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
next reply other threads:[~2008-09-20 3:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-20 3:21 varun mahajan [this message]
[not found] ` <20125.80062.qm-lNdE0ozIhWIn1dgYqARqB/xNefe2kvS0AL8bYrjMMd8@public.gmane.org>
2008-09-22 11:30 ` New style I2C driver for KXSD9 accelerometer Jonathan Cameron
2008-09-22 17:38 ` Trilok Soni
[not found] ` <5d5443650809221038u7bece6fco2a123c7c85014318-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-09-22 22:43 ` Ben Dooks
[not found] ` <20080922224345.GL2716-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2008-09-23 10:19 ` Jonathan Cameron
[not found] ` <48D8C2CB.30505-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2008-12-20 20:33 ` [i2c] " Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20125.80062.qm@web7902.mail.in.yahoo.com \
--to=invincible_6-/e1597as9lqxfyw1ccd5bw@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox