public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* New style I2C driver for KXSD9 accelerometer
@ 2008-09-20  3:21 varun mahajan
       [not found] ` <20125.80062.qm-lNdE0ozIhWIn1dgYqARqB/xNefe2kvS0AL8bYrjMMd8@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: varun mahajan @ 2008-09-20  3:21 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-12-20 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-20  3:21 New style I2C driver for KXSD9 accelerometer varun mahajan
     [not found] ` <20125.80062.qm-lNdE0ozIhWIn1dgYqARqB/xNefe2kvS0AL8bYrjMMd8@public.gmane.org>
2008-09-22 11:30   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox