From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <50918B31.6010103@kernel.org> Date: Wed, 31 Oct 2012 20:33:53 +0000 From: Jonathan Cameron MIME-Version: 1.0 To: Lars-Peter Clausen CC: Denis CIOCCA , Denis Ciocca , Jonathan Cameron , Pavel Machek , "linux-iio@vger.kernel.org" , "burman.yan@gmail.com" Subject: Re: STMicroelectronics accelerometers driver. References: <5072F3B9.4050309@st.com> <5073260C.3010506@metafoo.de> <20121008195007.GA32042@elf.ucw.cz> <507338B5.60307@metafoo.de> <665718a4-de6b-4d09-ba80-35705fcf2595@email.android.com> <507D9EA3.4070009@metafoo.de> <5085128C.7020507@st.com> <50858B44.2080006@kernel.org> <5087E2A8.4070304@st.com> <508A7DA6.7050505@metafoo.de> <508E4492.8080000@st.com> <508E48D1.3000703@metafoo.de> <508E5978.5000907@st.com> <508E5AD5.1040907@metafoo.de> <50914366.4090000@st.com> <5091546D.9000601@metafoo.de> In-Reply-To: <5091546D.9000601@metafoo.de> Content-Type: text/plain; charset=ISO-8859-1 List-ID: On 10/31/2012 04:40 PM, Lars-Peter Clausen wrote: > Hi, > > On 10/31/2012 03:27 PM, Denis CIOCCA wrote: >> Hi Lars-Peter, >> >> I'm trying modified the driver to change the fullscale attribute and use >> the in_accel_*_scale attribute. >> My question is that: >> >> - the in_accel_*_scale attribute rappresent the conversion value from >> raw data sensor to m/s2, if I use only this value, how can I know what >> is the maximum full scale associated to the value? > > Unfortunately there is currently no way in IIO to specify minimum or maximum > values for a given channel. But you are welcome to come up with one, I think > this will be useful for other drivers as well. My personal preference would be an additional (for now optional) callback alongside read_raw and write_raw called something like available. This would be used by additional xxxxx_available attributes to describe the possible values for info_mask element. Exactly how to do this cleanly is a small 'implemention detail' which means this will probably be rather more complex than this implies :) Interdependent info_mask elements will be 'interesting' (say a scale attribute for which the possible values change with the sampling frequency or visa-versa). I've been meaning to look at this for a while, but if anyone else fancies giving it a go, feel free! > >> >> - how can I view a list of available values? I have to create scale >> attribute on sysfs? If the last point is true, it is so redundant what I >> did before? > > You should add a scale_available attribute. Some ADC drivers implement this, > you could use them as an example. > > - Lars > >> >> >> Thanks, >> >> Denis >> >> >> On 10/29/2012 11:30 AM, Lars-Peter Clausen wrote: >>> On 10/29/2012 11:24 AM, Denis CIOCCA wrote: >>>> >>>>> There is no attachment attached to this mail. >>>> my was a question. You prefer I attach all source code or the last modified? >>>> >>>> >>>>>> I don't find IIO_G_TO_M_S_2 in the framework code, but I added this >>>>>> macro in my source code. It is exatly? >>>>> >>>>> It's in the latest IIO tree and also in staging/staging-next. The definition is >>>>> >>>>> +#define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) \ >>>>> / 18000000ULL) >>>> >>>> Sorry but I'm lost. The relation from IIO_DEGREE_TO_RAD and IIO_G_TO_M_S_2? >>>> >>> >>> Sorry, too early in the morning, copied the wrong line. >>> >>> +#define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL) >>> >>> Btw. the full patch can be found here: >>> http://comments.gmane.org/gmane.linux.kernel.iio/5777 >>> >>> - Lars >>> >