linux/drivers/iio/light/acpi-als.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ACPI Ambient Light Sensor Driver
 *
 * Based on ALS driver:
 * Copyright (C) 2009 Zhang Rui <[email protected]>
 *
 * Rework for IIO subsystem:
 * Copyright (C) 2012-2013 Martin Liska <[email protected]>
 *
 * Final cleanup and debugging:
 * Copyright (C) 2013-2014 Marek Vasut <[email protected]>
 * Copyright (C) 2015 Gabriele Mazzotta <[email protected]>
 */

#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/mutex.h>

#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>

#define ACPI_ALS_CLASS
#define ACPI_ALS_DEVICE_NAME
#define ACPI_ALS_NOTIFY_ILLUMINANCE

/*
 * 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!
 */
static const struct iio_chan_spec acpi_als_channels[] =;

/*
 * 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

struct acpi_als {};

/*
 * 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
#define ACPI_ALS_CHROMATICITY
#define ACPI_ALS_COLOR_TEMP
#define ACPI_ALS_POLLING
#define ACPI_ALS_TABLES

static int acpi_als_read_value(struct acpi_als *als, char *prop, s32 *val)
{}

static void acpi_als_notify(struct acpi_device *device, u32 event)
{}

static int acpi_als_read_raw(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan, int *val,
			     int *val2, long mask)
{}

static const struct iio_info acpi_als_info =;

static irqreturn_t acpi_als_trigger_handler(int irq, void *p)
{}

static int acpi_als_add(struct acpi_device *device)
{}

static const struct acpi_device_id acpi_als_device_ids[] =;

MODULE_DEVICE_TABLE(acpi, acpi_als_device_ids);

static struct acpi_driver acpi_als_driver =;

module_acpi_driver();

MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();