summaryrefstree
path: root/kernel/include/linux/i2c/pcal6524.h
blob: cac49e7e82b9d1ee357f947cf217a3fbc1836d02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* platform data for the PCAL6524 16-bit I/O expander driver */

#ifndef _PCAL6524_H_
#define _PCAL6524_H_

#define DRV_NAME	"pcal6524-gpio"

#define PCAL6524_INPUT			0x00  /* Input port [RO]                            */
#define PCAL6524_DAT_OUT		0x04  /* GPIO DATA OUT [R/W]                        */
#define PCAL6524_POLARITY		0x08  /* Polarity Inversion port [R/W]              */
#define PCAL6524_CONFIG			0x0C  /* Configuration port [R/W]                   */
#define PCAL6524_DRIVE0			0x40  /* Output drive strength register Port0 [R/W] */
#define PCAL6524_DRIVE1			0x42  /* Output drive strength register Port1 [R/W] */
#define PCAL6524_DRIVE2			0x44  /* Output drive strength register Port1 [R/W] */
#define PCAL6524_INPUT_LATCH		0x48  /* Port0 Input latch register  [R/W]          */
#define PCAL6524_EN_PULLUPDOWN		0x4C  /* Port0 Pull-up/Pull-down Enable [R/W]       */
#define PCAL6524_SEL_PULLUPDOWN		0x50  /* Port0 Pull-up/Pull-down selection [R/W]    */
#define PCAL6524_INT_MASK		0x54  /* Interrupt mask register [R/W]              */
#define PCAL6524_INT_STATUS		0x58  /* Interrupt status register [RO]             */
#define PCAL6524_OUTPUT_CONFIG		0x5C  /* Output port configuration register [R/W]   */

#define NO_PULL				0x00
#define PULL_DOWN			0x01
#define PULL_UP				0x02

#define POWER_ON			1
#define POWER_OFF			0

#define PCAL6524_PORT_CNT		3
#define PCAL6524_MAX_GPIO		23

/* EXPANDER GPIO Drive Strength */
enum {
	GPIO_CFG_6_25MA,
	GPIO_CFG_12_5MA,
	GPIO_CFG_18_75MA,
	GPIO_CFG_25MA,
};

struct pcal6524_platform_data {
	/* number of the first GPIO */
	unsigned int gpio_base;
	int gpio_start;
	int ngpio;
	int irq_base;
	int irq_gpio;
	int reset_gpio;
	uint32_t support_init;
	uint32_t init_config;
	uint32_t init_data_out;
	uint32_t init_en_pull;
	uint32_t init_sel_pull;
	struct regulator *vdd;
};

#ifdef CONFIG_SEC_PM_DEBUG
int expander_print_all(void);
#endif

#endif