2008-11-11 07:49:08 adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65022
hi,
i went through the i2c documentation for balckfin...http://docs.blackfin.uclinux.org/doku.php?id=i2c
information is given on how to write a client driver, i went through the i2c documentation in the linux 2.6 kernel. they say a client driver needs a algo and bus driver for it. my question is,for interfacing the adxl345 accelerometer chip do i have to write my own bus and algo driver or can i use the ones which are already there. and how do i decide which one to use? i could not find any information on this.
thanks
abhri
QuoteReplyEditDelete
2008-11-11 08:10:15 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65024
you need a bus driver for whatever i2c bus you're hooking it up to. if you hook up to the Blackfin i2c bus, then there is already a driver for that.
considering you're designing the hardware, i would hope you would know what i2c bus you're connecting the device up to ...
QuoteReplyEditDelete
2008-11-12 01:01:03 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65073
thanks mike for the info
QuoteReplyEditDelete
2008-11-12 08:32:50 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65150
hi
i think the blackfin bus driver will work fine. in the kernel drivers/i2c/ there are some chips drivers also. what i am not understanding is what all things i need to make my client driver for adxl345 work. i have a bus driver, do i need any other drivers or my client driver is enough. is there any documentation for writing drivers for new chips? if there are any pointers please help.
thanks
abhri
QuoteReplyEditDelete
2008-11-12 08:35:31 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65152
client drivers and chip drivers are the same thing
please read this page:
http://docs.blackfin.uclinux.org/doku.php?id=i2c
QuoteReplyEditDelete
2008-11-12 09:29:52 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65155
hi,
so as i understand now my chip/client driver will use the blackfin -twi-driver for bus driver, and the algorithm will be taken care by the bus driver itself. all that i need to do is write the client/chip driver for adxl345.?
thanks
abhri
QuoteReplyEditDelete
2008-11-12 09:37:02 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65157
the exact bus driver does not matter as they all present the same I2C interface. the only thing you need to implement is the adxl345 i2c client driver.
QuoteReplyEditDelete
2008-11-12 09:40:49 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65158
thanks a lot mike
abhri
QuoteReplyEditDelete
2008-11-14 05:17:06 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65285
hi
can i provide ioctls in my chip driver for adxl345.? i saw the drivers in drivers/i2c/chips none of them provided ioctls .. is there an alternative?
thanks
abhri
QuoteReplyEditDelete
2008-11-14 05:28:35 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65287
what you choose to do in your driver is your business ...
QuoteReplyEditDelete
2008-11-17 04:42:50 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65365
hi
i am having doubts on where to put the accelerometer i2c driver. my requirements are..
i need to export data( 32 bytes)to userspace,
i need to provide ioctls to user for setting up the registers.
please advice me as to where in the linux subsystem i should put my accelerometer driver.
thanks
abhri
QuoteReplyEditDelete
2008-11-17 06:43:45 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65370
unless you plan on submitting your driver to mainline, i wouldnt put it in the kernel tree. just build it as a module externally.
otherwise, look in drivers/hwmon/ ... there seem to be a bunch of accelerometers in there already.
QuoteReplyEditDelete
2008-11-17 10:01:46 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65377
hi,
i guess i would build a module, coz i have no experience of submitting mainline. i saw the drivers/char/bfin_twi_lcd.c code and thinking of doing the driver similiarly. is this approach correct?
thanks
abhri
QuoteReplyEditDelete
2008-11-17 10:17:49 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65379
you can use this:
http://docs.blackfin.uclinux.org/doku.php?id=a_simple_module_example
QuoteReplyEditDelete
2008-11-18 07:08:09 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65438
hi,
i need to transfer some 32 bytes of data to user space from kernel space. any advice on how to do it?
thanks
abhri
QuoteReplyEditDelete
2008-11-18 08:45:03 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65440
the simplest way is probably a char device
QuoteReplyEditDelete
2008-11-18 19:10:08 Re: adxl345 i2c driver
Frank Van Hooft (CANADA)
Message: 65465
If you're struggling with the idea of doing it in kernelspace, you might consider accessing your I2C device from userspace. The example application ppifcd does that, in its case talking to an image sensor via I2C from userspace. Take a look at fcd.c and associated files to see how Mike H did it.
QuoteReplyEditDelete
2008-11-19 01:54:19 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 65473
hi ,
i will look into the userspace example. But my requirement is that i need to write a kernel space driver. i looked into the bfin_twi_lcd.c and implementing my driver on similiar lines.i am using copy_to_user to transfer data to userspace.and i am using ioctl's to set the registers of the adxl345 accelerometer. is this a decent approach?
thanks
abhri
QuoteReplyEditDelete
2008-11-19 21:06:28 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 65564
sounds fine
QuoteReplyEditDelete
2008-12-02 04:03:39 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 66127
hi
my driver is working. i can set up the accelerometer using ioctl command from my application. and then read back register values and display them. But i want to report activity in real time, should i use the input subsytem for reporting values? any suggestions?
thanks
abhri
QuoteReplyEditDelete
2008-12-03 10:20:37 Re: adxl345 i2c driver
abhrajit datta (INDIA)
Message: 66243
hi,
there are a total of 8 interrupts in the adxl345, like activity/inactivity, free fall, tap double tap, data ready etc. what can be the best way to report these events ? please give suggestions.
thanks
abhri
QuoteReplyEditDelete
2008-12-03 14:47:20 Re: adxl345 i2c driver
Mike Frysinger (UNITED STATES)
Message: 66249
probably the event subsystem