Skip to content

Commit

Permalink
hw-mgmt: patches: Fix mp2891 threshold limits
Browse files Browse the repository at this point in the history
Fix mp2891 threshold limits

Signed-off-by: Oleksandr Shamray <[email protected]>
  • Loading branch information
sholeksandr committed Nov 20, 2024
1 parent f741330 commit 61db91e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..8e551b9c5
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..8e551b9c5
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..8e551b9c5
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..8e551b9c5
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..8e551b9c5
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,13 +343,13 @@ index 000000000..522c0bb5f
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, PMBUS_VOUT_MAX);
+ if (ret <= 0)
+ return ret;
+ ret = (ret & GENMASK(10, 0)) * data->vid_step[page];
+ return DIV_ROUND_CLOSEST(ret, 10000);
+ return DIV_ROUND_CLOSEST(ret, 100);
+ case PMBUS_IOUT_UC_FAULT_LIMIT:
+ ret = pmbus_read_word_data(client, page, phase, reg);
+ return ret <= 0 ? ret : DIV_ROUND_CLOSEST((ret & GENMASK(7, 0)) *
Expand Down

0 comments on commit 61db91e

Please sign in to comment.