drm/panel: simple: add Multi-Inno Technology MI0700A2T-30
[drm/drm-misc.git] / drivers / iio / accel / mma9551_core.h
blob543454a31dc0c5aad52ce4949869a6022f633115
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Common code for Freescale MMA955x Intelligent Sensor Platform drivers
4 * Copyright (c) 2014, Intel Corporation.
5 */
7 #ifndef _MMA9551_CORE_H_
8 #define _MMA9551_CORE_H_
10 /* Applications IDs */
11 #define MMA9551_APPID_VERSION 0x00
12 #define MMA9551_APPID_GPIO 0x03
13 #define MMA9551_APPID_AFE 0x06
14 #define MMA9551_APPID_TILT 0x0B
15 #define MMA9551_APPID_SLEEP_WAKE 0x12
16 #define MMA9551_APPID_PEDOMETER 0x15
17 #define MMA9551_APPID_RSC 0x17
18 #define MMA9551_APPID_NONE 0xff
20 /* Reset/Suspend/Clear application app masks */
21 #define MMA9551_RSC_PED BIT(21)
23 #define MMA9551_AUTO_SUSPEND_DELAY_MS 2000
25 enum mma9551_gpio_pin {
26 mma9551_gpio6 = 0,
27 mma9551_gpio7,
28 mma9551_gpio8,
29 mma9551_gpio9,
30 mma9551_gpio_max = mma9551_gpio9,
33 #define MMA9551_ACCEL_CHANNEL(axis) { \
34 .type = IIO_ACCEL, \
35 .modified = 1, \
36 .channel2 = axis, \
37 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
38 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
41 int mma9551_read_config_byte(struct i2c_client *client, u8 app_id,
42 u16 reg, u8 *val);
43 int mma9551_write_config_byte(struct i2c_client *client, u8 app_id,
44 u16 reg, u8 val);
45 int mma9551_read_status_byte(struct i2c_client *client, u8 app_id,
46 u16 reg, u8 *val);
47 int mma9551_read_config_word(struct i2c_client *client, u8 app_id,
48 u16 reg, u16 *val);
49 int mma9551_write_config_word(struct i2c_client *client, u8 app_id,
50 u16 reg, u16 val);
51 int mma9551_read_status_word(struct i2c_client *client, u8 app_id,
52 u16 reg, u16 *val);
53 int mma9551_read_config_words(struct i2c_client *client, u8 app_id,
54 u16 reg, u8 len, u16 *buf);
55 int mma9551_read_status_words(struct i2c_client *client, u8 app_id,
56 u16 reg, u8 len, u16 *buf);
57 int mma9551_write_config_words(struct i2c_client *client, u8 app_id,
58 u16 reg, u8 len, u16 *buf);
59 int mma9551_update_config_bits(struct i2c_client *client, u8 app_id,
60 u16 reg, u8 mask, u8 val);
61 int mma9551_gpio_config(struct i2c_client *client, enum mma9551_gpio_pin pin,
62 u8 app_id, u8 bitnum, int polarity);
63 int mma9551_read_version(struct i2c_client *client);
64 int mma9551_set_device_state(struct i2c_client *client, bool enable);
65 int mma9551_set_power_state(struct i2c_client *client, bool on);
66 void mma9551_sleep(int freq);
67 int mma9551_read_accel_chan(struct i2c_client *client,
68 const struct iio_chan_spec *chan,
69 int *val, int *val2);
70 int mma9551_read_accel_scale(int *val, int *val2);
71 int mma9551_app_reset(struct i2c_client *client, u32 app_mask);
73 #endif /* _MMA9551_CORE_H_ */