| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Hardware monitoring driver for Maxim MAX8688 |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2011 Ericsson AB. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #include <linux/bitops.h> |
|---|
| .. | .. |
|---|
| 41 | 28 | #define MAX8688_STATUS_OT_FAULT BIT(13) |
|---|
| 42 | 29 | #define MAX8688_STATUS_OT_WARNING BIT(14) |
|---|
| 43 | 30 | |
|---|
| 44 | | -static int max8688_read_word_data(struct i2c_client *client, int page, int reg) |
|---|
| 31 | +static int max8688_read_word_data(struct i2c_client *client, int page, |
|---|
| 32 | + int phase, int reg) |
|---|
| 45 | 33 | { |
|---|
| 46 | 34 | int ret; |
|---|
| 47 | 35 | |
|---|
| .. | .. |
|---|
| 50 | 38 | |
|---|
| 51 | 39 | switch (reg) { |
|---|
| 52 | 40 | case PMBUS_VIRT_READ_VOUT_MAX: |
|---|
| 53 | | - ret = pmbus_read_word_data(client, 0, MAX8688_MFR_VOUT_PEAK); |
|---|
| 41 | + ret = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 42 | + MAX8688_MFR_VOUT_PEAK); |
|---|
| 54 | 43 | break; |
|---|
| 55 | 44 | case PMBUS_VIRT_READ_IOUT_MAX: |
|---|
| 56 | | - ret = pmbus_read_word_data(client, 0, MAX8688_MFR_IOUT_PEAK); |
|---|
| 45 | + ret = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 46 | + MAX8688_MFR_IOUT_PEAK); |
|---|
| 57 | 47 | break; |
|---|
| 58 | 48 | case PMBUS_VIRT_READ_TEMP_MAX: |
|---|
| 59 | | - ret = pmbus_read_word_data(client, 0, |
|---|
| 49 | + ret = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 60 | 50 | MAX8688_MFR_TEMPERATURE_PEAK); |
|---|
| 61 | 51 | break; |
|---|
| 62 | 52 | case PMBUS_VIRT_RESET_VOUT_HISTORY: |
|---|
| .. | .. |
|---|
| 107 | 97 | |
|---|
| 108 | 98 | switch (reg) { |
|---|
| 109 | 99 | case PMBUS_STATUS_VOUT: |
|---|
| 110 | | - mfg_status = pmbus_read_word_data(client, 0, |
|---|
| 100 | + mfg_status = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 111 | 101 | MAX8688_MFG_STATUS); |
|---|
| 112 | 102 | if (mfg_status < 0) |
|---|
| 113 | 103 | return mfg_status; |
|---|
| .. | .. |
|---|
| 121 | 111 | ret |= PB_VOLTAGE_OV_FAULT; |
|---|
| 122 | 112 | break; |
|---|
| 123 | 113 | case PMBUS_STATUS_IOUT: |
|---|
| 124 | | - mfg_status = pmbus_read_word_data(client, 0, |
|---|
| 114 | + mfg_status = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 125 | 115 | MAX8688_MFG_STATUS); |
|---|
| 126 | 116 | if (mfg_status < 0) |
|---|
| 127 | 117 | return mfg_status; |
|---|
| .. | .. |
|---|
| 133 | 123 | ret |= PB_IOUT_OC_FAULT; |
|---|
| 134 | 124 | break; |
|---|
| 135 | 125 | case PMBUS_STATUS_TEMPERATURE: |
|---|
| 136 | | - mfg_status = pmbus_read_word_data(client, 0, |
|---|
| 126 | + mfg_status = pmbus_read_word_data(client, 0, 0xff, |
|---|
| 137 | 127 | MAX8688_MFG_STATUS); |
|---|
| 138 | 128 | if (mfg_status < 0) |
|---|
| 139 | 129 | return mfg_status; |
|---|
| .. | .. |
|---|
| 175 | 165 | .write_word_data = max8688_write_word_data, |
|---|
| 176 | 166 | }; |
|---|
| 177 | 167 | |
|---|
| 178 | | -static int max8688_probe(struct i2c_client *client, |
|---|
| 179 | | - const struct i2c_device_id *id) |
|---|
| 168 | +static int max8688_probe(struct i2c_client *client) |
|---|
| 180 | 169 | { |
|---|
| 181 | | - return pmbus_do_probe(client, id, &max8688_info); |
|---|
| 170 | + return pmbus_do_probe(client, &max8688_info); |
|---|
| 182 | 171 | } |
|---|
| 183 | 172 | |
|---|
| 184 | 173 | static const struct i2c_device_id max8688_id[] = { |
|---|
| .. | .. |
|---|
| 193 | 182 | .driver = { |
|---|
| 194 | 183 | .name = "max8688", |
|---|
| 195 | 184 | }, |
|---|
| 196 | | - .probe = max8688_probe, |
|---|
| 185 | + .probe_new = max8688_probe, |
|---|
| 197 | 186 | .remove = pmbus_do_remove, |
|---|
| 198 | 187 | .id_table = max8688_id, |
|---|
| 199 | 188 | }; |
|---|