Custom sysfs entries for persistence, gain & threshold in light sensor

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

 



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



[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