Skip to content

Commit

Permalink
[Mellanox] Add new kernel patches from HW-MGMT package V.7.0020.3005 (s…
Browse files Browse the repository at this point in the history
…onic-net#287)

* Add kernel patches for SN2201

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* update SN2201 kernel patch with hw-mgmt 2144

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* update SN2201 kernel patch

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* Add new patches with hw-mgmt-3000

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* Update kernel patch to V.7.0020.3005

Signed-off-by: Kebo Liu <kebol@nvidia.com>

* fix corrupted patch

Signed-off-by: Kebo Liu <kebol@nvidia.com>
  • Loading branch information
keboliu authored Jul 28, 2022
1 parent 50e2bff commit fdd9bac
Show file tree
Hide file tree
Showing 13 changed files with 2,703 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From 7ea34bd6ec1453e21f9f1d9442ea662a92423f32 Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <vadimp@nvidia.com>
Date: Thu, 7 Oct 2021 19:30:05 +0000
Subject: [PATCH backport 5.10/Alligator 1/9] mlxsw: core: Extend external
cooling device whitelist for thermal zone binding

Allow thermal zone binding to an external cooling device of type
"emc2305".
Motivation to support new system SN2021 equipped with ASIC Spectrum-1
supporting 48x Gbps RJ45 + 4x100G QSFP28 ports.
System airflow control is provided by EMC2305 RPM-based PWM Fan Speed
Controller as colling device.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index f9c9ebf68..cc4cddbdb 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -38,6 +38,7 @@
/* External cooling devices, allowed for binding to mlxsw thermal zones. */
static char * const mlxsw_thermal_external_allowed_cdev[] = {
"mlxreg_fan",
+ "emc2305",
};

enum mlxsw_thermal_trips {
--
2.20.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From abcebcd39fe094b68826cc04f2eca835606697f9 Mon Sep 17 00:00:00 2001
From: Michael Shych <michaelsh@nvidia.com>
Date: Sat, 30 Apr 2022 14:58:07 +0300
Subject: [PATCH] platform_data/mlxreg: Add field for notification callback

Add notification callback to inform caller that platform driver probing
has been completed. It allows to caller to perform some initialization
flow steps depending on specific driver probing completion.

Signed-off-by: Michael Shych <michaelsh@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20220430115809.54565-2-michaelsh@nvidia.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---

diff --git a/include/linux/platform_data/mlxreg.h b/include/linux/platform_data/mlxreg.h
index 40185f9d7c14..a6bd74e29b6b 100644
--- a/include/linux/platform_data/mlxreg.h
+++ b/include/linux/platform_data/mlxreg.h
@@ -216,6 +216,8 @@
* @mask_low: low aggregation interrupt common mask;
* @deferred_nr: I2C adapter number must be exist prior probing execution;
* @shift_nr: I2C adapter numbers must be incremented by this value;
+ * @handle: handle to be passed by callback;
+ * @completion_notify: callback to notify when platform driver probing is done;
*/
struct mlxreg_core_hotplug_platform_data {
struct mlxreg_core_item *items;
@@ -228,6 +230,8 @@
u32 mask_low;
int deferred_nr;
int shift_nr;
+ void *handle;
+ int (*completion_notify)(void *handle, int id);
};

#endif /* __LINUX_PLATFORM_DATA_MLXREG_H */
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 81abceea27623640f0d69d1526cb6d11d964025d Mon Sep 17 00:00:00 2001
From: Vadim Pasternak <vadimp@nvidia.com>
Date: Thu, 7 Oct 2021 19:04:25 +0000
Subject: [PATCH backport 5.10/Alligator 3/9] i2c: mlxcpld: Add callback to
notify probing completion

Add notification to inform caller that driver probing has been
completed. It allows to user, invoked platform device registration for
"i2c-mlxcpld" driver, to be notified that bus adapter is available, and
thus some devices could be connected to this bus.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
---
drivers/i2c/busses/i2c-mlxcpld.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mlxcpld.c b/drivers/i2c/busses/i2c-mlxcpld.c
index 56aa424fd..fb451d42a 100644
--- a/drivers/i2c/busses/i2c-mlxcpld.c
+++ b/drivers/i2c/busses/i2c-mlxcpld.c
@@ -560,6 +560,10 @@ static int mlxcpld_i2c_probe(struct platform_device *pdev)
if (err)
goto mlxcpld_i2_probe_failed;

+ /* Notify caller when adapter is added. */
+ if (pdata && pdata->completion_notify)
+ pdata->completion_notify(pdata->handle, mlxcpld_i2c_adapter.nr);
+
return 0;

mlxcpld_i2_probe_failed:
--
2.20.1

284 changes: 284 additions & 0 deletions patch/0085-hwmon-powr1220-Upgrade-driver-to-support-hwmon-info-.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
From 915d4664b7158d8d0f44da810186742c69300f02 Mon Sep 17 00:00:00 2001
From: Michael Shych <michaelsh@nvidia.com>
Date: Tue, 18 Jan 2022 09:56:10 +0200
Subject: [PATCH] hwmon: (powr1220) Upgrade driver to support hwmon info
infrastructure

Reduce code by using devm_hwmon_device_register_with_groups() API by
devm_hwmon_device_register_with_info() API.
The motivation is to reduce code and to allow easy support for similar
devices by the same driver.

Signed-off-by: Michael Shych <michaelsh@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20220118075611.10665-3-michaelsh@nvidia.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/powr1220.c | 207 +++++++++++++++++++++--------------------------
1 file changed, 92 insertions(+), 115 deletions(-)

diff --git a/drivers/hwmon/powr1220.c b/drivers/hwmon/powr1220.c
index 542e4a7b0234..0fa1a136eec8 100644
--- a/drivers/hwmon/powr1220.c
+++ b/drivers/hwmon/powr1220.c
@@ -111,7 +111,7 @@
mutex_lock(&data->update_lock);

if (time_after(jiffies, data->adc_last_updated[ch_num] + HZ) ||
- !data->adc_valid[ch_num]) {
+ !data->adc_valid[ch_num]) {
/*
* figure out if we need to use the attenuator for
* high inputs or inputs that we don't yet have a measurement
@@ -119,12 +119,12 @@
* max reading.
*/
if (data->adc_maxes[ch_num] > ADC_MAX_LOW_MEASUREMENT_MV ||
- data->adc_maxes[ch_num] == 0)
+ data->adc_maxes[ch_num] == 0)
adc_range = 1 << 4;

/* set the attenuator and mux */
result = i2c_smbus_write_byte_data(data->client, ADC_MUX,
- adc_range | ch_num);
+ adc_range | ch_num);
if (result)
goto exit;

@@ -167,135 +167,109 @@
return result;
}

