History

Merge branch 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c updates from Wolfram Sang: - mostly driver updates. Bigger ones for mlxcpld and iproc. But most of them are all over the place. - removal of the efm32, sirf, u300, and zte zx bus drivers because of platform removal. So, we have a pleasant diffstat this time. - first set of cleanups in the I2C core as preparation to increase maximum length of SMBus transfers to 255 (as specified in the new standard). Better documentation of struct i2c_msg and its flags stand out here. - the testunit can now respond to SMBus block process calls which is the testcase when implementing the above new maximum length. * 'i2c/for-5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (62 commits) i2c: remove redundant error print in stm32f7_i2c_probe i2c: testunit: add support for block process calls i2c: busses: Replace spin_lock_irqsave with spin_lock in hard IRQ dt-bindings: eeprom: at24: Document ROHM BR24G01 i2c: i801: Add support for Intel Alder Lake PCH-P i2c: mv64xxx: Fix check for missing clock after adding RPM i2c: mux: mlxcpld: Add callback to notify mux creation completion i2c: mux: mlxcpld: Extend supported mux number i2c: mux: mlxcpld: Extend driver to support word address space devices i2c: mux: mlxcpld: Get rid of adapter numbers enforcement i2c: mux: mlxcpld: Prepare mux selection infrastructure for two-byte support i2c: mux: mlxcpld: Convert driver to platform driver i2c: imx: Synthesize end of transaction events without idle interrupts i2c: i2c-qcom-geni: Add shutdown callback for i2c i2c: mv64xxx: Add runtime PM support i2c: amd-mp2: Remove unused macro i2c: amd-mp2: convert to PCI logging functions i2c: mux: mlxcpld: Move header file out of x86 realm platform/x86: mlxcpld: Update module license i2c: mux: mlxcpld: Update module license ...

Linus Torvalds committed 5 years ago

Commit 32c080c2 parents a26a9d8 0b16cfd44 files · +906 −3201Browse files

