Changes since v3:
* Add `cp2615_check_iop()`: check that IOP is functional, before use
* Use kernel types __be16, u8 and s8
* Add __attribute__((packed)) to `struct`s
* Make `cp2615_i2c_quirks` and `cp2615_check_iop()` static
* Fix `strncpy` invocation
* Add myself to MAINTAINERS
* Misc formatting, warning fixing (ex. identicalConditionAfterEarlyExit) etc.
Bence Csókás (2):
i2c: Add I2C_AQ_NO_REP_START adapter quirk
Adding i2c-cp2615: i2c support for Silicon Labs' CP2615 Digital Audio
Bridge
MAINTAINERS | 5 +
drivers/i2c/busses/Kconfig | 10 +
drivers/i2c/busses/Makefile | 1 +
drivers/i2c/busses/i2c-cp2615.c | 336 ++++++++++++++++++++++++++++++++
include/linux/i2c.h | 2 +
5 files changed, 354 insertions(+)
create mode 100644 drivers/i2c/busses/i2c-cp2615.c
--
2.31.0
This quirk signifies that the adapter cannot do a repeated
START, it always issues a STOP condition after transfers.
Suggested-by: Wolfram Sang <[email protected]>
Signed-off-by: Bence Csókás <[email protected]>
---
include/linux/i2c.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 56622658b215..a670ae129f4b 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -687,6 +687,8 @@ struct i2c_adapter_quirks {
#define I2C_AQ_NO_ZERO_LEN_READ BIT(5)
#define I2C_AQ_NO_ZERO_LEN_WRITE BIT(6)
#define I2C_AQ_NO_ZERO_LEN (I2C_AQ_NO_ZERO_LEN_READ | I2C_AQ_NO_ZERO_LEN_WRITE)
+/* adapter cannot do repeated START */
+#define I2C_AQ_NO_REP_START BIT(7)
/*
* i2c_adapter is the structure used to identify a physical i2c bus along
--
2.31.0
Create an i2c_adapter for CP2615's I2C master interface
Signed-off-by: Bence Csókás <[email protected]>
---
MAINTAINERS | 5 +
drivers/i2c/busses/Kconfig | 10 +
drivers/i2c/busses/Makefile | 1 +
drivers/i2c/busses/i2c-cp2615.c | 336 ++++++++++++++++++++++++++++++++
4 files changed, 352 insertions(+)
create mode 100644 drivers/i2c/busses/i2c-cp2615.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 281de213ef47..d7ca6ad75d87 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4521,6 +4521,11 @@ F: drivers/counter/
F: include/linux/counter.h
F: include/linux/counter_enum.h
+CP2615 I2C DRIVER
+M: Bence Csókás <[email protected]>
+S: Maintained
+F: drivers/i2c/busses/i2c-cp2615.c
+
CPMAC ETHERNET DRIVER
M: Florian Fainelli <[email protected]>
L: [email protected]
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index a49e0ed4a599..7a0dd18140d3 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1227,6 +1227,16 @@ config I2C_DLN2
This driver can also be built as a module. If so, the module
will be called i2c-dln2.
+config I2C_CP2615
+ tristate "Silicon Labs CP2615 USB sound card and I2C adapter"
+ depends on USB
+ help
+ If you say yes to this option, support will be included for Silicon
+ Labs CP2615's I2C interface.
+
+ This driver can also be built as a module. If so, the module
+ will be called i2c-cp2615.
+
config I2C_PARPORT
tristate "Parallel port adapter"
depends on PARPORT
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 683c49faca05..adb71d9c9d42 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -127,6 +127,7 @@ obj-$(CONFIG_I2C_ZX2967) += i2c-zx2967.o
# External I2C/SMBus adapter drivers
obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o
obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o
+obj-$(CONFIG_I2C_CP2615) += i2c-cp2615.o
obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o
obj-$(CONFIG_I2C_ROBOTFUZZ_OSIF) += i2c-robotfuzz-osif.o
obj-$(CONFIG_I2C_TAOS_EVM) += i2c-taos-evm.o
diff --git a/drivers/i2c/busses/i2c-cp2615.c b/drivers/i2c/busses/i2c-cp2615.c
new file mode 100644
index 000000000000..cd4146f7e60b
--- /dev/null
+++ b/drivers/i2c/busses/i2c-cp2615.c
@@ -0,0 +1,336 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * i2c support for Silicon Labs' CP2615 Digital Audio Bridge
+ *
+ * (c) 2021, Bence Csókás <[email protected]>
+ */
+
+#include <linux/errno.h>
+#include <linux/i2c.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/usb.h>
+
+/** CP2615 I/O Protocol implementation */
+
+#define CP2615_VID 0x10c4
+#define CP2615_PID 0xeac1
+
+#define IOP_EP_IN 0x82
+#define IOP_EP_OUT 0x02
+#define IOP_IFN 1
+#define IOP_ALTSETTING 2
+
+#define MAX_IOP_SIZE 64
+#define MAX_IOP_PAYLOAD_SIZE (MAX_IOP_SIZE - 6)
+#define MAX_I2C_SIZE (MAX_IOP_PAYLOAD_SIZE - 4)
+
+enum cp2615_iop_msg_type {
+ iop_GetAccessoryInfo = 0xD100,
+ iop_AccessoryInfo = 0xA100,
+ iop_GetPortConfiguration = 0xD203,
+ iop_PortConfiguration = 0xA203,
+ iop_DoI2cTransfer = 0xD400,
+ iop_I2cTransferResult = 0xA400,
+ iop_GetSerialState = 0xD501,
+ iop_SerialState = 0xA501
+};
+
+struct __attribute__((packed)) cp2615_iop_msg {
+ __be16 preamble, length, msg;
+ u8 data[MAX_IOP_PAYLOAD_SIZE];
+};
+
+int cp2615_init_iop_msg(struct cp2615_iop_msg *ret, enum cp2615_iop_msg_type msg,
+ const void *data, size_t data_len);
+
+#define PART_ID_A01 0x1400
+#define PART_ID_A02 0x1500
+
+struct __attribute__((packed)) cp2615_iop_accessory_info {
+ __be16 part_id, option_id, proto_ver;
+};
+
+struct __attribute__((packed)) cp2615_i2c_transfer {
+ u8 tag, i2caddr, read_len, write_len;
+ u8 data[MAX_I2C_SIZE];
+};
+
+/* Possible values for struct cp2615_i2c_transfer_result.status */
+enum cp2615_i2c_status {
+ /* Writing to the internal EEPROM failed, because it is locked */
+ CP2615_CFG_LOCKED = -6,
+ /* read_len or write_len out of range */
+ CP2615_INVALID_PARAM = -4,
+ /* I2C slave did not ACK in time */
+ CP2615_TIMEOUT,
+ /* I2C bus busy */
+ CP2615_BUS_BUSY,
+ /* I2C bus error (ie. device NAK'd the request) */
+ CP2615_BUS_ERROR,
+ CP2615_SUCCESS
+};
+
+struct __attribute__((packed)) cp2615_i2c_transfer_result {
+ u8 tag, i2caddr;
+ s8 status;
+ u8 read_len;
+ u8 data[MAX_I2C_SIZE];
+};
+
+int cp2615_init_i2c_msg(struct cp2615_iop_msg *ret, const struct cp2615_i2c_transfer *data);
+
+/* Translates status codes to Linux errno's */
+int cp2615_check_status(enum cp2615_i2c_status status);
+
+int cp2615_init_iop_msg(struct cp2615_iop_msg *ret, enum cp2615_iop_msg_type msg,
+ const void *data, size_t data_len)
+{
+ if (data_len > MAX_IOP_PAYLOAD_SIZE)
+ return -EFBIG;
+
+ if (!ret)
+ return -EINVAL;
+
+ ret->preamble = 0x2A2A;
+ ret->length = htons(data_len + 6);
+ ret->msg = htons(msg);
+ if (data && data_len)
+ memcpy(&ret->data, data, data_len);
+ return 0;
+}
+
+int cp2615_init_i2c_msg(struct cp2615_iop_msg *ret, const struct cp2615_i2c_transfer *data)
+{
+ return cp2615_init_iop_msg(ret, iop_DoI2cTransfer, data, 4 + data->write_len);
+}
+
+int cp2615_check_status(enum cp2615_i2c_status status)
+{
+ switch (status) {
+ case CP2615_SUCCESS:
+ return 0;
+ case CP2615_BUS_ERROR:
+ return -ENXIO;
+ case CP2615_BUS_BUSY:
+ return -EAGAIN;
+ case CP2615_TIMEOUT:
+ return -ETIMEDOUT;
+ case CP2615_INVALID_PARAM:
+ return -EINVAL;
+ case CP2615_CFG_LOCKED:
+ return -EPERM;
+ }
+ /* Unknown error code */
+ return -EPROTO;
+}
+
+/** Driver code */
+
+static int
+cp2615_i2c_send(struct usb_interface *usbif, struct cp2615_i2c_transfer *i2c_w)
+{
+ struct cp2615_iop_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
+ struct usb_device *usbdev = interface_to_usbdev(usbif);
+ int res = cp2615_init_i2c_msg(msg, i2c_w);
+
+ if (!res)
+ res = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, IOP_EP_OUT),
+ msg, ntohs(msg->length), NULL, 0);
+ kfree(msg);
+ return res;
+}
+
+static int
+cp2615_i2c_recv(struct usb_interface *usbif, unsigned char tag, void *buf)
+{
+ struct cp2615_iop_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
+ struct cp2615_i2c_transfer_result *i2c_r = (struct cp2615_i2c_transfer_result *)&msg->data;
+ struct usb_device *usbdev = interface_to_usbdev(usbif);
+ int res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN),
+ msg, sizeof(struct cp2615_iop_msg), NULL, 0);
+
+ if (res < 0) {
+ kfree(msg);
+ return res;
+ }
+
+ if (msg->msg != htons(iop_I2cTransferResult) || i2c_r->tag != tag) {
+ kfree(msg);
+ return -EIO;
+ }
+
+ res = cp2615_check_status(i2c_r->status);
+ if (!res)
+ memcpy(buf, &i2c_r->data, i2c_r->read_len);
+
+ kfree(msg);
+ return res;
+}
+
+/* Checks if the IOP is functional by querying the part's ID */
+static int cp2615_check_iop(struct usb_interface *usbif)
+{
+ struct cp2615_iop_msg *msg = kzalloc(sizeof(*msg), GFP_KERNEL);
+ struct cp2615_iop_accessory_info *info = (struct cp2615_iop_accessory_info *)&msg->data;
+ struct usb_device *usbdev = interface_to_usbdev(usbif);
+ int res = cp2615_init_iop_msg(msg, iop_GetAccessoryInfo, NULL, 0);
+
+ if (res)
+ goto out;
+
+ res = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, IOP_EP_OUT),
+ msg, ntohs(msg->length), NULL, 0);
+ if (res)
+ goto out;
+
+ res = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, IOP_EP_IN),
+ msg, sizeof(struct cp2615_iop_msg), NULL, 0);
+ if (res)
+ goto out;
+
+ if (msg->msg != htons(iop_AccessoryInfo)) {
+ res = -EIO;
+ goto out;
+ }
+
+ switch (ntohs(info->part_id)) {
+ case PART_ID_A01:
+ dev_dbg(&usbif->dev, "Found A01 part. (WARNING: errata exist!)\n");
+ break;
+ case PART_ID_A02:
+ dev_dbg(&usbif->dev, "Found good A02 part.\n");
+ break;
+ default:
+ dev_warn(&usbif->dev, "Unknown part ID %04X\n", ntohs(info->part_id));
+ }
+
+out:
+ kfree(msg);
+ return res;
+}
+
+static int
+cp2615_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+{
+ struct usb_interface *usbif = adap->algo_data;
+ int i = 0, ret = 0;
+ struct i2c_msg *msg;
+ struct cp2615_i2c_transfer i2c_w = {0};
+
+ dev_dbg(&usbif->dev, "Doing %d I2C transactions\n", num);
+
+ for (; !ret && i < num; i++) {
+ msg = &msgs[i];
+
+ i2c_w.tag = 0xdd;
+ i2c_w.i2caddr = i2c_8bit_addr_from_msg(msg);
+ if (msg->flags & I2C_M_RD) {
+ i2c_w.read_len = msg->len;
+ i2c_w.write_len = 0;
+ } else {
+ i2c_w.read_len = 0;
+ i2c_w.write_len = msg->len;
+ memcpy(&i2c_w.data, msg->buf, i2c_w.write_len);
+ }
+ ret = cp2615_i2c_send(usbif, &i2c_w);
+ if (ret)
+ break;
+ ret = cp2615_i2c_recv(usbif, i2c_w.tag, msg->buf);
+ }
+ if (ret < 0)
+ return ret;
+ return i;
+}
+
+static u32
+cp2615_i2c_func(struct i2c_adapter *adap)
+{
+ return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+}
+
+static const struct i2c_algorithm cp2615_i2c_algo = {
+ .master_xfer = cp2615_i2c_master_xfer,
+ .functionality = cp2615_i2c_func,
+};
+
+/*
+ * This chip has some limitations: one is that the USB endpoint
+ * can only receive 64 bytes/transfer, that leaves 54 bytes for
+ * the I2C transfer. On top of that, EITHER read_len OR write_len
+ * may be zero, but not both. If both are non-zero, the adapter
+ * issues a write followed by a read. And the chip does not
+ * support repeated START between the write and read phases.
+ */
+static struct i2c_adapter_quirks cp2615_i2c_quirks = {
+ .max_write_len = MAX_I2C_SIZE,
+ .max_read_len = MAX_I2C_SIZE,
+ .flags = I2C_AQ_COMB_WRITE_THEN_READ | I2C_AQ_NO_ZERO_LEN | I2C_AQ_NO_REP_START,
+ .max_comb_1st_msg_len = MAX_I2C_SIZE,
+ .max_comb_2nd_msg_len = MAX_I2C_SIZE
+};
+
+static void
+cp2615_i2c_remove(struct usb_interface *usbif)
+{
+ struct i2c_adapter *adap = usb_get_intfdata(usbif);
+
+ usb_set_intfdata(usbif, NULL);
+ i2c_del_adapter(adap);
+}
+
+static int
+cp2615_i2c_probe(struct usb_interface *usbif, const struct usb_device_id *id)
+{
+ int ret = 0;
+ struct i2c_adapter *adap;
+ struct usb_device *usbdev = interface_to_usbdev(usbif);
+
+ ret = usb_set_interface(usbdev, IOP_IFN, IOP_ALTSETTING);
+ if (ret)
+ return ret;
+
+ ret = cp2615_check_iop(usbif);
+ if (ret)
+ return ret;
+
+ adap = devm_kzalloc(&usbif->dev, sizeof(struct i2c_adapter), GFP_KERNEL);
+ if (!adap)
+ return -ENOMEM;
+
+ strncpy(adap->name, usbdev->serial, sizeof(adap->name) - 1);
+ adap->owner = THIS_MODULE;
+ adap->dev.parent = &usbif->dev;
+ adap->dev.of_node = usbif->dev.of_node;
+ adap->timeout = HZ;
+ adap->algo = &cp2615_i2c_algo;
+ adap->quirks = &cp2615_i2c_quirks;
+ adap->algo_data = usbif;
+
+ ret = i2c_add_adapter(adap);
+ if (ret)
+ return ret;
+
+ usb_set_intfdata(usbif, adap);
+ return 0;
+}
+
+static const struct usb_device_id id_table[] = {
+ { USB_DEVICE_INTERFACE_NUMBER(CP2615_VID, CP2615_PID, IOP_IFN) },
+ { }
+};
+
+MODULE_DEVICE_TABLE(usb, id_table);
+
+static struct usb_driver cp2615_i2c_driver = {
+ .name = "i2c-cp2615",
+ .probe = cp2615_i2c_probe,
+ .disconnect = cp2615_i2c_remove,
+ .id_table = id_table,
+};
+
+module_usb_driver(cp2615_i2c_driver);
+
+MODULE_AUTHOR("Bence Csókás <[email protected]>");
+MODULE_DESCRIPTION("CP2615 I2C bus driver");
+MODULE_LICENSE("GPL");
--
2.31.0
Hi "Bence,
I love your patch! Yet something to improve:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on linux/master linus/master v5.12-rc5 next-20210331]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bence-Cs-k-s/Adding-i2c-cp2615-i2c-support-for-Silicon-Labs-CP2615-Digital-Audio/20210401-030413
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/f7bd7e90cde56628778fb121154088af095d3fa8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bence-Cs-k-s/Adding-i2c-cp2615-i2c-support-for-Silicon-Labs-CP2615-Digital-Audio/20210401-030413
git checkout f7bd7e90cde56628778fb121154088af095d3fa8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
drivers/i2c/busses/i2c-cp2615.c:323:1: warning: data definition has no type or storage class
323 | MODULE_DEVICE_TABLE(usb, id_table);
| ^~~~~~~~~~~~~~~~~~~
>> drivers/i2c/busses/i2c-cp2615.c:323:1: error: type defaults to 'int' in declaration of 'MODULE_DEVICE_TABLE' [-Werror=implicit-int]
drivers/i2c/busses/i2c-cp2615.c:323:1: warning: parameter names (without types) in function declaration
In file included from include/linux/device.h:32,
from include/linux/acpi.h:15,
from include/linux/i2c.h:13,
from drivers/i2c/busses/i2c-cp2615.c:9:
include/linux/device/driver.h:263:1: warning: data definition has no type or storage class
263 | module_init(__driver##_init); \
| ^~~~~~~~~~~
include/linux/usb.h:1305:2: note: in expansion of macro 'module_driver'
1305 | module_driver(__usb_driver, usb_register, \
| ^~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
>> include/linux/device/driver.h:263:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int]
263 | module_init(__driver##_init); \
| ^~~~~~~~~~~
include/linux/usb.h:1305:2: note: in expansion of macro 'module_driver'
1305 | module_driver(__usb_driver, usb_register, \
| ^~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: warning: parameter names (without types) in function declaration
In file included from include/linux/device.h:32,
from include/linux/acpi.h:15,
from include/linux/i2c.h:13,
from drivers/i2c/busses/i2c-cp2615.c:9:
include/linux/device/driver.h:268:1: warning: data definition has no type or storage class
268 | module_exit(__driver##_exit);
| ^~~~~~~~~~~
include/linux/usb.h:1305:2: note: in expansion of macro 'module_driver'
1305 | module_driver(__usb_driver, usb_register, \
| ^~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
>> include/linux/device/driver.h:268:1: error: type defaults to 'int' in declaration of 'module_exit' [-Werror=implicit-int]
268 | module_exit(__driver##_exit);
| ^~~~~~~~~~~
include/linux/usb.h:1305:2: note: in expansion of macro 'module_driver'
1305 | module_driver(__usb_driver, usb_register, \
| ^~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: warning: parameter names (without types) in function declaration
>> drivers/i2c/busses/i2c-cp2615.c:334:15: error: expected declaration specifiers or '...' before string constant
334 | MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:335:20: error: expected declaration specifiers or '...' before string constant
335 | MODULE_DESCRIPTION("CP2615 I2C bus driver");
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:336:16: error: expected declaration specifiers or '...' before string constant
336 | MODULE_LICENSE("GPL");
| ^~~~~
In file included from include/linux/device.h:32,
from include/linux/acpi.h:15,
from include/linux/i2c.h:13,
from drivers/i2c/busses/i2c-cp2615.c:9:
drivers/i2c/busses/i2c-cp2615.c:332:19: warning: 'cp2615_i2c_driver_exit' defined but not used [-Wunused-function]
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
include/linux/device/driver.h:264:20: note: in definition of macro 'module_driver'
264 | static void __exit __driver##_exit(void) \
| ^~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:19: warning: 'cp2615_i2c_driver_init' defined but not used [-Wunused-function]
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
include/linux/device/driver.h:259:19: note: in definition of macro 'module_driver'
259 | static int __init __driver##_init(void) \
| ^~~~~~~~
drivers/i2c/busses/i2c-cp2615.c:332:1: note: in expansion of macro 'module_usb_driver'
332 | module_usb_driver(cp2615_i2c_driver);
| ^~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
Selected by
- SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
- SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC
vim +323 drivers/i2c/busses/i2c-cp2615.c
322
> 323 MODULE_DEVICE_TABLE(usb, id_table);
324
325 static struct usb_driver cp2615_i2c_driver = {
326 .name = "i2c-cp2615",
327 .probe = cp2615_i2c_probe,
328 .disconnect = cp2615_i2c_remove,
329 .id_table = id_table,
330 };
331
332 module_usb_driver(cp2615_i2c_driver);
333
> 334 MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
Hi "Bence,
I love your patch! Yet something to improve:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on linux/master linus/master v5.12-rc5 next-20210331]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Bence-Cs-k-s/Adding-i2c-cp2615-i2c-support-for-Silicon-Labs-CP2615-Digital-Audio/20210401-030413
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: riscv-randconfig-r032-20210401 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 1c268a8ff4e90a85d0e634350b1104080614cf2b)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/f7bd7e90cde56628778fb121154088af095d3fa8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Bence-Cs-k-s/Adding-i2c-cp2615-i2c-support-for-Silicon-Labs-CP2615-Digital-Audio/20210401-030413
git checkout f7bd7e90cde56628778fb121154088af095d3fa8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All error/warnings (new ones prefixed by >>):
>> drivers/i2c/busses/i2c-cp2615.c:323:1: warning: declaration specifier missing, defaulting to 'int'
MODULE_DEVICE_TABLE(usb, id_table);
^
int
>> drivers/i2c/busses/i2c-cp2615.c:323:21: error: a parameter list without types is only allowed in a function definition
MODULE_DEVICE_TABLE(usb, id_table);
^
drivers/i2c/busses/i2c-cp2615.c:332:1: warning: declaration specifier missing, defaulting to 'int'
module_usb_driver(cp2615_i2c_driver);
^
include/linux/usb.h:1305:2: note: expanded from macro 'module_usb_driver'
module_driver(__usb_driver, usb_register, \
^
include/linux/device/driver.h:262:3: note: expanded from macro 'module_driver'
} \
^
drivers/i2c/busses/i2c-cp2615.c:332:1: error: a parameter list without types is only allowed in a function definition
include/linux/usb.h:1305:2: note: expanded from macro 'module_usb_driver'
module_driver(__usb_driver, usb_register, \
^
include/linux/device/driver.h:263:13: note: expanded from macro 'module_driver'
module_init(__driver##_init); \
^
<scratch space>:203:1: note: expanded from here
cp2615_i2c_driver_init
^
drivers/i2c/busses/i2c-cp2615.c:332:1: warning: declaration specifier missing, defaulting to 'int'
include/linux/usb.h:1305:2: note: expanded from macro 'module_usb_driver'
module_driver(__usb_driver, usb_register, \
^
include/linux/device/driver.h:267:3: note: expanded from macro 'module_driver'
} \
^
drivers/i2c/busses/i2c-cp2615.c:332:1: error: a parameter list without types is only allowed in a function definition
include/linux/usb.h:1305:2: note: expanded from macro 'module_usb_driver'
module_driver(__usb_driver, usb_register, \
^
include/linux/device/driver.h:268:13: note: expanded from macro 'module_driver'
module_exit(__driver##_exit);
^
<scratch space>:205:1: note: expanded from here
cp2615_i2c_driver_exit
^
>> drivers/i2c/busses/i2c-cp2615.c:334:15: error: expected parameter declarator
MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
^
>> drivers/i2c/busses/i2c-cp2615.c:334:15: error: expected ')'
drivers/i2c/busses/i2c-cp2615.c:334:14: note: to match this '('
MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
^
drivers/i2c/busses/i2c-cp2615.c:334:1: warning: declaration specifier missing, defaulting to 'int'
MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
^
int
>> drivers/i2c/busses/i2c-cp2615.c:334:14: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
^
void
drivers/i2c/busses/i2c-cp2615.c:335:20: error: expected parameter declarator
MODULE_DESCRIPTION("CP2615 I2C bus driver");
^
drivers/i2c/busses/i2c-cp2615.c:335:20: error: expected ')'
drivers/i2c/busses/i2c-cp2615.c:335:19: note: to match this '('
MODULE_DESCRIPTION("CP2615 I2C bus driver");
^
drivers/i2c/busses/i2c-cp2615.c:335:1: warning: declaration specifier missing, defaulting to 'int'
MODULE_DESCRIPTION("CP2615 I2C bus driver");
^
int
drivers/i2c/busses/i2c-cp2615.c:335:19: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_DESCRIPTION("CP2615 I2C bus driver");
^
void
drivers/i2c/busses/i2c-cp2615.c:336:16: error: expected parameter declarator
MODULE_LICENSE("GPL");
^
drivers/i2c/busses/i2c-cp2615.c:336:16: error: expected ')'
drivers/i2c/busses/i2c-cp2615.c:336:15: note: to match this '('
MODULE_LICENSE("GPL");
^
drivers/i2c/busses/i2c-cp2615.c:336:1: warning: declaration specifier missing, defaulting to 'int'
MODULE_LICENSE("GPL");
^
int
drivers/i2c/busses/i2c-cp2615.c:336:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
MODULE_LICENSE("GPL");
^
void
6 warnings and 12 errors generated.
vim +323 drivers/i2c/busses/i2c-cp2615.c
322
> 323 MODULE_DEVICE_TABLE(usb, id_table);
324
325 static struct usb_driver cp2615_i2c_driver = {
326 .name = "i2c-cp2615",
327 .probe = cp2615_i2c_probe,
328 .disconnect = cp2615_i2c_remove,
329 .id_table = id_table,
330 };
331
332 module_usb_driver(cp2615_i2c_driver);
333
> 334 MODULE_AUTHOR("Bence Cs?k?s <[email protected]>");
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
On Wed, Mar 31, 2021 at 07:19:20PM +0000, Bence Csókás wrote:
> This quirk signifies that the adapter cannot do a repeated
> START, it always issues a STOP condition after transfers.
>
> Suggested-by: Wolfram Sang <[email protected]>
> Signed-off-by: Bence Csókás <[email protected]>
Applied to for-next, thanks!
On Wed, Mar 31, 2021 at 07:19:21PM +0000, Bence Csókás wrote:
> Create an i2c_adapter for CP2615's I2C master interface
>
> Signed-off-by: Bence Csókás <[email protected]>
Switched to '__packed', add some more 'static', added <module.h>, and
applied to for-next, thanks!