-/* Shows the voltage associated with the specified ADC channel */
-static ssize_t powr1220_voltage_show(struct device *dev,
- struct device_attribute *dev_attr,
- char *buf)
+static umode_t
+powr1220_is_visible(const void *data, enum hwmon_sensor_types type, u32
+ attr, int channel)
{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr);
- int adc_val = powr1220_read_adc(dev, attr->index);
-
- if (adc_val < 0)
- return adc_val;
+ switch (type) {
+ case hwmon_in:
+ switch (attr) {
+ case hwmon_in_input:
+ case hwmon_in_highest:
+ case hwmon_in_label:
+ return 0444;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }

- return sprintf(buf, "%d\n", adc_val);
+ return 0;
}

-/* Shows the maximum setting associated with the specified ADC channel */
-static ssize_t powr1220_max_show(struct device *dev,
- struct device_attribute *dev_attr, char *buf)
+static int
+powr1220_read_string(struct device *dev, enum hwmon_sensor_types type, u32 attr,
+ int channel, const char **str)
{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr);
- struct powr1220_data *data = dev_get_drvdata(dev);
+ switch (type) {
+ case hwmon_in:
+ switch (attr) {
+ case hwmon_in_label:
+ *str = input_names[channel];
+ return 0;
+ default:
+ return -EOPNOTSUPP;
+ }
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }

- return sprintf(buf, "%d\n", data->adc_maxes[attr->index]);
+ return -EOPNOTSUPP;
}

-/* Shows the label associated with the specified ADC channel */
-static ssize_t powr1220_label_show(struct device *dev,
- struct device_attribute *dev_attr,
- char *buf)
+static int
+powr1220_read(struct device *dev, enum hwmon_sensor_types type, u32
+ attr, int channel, long *val)
{
- struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr);
+ struct powr1220_data *data = dev_get_drvdata(dev);
+ int ret;

