All of lore.kernel.org
 help / color / mirror / Atom feed
* question about driver for different sensors in the same ASIC
@ 2012-12-12 19:19 Denis Ciocca
  2012-12-12 19:45 ` Lars-Peter Clausen
  0 siblings, 1 reply; 7+ messages in thread
From: Denis Ciocca @ 2012-12-12 19:19 UTC (permalink / raw)
  To: lars, jic23; +Cc: linux-iio@vger.kernel.org

Ho guys,

I have a 	question for you!
If I have two sensors (accelerometer and gyroscope for example) in the =
same ASIC with the same I2C address, I have to do only one driver (only =
probe I think) for the devices or it is possible execute two different =
probes (one for accelerometer and the other one for gyroscope) keeping =
separate the drivers?
Thanks,

Denis=

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

* Re: question about driver for different sensors in the same ASIC
  2012-12-12 19:19 question about driver for different sensors in the same ASIC Denis Ciocca
@ 2012-12-12 19:45 ` Lars-Peter Clausen
       [not found]   ` <CAEE_umopjN7C_jXhozc5r+uyCbO32E3NoLF=REvwtvPXYaR54w@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Lars-Peter Clausen @ 2012-12-12 19:45 UTC (permalink / raw)
  To: Denis Ciocca; +Cc: jic23, linux-iio@vger.kernel.org

On 12/12/2012 08:19 PM, Denis Ciocca wrote:
> Ho guys,
> 
> I have a 	question for you!
> If I have two sensors (accelerometer and gyroscope for example) in the same ASIC with the same I2C address, I have to do only one driver (only probe I think) for the devices or it is possible execute two different probes (one for accelerometer and the other one for gyroscope) keeping separate the drivers?
> Thanks,
> 
> Denis

Usually you'd want to be able to sample both the accelerometer and gyro sensors
at the same time, so just one driver should be fine.

Or have the gyro and accelerometer sensors completely separated register maps
and don't share any functionality?

- Lars

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

* Re: question about driver for different sensors in the same ASIC
       [not found]     ` <50C8E7A7.2030901@metafoo.de>
@ 2012-12-12 21:09       ` Alexander Holler
  2012-12-13  8:28       ` Jonathan Cameron
  1 sibling, 0 replies; 7+ messages in thread
From: Alexander Holler @ 2012-12-12 21:09 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis Ciocca, linux-iio@vger.kernel.org, Jonathan Cameron

Am 12.12.2012 21:23, schrieb Lars-Peter Clausen:
> On 12/12/2012 08:49 PM, Denis Ciocca wrote:
>>> Usually you'd want to be able to sample both the accelerometer and gyro
>> sensors
>>> at the same time, so just one driver should be fine.
>>>
>>> Or have the gyro and accelerometer sensors completely separated register
>> maps
>>> and don't share any functionality?
>>
>> Some sensors doesn't share any functionality, simply share the same
>> interface or better the control registers for single sensor are separated.
>> I test this with the current driver but the second proble doesn't start!
>> Only one probe is mandatory?
>
> You can only have one device per I2C address and only one probe call per
> device. If you really want to use two separated drivers you could create a mfd
> device and one subdevice for the gyro and accelerometer.

There are patches for a driver to use HID over i2c on lkml. Might be 
need some effort to implement that on devices, but maybe it's a solution.

Regards,

Alexander

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

* Re: question about driver for different sensors in the same ASIC
       [not found]     ` <50C8E7A7.2030901@metafoo.de>
  2012-12-12 21:09       ` Alexander Holler
@ 2012-12-13  8:28       ` Jonathan Cameron
  2012-12-13  8:48         ` Jonathan Cameron
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2012-12-13  8:28 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis Ciocca, linux-iio@vger.kernel.org, Jonathan Cameron

