| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Hardware monitoring driver for IR35221 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) IBM Corporation 2017. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation; either version |
|---|
| 9 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/err.h> |
|---|
| .. | .. |
|---|
| 25 | 21 | #define IR35221_MFR_IOUT_VALLEY 0xcb |
|---|
| 26 | 22 | #define IR35221_MFR_TEMP_VALLEY 0xcc |
|---|
| 27 | 23 | |
|---|
| 28 | | -static int ir35221_read_word_data(struct i2c_client *client, int page, int reg) |
|---|
| 24 | +static int ir35221_read_word_data(struct i2c_client *client, int page, |
|---|
| 25 | + int phase, int reg) |
|---|
| 29 | 26 | { |
|---|
| 30 | 27 | int ret; |
|---|
| 31 | 28 | |
|---|
| 32 | 29 | switch (reg) { |
|---|
| 33 | 30 | case PMBUS_VIRT_READ_VIN_MAX: |
|---|
| 34 | | - ret = pmbus_read_word_data(client, page, IR35221_MFR_VIN_PEAK); |
|---|
| 31 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 32 | + IR35221_MFR_VIN_PEAK); |
|---|
| 35 | 33 | break; |
|---|
| 36 | 34 | case PMBUS_VIRT_READ_VOUT_MAX: |
|---|
| 37 | | - ret = pmbus_read_word_data(client, page, IR35221_MFR_VOUT_PEAK); |
|---|
| 35 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 36 | + IR35221_MFR_VOUT_PEAK); |
|---|
| 38 | 37 | break; |
|---|
| 39 | 38 | case PMBUS_VIRT_READ_IOUT_MAX: |
|---|
| 40 | | - ret = pmbus_read_word_data(client, page, IR35221_MFR_IOUT_PEAK); |
|---|
| 39 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 40 | + IR35221_MFR_IOUT_PEAK); |
|---|
| 41 | 41 | break; |
|---|
| 42 | 42 | case PMBUS_VIRT_READ_TEMP_MAX: |
|---|
| 43 | | - ret = pmbus_read_word_data(client, page, IR35221_MFR_TEMP_PEAK); |
|---|
| 43 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 44 | + IR35221_MFR_TEMP_PEAK); |
|---|
| 44 | 45 | break; |
|---|
| 45 | 46 | case PMBUS_VIRT_READ_VIN_MIN: |
|---|
| 46 | | - ret = pmbus_read_word_data(client, page, |
|---|
| 47 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 47 | 48 | IR35221_MFR_VIN_VALLEY); |
|---|
| 48 | 49 | break; |
|---|
| 49 | 50 | case PMBUS_VIRT_READ_VOUT_MIN: |
|---|
| 50 | | - ret = pmbus_read_word_data(client, page, |
|---|
| 51 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 51 | 52 | IR35221_MFR_VOUT_VALLEY); |
|---|
| 52 | 53 | break; |
|---|
| 53 | 54 | case PMBUS_VIRT_READ_IOUT_MIN: |
|---|
| 54 | | - ret = pmbus_read_word_data(client, page, |
|---|
| 55 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 55 | 56 | IR35221_MFR_IOUT_VALLEY); |
|---|
| 56 | 57 | break; |
|---|
| 57 | 58 | case PMBUS_VIRT_READ_TEMP_MIN: |
|---|
| 58 | | - ret = pmbus_read_word_data(client, page, |
|---|
| 59 | + ret = pmbus_read_word_data(client, page, phase, |
|---|
| 59 | 60 | IR35221_MFR_TEMP_VALLEY); |
|---|
| 60 | 61 | break; |
|---|
| 61 | 62 | default: |
|---|
| .. | .. |
|---|
| 66 | 67 | return ret; |
|---|
| 67 | 68 | } |
|---|
| 68 | 69 | |
|---|
| 69 | | -static int ir35221_probe(struct i2c_client *client, |
|---|
| 70 | | - const struct i2c_device_id *id) |
|---|
| 70 | +static int ir35221_probe(struct i2c_client *client) |
|---|
| 71 | 71 | { |
|---|
| 72 | 72 | struct pmbus_driver_info *info; |
|---|
| 73 | 73 | u8 buf[I2C_SMBUS_BLOCK_MAX]; |
|---|
| .. | .. |
|---|
| 122 | 122 | | PMBUS_HAVE_STATUS_INPUT | PMBUS_HAVE_STATUS_TEMP; |
|---|
| 123 | 123 | info->func[1] = info->func[0]; |
|---|
| 124 | 124 | |
|---|
| 125 | | - return pmbus_do_probe(client, id, info); |
|---|
| 125 | + return pmbus_do_probe(client, info); |
|---|
| 126 | 126 | } |
|---|
| 127 | 127 | |
|---|
| 128 | 128 | static const struct i2c_device_id ir35221_id[] = { |
|---|
| .. | .. |
|---|
| 136 | 136 | .driver = { |
|---|
| 137 | 137 | .name = "ir35221", |
|---|
| 138 | 138 | }, |
|---|
| 139 | | - .probe = ir35221_probe, |
|---|
| 139 | + .probe_new = ir35221_probe, |
|---|
| 140 | 140 | .remove = pmbus_do_remove, |
|---|
| 141 | 141 | .id_table = ir35221_id, |
|---|
| 142 | 142 | }; |
|---|