platform: mellanox: nvsw-sn2201: change fans i2c busses.
authorMichael Shych <michaelsh@nvidia.com>
Tue, 22 Aug 2023 11:34:50 +0000 (11:34 +0000)
committerHans de Goede <hdegoede@redhat.com>
Wed, 23 Aug 2023 15:31:30 +0000 (17:31 +0200)
Define the exact i2c bus (adapter number) of fans on the SN2201 system.
This will cause fan's EEPROMs be connected already from nvsw-sn2201
platform driver and not from user space after receiving udev events.

Signed-off-by: Michael Shych <michaelsh@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230822113451.13785-16-vadimp@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/mellanox/nvsw-sn2201.c

index 7b9c107..75b6996 100644 (file)
 #define NVSW_SN2201_MAIN_MUX_CH5_NR    (NVSW_SN2201_MAIN_MUX_CH0_NR + 5)
 #define NVSW_SN2201_MAIN_MUX_CH6_NR    (NVSW_SN2201_MAIN_MUX_CH0_NR + 6)
 #define NVSW_SN2201_MAIN_MUX_CH7_NR    (NVSW_SN2201_MAIN_MUX_CH0_NR + 7)
+#define NVSW_SN2201_2ND_MUX_CH0_NR     (NVSW_SN2201_MAIN_MUX_CH7_NR + 1)
+#define NVSW_SN2201_2ND_MUX_CH1_NR     (NVSW_SN2201_MAIN_MUX_CH7_NR + 2)
+#define NVSW_SN2201_2ND_MUX_CH2_NR     (NVSW_SN2201_MAIN_MUX_CH7_NR + 3)
+#define NVSW_SN2201_2ND_MUX_CH3_NR     (NVSW_SN2201_MAIN_MUX_CH7_NR + 4)
 
 #define NVSW_SN2201_CPLD_NR            NVSW_SN2201_MAIN_MUX_CH0_NR
 #define NVSW_SN2201_NR_NONE            -1
@@ -425,28 +429,28 @@ static struct mlxreg_core_data nvsw_sn2201_fan_items_data[] = {
                .reg = NVSW_SN2201_FAN_PRSNT_STATUS_OFFSET,
                .mask = BIT(0),
                .hpdev.brdinfo = &nvsw_sn2201_fan_devices[0],
-               .hpdev.nr = NVSW_SN2201_NR_NONE,
+               .hpdev.nr = NVSW_SN2201_2ND_MUX_CH0_NR,
        },
        {
                .label = "fan2",
                .reg = NVSW_SN2201_FAN_PRSNT_STATUS_OFFSET,
                .mask = BIT(1),
                .hpdev.brdinfo = &nvsw_sn2201_fan_devices[1],
-               .hpdev.nr = NVSW_SN2201_NR_NONE,
+               .hpdev.nr = NVSW_SN2201_2ND_MUX_CH1_NR,
        },
        {
                .label = "fan3",
                .reg = NVSW_SN2201_FAN_PRSNT_STATUS_OFFSET,
                .mask = BIT(2),
                .hpdev.brdinfo = &nvsw_sn2201_fan_devices[2],
-               .hpdev.nr = NVSW_SN2201_NR_NONE,
+               .hpdev.nr = NVSW_SN2201_2ND_MUX_CH2_NR,
        },
        {
                .label = "fan4",
                .reg = NVSW_SN2201_FAN_PRSNT_STATUS_OFFSET,
                .mask = BIT(3),
                .hpdev.brdinfo = &nvsw_sn2201_fan_devices[3],
-               .hpdev.nr = NVSW_SN2201_NR_NONE,
+               .hpdev.nr = NVSW_SN2201_2ND_MUX_CH3_NR,
        },
 };