#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"
#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 …
#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 …
#define ORIENT_CONF …
#define ORIENT …
#define ID_ADXL345 …
#define ID_ADXL346 …
#define DATA_READY …
#define SINGLE_TAP …
#define DOUBLE_TAP …
#define ACTIVITY …
#define INACTIVITY …
#define FREE_FALL …
#define WATERMARK …
#define OVERRUN …
#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 …
#define SUPPRESS …
#define TAP_X_EN …
#define TAP_Y_EN …
#define TAP_Z_EN …
#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 …
#define LOW_POWER …
#define RATE(x) …
#define PCTL_LINK …
#define PCTL_AUTO_SLEEP …
#define PCTL_MEASURE …
#define PCTL_SLEEP …
#define PCTL_WAKEUP(x) …
#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 …
#define ADXL_FULLRES_MAX_VAL …
#define ADXL_FIXEDRES_MAX_VAL …
#define FIFO_MODE(x) …
#define FIFO_BYPASS …
#define FIFO_FIFO …
#define FIFO_STREAM …
#define FIFO_TRIGGER …
#define TRIGGER …
#define SAMPLES(x) …
#define FIFO_TRIG …
#define ENTRIES(x) …
#define XSIGN …
#define YSIGN …
#define ZSIGN …
#define XTAP …
#define YTAP …
#define ZTAP …
#define ORIENT_DEADZONE(x) …
#define ORIENT_DIVISOR(x) …
#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;
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(…) …;