linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Custom sysfs entries for persistence, gain & threshold in light sensor
@ 2019-09-06 16:33 rishi gupta
  2019-09-07 10:49 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: rishi gupta @ 2019-09-06 16:33 UTC (permalink / raw)
  To: linux-iio

Hi experts,

I am writing driver for veml6030 ambient light sensor. Application can
set persistence, gain & threshold which will in turn update registers
in sensor.

In IIO framework there is no standard constant for this.

1) Does using sysfs entries will be fine or there is better alternative.

static IIO_DEVICE_ATTR_WO(gain, 0);
static IIO_DEVICE_ATTR_WO(threshold, 0);
static IIO_DEVICE_ATTR_WO(persistence, 0);
static IIO_CONST_ATTR(persistence_available, "1 2 4 8");
static IIO_CONST_ATTR(gain_available, "0.125 0.25 1 2");

static struct attribute *veml6030_attributes[] = {
&iio_const_attr_gain.dev_attr.attr,
&iio_const_attr_threshold.dev_attr.attr,
&iio_const_attr_persistence.dev_attr.attr,
&iio_const_attr_persistence_available.dev_attr.attr,
NULL
};

2) Can IIO_CHAN_INFO_HARDWAREGAIN can be used for gain instead of
custom sysfs file.

Datasheet: https://www.vishay.com/docs/84366/veml6030.pdf

Regards,
Rishi

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

end of thread, other threads:[~2019-09-07 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 16:33 Custom sysfs entries for persistence, gain & threshold in light sensor rishi gupta
2019-09-07 10:49 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).