Lines Matching +full:multi +full:- +full:phase
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Hardware monitoring driver for MPS Multi-phase Digital VR Controllers
46 return -ENODATA; in mp2888_read_byte_data()
57 * , bits 0-2. The value is selected as below: in mp2888_current_sense_gain_and_resolution_get()
58 * 00b - 5µA/A, 01b - 8.5µA/A, 10b - 9.7µA/A, 11b - 10µA/A. Other in mp2888_current_sense_gain_and_resolution_get()
67 data->curr_sense_gain = 85; in mp2888_current_sense_gain_and_resolution_get()
70 data->curr_sense_gain = 97; in mp2888_current_sense_gain_and_resolution_get()
73 data->curr_sense_gain = 100; in mp2888_current_sense_gain_and_resolution_get()
76 data->curr_sense_gain = 50; in mp2888_current_sense_gain_and_resolution_get()
79 return -EINVAL; in mp2888_current_sense_gain_and_resolution_get()
83 * Obtain resolution selector for total and phase current report and protection. in mp2888_current_sense_gain_and_resolution_get()
84 * 0: original resolution; 1: half resolution (in such case phase current value should in mp2888_current_sense_gain_and_resolution_get()
87 data->total_curr_resolution = (ret & MP2888_TOTAL_CURRENT_RESOLUTION) >> 3; in mp2888_current_sense_gain_and_resolution_get()
88 data->phase_curr_resolution = (ret & MP2888_PHASE_CURRENT_RESOLUTION) >> 4; in mp2888_current_sense_gain_and_resolution_get()
94 mp2888_read_phase(struct i2c_client *client, struct mp2888_data *data, int page, int phase, u8 reg) in mp2888_read_phase() argument
98 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_phase()
102 if (!((phase + 1) % 2)) in mp2888_read_phase()
109 * - Kcs is the DrMOS current sense gain of power stage, which is obtained from the in mp2888_read_phase()
110 * register MP2888_MFR_VR_CONFIG1, bits 13-12 with the following selection of DrMOS in mp2888_read_phase()
111 * (data->curr_sense_gain): in mp2888_read_phase()
112 * 00b - 8.5µA/A, 01b - 9.7µA/A, 1b - 10µA/A, 11b - 5µA/A. in mp2888_read_phase()
113 * - Rcs is the internal phase current sense resistor. This parameter depends on hardware in mp2888_read_phase()
116 * If phase current resolution bit is set to 1, READ_CSx value should be doubled. in mp2888_read_phase()
117 * Note, that current phase sensing, providing by the device is not accurate. This is in mp2888_read_phase()
121 ret = DIV_ROUND_CLOSEST(ret * 200 - 19600, data->curr_sense_gain); in mp2888_read_phase()
123 ret = (data->total_curr_resolution) ? ret * 2 : ret; in mp2888_read_phase()
128 mp2888_read_phases(struct i2c_client *client, struct mp2888_data *data, int page, int phase) in mp2888_read_phases() argument
132 switch (phase) { in mp2888_read_phases()
134 ret = mp2888_read_phase(client, data, page, phase, MP2888_MFR_READ_CS1_2); in mp2888_read_phases()
137 ret = mp2888_read_phase(client, data, page, phase, MP2888_MFR_READ_CS3_4); in mp2888_read_phases()
140 ret = mp2888_read_phase(client, data, page, phase, MP2888_MFR_READ_CS5_6); in mp2888_read_phases()
143 ret = mp2888_read_phase(client, data, page, phase, MP2888_MFR_READ_CS7_8); in mp2888_read_phases()
146 ret = mp2888_read_phase(client, data, page, phase, MP2888_MFR_READ_CS9_10); in mp2888_read_phases()
149 return -ENODATA; in mp2888_read_phases()
154 static int mp2888_read_word_data(struct i2c_client *client, int page, int phase, int reg) in mp2888_read_word_data() argument
162 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
174 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
179 * degrees C - scaling is needed to match both. in mp2888_read_word_data()
184 if (phase != 0xff) in mp2888_read_word_data()
185 return mp2888_read_phases(client, data, page, phase); in mp2888_read_word_data()
187 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
195 ret = data->total_curr_resolution ? ret * 2 : ret; in mp2888_read_word_data()
198 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
207 ret = data->total_curr_resolution ? ret * 8 : ret * 4; in mp2888_read_word_data()
211 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
214 ret = data->total_curr_resolution ? ret : DIV_ROUND_CLOSEST(ret, 2); in mp2888_read_word_data()
217 ret = pmbus_read_word_data(client, page, phase, reg); in mp2888_read_word_data()
225 ret = data->total_curr_resolution ? ret * 2 : ret; in mp2888_read_word_data()
229 * spec. Skip all of them to avoid exposing non-relevant inputs to sysfs. in mp2888_read_word_data()
255 return -ENXIO; in mp2888_read_word_data()
257 return -ENODATA; in mp2888_read_word_data()
276 word = data->total_curr_resolution ? DIV_ROUND_CLOSEST(word, 8) : in mp2888_write_word_data()
283 word = data->total_curr_resolution ? DIV_ROUND_CLOSEST(word, 4) : in mp2888_write_word_data()
289 return -ENODATA; in mp2888_write_word_data()
304 /* Identify multiphase number - could be from 1 to 10. */ in mp2888_identify_multiphase()
309 info->phases[0] = ret & GENMASK(3, 0); in mp2888_identify_multiphase()
312 * The device provides a total of 10 PWM pins, and can be configured to different phase in mp2888_identify_multiphase()
315 if (info->phases[0] > MP2888_MAX_PHASE) in mp2888_identify_multiphase()
316 return -EINVAL; in mp2888_identify_multiphase()
360 data = devm_kzalloc(&client->dev, sizeof(struct mp2888_data), GFP_KERNEL); in mp2888_probe()
362 return -ENOMEM; in mp2888_probe()
364 memcpy(&data->info, &mp2888_info, sizeof(*info)); in mp2888_probe()
365 info = &data->info; in mp2888_probe()