- return sprintf(buf, "%s\n", input_names[attr->index]);
+ switch (type) {
+ case hwmon_in:
+ switch (attr) {
+ case hwmon_in_input:
+ ret = powr1220_read_adc(dev, channel);
+ if (ret < 0)
+ return ret;
+ *val = ret;
+ break;
+ case hwmon_in_highest:
+ *val = data->adc_maxes[channel];
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+ break;
+ default:
+ return -EOPNOTSUPP;
}

-static SENSOR_DEVICE_ATTR_RO(in0_input, powr1220_voltage, VMON1);
-static SENSOR_DEVICE_ATTR_RO(in1_input, powr1220_voltage, VMON2);
-static SENSOR_DEVICE_ATTR_RO(in2_input, powr1220_voltage, VMON3);
-static SENSOR_DEVICE_ATTR_RO(in3_input, powr1220_voltage, VMON4);
-static SENSOR_DEVICE_ATTR_RO(in4_input, powr1220_voltage, VMON5);
-static SENSOR_DEVICE_ATTR_RO(in5_input, powr1220_voltage, VMON6);
-static SENSOR_DEVICE_ATTR_RO(in6_input, powr1220_voltage, VMON7);
-static SENSOR_DEVICE_ATTR_RO(in7_input, powr1220_voltage, VMON8);
-static SENSOR_DEVICE_ATTR_RO(in8_input, powr1220_voltage, VMON9);
-static SENSOR_DEVICE_ATTR_RO(in9_input, powr1220_voltage, VMON10);
-static SENSOR_DEVICE_ATTR_RO(in10_input, powr1220_voltage, VMON11);
-static SENSOR_DEVICE_ATTR_RO(in11_input, powr1220_voltage, VMON12);
-static SENSOR_DEVICE_ATTR_RO(in12_input, powr1220_voltage, VCCA);
-static SENSOR_DEVICE_ATTR_RO(in13_input, powr1220_voltage, VCCINP);
-
-static SENSOR_DEVICE_ATTR_RO(in0_highest, powr1220_max, VMON1);
-static SENSOR_DEVICE_ATTR_RO(in1_highest, powr1220_max, VMON2);
-static SENSOR_DEVICE_ATTR_RO(in2_highest, powr1220_max, VMON3);
-static SENSOR_DEVICE_ATTR_RO(in3_highest, powr1220_max, VMON4);
-static SENSOR_DEVICE_ATTR_RO(in4_highest, powr1220_max, VMON5);
-static SENSOR_DEVICE_ATTR_RO(in5_highest, powr1220_max, VMON6);
-static SENSOR_DEVICE_ATTR_RO(in6_highest, powr1220_max, VMON7);
-static SENSOR_DEVICE_ATTR_RO(in7_highest, powr1220_max, VMON8);
-static SENSOR_DEVICE_ATTR_RO(in8_highest, powr1220_max, VMON9);
-static SENSOR_DEVICE_ATTR_RO(in9_highest, powr1220_max, VMON10);
-static SENSOR_DEVICE_ATTR_RO(in10_highest, powr1220_max, VMON11);
-static SENSOR_DEVICE_ATTR_RO(in11_highest, powr1220_max, VMON12);
-static SENSOR_DEVICE_ATTR_RO(in12_highest, powr1220_max, VCCA);
-static SENSOR_DEVICE_ATTR_RO(in13_highest, powr1220_max, VCCINP);
-
-static SENSOR_DEVICE_ATTR_RO(in0_label, powr1220_label, VMON1);
-static SENSOR_DEVICE_ATTR_RO(in1_label, powr1220_label, VMON2);
-static SENSOR_DEVICE_ATTR_RO(in2_label, powr1220_label, VMON3);
-static SENSOR_DEVICE_ATTR_RO(in3_label, powr1220_label, VMON4);
-static SENSOR_DEVICE_ATTR_RO(in4_label, powr1220_label, VMON5);
-static SENSOR_DEVICE_ATTR_RO(in5_label, powr1220_label, VMON6);
-static SENSOR_DEVICE_ATTR_RO(in6_label, powr1220_label, VMON7);
-static SENSOR_DEVICE_ATTR_RO(in7_label, powr1220_label, VMON8);
-static SENSOR_DEVICE_ATTR_RO(in8_label, powr1220_label, VMON9);
-static SENSOR_DEVICE_ATTR_RO(in9_label, powr1220_label, VMON10);
-static SENSOR_DEVICE_ATTR_RO(in10_label, powr1220_label, VMON11);
-static SENSOR_DEVICE_ATTR_RO(in11_label, powr1220_label, VMON12);
-static SENSOR_DEVICE_ATTR_RO(in12_label, powr1220_label, VCCA);
-static SENSOR_DEVICE_ATTR_RO(in13_label, powr1220_label, VCCINP);
-
-static struct attribute *powr1220_attrs[] = {
- &sensor_dev_attr_in0_input.dev_attr.attr,
- &sensor_dev_attr_in1_input.dev_attr.attr,
- &sensor_dev_attr_in2_input.dev_attr.attr,
- &sensor_dev_attr_in3_input.dev_attr.attr,
- &sensor_dev_attr_in4_input.dev_attr.attr,
- &sensor_dev_attr_in5_input.dev_attr.attr,
- &sensor_dev_attr_in6_input.dev_attr.attr,
- &sensor_dev_attr_in7_input.dev_attr.attr,
- &sensor_dev_attr_in8_input.dev_attr.attr,
- &sensor_dev_attr_in9_input.dev_attr.attr,
- &sensor_dev_attr_in10_input.dev_attr.attr,
- &sensor_dev_attr_in11_input.dev_attr.attr,
- &sensor_dev_attr_in12_input.dev_attr.attr,
- &sensor_dev_attr_in13_input.dev_attr.attr,
-
- &sensor_dev_attr_in0_highest.dev_attr.attr,
- &sensor_dev_attr_in1_highest.dev_attr.attr,
- &sensor_dev_attr_in2_highest.dev_attr.attr,
- &sensor_dev_attr_in3_highest.dev_attr.attr,
- &sensor_dev_attr_in4_highest.dev_attr.attr,
- &sensor_dev_attr_in5_highest.dev_attr.attr,
- &sensor_dev_attr_in6_highest.dev_attr.attr,
- &sensor_dev_attr_in7_highest.dev_attr.attr,
- &sensor_dev_attr_in8_highest.dev_attr.attr,
- &sensor_dev_attr_in9_highest.dev_attr.attr,
- &sensor_dev_attr_in10_highest.dev_attr.attr,
- &sensor_dev_attr_in11_highest.dev_attr.attr,
- &sensor_dev_attr_in12_highest.dev_attr.attr,
- &sensor_dev_attr_in13_highest.dev_attr.attr,
-
- &sensor_dev_attr_in0_label.dev_attr.attr,
- &sensor_dev_attr_in1_label.dev_attr.attr,
- &sensor_dev_attr_in2_label.dev_attr.attr,
- &sensor_dev_attr_in3_label.dev_attr.attr,
- &sensor_dev_attr_in4_label.dev_attr.attr,
- &sensor_dev_attr_in5_label.dev_attr.attr,
- &sensor_dev_attr_in6_label.dev_attr.attr,
- &sensor_dev_attr_in7_label.dev_attr.attr,
- &sensor_dev_attr_in8_label.dev_attr.attr,
- &sensor_dev_attr_in9_label.dev_attr.attr,
- &sensor_dev_attr_in10_label.dev_attr.attr,
- &sensor_dev_attr_in11_label.dev_attr.attr,
- &sensor_dev_attr_in12_label.dev_attr.attr,
- &sensor_dev_attr_in13_label.dev_attr.attr,
+ return 0;
+}
+
+static const struct hwmon_channel_info *powr1220_info[] = {
+ HWMON_CHANNEL_INFO(in,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL,
+ HWMON_I_INPUT | HWMON_I_HIGHEST | HWMON_I_LABEL),

NULL
};

-ATTRIBUTE_GROUPS(powr1220);
+static const struct hwmon_ops powr1220_hwmon_ops = {
+ .read = powr1220_read,
+ .read_string = powr1220_read_string,
+ .is_visible = powr1220_is_visible,
+};
+
+static const struct hwmon_chip_info powr1220_chip_info = {
+ .ops = &powr1220_hwmon_ops,
+ .info = powr1220_info,
+};

static int powr1220_probe(struct i2c_client *client)
{
@@ -312,8 +286,11 @@
mutex_init(&data->update_lock);
data->client = client;

- hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
- client->name, data, powr1220_groups);
+ hwmon_dev = devm_hwmon_device_register_with_info(&client->dev,
+ client->name,
+ data,
+ &powr1220_chip_info,
+ NULL);

return PTR_ERR_OR_ZERO(hwmon_dev);
}
Loading

0 comments on commit fdd9bac

Please sign in to comment.