From: Lars-Peter Clausen <lars@metafoo.de>
To: Duss Pirmin <pirmin.duss@flytec.ch>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] Add support for ads1110
Date: Wed, 21 Dec 2011 12:22:53 +0100 [thread overview]
Message-ID: <4EF1C18D.5090300@metafoo.de> (raw)
In-Reply-To: <4EF03E28.4020900@flytec.ch>
On 12/20/2011 08:50 AM, Duss Pirmin wrote:
> Hi
>
> On 12/15/2011 05:07 PM, Lars-Peter Clausen wrote:
>
>>> +static struct ads1110_conversion_mode
>>> +ads1110_conv_mode_table[ADS1110_MAX_CONV_MODE] = {
>>> + { "continuous-conversion", 0 },
>>> + { "single-conversion", 1 },
>>> +};
>>
>> This should probably not user controllable. You probably want to do a
>> single
>> conversion when reading from sysfs and use continuous conversion when
>> using
>> a triggered buffer.
>
> As this chip doesn't have an interrupt line all we can do is poll to
> determine if a conversion is completed. my suggestion here is to just
> use continuous conversion and return the last value from the chip.
> Otherwise we would need to poll in the read routine for sysfs. Or is
> there a better way to do it?
>
I would assume that the downside of having the chip constantly performing
conversions is that power consumption increases. If you know how long
approximately a conversion takes you could start the conversion in single mode
wait the conversion time and read the result back.
>>> +static struct attribute *ads1110_attributes[] = {
>>> +&iio_dev_attr_available_conversion_modes.dev_attr.attr,
>>> +&iio_dev_attr_available_data_rates.dev_attr.attr,
>>> +&iio_dev_attr_available_gains.dev_attr.attr,
>>> +&iio_dev_attr_value.dev_attr.attr,
>>> +&iio_dev_attr_conversion_mode.dev_attr.attr,
>>> +&iio_dev_attr_data_rate.dev_attr.attr,
>>> +&iio_dev_attr_gain.dev_attr.attr,
>>> +&iio_dev_attr_start_conversion.dev_attr.attr,
>>> + NULL,
>>> +};
>>
>> Please use channel_spec. Most of the attributes can probably be expresses
>> through it. For those which can not please take a look at
>> Documentation/sysfs-bus-iio and see which already existing attribute
>> names
>> match your use case. E.g. your "data_rate" should probably be
>> "sampling_frequency".
>>
>
> Is there an attribute for gain? I'm asking this, because the next chip I
> will write a driver for is the TI ADS1242, which also has a programmable
> gain.
We usually make the scale attribute writable for changing the gain. And if the
gain factor can only be on of a few discrete values also provide
scale_available attribute.
prev parent reply other threads:[~2011-12-21 11:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 13:51 [PATCH] Add support for ads1110 Duss Pirmin
2011-12-15 16:07 ` Lars-Peter Clausen
2011-12-16 9:43 ` Duss Pirmin
2011-12-20 7:50 ` Duss Pirmin
2011-12-21 11:22 ` Lars-Peter Clausen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4EF1C18D.5090300@metafoo.de \
--to=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pirmin.duss@flytec.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.