From: Lee Jones <lee@kernel.org>
To: "Thomas Richard (congatec GmbH)" <thomas.richard@bootlin.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Werner Gartner <Werner.Gartner@congatec.com>,
mfd@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org
Subject: Re: [PATCH v3 2/9] mfd: cgbc: Add I2C platform data
Date: Wed, 23 Sep 2026 16:02:54 +0100 [thread overview]
Message-ID: <20260923150254.GH3864833@google.com> (raw)
In-Reply-To: <20260911-cgbc-i2c-storage-devices-support-v3-2-594b53fbc5ea@bootlin.com>
On Fri, 11 Sep 2026, Thomas Richard (congatec GmbH) wrote:
> Define I2C platform data for each I2C bus in the cgbc MFD driver. Platform
> data passes per-bus parameters to the I2C driver, rather than being defined
> inside the i2c-cgbc driver itself. This makes the i2c-cgbc driver more
> generic.
>
> Signed-off-by: Thomas Richard (congatec GmbH) <thomas.richard@bootlin.com>
> ---
> MAINTAINERS | 1 +
> drivers/mfd/cgbc-core.c | 39 ++++++++++++++++++++++++++--------
> include/linux/platform_data/i2c-cgbc.h | 22 +++++++++++++++++++
> 3 files changed, 53 insertions(+), 9 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6215fcb07770..561f102c2541 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -6621,6 +6621,7 @@ F: drivers/mfd/cgbc-core.c
> F: drivers/video/backlight/cgbc_bl.c
> F: drivers/watchdog/cgbc_wdt.c
> F: include/linux/mfd/cgbc.h
> +F: include/linux/platform_data/i2c-cgbc.h
>
> CONSOLE SUBSYSTEM
> M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> diff --git a/drivers/mfd/cgbc-core.c b/drivers/mfd/cgbc-core.c
> index 4a409234e66c..321fa3fff2ac 100644
> --- a/drivers/mfd/cgbc-core.c
> +++ b/drivers/mfd/cgbc-core.c
> @@ -16,6 +16,7 @@
> #include <linux/mfd/cgbc.h>
> #include <linux/mfd/core.h>
> #include <linux/module.h>
> +#include <linux/platform_data/i2c-cgbc.h>
> #include <linux/platform_device.h>
> #include <linux/sysfs.h>
>
> @@ -55,6 +56,35 @@
>
> static struct platform_device *cgbc_pdev;
>
> +static const struct cgbc_i2c_platform_data cgbc_i2c_gp_pdata = {
> + .name = "Congatec General Purpose I2C adapter",
> + .cgbc_bus_id = 0,
> +};
> +
> +static const struct cgbc_i2c_platform_data cgbc_i2c_pm_pdata = {
> + .name = "Congatec Power Management I2C adapter",
> + .cgbc_bus_id = 4,
> +};
> +
> +static const struct mfd_cell cgbc_devs[] = {
> + { .name = "cgbc-backlight" },
MFD_CELL_*
> + { .name = "cgbc-gpio" },
> + { .name = "cgbc-hwmon" },
> + {
> + .name = "cgbc-i2c",
> + .id = 1,
Why does PLATFORM_DEVID_AUTO not work for you?
> + .platform_data = &cgbc_i2c_gp_pdata,
> + .pdata_size = sizeof(cgbc_i2c_gp_pdata),
> + },
> + {
> + .name = "cgbc-i2c",
> + .id = 2,
> + .platform_data = &cgbc_i2c_pm_pdata,
> + .pdata_size = sizeof(cgbc_i2c_pm_pdata),
> + },
> + { .name = "cgbc-wdt" },
> +};
> +
> /* Wait the Board Controller is ready to receive some session commands */
> static int cgbc_wait_device(struct cgbc_device_data *cgbc)
> {
> @@ -235,15 +265,6 @@ int cgbc_command(struct cgbc_device_data *cgbc, void *cmd, unsigned int cmd_size
> }
> EXPORT_SYMBOL_GPL(cgbc_command);
>
> -static struct mfd_cell cgbc_devs[] = {
> - { .name = "cgbc-wdt" },
> - { .name = "cgbc-gpio" },
> - { .name = "cgbc-i2c", .id = 1 },
> - { .name = "cgbc-i2c", .id = 2 },
> - { .name = "cgbc-hwmon" },
> - { .name = "cgbc-backlight" },
> -};
> -
> static int cgbc_map(struct cgbc_device_data *cgbc)
> {
> struct device *dev = cgbc->dev;
> diff --git a/include/linux/platform_data/i2c-cgbc.h b/include/linux/platform_data/i2c-cgbc.h
> new file mode 100644
> index 000000000000..4465e8a7b40e
> --- /dev/null
> +++ b/include/linux/platform_data/i2c-cgbc.h
I think this area is mainly used to share data with OF.
Did you consider include/linux/mfd?
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * i2c-cgbc interface to platform code
> + *
> + * Copyright (C) 2026 congatec GmbH
> + * Author: Thomas Richard <thomas.richard@bootlin.com>
> + */
> +
> +#ifndef _LINUX_I2C_CGBC_H
> +#define _LINUX_I2C_CGBC_H
> +
> +/**
> + * struct cgbc_platform_data - Platform data of the CGBC I2C driver
> + * @name: I2C adapter name
> + * @cgbc_bus_id: I2C bus ID (from Board Controller point of view)
> + */
> +struct cgbc_i2c_platform_data {
> + const char *name;
> + int cgbc_bus_id;
> +};
> +
> +#endif /* _LINUX_I2C_CGBC_H */
>
> --
> 2.53.0
>
--
Lee Jones
next prev parent reply other threads:[~2026-09-23 15:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 18:48 [PATCH v3 0/9] Congatec Board Controller: Add storage devices support Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 1/9] mfd: cgbc: Fix use of negative error code as valid session handle Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 2/9] mfd: cgbc: Add I2C platform data Thomas Richard (congatec GmbH)
2026-09-23 15:02 ` Lee Jones [this message]
2026-09-23 15:42 ` Thomas Richard
2026-09-11 18:48 ` [PATCH v3 3/9] i2c: cgbc: Use plateform data to get bus ID and adapter name Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 4/9] mfd: cgbc: Use PLATFORM_DEVID_AUTO for child device registration Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 5/9] mfd: cgbc: Use real I2C bus names Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 6/9] i2c: cgbc: Add support for fixed frequency buses Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 7/9] mfd: cgbc: Add virtual I2C bus support Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 8/9] mfd: cgbc: Add virtual storage devices on the virtual I2C bus Thomas Richard (congatec GmbH)
2026-09-11 18:48 ` [PATCH v3 9/9] i2c: cgbc: Register known I2C devices on the bus Thomas Richard (congatec GmbH)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923150254.GH3864833@google.com \
--to=lee@kernel.org \
--cc=Werner.Gartner@congatec.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=thomas.petazzoni@bootlin.com \
--cc=thomas.richard@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.