On 12/12/12 20:23, Lars-Peter Clausen wrote:
> On 12/12/2012 08:49 PM, Denis Ciocca wrote:
>>> Usually you'd want to be able to sample both the accelerometer and gyro
>> sensors
>>> at the same time, so just one driver should be fine.
>>>
>>> Or have the gyro and accelerometer sensors completely separated register
>> maps
>>> and don't share any functionality?
>>
>> Some sensors doesn't share any functionality, simply share the same
>> interface or better the control registers for single sensor are separated.
>> I test this with the current driver but the second proble doesn't start!
>> Only one probe is mandatory?
>
> You can only have one device per I2C address and only one probe call per
> device. If you really want to use two separated drivers you could create a mfd
> device and one subdevice for the gyro and accelerometer.
>
> - Lars
Agreed, not much else you can do other than refactor the driver to 
handle them as two 'instances' of the iio bits called from a single 
probe function with callbacks to make the shared i2c element work
reasonably...  Fiddly, but its got to be that or a fall blown mfd
(not sure if the mfd side of things will bring enough benefits here...)

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

* Re: question about driver for different sensors in the same ASIC
  2012-12-13  8:28       ` Jonathan Cameron
@ 2012-12-13  8:48         ` Jonathan Cameron
  2012-12-13  8:57           ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2012-12-13  8:48 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis Ciocca, linux-iio@vger.kernel.org, Jonathan Cameron

On 13/12/12 08:28, Jonathan Cameron wrote:
> On 12/12/12 20:23, Lars-Peter Clausen wrote:
>> On 12/12/2012 08:49 PM, Denis Ciocca wrote:
>>>> Usually you'd want to be able to sample both the accelerometer and gyro
>>> sensors
>>>> at the same time, so just one driver should be fine.
>>>>
>>>> Or have the gyro and accelerometer sensors completely separated
>>>> register
>>> maps
>>>> and don't share any functionality?
>>>
>>> Some sensors doesn't share any functionality, simply share the same
>>> interface or better the control registers for single sensor are
>>> separated.
>>> I test this with the current driver but the second proble doesn't start!
>>> Only one probe is mandatory?
>>
>> You can only have one device per I2C address and only one probe call per
>> device. If you really want to use two separated drivers you could
>> create a mfd
>> device and one subdevice for the gyro and accelerometer.
>>
>> - Lars
> Agreed, not much else you can do other than refactor the driver to
> handle them as two 'instances' of the iio bits called from a single
> probe function with callbacks to make the shared i2c element work
> reasonably...  Fiddly, but its got to be that or a fall blown mfd
> (not sure if the mfd side of things will bring enough benefits here...)
>
Just to give us some real basis for this discussion, which part number 
is it that does this?  The only ones I can immediately find (lsm330)
use different i2c addresses for the two parts.

Obviously if we are discussing a part for which docs are not available,
we'll be pestering you for more information as we can't get it from
the datasheet :)

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

* Re: question about driver for different sensors in the same ASIC
  2012-12-13  8:48         ` Jonathan Cameron
@ 2012-12-13  8:57           ` Jonathan Cameron
  2012-12-13  9:07             ` Jonathan Cameron
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Cameron @ 2012-12-13  8:57 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis Ciocca, linux-iio@vger.kernel.org, Jonathan Cameron

On 13/12/12 08:48, Jonathan Cameron wrote:
> On 13/12/12 08:28, Jonathan Cameron wrote:
>> On 12/12/12 20:23, Lars-Peter Clausen wrote:
>>> On 12/12/2012 08:49 PM, Denis Ciocca wrote:
>>>>> Usually you'd want to be able to sample both the accelerometer and
>>>>> gyro
>>>> sensors
>>>>> at the same time, so just one driver should be fine.
>>>>>
>>>>> Or have the gyro and accelerometer sensors completely separated
>>>>> register
>>>> maps
>>>>> and don't share any functionality?
>>>>
>>>> Some sensors doesn't share any functionality, simply share the same
>>>> interface or better the control registers for single sensor are
>>>> separated.
>>>> I test this with the current driver but the second proble doesn't
>>>> start!
>>>> Only one probe is mandatory?
>>>
>>> You can only have one device per I2C address and only one probe call per
>>> device. If you really want to use two separated drivers you could
>>> create a mfd
>>> device and one subdevice for the gyro and accelerometer.
>>>
>>> - Lars
>> Agreed, not much else you can do other than refactor the driver to
>> handle them as two 'instances' of the iio bits called from a single
>> probe function with callbacks to make the shared i2c element work
>> reasonably...  Fiddly, but its got to be that or a fall blown mfd
>> (not sure if the mfd side of things will bring enough benefits here...)
>>
> Just to give us some real basis for this discussion, which part number
> is it that does this?  The only ones I can immediately find (lsm330)
> use different i2c addresses for the two parts.
>
> Obviously if we are discussing a part for which docs are not available,
> we'll be pestering you for more information as we can't get it from
> the datasheet :)

Ah, the lsm333 has magnetometer and accelerometer together.  In that 
case though they go through the same datapath (fifo etc) I think
so you want a single hybrid device.

That datasheet is a little 'interesting' currently so I may well
be misreading it baddly ;)


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

* Re: question about driver for different sensors in the same ASIC
  2012-12-13  8:57           ` Jonathan Cameron
