/* * So far, there's only one channel in here, but the specification for * ACPI0008 says there can be more to what the block can report. Like * chromaticity and such. We are ready for incoming additions!
*/ staticconststruct iio_chan_spec acpi_als_channels[] = {
{
.type = IIO_LIGHT,
.scan_type = {
.sign = 's',
.realbits = 32,
.storagebits = 32,
}, /* _RAW is here for backward ABI compatibility */
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
BIT(IIO_CHAN_INFO_PROCESSED),
},
IIO_CHAN_SOFT_TIMESTAMP(1),
};
/* * The event buffer contains timestamp and all the data from * the ACPI0008 block. There are multiple, but so far we only * support _ALI (illuminance): One channel, padding and timestamp.
*/ #define ACPI_ALS_EVT_BUFFER_SIZE \
(sizeof(s32) + sizeof(s32) + sizeof(s64))
/* * All types of properties the ACPI0008 block can report. The ALI, ALC, ALT * and ALP can all be handled by acpi_als_read_value() below, while the ALR is * special. * * The _ALR property returns tables that can be used to fine-tune the values * reported by the other props based on the particular hardware type and it's * location (it contains tables for "rainy", "bright inhouse lighting" etc.). * * So far, we support only ALI (illuminance).
*/ #define ACPI_ALS_ILLUMINANCE "_ALI" #define ACPI_ALS_CHROMATICITY "_ALC" #define ACPI_ALS_COLOR_TEMP "_ALT" #define ACPI_ALS_POLLING "_ALP" #define ACPI_ALS_TABLES "_ALR"
ret = acpi_als_read_value(als, ACPI_ALS_ILLUMINANCE, &val); if (ret < 0) goto out;
*buffer = val;
/* * When coming from own trigger via polls, set polling function * timestamp here. Given ACPI notifier is already in a thread and call * function directly, there is no need to set the timestamp in the * notify function. * * If the timestamp was actually 0, the timestamp is set one more time.
*/ if (!pf->timestamp)
pf->timestamp = iio_get_time_ns(indio_dev);
als->trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
iio_device_id(indio_dev)); if (!als->trig) return -ENOMEM;
ret = devm_iio_trigger_register(dev, als->trig); if (ret) return ret; /* * Set hardware trigger by default to let events flow when * BIOS support notification.
*/
indio_dev->trig = iio_trigger_get(als->trig);
ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
iio_pollfunc_store_time,
acpi_als_trigger_handler,
NULL); if (ret) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.