Re: [PATCH 1/1] iio: ak8975: Add Ak8975 magnetometer sensor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/03/10 21:03, Andrew Chew wrote:
>> if I understand your comment correctly userspace needs to know that
>> number to convert from the magn_raw values to standard units.
>> Hence it must be exported.  My point is that the calib attributes
>> are used for devices that do their calibration offsets and scales
>> internally.  If it is a value userspace needs to apply then the
>> correct parameters are scale and offset. In the majority of devices
>> see so far these are fixed for all instances of the same part. That
>> isn't true here.
>>>
>>> And if we were to emit non-raw values (or provide the scale
>>> attributes), what's theexact name of the attributes?  And 
>> what units are we expecting?  Gauss?  Tesla?  I don't see 
>> that documented anywhere.
>> That is documented.  Gauss is the chosen standard for 
>> magnetometers.  I'll assume the
>> conversion factors are channel dependent in which case you need
>>
>> magn_x_raw, magn_x_scale, magn_x_offset
>>
>> note again, we have documented everything for some device types.
>> At the time, repeating for all of them was considered redundant, but
>> perhaps we do need to do this for the added clarity.
>>
>> The value in Gauss = (magn_x_raw + magn_x_offset)*magn_x_scale
> 

> The conversion formula doesn't have an offset, actually, so the order
> in which the offset and scale are applied don't really matter to me.
Cool. I misread your comment (lots of brackets and I was clearly half
asleep ;)
> 
> In any case, I think I got it now. I'm going to report the raw sensor
> value, and the scale factor for each axis to convert to gauss.
> 
> I assume when you say magn_x_scale, you really mean magn_x_gain?
> Because I don't see magn_x_scale defined in magnet.h. Or should I
> call the attribute magn_x_scale anyway, and not use the IIO_DEV_ATTR
> macro for gain?
Gah.  Take the documentation first.
Looks like the magnetometer macros slipped through the net - mainly
because no one was using them so they shouldn't have been there
in the first place.

Please can you add suitable macros for _scale?  You can also kill the _gain
ones if you like, or I can add that to the next set of clean up patches.
Killing the gain ones should be in a separate patch but it'll obviously cause
merge issues hence it is easier for you to do both.
The only provider of such an attribute is imu/adis16400_core.c and that
one is constant and shared across the axes so it uses
IIO_CONST_ATTR(magn_scale,...)

Thanks for pointing this out.

Jonathan


-----------------------------------------------------------------------------------
> This email message is for the sole use of the intended recipient(s) and may contain
> confidential information.  Any unauthorized review, use, disclosure or distribution
> is prohibited.  If you are not the intended recipient, please contact the sender by
> reply email and destroy all copies of the original message.
> -----------------------------------------------------------------------------------
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux