diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-pnx4008/i2c.h | 67 | ||||
-rw-r--r-- | include/linux/i2c-algo-bit.h | 5 | ||||
-rw-r--r-- | include/linux/i2c-algo-ite.h | 72 | ||||
-rw-r--r-- | include/linux/i2c-algo-pca.h | 1 | ||||
-rw-r--r-- | include/linux/i2c-algo-pcf.h | 3 | ||||
-rw-r--r-- | include/linux/i2c-algo-sgi.h | 1 | ||||
-rw-r--r-- | include/linux/i2c-id.h | 17 | ||||
-rw-r--r-- | include/linux/i2c-pnx.h | 43 | ||||
-rw-r--r-- | include/linux/i2c.h | 75 |
9 files changed, 157 insertions, 127 deletions
diff --git a/include/asm-arm/arch-pnx4008/i2c.h b/include/asm-arm/arch-pnx4008/i2c.h new file mode 100644 index 000000000000..92e8d65006f7 --- /dev/null +++ b/include/asm-arm/arch-pnx4008/i2c.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * PNX4008-specific tweaks for I2C IP3204 block | ||
3 | * | ||
4 | * Author: Vitaly Wool <vwool@ru.mvista.com> | ||
5 | * | ||
6 | * 2005 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __ASM_ARCH_I2C_H__ | ||
13 | #define __ASM_ARCH_I2C_H__ | ||
14 | |||
15 | #include <linux/pm.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | enum { | ||
19 | mstatus_tdi = 0x00000001, | ||
20 | mstatus_afi = 0x00000002, | ||
21 | mstatus_nai = 0x00000004, | ||
22 | mstatus_drmi = 0x00000008, | ||
23 | mstatus_active = 0x00000020, | ||
24 | mstatus_scl = 0x00000040, | ||
25 | mstatus_sda = 0x00000080, | ||
26 | mstatus_rff = 0x00000100, | ||
27 | mstatus_rfe = 0x00000200, | ||
28 | mstatus_tff = 0x00000400, | ||
29 | mstatus_tfe = 0x00000800, | ||
30 | }; | ||
31 | |||
32 | enum { | ||
33 | mcntrl_tdie = 0x00000001, | ||
34 | mcntrl_afie = 0x00000002, | ||
35 | mcntrl_naie = 0x00000004, | ||
36 | mcntrl_drmie = 0x00000008, | ||
37 | mcntrl_daie = 0x00000020, | ||
38 | mcntrl_rffie = 0x00000040, | ||
39 | mcntrl_tffie = 0x00000080, | ||
40 | mcntrl_reset = 0x00000100, | ||
41 | mcntrl_cdbmode = 0x00000400, | ||
42 | }; | ||
43 | |||
44 | enum { | ||
45 | rw_bit = 1 << 0, | ||
46 | start_bit = 1 << 8, | ||
47 | stop_bit = 1 << 9, | ||
48 | }; | ||
49 | |||
50 | #define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */ | ||
51 | #define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */ | ||
52 | #define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */ | ||
53 | #define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */ | ||
54 | #define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */ | ||
55 | #define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */ | ||
56 | #define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */ | ||
57 | #define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */ | ||
58 | #define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */ | ||
59 | #define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */ | ||
60 | #define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */ | ||
61 | #define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */ | ||
62 | #define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */ | ||
63 | |||
64 | #define HCLK_MHZ 13 | ||
65 | #define I2C_CHIP_NAME "PNX4008-I2C" | ||
66 | |||
67 | #endif /* __ASM_ARCH_I2C_H___ */ | ||
diff --git a/include/linux/i2c-algo-bit.h b/include/linux/i2c-algo-bit.h index c8f8df25c7e0..937da70cb4c4 100644 --- a/include/linux/i2c-algo-bit.h +++ b/include/linux/i2c-algo-bit.h | |||
@@ -26,9 +26,9 @@ | |||
26 | 26 | ||
27 | /* --- Defines for bit-adapters --------------------------------------- */ | 27 | /* --- Defines for bit-adapters --------------------------------------- */ |
28 | /* | 28 | /* |
29 | * This struct contains the hw-dependent functions of bit-style adapters to | 29 | * This struct contains the hw-dependent functions of bit-style adapters to |
30 | * manipulate the line states, and to init any hw-specific features. This is | 30 | * manipulate the line states, and to init any hw-specific features. This is |
31 | * only used if you have more than one hw-type of adapter running. | 31 | * only used if you have more than one hw-type of adapter running. |
32 | */ | 32 | */ |
33 | struct i2c_algo_bit_data { | 33 | struct i2c_algo_bit_data { |
34 | void *data; /* private data for lowlevel routines */ | 34 | void *data; /* private data for lowlevel routines */ |
@@ -44,6 +44,5 @@ struct i2c_algo_bit_data { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | int i2c_bit_add_bus(struct i2c_adapter *); | 46 | int i2c_bit_add_bus(struct i2c_adapter *); |
47 | int i2c_bit_del_bus(struct i2c_adapter *); | ||
48 | 47 | ||
49 | #endif /* _LINUX_I2C_ALGO_BIT_H */ | 48 | #endif /* _LINUX_I2C_ALGO_BIT_H */ |
diff --git a/include/linux/i2c-algo-ite.h b/include/linux/i2c-algo-ite.h deleted file mode 100644 index 0073fe96c76e..000000000000 --- a/include/linux/i2c-algo-ite.h +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | ||
2 | /* i2c-algo-ite.h i2c driver algorithms for ITE IIC adapters */ | ||
3 | /* ------------------------------------------------------------------------- */ | ||
4 | /* Copyright (C) 1995-97 Simon G. Vogl | ||
5 | 1998-99 Hans Berglund | ||
6 | |||
7 | This program is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation; either version 2 of the License, or | ||
10 | (at your option) any later version. | ||
11 | |||
12 | This program is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
20 | /* ------------------------------------------------------------------------- */ | ||
21 | |||
22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | ||
23 | Frodo Looijaard <frodol@dds.nl> */ | ||
24 | |||
25 | /* Modifications by MontaVista Software, 2001 | ||
26 | Changes made to support the ITE IIC peripheral */ | ||
27 | |||
28 | |||
29 | #ifndef I2C_ALGO_ITE_H | ||
30 | #define I2C_ALGO_ITE_H 1 | ||
31 | |||
32 | #include <linux/types.h> | ||
33 | |||
34 | /* Example of a sequential read request: | ||
35 | struct i2c_iic_msg s_msg; | ||
36 | |||
37 | s_msg.addr=device_address; | ||
38 | s_msg.len=length; | ||
39 | s_msg.buf=buffer; | ||
40 | s_msg.waddr=word_address; | ||
41 | ioctl(file,I2C_SREAD, &s_msg); | ||
42 | */ | ||
43 | #define I2C_SREAD 0x780 /* SREAD ioctl command */ | ||
44 | |||
45 | struct i2c_iic_msg { | ||
46 | __u16 addr; /* device address */ | ||
47 | __u16 waddr; /* word address */ | ||
48 | short len; /* msg length */ | ||
49 | char *buf; /* pointer to msg data */ | ||
50 | }; | ||
51 | |||
52 | #ifdef __KERNEL__ | ||
53 | struct i2c_adapter; | ||
54 | |||
55 | struct i2c_algo_iic_data { | ||
56 | void *data; /* private data for lolevel routines */ | ||
57 | void (*setiic) (void *data, int ctl, int val); | ||
58 | int (*getiic) (void *data, int ctl); | ||
59 | int (*getown) (void *data); | ||
60 | int (*getclock) (void *data); | ||
61 | void (*waitforpin) (void); | ||
62 | |||
63 | /* local settings */ | ||
64 | int udelay; | ||
65 | int mdelay; | ||
66 | int timeout; | ||
67 | }; | ||
68 | |||
69 | int i2c_iic_add_bus(struct i2c_adapter *); | ||
70 | int i2c_iic_del_bus(struct i2c_adapter *); | ||
71 | #endif /* __KERNEL__ */ | ||
72 | #endif /* I2C_ALGO_ITE_H */ | ||
diff --git a/include/linux/i2c-algo-pca.h b/include/linux/i2c-algo-pca.h index 226693e0d88b..fce47c051bb1 100644 --- a/include/linux/i2c-algo-pca.h +++ b/include/linux/i2c-algo-pca.h | |||
@@ -10,6 +10,5 @@ struct i2c_algo_pca_data { | |||
10 | }; | 10 | }; |
11 | 11 | ||
12 | int i2c_pca_add_bus(struct i2c_adapter *); | 12 | int i2c_pca_add_bus(struct i2c_adapter *); |
13 | int i2c_pca_del_bus(struct i2c_adapter *); | ||
14 | 13 | ||
15 | #endif /* _LINUX_I2C_ALGO_PCA_H */ | 14 | #endif /* _LINUX_I2C_ALGO_PCA_H */ |
diff --git a/include/linux/i2c-algo-pcf.h b/include/linux/i2c-algo-pcf.h index 9908f3fc4839..994eb86f882c 100644 --- a/include/linux/i2c-algo-pcf.h +++ b/include/linux/i2c-algo-pcf.h | |||
@@ -31,7 +31,7 @@ struct i2c_algo_pcf_data { | |||
31 | int (*getpcf) (void *data, int ctl); | 31 | int (*getpcf) (void *data, int ctl); |
32 | int (*getown) (void *data); | 32 | int (*getown) (void *data); |
33 | int (*getclock) (void *data); | 33 | int (*getclock) (void *data); |
34 | void (*waitforpin) (void); | 34 | void (*waitforpin) (void); |
35 | 35 | ||
36 | /* local settings */ | 36 | /* local settings */ |
37 | int udelay; | 37 | int udelay; |
@@ -39,6 +39,5 @@ struct i2c_algo_pcf_data { | |||
39 | }; | 39 | }; |
40 | 40 | ||
41 | int i2c_pcf_add_bus(struct i2c_adapter *); | 41 | int i2c_pcf_add_bus(struct i2c_adapter *); |
42 | int i2c_pcf_del_bus(struct i2c_adapter *); | ||
43 | 42 | ||
44 | #endif /* _LINUX_I2C_ALGO_PCF_H */ | 43 | #endif /* _LINUX_I2C_ALGO_PCF_H */ |
diff --git a/include/linux/i2c-algo-sgi.h b/include/linux/i2c-algo-sgi.h index 4a0113d64064..3b7715024e69 100644 --- a/include/linux/i2c-algo-sgi.h +++ b/include/linux/i2c-algo-sgi.h | |||
@@ -22,6 +22,5 @@ struct i2c_algo_sgi_data { | |||
22 | }; | 22 | }; |
23 | 23 | ||
24 | int i2c_sgi_add_bus(struct i2c_adapter *); | 24 | int i2c_sgi_add_bus(struct i2c_adapter *); |
25 | int i2c_sgi_del_bus(struct i2c_adapter *); | ||
26 | 25 | ||
27 | #endif /* I2C_ALGO_SGI_H */ | 26 | #endif /* I2C_ALGO_SGI_H */ |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 0f4cf34b6fa2..7ae3c3326643 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* i2c-id.h - identifier values for i2c drivers and adapters */ | 3 | /* i2c-id.h - identifier values for i2c drivers and adapters */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* Copyright (C) 1995-1999 Simon G. Vogl | 6 | /* Copyright (C) 1995-1999 Simon G. Vogl |
7 | 7 | ||
@@ -40,10 +40,10 @@ | |||
40 | #define I2C_DRIVERID_SAA7120 11 /* video encoder */ | 40 | #define I2C_DRIVERID_SAA7120 11 /* video encoder */ |
41 | #define I2C_DRIVERID_SAA7121 12 /* video encoder */ | 41 | #define I2C_DRIVERID_SAA7121 12 /* video encoder */ |
42 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ | 42 | #define I2C_DRIVERID_SAA7185B 13 /* video encoder */ |
43 | #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ | 43 | #define I2C_DRIVERID_CH7003 14 /* digital pc to tv encoder */ |
44 | #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ | 44 | #define I2C_DRIVERID_PCF8574A 15 /* i2c expander - 8 bit in/out */ |
45 | #define I2C_DRIVERID_PCF8582C 16 /* eeprom */ | 45 | #define I2C_DRIVERID_PCF8582C 16 /* eeprom */ |
46 | #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ | 46 | #define I2C_DRIVERID_AT24Cxx 17 /* eeprom 1/2/4/8/16 K */ |
47 | #define I2C_DRIVERID_TEA6300 18 /* audio mixer */ | 47 | #define I2C_DRIVERID_TEA6300 18 /* audio mixer */ |
48 | #define I2C_DRIVERID_BT829 19 /* pc to tv encoder */ | 48 | #define I2C_DRIVERID_BT829 19 /* pc to tv encoder */ |
49 | #define I2C_DRIVERID_TDA9850 20 /* audio mixer */ | 49 | #define I2C_DRIVERID_TDA9850 20 /* audio mixer */ |
@@ -82,9 +82,8 @@ | |||
82 | #define I2C_DRIVERID_STM41T00 52 /* real time clock */ | 82 | #define I2C_DRIVERID_STM41T00 52 /* real time clock */ |
83 | #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ | 83 | #define I2C_DRIVERID_UDA1342 53 /* UDA1342 audio codec */ |
84 | #define I2C_DRIVERID_ADV7170 54 /* video encoder */ | 84 | #define I2C_DRIVERID_ADV7170 54 /* video encoder */ |
85 | #define I2C_DRIVERID_RADEON 55 /* I2C bus on Radeon boards */ | ||
86 | #define I2C_DRIVERID_MAX1617 56 /* temp sensor */ | 85 | #define I2C_DRIVERID_MAX1617 56 /* temp sensor */ |
87 | #define I2C_DRIVERID_SAA7191 57 /* video encoder */ | 86 | #define I2C_DRIVERID_SAA7191 57 /* video decoder */ |
88 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ | 87 | #define I2C_DRIVERID_INDYCAM 58 /* SGI IndyCam */ |
89 | #define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ | 88 | #define I2C_DRIVERID_BT832 59 /* CMOS camera video processor */ |
90 | #define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ | 89 | #define I2C_DRIVERID_TDA9887 60 /* TDA988x IF-PLL demodulator */ |
@@ -132,7 +131,6 @@ | |||
132 | #define I2C_DRIVERID_ADM1021 1008 | 131 | #define I2C_DRIVERID_ADM1021 1008 |
133 | #define I2C_DRIVERID_ADM9240 1009 | 132 | #define I2C_DRIVERID_ADM9240 1009 |
134 | #define I2C_DRIVERID_LTC1710 1010 | 133 | #define I2C_DRIVERID_LTC1710 1010 |
135 | #define I2C_DRIVERID_ICSPLL 1012 | ||
136 | #define I2C_DRIVERID_BT869 1013 | 134 | #define I2C_DRIVERID_BT869 1013 |
137 | #define I2C_DRIVERID_MAXILIFE 1014 | 135 | #define I2C_DRIVERID_MAXILIFE 1014 |
138 | #define I2C_DRIVERID_MATORB 1015 | 136 | #define I2C_DRIVERID_MATORB 1015 |
@@ -165,7 +163,7 @@ | |||
165 | * ---- Adapter types ---------------------------------------------------- | 163 | * ---- Adapter types ---------------------------------------------------- |
166 | */ | 164 | */ |
167 | 165 | ||
168 | /* --- Bit algorithm adapters */ | 166 | /* --- Bit algorithm adapters */ |
169 | #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ | 167 | #define I2C_HW_B_LP 0x010000 /* Parallel port Philips style */ |
170 | #define I2C_HW_B_SER 0x010002 /* Serial line interface */ | 168 | #define I2C_HW_B_SER 0x010002 /* Serial line interface */ |
171 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ | 169 | #define I2C_HW_B_BT848 0x010005 /* BT848 video boards */ |
@@ -213,9 +211,6 @@ | |||
213 | /* --- MPC8xx PowerPC adapters */ | 211 | /* --- MPC8xx PowerPC adapters */ |
214 | #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ | 212 | #define I2C_HW_MPC8XX_EPON 0x110000 /* Eponymous MPC8xx I2C adapter */ |
215 | 213 | ||
216 | /* --- ITE based algorithms */ | ||
217 | #define I2C_HW_I_IIC 0x080000 /* controller on the ITE */ | ||
218 | |||
219 | /* --- PowerPC on-chip adapters */ | 214 | /* --- PowerPC on-chip adapters */ |
220 | #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ | 215 | #define I2C_HW_OCP 0x120000 /* IBM on-chip I2C adapter */ |
221 | 216 | ||
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h new file mode 100644 index 000000000000..e6e9c814da61 --- /dev/null +++ b/include/linux/i2c-pnx.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * Header file for I2C support on PNX010x/4008. | ||
3 | * | ||
4 | * Author: Dennis Kovalev <dkovalev@ru.mvista.com> | ||
5 | * | ||
6 | * 2004-2006 (c) MontaVista Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __I2C_PNX_H__ | ||
13 | #define __I2C_PNX_H__ | ||
14 | |||
15 | #include <asm/arch/i2c.h> | ||
16 | |||
17 | struct i2c_pnx_mif { | ||
18 | int ret; /* Return value */ | ||
19 | int mode; /* Interface mode */ | ||
20 | struct completion complete; /* I/O completion */ | ||
21 | struct timer_list timer; /* Timeout */ | ||
22 | char * buf; /* Data buffer */ | ||
23 | int len; /* Length of data buffer */ | ||
24 | }; | ||
25 | |||
26 | struct i2c_pnx_algo_data { | ||
27 | u32 base; | ||
28 | u32 ioaddr; | ||
29 | int irq; | ||
30 | struct i2c_pnx_mif mif; | ||
31 | int last; | ||
32 | }; | ||
33 | |||
34 | struct i2c_pnx_data { | ||
35 | int (*suspend) (struct platform_device *pdev, pm_message_t state); | ||
36 | int (*resume) (struct platform_device *pdev); | ||
37 | u32 (*calculate_input_freq) (struct platform_device *pdev); | ||
38 | int (*set_clock_run) (struct platform_device *pdev); | ||
39 | int (*set_clock_stop) (struct platform_device *pdev); | ||
40 | struct i2c_adapter *adapter; | ||
41 | }; | ||
42 | |||
43 | #endif /* __I2C_PNX_H__ */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 9b5d04768c2c..71e50d3e492f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* ------------------------------------------------------------------------- */ | 1 | /* ------------------------------------------------------------------------- */ |
2 | /* */ | 2 | /* */ |
3 | /* i2c.h - definitions for the i2c-bus interface */ | 3 | /* i2c.h - definitions for the i2c-bus interface */ |
4 | /* */ | 4 | /* */ |
5 | /* ------------------------------------------------------------------------- */ | 5 | /* ------------------------------------------------------------------------- */ |
6 | /* Copyright (C) 1995-2000 Simon G. Vogl | 6 | /* Copyright (C) 1995-2000 Simon G. Vogl |
7 | 7 | ||
@@ -27,7 +27,7 @@ | |||
27 | #define _LINUX_I2C_H | 27 | #define _LINUX_I2C_H |
28 | 28 | ||
29 | #include <linux/types.h> | 29 | #include <linux/types.h> |
30 | #ifdef __KERNEL__ | 30 | #ifdef __KERNEL__ |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/i2c-id.h> | 32 | #include <linux/i2c-id.h> |
33 | #include <linux/mod_devicetable.h> | 33 | #include <linux/mod_devicetable.h> |
@@ -53,8 +53,8 @@ union i2c_smbus_data; | |||
53 | 53 | ||
54 | /* | 54 | /* |
55 | * The master routines are the ones normally used to transmit data to devices | 55 | * The master routines are the ones normally used to transmit data to devices |
56 | * on a bus (or read from them). Apart from two basic transfer functions to | 56 | * on a bus (or read from them). Apart from two basic transfer functions to |
57 | * transmit one message at a time, a more complex version can be used to | 57 | * transmit one message at a time, a more complex version can be used to |
58 | * transmit an arbitrary number of messages without interruption. | 58 | * transmit an arbitrary number of messages without interruption. |
59 | */ | 59 | */ |
60 | extern int i2c_master_send(struct i2c_client *,const char* ,int); | 60 | extern int i2c_master_send(struct i2c_client *,const char* ,int); |
@@ -67,10 +67,10 @@ extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
67 | 67 | ||
68 | /* This is the very generalized SMBus access routine. You probably do not | 68 | /* This is the very generalized SMBus access routine. You probably do not |
69 | want to use this, though; one of the functions below may be much easier, | 69 | want to use this, though; one of the functions below may be much easier, |
70 | and probably just as fast. | 70 | and probably just as fast. |
71 | Note that we use i2c_adapter here, because you do not need a specific | 71 | Note that we use i2c_adapter here, because you do not need a specific |
72 | smbus adapter to call this function. */ | 72 | smbus adapter to call this function. */ |
73 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, | 73 | extern s32 i2c_smbus_xfer (struct i2c_adapter * adapter, u16 addr, |
74 | unsigned short flags, | 74 | unsigned short flags, |
75 | char read_write, u8 command, int size, | 75 | char read_write, u8 command, int size, |
76 | union i2c_smbus_data * data); | 76 | union i2c_smbus_data * data); |
@@ -112,14 +112,14 @@ struct i2c_driver { | |||
112 | 112 | ||
113 | /* Notifies the driver that a new bus has appeared. This routine | 113 | /* Notifies the driver that a new bus has appeared. This routine |
114 | * can be used by the driver to test if the bus meets its conditions | 114 | * can be used by the driver to test if the bus meets its conditions |
115 | * & seek for the presence of the chip(s) it supports. If found, it | 115 | * & seek for the presence of the chip(s) it supports. If found, it |
116 | * registers the client(s) that are on the bus to the i2c admin. via | 116 | * registers the client(s) that are on the bus to the i2c admin. via |
117 | * i2c_attach_client. | 117 | * i2c_attach_client. |
118 | */ | 118 | */ |
119 | int (*attach_adapter)(struct i2c_adapter *); | 119 | int (*attach_adapter)(struct i2c_adapter *); |
120 | int (*detach_adapter)(struct i2c_adapter *); | 120 | int (*detach_adapter)(struct i2c_adapter *); |
121 | 121 | ||
122 | /* tells the driver that a client is about to be deleted & gives it | 122 | /* tells the driver that a client is about to be deleted & gives it |
123 | * the chance to remove its private data. Also, if the client struct | 123 | * the chance to remove its private data. Also, if the client struct |
124 | * has been dynamically allocated by the driver in the function above, | 124 | * has been dynamically allocated by the driver in the function above, |
125 | * it must be freed here. | 125 | * it must be freed here. |
@@ -139,13 +139,13 @@ struct i2c_driver { | |||
139 | #define I2C_NAME_SIZE 50 | 139 | #define I2C_NAME_SIZE 50 |
140 | 140 | ||
141 | /* | 141 | /* |
142 | * i2c_client identifies a single device (i.e. chip) that is connected to an | 142 | * i2c_client identifies a single device (i.e. chip) that is connected to an |
143 | * i2c bus. The behaviour is defined by the routines of the driver. This | 143 | * i2c bus. The behaviour is defined by the routines of the driver. This |
144 | * function is mainly used for lookup & other admin. functions. | 144 | * function is mainly used for lookup & other admin. functions. |
145 | */ | 145 | */ |
146 | struct i2c_client { | 146 | struct i2c_client { |
147 | unsigned int flags; /* div., see below */ | 147 | unsigned int flags; /* div., see below */ |
148 | unsigned short addr; /* chip address - NOTE: 7bit */ | 148 | unsigned short addr; /* chip address - NOTE: 7bit */ |
149 | /* addresses are stored in the */ | 149 | /* addresses are stored in the */ |
150 | /* _LOWER_ 7 bits */ | 150 | /* _LOWER_ 7 bits */ |
151 | struct i2c_adapter *adapter; /* the adapter we sit on */ | 151 | struct i2c_adapter *adapter; /* the adapter we sit on */ |
@@ -182,14 +182,14 @@ static inline void i2c_set_clientdata (struct i2c_client *dev, void *data) | |||
182 | */ | 182 | */ |
183 | struct i2c_algorithm { | 183 | struct i2c_algorithm { |
184 | /* If an adapter algorithm can't do I2C-level access, set master_xfer | 184 | /* If an adapter algorithm can't do I2C-level access, set master_xfer |
185 | to NULL. If an adapter algorithm can do SMBus access, set | 185 | to NULL. If an adapter algorithm can do SMBus access, set |
186 | smbus_xfer. If set to NULL, the SMBus protocol is simulated | 186 | smbus_xfer. If set to NULL, the SMBus protocol is simulated |
187 | using common I2C messages */ | 187 | using common I2C messages */ |
188 | /* master_xfer should return the number of messages successfully | 188 | /* master_xfer should return the number of messages successfully |
189 | processed, or a negative value on error */ | 189 | processed, or a negative value on error */ |
190 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, | 190 | int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, |
191 | int num); | 191 | int num); |
192 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, | 192 | int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, |
193 | unsigned short flags, char read_write, | 193 | unsigned short flags, char read_write, |
194 | u8 command, int size, union i2c_smbus_data * data); | 194 | u8 command, int size, union i2c_smbus_data * data); |
195 | 195 | ||
@@ -216,6 +216,7 @@ struct i2c_adapter { | |||
216 | int (*client_unregister)(struct i2c_client *); | 216 | int (*client_unregister)(struct i2c_client *); |
217 | 217 | ||
218 | /* data fields that are valid for all devices */ | 218 | /* data fields that are valid for all devices */ |
219 | u8 level; /* nesting level for lockdep */ | ||
219 | struct mutex bus_lock; | 220 | struct mutex bus_lock; |
220 | struct mutex clist_lock; | 221 | struct mutex clist_lock; |
221 | 222 | ||
@@ -316,7 +317,7 @@ extern int i2c_check_addr (struct i2c_adapter *adapter, int addr); | |||
316 | * It will only call found_proc if some client is connected at the | 317 | * It will only call found_proc if some client is connected at the |
317 | * specific address (unless a 'force' matched); | 318 | * specific address (unless a 'force' matched); |
318 | */ | 319 | */ |
319 | extern int i2c_probe(struct i2c_adapter *adapter, | 320 | extern int i2c_probe(struct i2c_adapter *adapter, |
320 | struct i2c_client_address_data *address_data, | 321 | struct i2c_client_address_data *address_data, |
321 | int (*found_proc) (struct i2c_adapter *, int, int)); | 322 | int (*found_proc) (struct i2c_adapter *, int, int)); |
322 | 323 | ||
@@ -352,15 +353,15 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) | |||
352 | */ | 353 | */ |
353 | struct i2c_msg { | 354 | struct i2c_msg { |
354 | __u16 addr; /* slave address */ | 355 | __u16 addr; /* slave address */ |
355 | __u16 flags; | 356 | __u16 flags; |
356 | #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ | 357 | #define I2C_M_TEN 0x10 /* we have a ten bit chip address */ |
357 | #define I2C_M_RD 0x01 | 358 | #define I2C_M_RD 0x01 |
358 | #define I2C_M_NOSTART 0x4000 | 359 | #define I2C_M_NOSTART 0x4000 |
359 | #define I2C_M_REV_DIR_ADDR 0x2000 | 360 | #define I2C_M_REV_DIR_ADDR 0x2000 |
360 | #define I2C_M_IGNORE_NAK 0x1000 | 361 | #define I2C_M_IGNORE_NAK 0x1000 |
361 | #define I2C_M_NO_RD_ACK 0x0800 | 362 | #define I2C_M_NO_RD_ACK 0x0800 |
362 | __u16 len; /* msg length */ | 363 | __u16 len; /* msg length */ |
363 | __u8 *buf; /* pointer to msg data */ | 364 | __u8 *buf; /* pointer to msg data */ |
364 | }; | 365 | }; |
365 | 366 | ||
366 | /* To determine what functionality is present */ | 367 | /* To determine what functionality is present */ |
@@ -370,16 +371,16 @@ struct i2c_msg { | |||
370 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ | 371 | #define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_{REV_DIR_ADDR,NOSTART,..} */ |
371 | #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ | 372 | #define I2C_FUNC_SMBUS_HWPEC_CALC 0x00000008 /* SMBus 2.0 */ |
372 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ | 373 | #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */ |
373 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 | 374 | #define I2C_FUNC_SMBUS_QUICK 0x00010000 |
374 | #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 | 375 | #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000 |
375 | #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 | 376 | #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000 |
376 | #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 | 377 | #define I2C_FUNC_SMBUS_READ_BYTE_DATA 0x00080000 |
377 | #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 | 378 | #define I2C_FUNC_SMBUS_WRITE_BYTE_DATA 0x00100000 |
378 | #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 | 379 | #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000 |
379 | #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 | 380 | #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000 |
380 | #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 | 381 | #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000 |
381 | #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 | 382 | #define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 |
382 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 | 383 | #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000 |
383 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ | 384 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */ |
384 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ | 385 | #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */ |
385 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ | 386 | #define I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 0x10000000 /* I2C-like block xfer */ |
@@ -406,10 +407,10 @@ struct i2c_msg { | |||
406 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ | 407 | I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \ |
407 | I2C_FUNC_SMBUS_I2C_BLOCK) | 408 | I2C_FUNC_SMBUS_I2C_BLOCK) |
408 | 409 | ||
409 | /* | 410 | /* |
410 | * Data for SMBus Messages | 411 | * Data for SMBus Messages |
411 | */ | 412 | */ |
412 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ | 413 | #define I2C_SMBUS_BLOCK_MAX 32 /* As specified in SMBus standard */ |
413 | union i2c_smbus_data { | 414 | union i2c_smbus_data { |
414 | __u8 byte; | 415 | __u8 byte; |
415 | __u16 word; | 416 | __u16 word; |
@@ -421,11 +422,11 @@ union i2c_smbus_data { | |||
421 | #define I2C_SMBUS_READ 1 | 422 | #define I2C_SMBUS_READ 1 |
422 | #define I2C_SMBUS_WRITE 0 | 423 | #define I2C_SMBUS_WRITE 0 |
423 | 424 | ||
424 | /* SMBus transaction types (size parameter in the above functions) | 425 | /* SMBus transaction types (size parameter in the above functions) |
425 | Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ | 426 | Note: these no longer correspond to the (arbitrary) PIIX4 internal codes! */ |
426 | #define I2C_SMBUS_QUICK 0 | 427 | #define I2C_SMBUS_QUICK 0 |
427 | #define I2C_SMBUS_BYTE 1 | 428 | #define I2C_SMBUS_BYTE 1 |
428 | #define I2C_SMBUS_BYTE_DATA 2 | 429 | #define I2C_SMBUS_BYTE_DATA 2 |
429 | #define I2C_SMBUS_WORD_DATA 3 | 430 | #define I2C_SMBUS_WORD_DATA 3 |
430 | #define I2C_SMBUS_PROC_CALL 4 | 431 | #define I2C_SMBUS_PROC_CALL 4 |
431 | #define I2C_SMBUS_BLOCK_DATA 5 | 432 | #define I2C_SMBUS_BLOCK_DATA 5 |
@@ -434,15 +435,15 @@ union i2c_smbus_data { | |||
434 | 435 | ||
435 | 436 | ||
436 | /* ----- commands for the ioctl like i2c_command call: | 437 | /* ----- commands for the ioctl like i2c_command call: |
437 | * note that additional calls are defined in the algorithm and hw | 438 | * note that additional calls are defined in the algorithm and hw |
438 | * dependent layers - these can be listed here, or see the | 439 | * dependent layers - these can be listed here, or see the |
439 | * corresponding header files. | 440 | * corresponding header files. |
440 | */ | 441 | */ |
441 | /* -> bit-adapter specific ioctls */ | 442 | /* -> bit-adapter specific ioctls */ |
442 | #define I2C_RETRIES 0x0701 /* number of times a device address */ | 443 | #define I2C_RETRIES 0x0701 /* number of times a device address */ |
443 | /* should be polled when not */ | 444 | /* should be polled when not */ |
444 | /* acknowledging */ | 445 | /* acknowledging */ |
445 | #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ | 446 | #define I2C_TIMEOUT 0x0702 /* set timeout - call with int */ |
446 | 447 | ||
447 | 448 | ||
448 | /* this is for i2c-dev.c */ | 449 | /* this is for i2c-dev.c */ |