linux/drivers/input/misc/adxl34x.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * ADXL345/346 Three-Axis Digital Accelerometers
 *
 * Enter bugs at http://blackfin.uclinux.org/
 *
 * Copyright (C) 2009 Michael Hennerich, Analog Devices Inc.
 */

#include <linux/device.h>
#include <linux/delay.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/input/adxl34x.h>
#include <linux/module.h>

#include "adxl34x.h"

/* ADXL345/6 Register Map */
#define DEVID
#define THRESH_TAP
#define OFSX
#define OFSY
#define OFSZ
#define DUR
#define LATENT
#define WINDOW
#define THRESH_ACT
#define THRESH_INACT
#define TIME_INACT
#define ACT_INACT_CTL
				/* inactivity detection */
#define THRESH_FF
#define TIME_FF
#define TAP_AXES
#define ACT_TAP_STATUS
#define BW_RATE
#define POWER_CTL
#define INT_ENABLE
#define INT_MAP
#define INT_SOURCE
#define DATA_FORMAT
#define DATAX0
#define DATAX1
#define DATAY0
#define DATAY1
#define DATAZ0
#define DATAZ1
#define FIFO_CTL
#define FIFO_STATUS
#define TAP_SIGN
/* Orientation ADXL346 only */
#define ORIENT_CONF
#define ORIENT

/* DEVIDs */
#define ID_ADXL345
#define ID_ADXL346

/* INT_ENABLE/INT_MAP/INT_SOURCE Bits */
#define DATA_READY
#define SINGLE_TAP
#define DOUBLE_TAP
#define ACTIVITY
#define INACTIVITY
#define FREE_FALL
#define WATERMARK
#define OVERRUN

/* ACT_INACT_CONTROL Bits */
#define ACT_ACDC
#define ACT_X_EN
#define ACT_Y_EN
#define ACT_Z_EN
#define INACT_ACDC
#define INACT_X_EN
#define INACT_Y_EN
#define INACT_Z_EN

/* TAP_AXES Bits */
#define SUPPRESS
#define TAP_X_EN
#define TAP_Y_EN
#define TAP_Z_EN

/* ACT_TAP_STATUS Bits */
#define ACT_X_SRC
#define ACT_Y_SRC
#define ACT_Z_SRC
#define ASLEEP
#define TAP_X_SRC
#define TAP_Y_SRC
#define TAP_Z_SRC

/* BW_RATE Bits */
#define LOW_POWER
#define RATE(x)

/* POWER_CTL Bits */
#define PCTL_LINK
#define PCTL_AUTO_SLEEP
#define PCTL_MEASURE
#define PCTL_SLEEP
#define PCTL_WAKEUP(x)

/* DATA_FORMAT Bits */
#define SELF_TEST
#define SPI
#define INT_INVERT
#define FULL_RES
#define JUSTIFY
#define RANGE(x)
#define RANGE_PM_2g
#define RANGE_PM_4g
#define RANGE_PM_8g
#define RANGE_PM_16g

/*
 * Maximum value our axis may get in full res mode for the input device
 * (signed 13 bits)
 */
#define ADXL_FULLRES_MAX_VAL

/*
 * Maximum value our axis may get in fixed res mode for the input device
 * (signed 10 bits)
 */
#define ADXL_FIXEDRES_MAX_VAL

/* FIFO_CTL Bits */
#define FIFO_MODE(x)
#define FIFO_BYPASS
#define FIFO_FIFO
#define FIFO_STREAM
#define FIFO_TRIGGER
#define TRIGGER
#define SAMPLES(x)

/* FIFO_STATUS Bits */
#define FIFO_TRIG
#define ENTRIES(x)

/* TAP_SIGN Bits ADXL346 only */
#define XSIGN
#define YSIGN
#define ZSIGN
#define XTAP
#define YTAP
#define ZTAP

/* ORIENT_CONF ADXL346 only */
#define ORIENT_DEADZONE(x)
#define ORIENT_DIVISOR(x)

/* ORIENT ADXL346 only */
#define ADXL346_2D_VALID
#define ADXL346_2D_ORIENT(x)
#define ADXL346_3D_VALID
#define ADXL346_3D_ORIENT(x)
#define ADXL346_2D_PORTRAIT_POS
#define ADXL346_2D_PORTRAIT_NEG
#define ADXL346_2D_LANDSCAPE_POS
#define ADXL346_2D_LANDSCAPE_NEG

