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 @@
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*2/*
3 i2c-dev.h - i2c-bus driver, char device interface3 * i2c-dev.h - I2C bus char device interface
4 4 *
5 Copyright (C) 1995-97 Simon G. Vogl5 * Copyright (C) 1995-97 Simon G. Vogl
6 Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>6 * Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl>
7 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*/
23 8
24#ifndef _UAPI_LINUX_I2C_DEV_H9#ifndef _UAPI_LINUX_I2C_DEV_H
25#define _UAPI_LINUX_I2C_DEV_H10#define _UAPI_LINUX_I2C_DEV_H
include/uapi/linux/i2c.h+67−61
@@ -1,29 +1,11 @@
1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/* ------------------------------------------------------------------------- */2/*
3/* */3 * i2c.h - definitions for the I2C bus interface
4/* i2c.h - definitions for the i2c-bus interface */4 *
5/* */5 * Copyright (C) 1995-2000 Simon G. Vogl
6/* ------------------------------------------------------------------------- */6 * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and
7/* Copyright (C) 1995-2000 Simon G. Vogl7 * Frodo Looijaard <frodol@dds.nl>
8 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> */
27 9
28#ifndef _UAPI_LINUX_I2C_H10#ifndef _UAPI_LINUX_I2C_H
29#define _UAPI_LINUX_I2C_H11#define _UAPI_LINUX_I2C_H
@@ -32,18 +14,41 @@ · 2 unmodified lines
32 14
33/**15/**
34 * struct i2c_msg - an I2C transaction segment beginning with START16 * struct i2c_msg - an I2C transaction segment beginning with START
35 * @addr: Slave address, either seven or ten bits. When this is a ten17 *
36 * bit address, I2C_M_TEN must be set in @flags and the adapter18 * @addr: Slave address, either 7 or 10 bits. When this is a 10 bit address,
37 * must support I2C_FUNC_10BIT_ADDR.19 * %I2C_M_TEN must be set in @flags and the adapter must support
38 * @flags: I2C_M_RD is handled by all adapters. No other flags may be20 * %I2C_FUNC_10BIT_ADDR.
39 * provided unless the adapter exported the relevant I2C_FUNC_*21 *
40 * flags through i2c_check_functionality().22 * @flags:
41 * @len: Number of data bytes in @buf being read from or written to the23 * Supported by all adapters:
42 * I2C slave address. For read transactions where I2C_M_RECV_LEN24 * %I2C_M_RD: read data (from slave to master). Guaranteed to be 0x0001!
43 * is set, the caller guarantees that this buffer can hold up to25 *
44 * 32 bytes in addition to the initial length byte sent by the26 * Optional:
45 * slave (plus, if used, the SMBus PEC); and this value will be27 * %I2C_M_DMA_SAFE: the buffer of this message is DMA safe. Makes only sense
46 * incremented by the number of block data bytes received.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 *
47 * @buf: The buffer into which data is read, or from which it's written.52 * @buf: The buffer into which data is read, or from which it's written.
48 *53 *
49 * An i2c_msg is the low level representation of one segment of an I2C54 * An i2c_msg is the low level representation of one segment of an I2C
@@ -60,40 +65,36 @@ · 10 unmodified lines
60 * group, it is followed by a STOP. Otherwise it is followed by the next65 * group, it is followed by a STOP. Otherwise it is followed by the next
61 * @i2c_msg transaction segment, beginning with a (repeated) START.66 * @i2c_msg transaction segment, beginning with a (repeated) START.
62 *67 *
63 * Alternatively, when the adapter supports I2C_FUNC_PROTOCOL_MANGLING then68 * Alternatively, when the adapter supports %I2C_FUNC_PROTOCOL_MANGLING then
64 * passing certain @flags may have changed those standard protocol behaviors.69 * passing certain @flags may have changed those standard protocol behaviors.
65 * Those flags are only for use with broken/nonconforming slaves, and with70 * Those flags are only for use with broken/nonconforming slaves, and with
66 * adapters which are known to support the specific mangling options they71 * adapters which are known to support the specific mangling options they need.
67 * need (one or more of IGNORE_NAK, NO_RD_ACK, NOSTART, and REV_DIR_ADDR).
68 */72 */
69struct i2c_msg {73struct i2c_msg {
70 __u16 addr; /* slave address */74 __u16 addr;
71 __u16 flags;75 __u16 flags;
72#define I2C_M_RD 0x0001 /* read data, from slave to master */76#define I2C_M_RD 0x0001 /* guaranteed to be 0x0001! */
73 /* I2C_M_RD is guaranteed to be 0x0001! */77#define I2C_M_TEN 0x0010 /* use only if I2C_FUNC_10BIT_ADDR */
74#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */78#define I2C_M_DMA_SAFE 0x0200 /* use only in kernel space */
75#define I2C_M_DMA_SAFE 0x0200 /* the buffer of this message is DMA safe */79#define I2C_M_RECV_LEN 0x0400 /* use only if I2C_FUNC_SMBUS_READ_BLOCK_DATA */
76 /* makes only sense in kernelspace */80#define I2C_M_NO_RD_ACK 0x0800 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
77 /* userspace buffers are copied anyway */81#define I2C_M_IGNORE_NAK 0x1000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
78#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */82#define I2C_M_REV_DIR_ADDR 0x2000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
79#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */83#define I2C_M_NOSTART 0x4000 /* use only if I2C_FUNC_NOSTART */
80#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */84#define I2C_M_STOP 0x8000 /* use only if I2C_FUNC_PROTOCOL_MANGLING */
81#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */85 __u16 len;
82#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */86 __u8 *buf;
83#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
84 __u16 len; /* msg length */
85 __u8 *buf; /* pointer to msg data */
86};87};
87 88
88/* To determine what functionality is present */89/* To determine what functionality is present */
89 90
90#define I2C_FUNC_I2C 0x0000000191#define I2C_FUNC_I2C 0x00000001
91#define I2C_FUNC_10BIT_ADDR 0x0000000292#define I2C_FUNC_10BIT_ADDR 0x00000002 /* required for I2C_M_TEN */
92#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* I2C_M_IGNORE_NAK etc. */93#define I2C_FUNC_PROTOCOL_MANGLING 0x00000004 /* required for I2C_M_IGNORE_NAK etc. */
93#define I2C_FUNC_SMBUS_PEC 0x0000000894#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 */
95#define I2C_FUNC_SLAVE 0x0000002096#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 */
97#define I2C_FUNC_SMBUS_QUICK 0x0001000098#define I2C_FUNC_SMBUS_QUICK 0x00010000
98#define I2C_FUNC_SMBUS_READ_BYTE 0x0002000099#define I2C_FUNC_SMBUS_READ_BYTE 0x00020000
99#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000100#define I2C_FUNC_SMBUS_WRITE_BYTE 0x00040000
@@ -102,11 +103,11 @@ struct i2c_msg { · 2 unmodified lines
102#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000103#define I2C_FUNC_SMBUS_READ_WORD_DATA 0x00200000
103#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000104#define I2C_FUNC_SMBUS_WRITE_WORD_DATA 0x00400000
104#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000105#define I2C_FUNC_SMBUS_PROC_CALL 0x00800000
105#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000106#define I2C_FUNC_SMBUS_READ_BLOCK_DATA 0x01000000 /* required for I2C_M_RECV_LEN */
106#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000107#define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA 0x02000000
107#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */108#define I2C_FUNC_SMBUS_READ_I2C_BLOCK 0x04000000 /* I2C-like block xfer */
108#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */109#define I2C_FUNC_SMBUS_WRITE_I2C_BLOCK 0x08000000 /* w/ 1-byte reg. addr. */
109#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000110#define I2C_FUNC_SMBUS_HOST_NOTIFY 0x10000000 /* SMBus 2.0 or later */
110 111
111#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \112#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \
112 I2C_FUNC_SMBUS_WRITE_BYTE)113 I2C_FUNC_SMBUS_WRITE_BYTE)
@@ -128,6 +129,11 @@ struct i2c_msg { · 15 unmodified lines
128 I2C_FUNC_SMBUS_I2C_BLOCK | \129 I2C_FUNC_SMBUS_I2C_BLOCK | \
129 I2C_FUNC_SMBUS_PEC)130 I2C_FUNC_SMBUS_PEC)
130 131
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
131/*137/*
132 * Data for SMBus Messages138 * Data for SMBus Messages
133 */139 */