@ 2012-12-13  9:07             ` Jonathan Cameron
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2012-12-13  9:07 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Denis Ciocca, linux-iio@vger.kernel.org, Jonathan Cameron

On 13/12/12 08:57, Jonathan Cameron wrote:
> On 13/12/12 08:48, Jonathan Cameron wrote:
>> On 13/12/12 08:28, Jonathan Cameron wrote:
>>> On 12/12/12 20:23, Lars-Peter Clausen wrote:
>>>> On 12/12/2012 08:49 PM, Denis Ciocca wrote:
>>>>>> Usually you'd want to be able to sample both the accelerometer and
>>>>>> gyro
>>>>> sensors
>>>>>> at the same time, so just one driver should be fine.
>>>>>>
>>>>>> Or have the gyro and accelerometer sensors completely separated
>>>>>> register
>>>>> maps
>>>>>> and don't share any functionality?
>>>>>
>>>>> Some sensors doesn't share any functionality, simply share the same
>>>>> interface or better the control registers for single sensor are
>>>>> separated.
>>>>> I test this with the current driver but the second proble doesn't
>>>>> start!
>>>>> Only one probe is mandatory?
>>>>
>>>> You can only have one device per I2C address and only one probe call
>>>> per
>>>> device. If you really want to use two separated drivers you could
>>>> create a mfd
>>>> device and one subdevice for the gyro and accelerometer.
>>>>
>>>> - Lars
>>> Agreed, not much else you can do other than refactor the driver to
>>> handle them as two 'instances' of the iio bits called from a single
>>> probe function with callbacks to make the shared i2c element work
>>> reasonably...  Fiddly, but its got to be that or a fall blown mfd
>>> (not sure if the mfd side of things will bring enough benefits here...)
>>>
>> Just to give us some real basis for this discussion, which part number
>> is it that does this?  The only ones I can immediately find (lsm330)
>> use different i2c addresses for the two parts.
>>
>> Obviously if we are discussing a part for which docs are not available,
>> we'll be pestering you for more information as we can't get it from
>> the datasheet :)
>
> Ah, the lsm333 has magnetometer and accelerometer together.  In that
> case though they go through the same datapath (fifo etc) I think
> so you want a single hybrid device.
To continue the conversation with myself.
I did misread the datasheet.   The magnetometer has its' own data rate
and as far as I can see doesn't have a fifo.  Hence you will need two
struct iio_dev's to allow for separate triggers etc.
It will be a little fiddly but can certainly be done.

Good luck and feel free to tell your hardware designers that I think
they are nuts and out to just make your life tricky!

>
> That datasheet is a little 'interesting' currently so I may well
> be misreading it baddly ;)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2012-12-13  9:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12 19:19 question about driver for different sensors in the same ASIC Denis Ciocca
2012-12-12 19:45 ` Lars-Peter Clausen
     [not found]   ` <CAEE_umopjN7C_jXhozc5r+uyCbO32E3NoLF=REvwtvPXYaR54w@mail.gmail.com>
     [not found]     ` <50C8E7A7.2030901@metafoo.de>
2012-12-12 21:09       ` Alexander Holler
2012-12-13  8:28       ` Jonathan Cameron
2012-12-13  8:48         ` Jonathan Cameron
2012-12-13  8:57           ` Jonathan Cameron
2012-12-13  9:07             ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.