Showing the changes to include/uapi (2 of 44 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/i2c-dev.h +5 −20
  2. include/uapi/linux/i2c.h +67 −61
include/uapi/linux/i2c-dev.h+5−20
@@ -1,25 +1,10 @@
11 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
22 /*
3− i2c-dev.h - i2c-bus driver, char device interface
4−
5− Copyright (C) 1995-97 Simon G. Vogl
6− Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
7−
8− This program is free software; you can redistribute it and/or modify
9− it under the terms of the GNU General Public License as published by
10− the Free Software Foundation; either version 2 of the License, or
11− (at your option) any later version.
12−
13− This program is distributed in the hope that it will be useful,
14− but WITHOUT ANY WARRANTY; without even the implied warranty of
15− MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16− GNU General Public License for more details.
17−
18− You should have received a copy of the GNU General Public License
19− along with this program; if not, write to the Free Software
20− Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21− MA 02110-1301 USA.
22−*/
3+ * i2c-dev.h - I2C bus char device interface
4+ *
5+ * Copyright (C) 1995-97 Simon G. Vogl
6+ * Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
7+ */
238
249 #ifndef _UAPI_LINUX_I2C_DEV_H
2510 #define _UAPI_LINUX_I2C_DEV_H
include/uapi/linux/i2c.h+67−61
@@ -1,29 +1,11 @@
11 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2−/* ------------------------------------------------------------------------- */
3−/* */
4−/* i2c.h - definitions for the i2c-bus interface */
5−/* */
6−/* ------------------------------------------------------------------------- */
7−/* Copyright (C) 1995-2000 Simon G. Vogl
8−
9− This program is free software; you can redistribute it and/or modify
10− it under the terms of the GNU General Public License as published by
11− the Free Software Foundation; either version 2 of the License, or
12− (at your option) any later version.
13−
14− This program is distributed in the hope that it will be useful,
15− but WITHOUT ANY WARRANTY; without even the implied warranty of
16− MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17− GNU General Public License for more details.
18−
19− You should have received a copy of the GNU General Public License
20− along with this program; if not, write to the Free Software
21− Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22− MA 02110-1301 USA. */
23−/* ------------------------------------------------------------------------- */
24−
25−/* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
26− Frodo Looijaard <frodol@dds.nl> */
2+/*
3+ * i2c.h - definitions for the I2C bus interface
4+ *
5+ * Copyright (C) 1995-2000 Simon G. Vogl
6+ * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
7+ * Frodo Looijaard <frodol@dds.nl>
8+ */
279
2810 #ifndef _UAPI_LINUX_I2C_H
2911 #define _UAPI_LINUX_I2C_H
@@ -32,18 +14,41 @@ · 2 unmodified lines
3214
3315 /**
3416 * struct i2c_msg - an I2C transaction segment beginning with START
35− * @addr: Slave address, either seven or ten bits. When this is a ten
36− * bit address, I2C_M_TEN must be set in @flags and the adapter
37− * must support I2C_FUNC_10BIT_ADDR.
38− * @flags: I2C_M_RD is handled by all adapters. No other flags may be
39− * provided unless the adapter exported the relevant I2C_FUNC_*
40− * flags through i2c_check_functionality().
41− * @len: Number of data bytes in @buf being read from or written to the
42− * I2C slave address. For read transactions where I2C_M_RECV_LEN
43− * is set, the caller guarantees that this buffer can hold up to
44− * 32 bytes in addition to the initial length byte sent by the
45− * slave (plus, if used, the SMBus PEC); and this value will be
46− * incremented by the number of block data bytes received.
17+ *
18+ * @addr: Slave address, either 7 or 10 bits. When this is a 10 bit address,
19+ * %I2C_M_TEN must be set in @flags and the adapter must support
20+ * %I2C_FUNC_10BIT_ADDR.
21+ *
22+ * @flags:
23+ * Supported by all adapters:
24+ * %I2C_M_RD: read data (from slave to master). Guaranteed to be 0x0001!
25+ *
26+ * Optional:
27+ * %I2C_M_DMA_SAFE: the buffer of this message is DMA safe. Makes only sense
28+ * in kernelspace, because userspace buffers are copied anyway
29+ *
30+ * Only if I2C_FUNC_10BIT_ADDR is set:
31+ * %I2C_M_TEN: this is a 10 bit chip address
32+ *
33+ * Only if I2C_FUNC_SMBUS_READ_BLOCK_DATA is set:
34+ * %I2C_M_RECV_LEN: message length will be first received byte
35+ *
36+ * Only if I2C_FUNC_NOSTART is set:
37+ * %I2C_M_NOSTART: skip repeated start sequence
38+
39+ * Only if I2C_FUNC_PROTOCOL_MANGLING is set:
40+ * %I2C_M_NO_RD_ACK: in a read message, master ACK/NACK bit is skipped
41+ * %I2C_M_IGNORE_NAK: treat NACK from client as ACK
42+ * %I2C_M_REV_DIR_ADDR: toggles the Rd/Wr bit
43+ * %I2C_M_STOP: force a STOP condition after the message
44+ *
45+ * @len: Number of data bytes in @buf being read from or written to the I2C
46+ * slave address. For read transactions where %I2C_M_RECV_LEN is set, the
47+ * caller guarantees that this buffer can hold up to %I2C_SMBUS_BLOCK_MAX
48+ * bytes in addition to the initial length byte sent by the slave (plus,
49+ * if used, the SMBus PEC); and this value will be incremented by the number
50+ * of block data bytes received.
51+ *
4752 * @buf: The buffer into which data is read, or from which it's written.
4853 *
4954 * An i2c_msg is the low level representation of one segment of an I2C
@@ -60,40 +65,36 @@ · 10 unmodified lines
6065 * group, it is followed by a STOP. Otherwise it is followed by the next
6166 * @i2c_msg transaction segment, beginning with a (repeated) START.
6267 *
63− * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then
68+ * Alternatively, when the adapter supports %I2C_FUNC_PROTOCOL_MANGLING then
6469 * passing certain @flags may have changed those standard protocol behaviors.
6570 * Those flags are only for use with broken/nonconforming slaves, and with
66− * adapters which are known to support the specific mangling options they
67− * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
71+ * adapters which are known to support the specific mangling options they need.
6872 */
6973 struct i2c_msg {
70− __u16 addr; /* slave address */
74+ __u16 addr;
7175 __u16 flags;
72−#define I2C_M_RD 0x0001 /* read data, from slave to master */
73− /* I2C_M_RD is guaranteed to be 0x0001! */
74−#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
75−#define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */
76− /* makes only sense in kernelspace */
77− /* userspace buffers are copied anyway */
78−#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */
79−#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
80−#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
81−#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
82−#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
83−#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
84− __u16 len; /* msg length */
85− __u8 *buf; /* pointer to msg data */
76+#define I2C_M_RD 0x0001 /* guaranteed to be 0x0001! */
77+#define I2C_M_TEN 0x0010 /* use only if I2C_FUNC_10BIT_ADDR */
78+#define I2C_M_DMA_SAFE 0x0200 /* use only in kernel space */
79+#define I2C_M_RECV_LEN 0x0400 /* use only if I2C_FUNC_SMBUS_READ_BLOCK_DATA */
80+#define I2C_M_NO_RD_ACK 0x0800 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
81+#define I2C_M_IGNORE_NAK 0x1000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
82+#define I2C_M_REV_DIR_ADDR 0x2000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
83+#define I2C_M_NOSTART 0x4000 /* use only if I2C_FUNC_NOSTART */
84+#define I2C_M_STOP 0x8000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
85+ __u16 len;
86+ __u8 *buf;
8687 };
8788
8889 /* To determine what functionality is present */
8990
9091 #define I2C_FUNC_I2C 0x00000001
91−#define I2C_FUNC_10BIT_ADDR 0x00000002
92−#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */
92+#define I2C_FUNC_10BIT_ADDR 0x00000002 /* required for I2C_M_TEN */
93+#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* required for I2C_M_IGNORE_NAK etc. */
9394 #define I2C_FUNC_SMBUS_PEC 0x00000008
94−#define I2C_FUNC_NOSTART 0x00000010 /* I2C_M_NOSTART */
95+#define I2C_FUNC_NOSTART 0x00000010 /* required for I2C_M_NOSTART */
9596 #define I2C_FUNC_SLAVE 0x00000020
96−#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 */
97+#define I2C_FUNC_SMBUS_BLOCK_PROC_CALL 0x00008000 /* SMBus 2.0 or later */
9798 #define I2C_FUNC_SMBUS_QUICK 0x00010000
9899 #define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
99100 #define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
@@ -102,11 +103,11 @@ struct i2c_msg { · 2 unmodified lines
102103 #define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
103104 #define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
104105 #define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
105−#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000
106+#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 /* required for I2C_M_RECV_LEN */
106107 #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
107108 #define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
108109 #define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
109−#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000
110+#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 /* SMBus 2.0 or later */
110111
111112 #define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
112113 I2C_FUNC_SMBUS_WRITE_BYTE)
@@ -128,6 +129,11 @@ struct i2c_msg { · 15 unmodified lines
128129 I2C_FUNC_SMBUS_I2C_BLOCK | \
129130 I2C_FUNC_SMBUS_PEC)
130131
132+/* if I2C_M_RECV_LEN is also supported */
133+#define I2C_FUNC_SMBUS_EMUL_ALL (I2C_FUNC_SMBUS_EMUL | \
134+ I2C_FUNC_SMBUS_READ_BLOCK_DATA | \
135+ I2C_FUNC_SMBUS_BLOCK_PROC_CALL)
136+
131137 /*
132138 * Data for SMBus Messages
133139 */