10 #include <linux/input.h>
11 #include <linux/module.h>
14 #include <linux/types.h>
17 #define MAX_SPI_FREQ_HZ 5000000
18 #define MAX_FREQ_NO_FIFODELAY 1500000
19 #define ADXL34X_CMD_MULTB (1 << 6)
20 #define ADXL34X_CMD_READ (1 << 7)
21 #define ADXL34X_WRITECMD(reg) (reg & 0x3F)
22 #define ADXL34X_READCMD(reg) (ADXL34X_CMD_READ | (reg & 0x3F))
23 #define ADXL34X_READMB_CMD(reg) (ADXL34X_CMD_READ | ADXL34X_CMD_MULTB \
26 static int adxl34x_spi_read(
struct device *
dev,
unsigned char reg)
33 return spi_w8r8(spi, cmd);
36 static int adxl34x_spi_write(
struct device *
dev,
37 unsigned char reg,
unsigned char val)
45 return spi_write(spi, buf,
sizeof(buf));
48 static int adxl34x_spi_read_block(
struct device *dev,
49 unsigned char reg,
int count,
58 return (status < 0) ? status : 0;
63 .write = adxl34x_spi_write,
64 .read = adxl34x_spi_read,
65 .read_block = adxl34x_spi_read_block,
85 spi_set_drvdata(spi, ac);
98 static int adxl34x_spi_suspend(
struct device *dev)
108 static int adxl34x_spi_resume(
struct device *dev)
126 .pm = &adxl34x_spi_pm,
128 .probe = adxl34x_spi_probe,