* Question on shared attributes
@ 2016-06-28 8:55 Phil Reid
2016-06-28 10:38 ` Cercueil, Paul
0 siblings, 1 reply; 3+ messages in thread
From: Phil Reid @ 2016-06-28 8:55 UTC (permalink / raw)
To: linux-iio
G'day All,
Found something interesting.
For a new iio driver I have a shared attribute on direction.
.info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ)
Which results in sysfs attribute name of:
in_sampling_frequency
Which results in iio_info giving the following output:
iio:device3: module0
7 channels found:
voltage0: (input)
6 channel-specific attributes found:
attr 0: scale value: 0.000149011
attr 1: raw value: 0
attr 2: hardwaregain value: 1
attr 3: index value: 0
attr 4: en value: 0
attr 5: type value: le:s24/32>>0
voltage1: (input)
6 channel-specific attributes found:
attr 0: raw value: 0
attr 1: scale value: 0.000149011
attr 2: hardwaregain value: 1
attr 3: en value: 0
attr 4: index value: 1
attr 5: type value: le:s24/32>>0
voltage2: (input)
6 channel-specific attributes found:
attr 0: raw value: 0
attr 1: scale value: 0.000149011
attr 2: hardwaregain value: 1
attr 3: en value: 0
attr 4: index value: 2
attr 5: type value: le:s24/32>>0
voltage3: (input)
6 channel-specific attributes found:
attr 0: hardwaregain value: 1
attr 1: raw value: 0
attr 2: scale value: 0.000149011
attr 3: en value: 0
attr 4: type value: le:s24/32>>0
attr 5: index value: 3
voltage4: (output)
2 channel-specific attributes found:
attr 0: raw value: 32768
attr 1: scale value: 2500000.000000000
voltage5: (output)
2 channel-specific attributes found:
attr 0: raw value: 32768
attr 1: scale value: 2500000.000000000
sampling: (input)
1 channel-specific attributes found:
attr 0: frequency value: 24000
2 device-specific attributes found:
attr 0: freq value: 6144000
attr 1: out_en value: 0
Note that the sampling_frequency attr has been converted into an input channel.
Modify the definition in industrialio-core.c
[IIO_CHAN_INFO_SAMP_FREQ] = "sampling_frequency",
to
[IIO_CHAN_INFO_SAMP_FREQ] = "samplingfrequency",
Results in the following output:
iio:device4: module0
6 channels found:
voltage0: (input)
6 channel-specific attributes found:
attr 0: scale value: 0.000149011
attr 1: raw value: 0
attr 2: hardwaregain value: 1
attr 3: index value: 0
attr 4: en value: 0
attr 5: type value: le:s24/32>>0
voltage1: (input)
6 channel-specific attributes found:
attr 0: raw value: 0
attr 1: scale value: 0.000149011
attr 2: hardwaregain value: 1
attr 3: en value: 0
attr 4: index value: 1
attr 5: type value: le:s24/32>>0
voltage2: (input)
6 channel-specific attributes found:
attr 0: raw value: 0
attr 1: scale value: 0.000149011
attr 2: hardwaregain value: 1
attr 3: en value: 0
attr 4: index value: 2
attr 5: type value: le:s24/32>>0
voltage3: (input)
6 channel-specific attributes found:
attr 0: hardwaregain value: 1
attr 1: raw value: 0
attr 2: scale value: 0.000149011
attr 3: en value: 0
attr 4: type value: le:s24/32>>0
attr 5: index value: 3
voltage4: (output)
2 channel-specific attributes found:
attr 0: raw value: 32768
attr 1: scale value: 2500000.000000000
voltage5: (output)
2 channel-specific attributes found:
attr 0: raw value: 32768
attr 1: scale value: 2500000.000000000
3 device-specific attributes found:
attr 0: freq value: 6144000
attr 1: in_samplingfrequency value: 24000
attr 2: out_en value: 0
Which makes more sense. So libiio is treating the name sampling as a channel name
in 'in_sampling_frequency' assuming that attributes never have an underscore in there name.
I'm guessing the same would be the case for out attributes as well.
A quick search of the drivers in the kernel to date indicate that IIO_CHAN_INFO_SAMP_FREQ is generally
shared by type or all. shared by dir occurs with the iio_simple_dummy, but can't see anything with a real device.
I'm using libiio from git://github.com/analogdevicesinc/libiio.git
So is this intended, or does libiio need to be smarter on identifying channels and shared attributes?
I'm guessing we cant change the kernel interface, which would be the easiest fix. :/
--
Regards
Phil Reid
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question on shared attributes
2016-06-28 8:55 Question on shared attributes Phil Reid
@ 2016-06-28 10:38 ` Cercueil, Paul
2016-06-29 3:24 ` Phil Reid
0 siblings, 1 reply; 3+ messages in thread
From: Cercueil, Paul @ 2016-06-28 10:38 UTC (permalink / raw)
To: preid, linux-iio
[-- Attachment #1: Type: text/plain, Size: 8528 bytes --]
Hi Phil,
I think right now libiio doesn't handle shared-by-dir attributes yet,
only shared-by-type. Ideally, 'in_sampling_frequency' should appear as
a 'sampling_frequency' attribute on all input channels of your module0
device.
Regards,
Paul Cercueil
Le mardi 28 juin 2016 à 16:55 +0800, Phil Reid a écrit :
> G'day All,
>
> Found something interesting.
> For a new iio driver I have a shared attribute on direction.
>
> .info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ)
>
> Which results in sysfs attribute name of:
> in_sampling_frequency
>
> Which results in iio_info giving the following output:
> iio:device3: module0
> 7 channels found:
> voltage0: (input)
> 6 channel-specific attributes found:
> attr 0: scale value: 0.000149011
> attr 1: raw value: 0
> attr 2: hardwaregain value: 1
> attr 3: index value: 0
> attr 4: en value: 0
> attr 5: type value: le:s24/32>>0
> voltage1: (input)
> 6 channel-specific attributes found:
> attr 0: raw value: 0
> attr 1: scale value: 0.000149011
> attr 2: hardwaregain value: 1
> attr 3: en value: 0
> attr 4: index value: 1
> attr 5: type value: le:s24/32>>0
> voltage2: (input)
> 6 channel-specific attributes found:
> attr 0: raw value: 0
> attr 1: scale value: 0.000149011
> attr 2: hardwaregain value: 1
> attr 3: en value: 0
> attr 4: index value: 2
> attr 5: type value: le:s24/32>>0
> voltage3: (input)
> 6 channel-specific attributes found:
> attr 0: hardwaregain value: 1
> attr 1: raw value: 0
> attr 2: scale value: 0.000149011
> attr 3: en value: 0
> attr 4: type value: le:s24/32>>0
> attr 5: index value: 3
> voltage4: (output)
> 2 channel-specific attributes found:
> attr 0: raw value: 32768
> attr 1: scale value: 2500000.000000000
> voltage5: (output)
> 2 channel-specific attributes found:
> attr 0: raw value: 32768
> attr 1: scale value: 2500000.000000000
> sampling: (input)
> 1 channel-specific attributes found:
> attr 0: frequency value: 24000
> 2 device-specific attributes found:
> attr 0: freq value: 6144000
> attr 1: out_en value: 0
>
>
> Note that the sampling_frequency attr has been converted into an
> input channel.
>
> Modify the definition in industrialio-core.c
> [IIO_CHAN_INFO_SAMP_FREQ] = "sampling_frequency",
> to
> [IIO_CHAN_INFO_SAMP_FREQ] = "samplingfrequency",
>
> Results in the following output:
> iio:device4: module0
> 6 channels found:
> voltage0: (input)
> 6 channel-specific attributes found:
> attr 0: scale value: 0.000149011
> attr 1: raw value: 0
> attr 2: hardwaregain value: 1
> attr 3: index value: 0
> attr 4: en value: 0
> attr 5: type value: le:s24/32>>0
> voltage1: (input)
> 6 channel-specific attributes found:
> attr 0: raw value: 0
> attr 1: scale value: 0.000149011
> attr 2: hardwaregain value: 1
> attr 3: en value: 0
> attr 4: index value: 1
> attr 5: type value: le:s24/32>>0
> voltage2: (input)
> 6 channel-specific attributes found:
> attr 0: raw value: 0
> attr 1: scale value: 0.000149011
> attr 2: hardwaregain value: 1
> attr 3: en value: 0
> attr 4: index value: 2
> attr 5: type value: le:s24/32>>0
> voltage3: (input)
> 6 channel-specific attributes found:
> attr 0: hardwaregain value: 1
> attr 1: raw value: 0
> attr 2: scale value: 0.000149011
> attr 3: en value: 0
> attr 4: type value: le:s24/32>>0
> attr 5: index value: 3
> voltage4: (output)
> 2 channel-specific attributes found:
> attr 0: raw value: 32768
> attr 1: scale value: 2500000.000000000
> voltage5: (output)
> 2 channel-specific attributes found:
> attr 0: raw value: 32768
> attr 1: scale value: 2500000.000000000
> 3 device-specific attributes found:
> attr 0: freq value: 6144000
> attr 1: in_samplingfrequency value: 24000
> attr 2: out_en value: 0
>
> Which makes more sense. So libiio is treating the name sampling as a
> channel name
> in 'in_sampling_frequency' assuming that attributes never have an
> underscore in there name.
>
> I'm guessing the same would be the case for out attributes as well.
>
> A quick search of the drivers in the kernel to date indicate that
> IIO_CHAN_INFO_SAMP_FREQ is generally
> shared by type or all. shared by dir occurs with the
> iio_simple_dummy, but can't see anything with a real device.
> I'm using libiio from git://github.com/analogdevicesinc/libiio.git
>
> So is this intended, or does libiio need to be smarter on identifying
> channels and shared attributes?
> I'm guessing we cant change the kernel interface, which would be the
> easiest fix. :/
>
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Question on shared attributes
2016-06-28 10:38 ` Cercueil, Paul
@ 2016-06-29 3:24 ` Phil Reid
0 siblings, 0 replies; 3+ messages in thread
From: Phil Reid @ 2016-06-29 3:24 UTC (permalink / raw)
To: Cercueil, Paul, linux-iio
On 28/06/2016 18:38, Cercueil, Paul wrote:
> Hi Phil,
>
> I think right now libiio doesn't handle shared-by-dir attributes yet,
> only shared-by-type. Ideally, 'in_sampling_frequency' should appear as
> a 'sampling_frequency' attribute on all input channels of your module0
> device.
>
> Regards,
> Paul Cercueil
>
> Le mardi 28 juin 2016 à 16:55 +0800, Phil Reid a écrit :
>> G'day All,
>>
>> Found something interesting.
>> For a new iio driver I have a shared attribute on direction.
>>
>> .info_mask_shared_by_dir = BIT(IIO_CHAN_INFO_SAMP_FREQ)
>>
>> Which results in sysfs attribute name of:
>> in_sampling_frequency
>>
>> Which results in iio_info giving the following output:
>> iio:device3: module0
>> 7 channels found:
*snip*
>> sampling: (input)
>> 1 channel-specific attributes found:
>> attr 0: frequency value: 24000
>> 2 device-specific attributes found:
>> attr 0: freq value: 6144000
>> attr 1: out_en value: 0
>>
>>
>> Note that the sampling_frequency attr has been converted into an
>> input channel.
>>
>> Modify the definition in industrialio-core.c
>> [IIO_CHAN_INFO_SAMP_FREQ] = "sampling_frequency",
>> to
>> [IIO_CHAN_INFO_SAMP_FREQ] = "samplingfrequency",
>>
>> Results in the following output:
>> iio:device4: module0
>> 6 channels found:
*snip*
>> 3 device-specific attributes found:
>> attr 0: freq value: 6144000
>> attr 1: in_samplingfrequency value: 24000
>> attr 2: out_en value: 0
>>
>> Which makes more sense. So libiio is treating the name sampling as a
>> channel name
>> in 'in_sampling_frequency' assuming that attributes never have an
>> underscore in there name.
>>
>> I'm guessing the same would be the case for out attributes as well.
>>
>> A quick search of the drivers in the kernel to date indicate that
>> IIO_CHAN_INFO_SAMP_FREQ is generally
>> shared by type or all. shared by dir occurs with the
>> iio_simple_dummy, but can't see anything with a real device.
>> I'm using libiio from git://github.com/analogdevicesinc/libiio.git
>>
>> So is this intended, or does libiio need to be smarter on identifying
>> channels and shared attributes?
>> I'm guessing we cant change the kernel interface, which would be the
>> easiest fix. :/
>>
I found making it a info_mask_shared_by_type resulted in the sampling_freq
becoming an attribute of all the input channels. I find it a little conintutive
that a shared attribute is populated into all the channels. libiio doesn't
seem to provide an interface I can find to indicate if a parameter is shared or not.
I guess with the current method of multiplexing the data streams it doesn't make
sense to have anything other than the same value for sample rate.
I just assumed that the sample_frequency would have been a device specific value.
--
Regards
Phil Reid
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-29 3:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28 8:55 Question on shared attributes Phil Reid
2016-06-28 10:38 ` Cercueil, Paul
2016-06-29 3:24 ` Phil Reid
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.