linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 01/11] i2c: Introduce common module to instantiate CCGx UCSI
@ 2021-12-07 19:21 Andy Shevchenko
  2021-12-07 19:21 ` [PATCH v1 02/11] i2c: designware-pci: Switch to use i2c_new_ccgx_ucsi() Andy Shevchenko
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: Andy Shevchenko @ 2021-12-07 19:21 UTC (permalink / raw)
  To: Wolfram Sang, Andy Shevchenko, linux-kernel, linux-i2c
  Cc: Jarkko Nikula, Mika Westerberg, Ajay Gupta

Introduce a common module to provide an API to instantiate UCSI device
for Cypress CCGx Type-C controller. Individual bus drivers need to select
this one on demand.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/Kconfig         |  7 +++++++
 drivers/i2c/busses/Makefile        |  3 +++
 drivers/i2c/busses/i2c-ccgx-ucsi.c | 27 +++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-ccgx-ucsi.h | 11 +++++++++++
 4 files changed, 48 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-ccgx-ucsi.c
 create mode 100644 drivers/i2c/busses/i2c-ccgx-ucsi.h

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index df89cb809330..0fb2caf7498c 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -9,6 +9,13 @@ menu "I2C Hardware Bus support"
 comment "PC SMBus host controller drivers"
 	depends on PCI
 
+config I2C_CCGX_UCSI
+	tristate
+	help
+	  A common module to provide an API to instantiate UCSI device
+	  for Cypress CCGx Type-C controller. Individual bus drivers
+	  need to select this one on demand.
+
 config I2C_ALI1535
 	tristate "ALI 1535"
 	depends on PCI
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 1d00dce77098..79405cb5d600 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -6,6 +6,9 @@
 # ACPI drivers
 obj-$(CONFIG_I2C_SCMI)		+= i2c-scmi.o
 
+# Auxiliary I2C/SMBus modules
+obj-$(CONFIG_I2C_CCGX_UCSI)	+= i2c-ccgx-ucsi.o
+
 # PC SMBus host controller drivers
 obj-$(CONFIG_I2C_ALI1535)	+= i2c-ali1535.o
 obj-$(CONFIG_I2C_ALI1563)	+= i2c-ali1563.o
diff --git a/drivers/i2c/busses/i2c-ccgx-ucsi.c b/drivers/i2c/busses/i2c-ccgx-ucsi.c
new file mode 100644
index 000000000000..141c3d1ef752
--- /dev/null
+++ b/drivers/i2c/busses/i2c-ccgx-ucsi.c
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Instantiate UCSI device for Cypress CCGx Type-C controller.
+ * Derived from i2c-designware-pcidrv.c and i2c-nvidia-gpu.c.
+ */
+
+#include <linux/i2c.h>
+#include <linux/export.h>
+#include <linux/string.h>
+
+#include "i2c-ccgx-ucsi.h"
+
+struct software_node;
+
+struct i2c_client *i2c_new_ccgx_ucsi(struct i2c_adapter *adapter, int irq,
+				     const struct software_node *swnode)
+{
+	struct i2c_board_info info = {};
+
+	strscpy(info.type, "ccgx-ucsi", sizeof(info.type));
+	info.addr = 0x08;
+	info.irq = irq;
+	info.swnode = swnode;
+
+	return i2c_new_client_device(adapter, &info);
+}
+EXPORT_SYMBOL_GPL(i2c_new_ccgx_ucsi);
diff --git a/drivers/i2c/busses/i2c-ccgx-ucsi.h b/drivers/i2c/busses/i2c-ccgx-ucsi.h
new file mode 100644
index 000000000000..739ac7a4b117
--- /dev/null
+++ b/drivers/i2c/busses/i2c-ccgx-ucsi.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef __I2C_CCGX_UCSI_H_
+#define __I2C_CCGX_UCSI_H_
+
+struct i2c_adapter;
+struct i2c_client;
+struct software_node;
+
+struct i2c_client *i2c_new_ccgx_ucsi(struct i2c_adapter *adapter, int irq,
+				     const struct software_node *swnode);
+#endif /* __I2C_CCGX_UCSI_H_ */
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-12-15 13:50 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-07 19:21 [PATCH v1 01/11] i2c: Introduce common module to instantiate CCGx UCSI Andy Shevchenko
2021-12-07 19:21 ` [PATCH v1 02/11] i2c: designware-pci: Switch to use i2c_new_ccgx_ucsi() Andy Shevchenko
2021-12-07 19:21 ` [PATCH v1 03/11] i2c: designware-pci: Use temporary variable for struct device Andy Shevchenko
2021-12-08 12:35   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 04/11] i2c: designware-pci: Convert to use dev_err_probe() Andy Shevchenko
2021-12-08 12:21   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 05/11] i2c: designware-pci: use __maybe_unused for PM functions Andy Shevchenko
2021-12-08 12:31   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 06/11] i2c: designware-pci: Fix to change data types of hcnt and lcnt parameters Andy Shevchenko
2021-12-08 12:29   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 07/11] i2c: designware-pci: Group MODULE_*() macros Andy Shevchenko
2021-12-08 12:30   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 08/11] i2c: designware-pci: Add a note about struct dw_scl_sda_cfg usage Andy Shevchenko
2021-12-08 12:29   ` Jarkko Nikula
2021-12-07 19:21 ` [PATCH v1 09/11] i2c: nvidia-gpu: Switch to use i2c_new_ccgx_ucsi() Andy Shevchenko
2021-12-07 19:21 ` [PATCH v1 10/11] i2c: nvidia-gpu: Use temporary variable for struct device Andy Shevchenko
2021-12-07 19:21 ` [PATCH v1 11/11] i2c: nvidia-gpu: Convert to use dev_err_probe() Andy Shevchenko
2021-12-08 12:29 ` [PATCH v1 01/11] i2c: Introduce common module to instantiate CCGx UCSI Jarkko Nikula
2021-12-13 18:00   ` Andy Shevchenko
2021-12-15 13:50     ` Shah, Nehal-bakulchandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).