From 2e5056c4a17aee64d83a321daa7b6d33e3f91ebf Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Fri, 25 May 2018 00:12:31 +0200 Subject: [PATCH] add temperature attribute for MCI cards --- ddbridge/ddbridge-core.c | 8 +++++++- ddbridge/ddbridge-hw.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ddbridge/ddbridge-core.c b/ddbridge/ddbridge-core.c index 953930f..8101ee6 100644 --- a/ddbridge/ddbridge-core.c +++ b/ddbridge/ddbridge-core.c @@ -3584,7 +3584,7 @@ static ssize_t temp_show(struct device *device, int i; u8 tmp[2]; - if (link->info->type == DDB_MOD) { + if (link->info->type == DDB_MOD ) { if (link->info->version >= 2) { temp = 0xffff & ddbreadl(dev, TEMPMON2_BOARD); temp = (temp * 1000) >> 8; @@ -3614,6 +3614,12 @@ static ssize_t temp_show(struct device *device, } return sprintf(buf, "%d %d\n", temp, temp2); } + if (link->info->type == DDB_OCTOPUS_MCI ) { + temp = 0xffff & ddbreadl(dev, TEMPMON_SENSOR0); + temp = (temp * 1000) >> 8; + + return sprintf(buf, "%d\n", temp); + } if (!link->info->temp_num) return sprintf(buf, "no sensor\n"); adap = &dev->i2c[link->info->temp_bus].adap; diff --git a/ddbridge/ddbridge-hw.c b/ddbridge/ddbridge-hw.c index 4d12da4..34abc2c 100644 --- a/ddbridge/ddbridge-hw.c +++ b/ddbridge/ddbridge-hw.c @@ -584,6 +584,7 @@ static const struct ddb_info ddb_s2x_48 = { .tempmon_irq = 24, .mci_ports = 4, .mci_type = 0, + .temp_num = 1, }; static const struct ddb_info ddb_m4 = { @@ -595,6 +596,7 @@ static const struct ddb_info ddb_m4 = { .tempmon_irq = 24, .mci_ports = 2, .mci_type = 1, + .temp_num = 1, }; /****************************************************************************/