mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
add templX for sensors on GT link cards
This commit is contained in:
parent
9c1fc648dc
commit
1e15f5474d
@ -3578,11 +3578,16 @@ static ssize_t temp_show(struct device *device,
|
|||||||
struct device_attribute *attr, char *buf)
|
struct device_attribute *attr, char *buf)
|
||||||
{
|
{
|
||||||
struct ddb *dev = dev_get_drvdata(device);
|
struct ddb *dev = dev_get_drvdata(device);
|
||||||
struct ddb_link *link = &dev->link[0];
|
struct ddb_link *link;
|
||||||
struct i2c_adapter *adap;
|
struct i2c_adapter *adap;
|
||||||
s32 temp, temp2, temp3;
|
s32 temp, temp2, temp3;
|
||||||
int i;
|
int i;
|
||||||
u8 tmp[2];
|
u8 tmp[2];
|
||||||
|
int l = 0;
|
||||||
|
|
||||||
|
if (attr->attr.name[4] == 'l')
|
||||||
|
l = attr->attr.name[5] - 0x30;
|
||||||
|
link = &dev->link[l];
|
||||||
|
|
||||||
if (link->info->type == DDB_MOD ) {
|
if (link->info->type == DDB_MOD ) {
|
||||||
if (link->info->version >= 2) {
|
if (link->info->version >= 2) {
|
||||||
@ -3615,7 +3620,7 @@ static ssize_t temp_show(struct device *device,
|
|||||||
return sprintf(buf, "%d %d\n", temp, temp2);
|
return sprintf(buf, "%d %d\n", temp, temp2);
|
||||||
}
|
}
|
||||||
if (link->info->type == DDB_OCTOPUS_MCI) {
|
if (link->info->type == DDB_OCTOPUS_MCI) {
|
||||||
temp = 0xffff & ddbreadl(dev, TEMPMON_SENSOR0);
|
temp = 0xffff & ddblreadl(link, TEMPMON_SENSOR0);
|
||||||
temp = (temp * 1000) >> 8;
|
temp = (temp * 1000) >> 8;
|
||||||
|
|
||||||
return sprintf(buf, "%d\n", temp);
|
return sprintf(buf, "%d\n", temp);
|
||||||
@ -4030,7 +4035,10 @@ static struct device_attribute ddb_attrs[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct device_attribute ddb_attrs_temp[] = {
|
static struct device_attribute ddb_attrs_temp[] = {
|
||||||
__ATTR_RO(temp),
|
__ATTR_MRO(temp, temp_show),
|
||||||
|
__ATTR_MRO(templ1, temp_show),
|
||||||
|
__ATTR_MRO(templ2, temp_show),
|
||||||
|
__ATTR_MRO(templ3, temp_show),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct device_attribute ddb_attrs_mod[] = {
|
static struct device_attribute ddb_attrs_mod[] = {
|
||||||
@ -4112,8 +4120,11 @@ static void ddb_device_attrs_del(struct ddb *dev)
|
|||||||
dev->link[i].info->tempmon_irq)
|
dev->link[i].info->tempmon_irq)
|
||||||
device_remove_file(dev->ddb_dev,
|
device_remove_file(dev->ddb_dev,
|
||||||
&ddb_attrs_fanspeed[i]);
|
&ddb_attrs_fanspeed[i]);
|
||||||
for (i = 0; i < dev->link[0].info->temp_num; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
if (dev->link[i].info &&
|
||||||
|
dev->link[i].info->temp_num)
|
||||||
device_remove_file(dev->ddb_dev, &ddb_attrs_temp[i]);
|
device_remove_file(dev->ddb_dev, &ddb_attrs_temp[i]);
|
||||||
|
for (i = 0; i < dev->link[0].info->temp_num; i++)
|
||||||
for (i = 0; i < dev->link[0].info->port_num; i++)
|
for (i = 0; i < dev->link[0].info->port_num; i++)
|
||||||
device_remove_file(dev->ddb_dev, &ddb_attrs_mod[i]);
|
device_remove_file(dev->ddb_dev, &ddb_attrs_mod[i]);
|
||||||
for (i = 0; i < dev->link[0].info->fan_num; i++)
|
for (i = 0; i < dev->link[0].info->fan_num; i++)
|
||||||
@ -4135,7 +4146,9 @@ static int ddb_device_attrs_add(struct ddb *dev)
|
|||||||
for (i = 0; ddb_attrs[i].attr.name; i++)
|
for (i = 0; ddb_attrs[i].attr.name; i++)
|
||||||
if (device_create_file(dev->ddb_dev, &ddb_attrs[i]))
|
if (device_create_file(dev->ddb_dev, &ddb_attrs[i]))
|
||||||
goto fail;
|
goto fail;
|
||||||
for (i = 0; i < dev->link[0].info->temp_num; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
if (dev->link[i].info &&
|
||||||
|
dev->link[i].info->temp_num)
|
||||||
if (device_create_file(dev->ddb_dev, &ddb_attrs_temp[i]))
|
if (device_create_file(dev->ddb_dev, &ddb_attrs_temp[i]))
|
||||||
goto fail;
|
goto fail;
|
||||||
for (i = 0; (i < dev->link[0].info->port_num) && (i < 10); i++)
|
for (i = 0; (i < dev->link[0].info->port_num) && (i < 10); i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user