Commit 4ebf4987 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Wolfram Sang
Browse files

i2c: Introduce common module to instantiate CCGx UCSI



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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 9c02d401
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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
+3 −0
Original line number Diff line number Diff line
@@ -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
+30 −0
Original line number Diff line number Diff line
// 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/module.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);

MODULE_LICENSE("GPL");
+11 −0
Original line number Diff line number Diff line
/* 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_ */