#define ADXL346_3D_FRONT
#define ADXL346_3D_BACK
#define ADXL346_3D_RIGHT
#define ADXL346_3D_LEFT
#define ADXL346_3D_TOP
#define ADXL346_3D_BOTTOM

#undef ADXL_DEBUG

#define ADXL_X_AXIS
#define ADXL_Y_AXIS
#define ADXL_Z_AXIS

#define AC_READ(ac, reg)
#define AC_WRITE(ac, reg, val)

struct axis_triple {};

struct adxl34x {};

static const struct adxl34x_platform_data adxl34x_default_init =;

static void adxl34x_get_triple(struct adxl34x *ac, struct axis_triple *axis)
{}

static void adxl34x_service_ev_fifo(struct adxl34x *ac)
{}

static void adxl34x_report_key_single(struct input_dev *input, int key)
{}

static void adxl34x_send_key_events(struct adxl34x *ac,
		struct adxl34x_platform_data *pdata, int status, int press)
{}

static void adxl34x_do_tap(struct adxl34x *ac,
		struct adxl34x_platform_data *pdata, int status)
{}

static irqreturn_t adxl34x_irq(int irq, void *handle)
{}

static void __adxl34x_disable(struct adxl34x *ac)
{}

static void __adxl34x_enable(struct adxl34x *ac)
{}

static int adxl34x_suspend(struct device *dev)
{}

static int adxl34x_resume(struct device *dev)
{}

static ssize_t adxl34x_disable_show(struct device *dev,
				    struct device_attribute *attr, char *buf)
{}

static ssize_t adxl34x_disable_store(struct device *dev,
				     struct device_attribute *attr,
				     const char *buf, size_t count)
{}

static DEVICE_ATTR(disable, 0664, adxl34x_disable_show, adxl34x_disable_store);

static ssize_t adxl34x_calibrate_show(struct device *dev,
				      struct device_attribute *attr, char *buf)
{}

static ssize_t adxl34x_calibrate_store(struct device *dev,
				       struct device_attribute *attr,
				       const char *buf, size_t count)
{}

static DEVICE_ATTR(calibrate, 0664,
		   adxl34x_calibrate_show, adxl34x_calibrate_store);

static ssize_t adxl34x_rate_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

static ssize_t adxl34x_rate_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{}

static DEVICE_ATTR(rate, 0664, adxl34x_rate_show, adxl34x_rate_store);

static ssize_t adxl34x_autosleep_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

static ssize_t adxl34x_autosleep_store(struct device *dev,
				  struct device_attribute *attr,
				  const char *buf, size_t count)
{}

static DEVICE_ATTR(autosleep, 0664,
		   adxl34x_autosleep_show, adxl34x_autosleep_store);

static ssize_t adxl34x_position_show(struct device *dev,
				 struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR(position, S_IRUGO, adxl34x_position_show, NULL);

#ifdef ADXL_DEBUG
static ssize_t adxl34x_write_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{
	struct adxl34x *ac = dev_get_drvdata(dev);
	unsigned int val;
	int error;

	/*
	 * This allows basic ADXL register write access for debug purposes.
	 */
	error = kstrtouint(buf, 16, &val);
	if (error)
		return error;

	guard(mutex)(&ac->mutex);
	AC_WRITE(ac, val >> 8, val & 0xFF);

	return count;
}

static DEVICE_ATTR(write, 0664, NULL, adxl34x_write_store);
#endif

static struct attribute *adxl34x_attributes[] =;

static const struct attribute_group adxl34x_attr_group =;

const struct attribute_group *adxl34x_groups[] =;
EXPORT_SYMBOL_GPL();

static int adxl34x_input_open(struct input_dev *input)
{}

static void adxl34x_input_close(struct input_dev *input)
{}

struct adxl34x *adxl34x_probe(struct device *dev, int irq,
			      bool fifo_delay_default,
			      const struct adxl34x_bus_ops *bops)
{}
EXPORT_SYMBOL_GPL();

EXPORT_GPL_SIMPLE_DEV_PM_OPS();

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