Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294827
b: refs/heads/master
c: 941a956
h: refs/heads/master
i:
  294825: 7438567
  294823: 236fde4
v: v3
  • Loading branch information
Andre Przywara authored and Jean Delvare committed Mar 23, 2012
1 parent 1239d04 commit 7c02e2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fc0900cbda9243957d812cd6b4cc87965f9fe75f
refs/heads/master: 941a956b0e387b21f385f486c34ef67576775cfc
8 changes: 4 additions & 4 deletions trunk/drivers/hwmon/fam15h_power.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ static ssize_t show_power(struct device *dev,
REG_TDP_RUNNING_AVERAGE, &val);
running_avg_capture = (val >> 4) & 0x3fffff;
running_avg_capture = sign_extend32(running_avg_capture, 21);
running_avg_range = val & 0xf;
running_avg_range = (val & 0xf) + 1;

pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5),
REG_TDP_LIMIT3, &val);

tdp_limit = val >> 16;
curr_pwr_watts = tdp_limit + data->base_tdp -
(s32)(running_avg_capture >> (running_avg_range + 1));
curr_pwr_watts = (tdp_limit + data->base_tdp) << running_avg_range;
curr_pwr_watts -= running_avg_capture;
curr_pwr_watts *= data->tdp_to_watts;

/*
Expand All @@ -78,7 +78,7 @@ static ssize_t show_power(struct device *dev,
* scaling factor 1/(2^16). For conversion we use
* (10^6)/(2^16) = 15625/(2^10)
*/
curr_pwr_watts = (curr_pwr_watts * 15625) >> 10;
curr_pwr_watts = (curr_pwr_watts * 15625) >> (10 + running_avg_range);
return sprintf(buf, "%u\n", (unsigned int) curr_pwr_watts);
}
static DEVICE_ATTR(power1_input, S_IRUGO, show_power, NULL);
Expand Down

0 comments on commit 7c02e2e

Please sign in to comment.