* [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments
@ 2024-01-10 20:13 Heiner Kallweit
2024-01-10 20:13 ` [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-10 20:13 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti, Peter Rosin, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
i801 is the last bus driver supporting I2C_CLASS_SPD. It's used for
device probing on muxed bus segments. Only known use case so far is
systems with more than 8 memory modules (with thermal sensor) on
muxed smbus segments.
As discussed with Jean, to be able to remove I2C_CLASS_SPD completely
the following has to be done:
1. Extend i2c_register_spd() for use on muxed bus segments
2. Enable explicit instantiation of thermal sensors on memory modules
3. Extend i801 to call i2c_register_spd() on muxed bus segments
Step 2 has been accomplished:
caba40ec3531 ("eeprom: at24: Probe for DDR3 thermal sensor in the SPD case")
393bd1000f81 ("eeprom: ee1004: add support for temperature sensor")
Patch 1 does step 1
Patches 2 and 3 provide the basis for patch 4
Patch 4 does step 3
Note: i801 creates the mux platform device, loading and probing of the
mux driver may be asynchronous. Therefore we can't call i2c_register_spd()
for the muxed segments from i801. Instead we have to add a flag to the
platform data, so that the mux driver knows it's supposed to call
i2c_register_spd().
This series replaces the earlier RFC series.
Heiner Kallweit (4):
i2c: smbus: Prepare i2c_register_spd for usage on muxed segments
i2c: mux: add basic support for calling i2c_register_spd on muxed bus
segments
i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment
i2c: i801: Call i2c_register_spd() on muxed bus segments
drivers/i2c/busses/i2c-i801.c | 1 +
drivers/i2c/i2c-mux.c | 4 ++++
drivers/i2c/i2c-smbus.c | 19 ++++++++++++-------
drivers/i2c/muxes/i2c-mux-gpio.c | 1 +
include/linux/i2c-mux.h | 1 +
include/linux/platform_data/i2c-mux-gpio.h | 2 ++
6 files changed, 21 insertions(+), 7 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments
2024-01-10 20:13 [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
@ 2024-01-10 20:13 ` Heiner Kallweit
2024-01-10 23:00 ` Peter Rosin
2024-01-10 20:14 ` [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments Heiner Kallweit
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-10 20:13 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti, Peter Rosin, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
If this is an adapter on a muxed bus segment, assume that each segment
is connected to a subset of the (> 8) overall memory slots. In this
case let's probe the maximum of 8 slots, however stop if the number
of overall populated slots is reached.
If we're not on a muxed segment and the total number of slots is > 8,
report an error, because then not all SPD eeproms can be addressed.
Presumably the bus is muxed, but the mux config is missing.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/i2c-smbus.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
index 74807c6db..e94714d5a 100644
--- a/drivers/i2c/i2c-smbus.c
+++ b/drivers/i2c/i2c-smbus.c
@@ -351,13 +351,18 @@ void i2c_register_spd(struct i2c_adapter *adap)
if (!dimm_count)
return;
- dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
- dimm_count, slot_count);
-
- if (slot_count > 8) {
- dev_warn(&adap->dev,
- "Systems with more than 8 memory slots not supported yet, not instantiating SPD\n");
- return;
+ /* Check whether we're a child adapter on a muxed segment */
+ if (i2c_parent_is_i2c_adapter(adap)) {
+ if (slot_count > 8)
+ slot_count = 8;
+ } else {
+ dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
+ dimm_count, slot_count);
+ if (slot_count > 8) {
+ dev_err(&adap->dev,
+ "More than 8 memory slots on a single bus, mux config missing?\n");
+ return;
+ }
}
/*
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
2024-01-10 20:13 [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
2024-01-10 20:13 ` [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
@ 2024-01-10 20:14 ` Heiner Kallweit
2024-01-11 15:53 ` kernel test robot
2024-01-13 8:38 ` kernel test robot
2024-01-10 20:15 ` [PATCH 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment Heiner Kallweit
2024-01-10 20:16 ` [PATCH 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments Heiner Kallweit
3 siblings, 2 replies; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-10 20:14 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti, Peter Rosin, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
This extension allows mux drivers to instruct i2c_mux_add_adapter to
call i2c_register_spd. First user of this feature will be gpio mux.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/i2c-mux.c | 4 ++++
include/linux/i2c-mux.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
index 57ff09f18..ada9c764f 100644
--- a/drivers/i2c/i2c-mux.c
+++ b/drivers/i2c/i2c-mux.c
@@ -22,6 +22,7 @@
#include <linux/acpi.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
+#include <linux/i2c-smbus.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -429,6 +430,9 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
i2c_adapter_id(&priv->adap));
+ if (muxc->register_spd)
+ i2c_register_spd(&priv->adap);
+
muxc->adapter[muxc->num_adapters++] = &priv->adap;
return 0;
diff --git a/include/linux/i2c-mux.h b/include/linux/i2c-mux.h
index 98ef73b7c..ec51d9bc4 100644
--- a/include/linux/i2c-mux.h
+++ b/include/linux/i2c-mux.h
@@ -21,6 +21,7 @@ struct i2c_mux_core {
unsigned int mux_locked:1;
unsigned int arbitrator:1;
unsigned int gate:1;
+ unsigned int register_spd:1;
void *priv;
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment
2024-01-10 20:13 [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
2024-01-10 20:13 ` [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
2024-01-10 20:14 ` [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments Heiner Kallweit
@ 2024-01-10 20:15 ` Heiner Kallweit
2024-01-10 20:16 ` [PATCH 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments Heiner Kallweit
3 siblings, 0 replies; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-10 20:15 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti, Peter Rosin, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
Allow the gpio-based multiplexer to call i2c_register_spd on
muxed segments. First user will be i801.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/muxes/i2c-mux-gpio.c | 1 +
include/linux/platform_data/i2c-mux-gpio.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 6b979a0a6..c841407c7 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -161,6 +161,7 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
}
mux->gpios = muxc->priv;
muxc->priv = mux;
+ muxc->register_spd = mux->data.register_spd;
platform_set_drvdata(pdev, muxc);
diff --git a/include/linux/platform_data/i2c-mux-gpio.h b/include/linux/platform_data/i2c-mux-gpio.h
index 5e4c2c272..cbeb74f92 100644
--- a/include/linux/platform_data/i2c-mux-gpio.h
+++ b/include/linux/platform_data/i2c-mux-gpio.h
@@ -20,6 +20,7 @@
* @n_values: Number of multiplexer positions (busses to instantiate)
* @classes: Optional I2C auto-detection classes
* @idle: Bitmask to write to MUX when idle or GPIO_I2CMUX_NO_IDLE if not used
+ * @register_spd: call i2c_register_spd for the child adapters on muxed segments
*/
struct i2c_mux_gpio_platform_data {
int parent;
@@ -28,6 +29,7 @@ struct i2c_mux_gpio_platform_data {
int n_values;
const unsigned *classes;
unsigned idle;
+ unsigned int register_spd:1;
};
#endif /* _LINUX_I2C_MUX_GPIO_H */
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments
2024-01-10 20:13 [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
` (2 preceding siblings ...)
2024-01-10 20:15 ` [PATCH 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment Heiner Kallweit
@ 2024-01-10 20:16 ` Heiner Kallweit
3 siblings, 0 replies; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-10 20:16 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti, Peter Rosin, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
Instruct child adapters to call i2c_register_spd() for each muxed
bus segment.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/busses/i2c-i801.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 3932e8d96..15c93ec5b 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1404,6 +1404,7 @@ static void i801_add_mux(struct i801_priv *priv)
gpio_data.n_values = mux_config->n_values;
gpio_data.classes = mux_config->classes;
gpio_data.idle = I2C_MUX_GPIO_NO_IDLE;
+ gpio_data.register_spd = 1;
/* Register GPIO descriptor lookup table */
lookup = devm_kzalloc(dev,
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments
2024-01-10 20:13 ` [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
@ 2024-01-10 23:00 ` Peter Rosin
2024-01-11 6:49 ` Heiner Kallweit
0 siblings, 1 reply; 9+ messages in thread
From: Peter Rosin @ 2024-01-10 23:00 UTC (permalink / raw)
To: Heiner Kallweit, Jean Delvare, Andi Shyti, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
Hi!
2024-01-10 at 21:13, Heiner Kallweit wrote:
> If this is an adapter on a muxed bus segment, assume that each segment
> is connected to a subset of the (> 8) overall memory slots. In this
> case let's probe the maximum of 8 slots, however stop if the number
> of overall populated slots is reached.
>
> If we're not on a muxed segment and the total number of slots is > 8,
> report an error, because then not all SPD eeproms can be addressed.
> Presumably the bus is muxed, but the mux config is missing.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/i2c/i2c-smbus.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
> index 74807c6db..e94714d5a 100644
> --- a/drivers/i2c/i2c-smbus.c
> +++ b/drivers/i2c/i2c-smbus.c
> @@ -351,13 +351,18 @@ void i2c_register_spd(struct i2c_adapter *adap)
> if (!dimm_count)
> return;
>
> - dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
> - dimm_count, slot_count);
> -
> - if (slot_count > 8) {
> - dev_warn(&adap->dev,
> - "Systems with more than 8 memory slots not supported yet, not instantiating SPD\n");
> - return;
> + /* Check whether we're a child adapter on a muxed segment */
> + if (i2c_parent_is_i2c_adapter(adap)) {
> + if (slot_count > 8)
> + slot_count = 8;'
The comment "Only works on systems with 1 to 8 memory slots" above
i2c_register_spd() is now incorrect and needs adjusting.
> + } else {
> + dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
> + dimm_count, slot_count);
> + if (slot_count > 8) {
> + dev_err(&adap->dev,
> + "More than 8 memory slots on a single bus, mux config missing?\n");
> + return;
> + }
> }
>
> /*
The loop below this hunk is limited by dimm_count, but it is checked
separately for each muxed segment. It is therefore now possible to
instantiate a total number of slots larger than the dimm_count.
That was not possible before. I don't know if that's a problem, but
the check have been (silently) relaxed.
Cheers,
Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments
2024-01-10 23:00 ` Peter Rosin
@ 2024-01-11 6:49 ` Heiner Kallweit
0 siblings, 0 replies; 9+ messages in thread
From: Heiner Kallweit @ 2024-01-11 6:49 UTC (permalink / raw)
To: Peter Rosin, Jean Delvare, Andi Shyti, Wolfram Sang,
Peter Korsgaard
Cc: linux-i2c@vger.kernel.org
On 11.01.2024 00:00, Peter Rosin wrote:
> Hi!
>
> 2024-01-10 at 21:13, Heiner Kallweit wrote:
>> If this is an adapter on a muxed bus segment, assume that each segment
>> is connected to a subset of the (> 8) overall memory slots. In this
>> case let's probe the maximum of 8 slots, however stop if the number
>> of overall populated slots is reached.
>>
>> If we're not on a muxed segment and the total number of slots is > 8,
>> report an error, because then not all SPD eeproms can be addressed.
>> Presumably the bus is muxed, but the mux config is missing.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>> drivers/i2c/i2c-smbus.c | 19 ++++++++++++-------
>> 1 file changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c
>> index 74807c6db..e94714d5a 100644
>> --- a/drivers/i2c/i2c-smbus.c
>> +++ b/drivers/i2c/i2c-smbus.c
>> @@ -351,13 +351,18 @@ void i2c_register_spd(struct i2c_adapter *adap)
>> if (!dimm_count)
>> return;
>>
>> - dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
>> - dimm_count, slot_count);
>> -
>> - if (slot_count > 8) {
>> - dev_warn(&adap->dev,
>> - "Systems with more than 8 memory slots not supported yet, not instantiating SPD\n");
>> - return;
>> + /* Check whether we're a child adapter on a muxed segment */
>> + if (i2c_parent_is_i2c_adapter(adap)) {
>> + if (slot_count > 8)
>> + slot_count = 8;'
>
> The comment "Only works on systems with 1 to 8 memory slots" above
> i2c_register_spd() is now incorrect and needs adjusting.
>
Right, this comment can be removed.
I'll wait for more feedback on the series before submitting a v2.
>> + } else {
>> + dev_info(&adap->dev, "%d/%d memory slots populated (from DMI)\n",
>> + dimm_count, slot_count);
>> + if (slot_count > 8) {
>> + dev_err(&adap->dev,
>> + "More than 8 memory slots on a single bus, mux config missing?\n");
>> + return;
>> + }
>> }
>>
>> /*
>
> The loop below this hunk is limited by dimm_count, but it is checked
> separately for each muxed segment. It is therefore now possible to
> instantiate a total number of slots larger than the dimm_count.
> That was not possible before. I don't know if that's a problem, but
> the check have been (silently) relaxed.
>
That's intentional. Keeping the current logic would have required to
add some kind of counter at the parent level, keeping track of how many
memory modules were instantiated per muxed segment.
For the sake of simplicity this was omitted. Instead we may probe more
slots than needed, however only impact should be that i2c_register_spd()
may take a little bit longer on affected systems.
> Cheers,
> Peter
Heiner
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
2024-01-10 20:14 ` [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments Heiner Kallweit
@ 2024-01-11 15:53 ` kernel test robot
2024-01-13 8:38 ` kernel test robot
1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-01-11 15:53 UTC (permalink / raw)
To: Heiner Kallweit, Jean Delvare, Andi Shyti, Peter Rosin,
Wolfram Sang, Peter Korsgaard
Cc: oe-kbuild-all, linux-i2c@vger.kernel.org
Hi Heiner,
kernel test robot noticed the following build errors:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on next-20240111]
[cannot apply to linus/master v6.7]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Heiner-Kallweit/i2c-smbus-Prepare-i2c_register_spd-for-usage-on-muxed-segments/20240111-042152
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
patch link: https://lore.kernel.org/r/53e5c71a-d954-4211-91a1-de067451d532%40gmail.com
patch subject: [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
config: i386-randconfig-053-20240111 (https://download.01.org/0day-ci/archive/20240111/202401112333.GUpSFOuc-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240111/202401112333.GUpSFOuc-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401112333.GUpSFOuc-lkp@intel.com/
All errors (new ones prefixed by >>):
ld: drivers/i2c/i2c-mux.o: in function `i2c_mux_add_adapter':
>> drivers/i2c/i2c-mux.c:434: undefined reference to `i2c_register_spd'
vim +434 drivers/i2c/i2c-mux.c
283
284 int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
285 u32 force_nr, u32 chan_id,
286 unsigned int class)
287 {
288 struct i2c_adapter *parent = muxc->parent;
289 struct i2c_mux_priv *priv;
290 char symlink_name[20];
291 int ret;
292
293 if (muxc->num_adapters >= muxc->max_adapters) {
294 dev_err(muxc->dev, "No room for more i2c-mux adapters\n");
295 return -EINVAL;
296 }
297
298 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
299 if (!priv)
300 return -ENOMEM;
301
302 /* Set up private adapter data */
303 priv->muxc = muxc;
304 priv->chan_id = chan_id;
305
306 /* Need to do algo dynamically because we don't know ahead
307 * of time what sort of physical adapter we'll be dealing with.
308 */
309 if (parent->algo->master_xfer) {
310 if (muxc->mux_locked)
311 priv->algo.master_xfer = i2c_mux_master_xfer;
312 else
313 priv->algo.master_xfer = __i2c_mux_master_xfer;
314 }
315 if (parent->algo->master_xfer_atomic)
316 priv->algo.master_xfer_atomic = priv->algo.master_xfer;
317
318 if (parent->algo->smbus_xfer) {
319 if (muxc->mux_locked)
320 priv->algo.smbus_xfer = i2c_mux_smbus_xfer;
321 else
322 priv->algo.smbus_xfer = __i2c_mux_smbus_xfer;
323 }
324 if (parent->algo->smbus_xfer_atomic)
325 priv->algo.smbus_xfer_atomic = priv->algo.smbus_xfer;
326
327 priv->algo.functionality = i2c_mux_functionality;
328
329 /* Now fill out new adapter structure */
330 snprintf(priv->adap.name, sizeof(priv->adap.name),
331 "i2c-%d-mux (chan_id %d)", i2c_adapter_id(parent), chan_id);
332 priv->adap.owner = THIS_MODULE;
333 priv->adap.algo = &priv->algo;
334 priv->adap.algo_data = priv;
335 priv->adap.dev.parent = &parent->dev;
336 priv->adap.retries = parent->retries;
337 priv->adap.timeout = parent->timeout;
338 priv->adap.quirks = parent->quirks;
339 if (muxc->mux_locked)
340 priv->adap.lock_ops = &i2c_mux_lock_ops;
341 else
342 priv->adap.lock_ops = &i2c_parent_lock_ops;
343
344 /* Sanity check on class */
345 if (i2c_mux_parent_classes(parent) & class & ~I2C_CLASS_DEPRECATED)
346 dev_err(&parent->dev,
347 "Segment %d behind mux can't share classes with ancestors\n",
348 chan_id);
349 else
350 priv->adap.class = class;
351
352 /*
353 * Try to populate the mux adapter's of_node, expands to
354 * nothing if !CONFIG_OF.
355 */
356 if (muxc->dev->of_node) {
357 struct device_node *dev_node = muxc->dev->of_node;
358 struct device_node *mux_node, *child = NULL;
359 u32 reg;
360
361 if (muxc->arbitrator)
362 mux_node = of_get_child_by_name(dev_node, "i2c-arb");
363 else if (muxc->gate)
364 mux_node = of_get_child_by_name(dev_node, "i2c-gate");
365 else
366 mux_node = of_get_child_by_name(dev_node, "i2c-mux");
367
368 if (mux_node) {
369 /* A "reg" property indicates an old-style DT entry */
370 if (!of_property_read_u32(mux_node, "reg", ®)) {
371 of_node_put(mux_node);
372 mux_node = NULL;
373 }
374 }
375
376 if (!mux_node)
377 mux_node = of_node_get(dev_node);
378 else if (muxc->arbitrator || muxc->gate)
379 child = of_node_get(mux_node);
380
381 if (!child) {
382 for_each_child_of_node(mux_node, child) {
383 ret = of_property_read_u32(child, "reg", ®);
384 if (ret)
385 continue;
386 if (chan_id == reg)
387 break;
388 }
389 }
390
391 priv->adap.dev.of_node = child;
392 of_node_put(mux_node);
393 }
394
395 /*
396 * Associate the mux channel with an ACPI node.
397 */
398 if (has_acpi_companion(muxc->dev))
399 acpi_preset_companion(&priv->adap.dev,
400 ACPI_COMPANION(muxc->dev),
401 chan_id);
402
403 if (force_nr) {
404 priv->adap.nr = force_nr;
405 ret = i2c_add_numbered_adapter(&priv->adap);
406 if (ret < 0) {
407 dev_err(&parent->dev,
408 "failed to add mux-adapter %u as bus %u (error=%d)\n",
409 chan_id, force_nr, ret);
410 goto err_free_priv;
411 }
412 } else {
413 ret = i2c_add_adapter(&priv->adap);
414 if (ret < 0) {
415 dev_err(&parent->dev,
416 "failed to add mux-adapter %u (error=%d)\n",
417 chan_id, ret);
418 goto err_free_priv;
419 }
420 }
421
422 WARN(sysfs_create_link(&priv->adap.dev.kobj, &muxc->dev->kobj,
423 "mux_device"),
424 "can't create symlink to mux device\n");
425
426 snprintf(symlink_name, sizeof(symlink_name), "channel-%u", chan_id);
427 WARN(sysfs_create_link(&muxc->dev->kobj, &priv->adap.dev.kobj,
428 symlink_name),
429 "can't create symlink to channel %u\n", chan_id);
430 dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
431 i2c_adapter_id(&priv->adap));
432
433 if (muxc->register_spd)
> 434 i2c_register_spd(&priv->adap);
435
436 muxc->adapter[muxc->num_adapters++] = &priv->adap;
437 return 0;
438
439 err_free_priv:
440 kfree(priv);
441 return ret;
442 }
443 EXPORT_SYMBOL_GPL(i2c_mux_add_adapter);
444
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
2024-01-10 20:14 ` [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments Heiner Kallweit
2024-01-11 15:53 ` kernel test robot
@ 2024-01-13 8:38 ` kernel test robot
1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-01-13 8:38 UTC (permalink / raw)
To: Heiner Kallweit, Jean Delvare, Andi Shyti, Peter Rosin,
Wolfram Sang, Peter Korsgaard
Cc: oe-kbuild-all, linux-i2c@vger.kernel.org
Hi Heiner,
kernel test robot noticed the following build errors:
[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on next-20240112]
[cannot apply to linus/master v6.7]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Heiner-Kallweit/i2c-smbus-Prepare-i2c_register_spd-for-usage-on-muxed-segments/20240111-042152
base: https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
patch link: https://lore.kernel.org/r/53e5c71a-d954-4211-91a1-de067451d532%40gmail.com
patch subject: [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments
config: loongarch-randconfig-001-20240111 (https://download.01.org/0day-ci/archive/20240113/202401131601.Qe16pupf-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240113/202401131601.Qe16pupf-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401131601.Qe16pupf-lkp@intel.com/
All errors (new ones prefixed by >>):
loongarch64-linux-ld: drivers/i2c/i2c-mux.o: in function `.L155':
>> i2c-mux.c:(.text+0xc84): undefined reference to `i2c_register_spd'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-01-13 8:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 20:13 [PATCH 0/4] i2c: Support i2c_register_spd() on multiplexed bus segments Heiner Kallweit
2024-01-10 20:13 ` [PATCH 1/4] i2c: smbus: Prepare i2c_register_spd for usage on muxed segments Heiner Kallweit
2024-01-10 23:00 ` Peter Rosin
2024-01-11 6:49 ` Heiner Kallweit
2024-01-10 20:14 ` [PATCH 2/4] i2c: mux: add basic support for calling i2c_register_spd on muxed bus segments Heiner Kallweit
2024-01-11 15:53 ` kernel test robot
2024-01-13 8:38 ` kernel test robot
2024-01-10 20:15 ` [PATCH 3/4] i2c: mux: gpio: Allow to call i2c_register_spd on a muxed segment Heiner Kallweit
2024-01-10 20:16 ` [PATCH 4/4] i2c: i801: Call i2c_register_spd() on muxed bus segments Heiner Kallweit
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).