Lines Matching +full:channel +full:- +full:11
1 // SPDX-License-Identifier: GPL-2.0+
9 * - CPU temperature
10 * - DIMM temperature
11 * - Chassis zone temperatures
12 * - CPU fan RPM
13 * - DIMM fan RPM
14 * - Chassis fans RPM
69 static int px_temp_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
89 static int gen_temp_map[] = {0, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
106 static int px_fan_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
111 "Front_Fan1-1",
112 "Front_Fan1-2",
127 static int p7_fan_map[] = {0, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14};
143 static int p5_fan_map[] = {0, 5, 6, 7, 8, 10, 11, 14};
156 static int p8_fan_map[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14};
184 lenovo_ec_do_read_temp(struct ec_sensors_data *data, u32 attr, int channel, long *val) in lenovo_ec_do_read_temp() argument
190 mutex_lock(&data->mec_mutex); in lenovo_ec_do_read_temp()
191 lsb = get_ec_reg(2, 0x81 + channel); in lenovo_ec_do_read_temp()
192 mutex_unlock(&data->mec_mutex); in lenovo_ec_do_read_temp()
194 return -ENODATA; in lenovo_ec_do_read_temp()
195 *val = (lsb - 0x40) * 1000; in lenovo_ec_do_read_temp()
198 return -EOPNOTSUPP; in lenovo_ec_do_read_temp()
203 lenovo_ec_do_read_fan(struct ec_sensors_data *data, u32 attr, int channel, long *val) in lenovo_ec_do_read_fan() argument
207 channel *= 2; in lenovo_ec_do_read_fan()
210 mutex_lock(&data->mec_mutex); in lenovo_ec_do_read_fan()
211 lsb = get_ec_reg(4, 0x20 + channel); in lenovo_ec_do_read_fan()
212 msb = get_ec_reg(4, 0x21 + channel); in lenovo_ec_do_read_fan()
213 mutex_unlock(&data->mec_mutex); in lenovo_ec_do_read_fan()
217 mutex_lock(&data->mec_mutex); in lenovo_ec_do_read_fan()
218 lsb = get_ec_reg(4, 0x40 + channel); in lenovo_ec_do_read_fan()
219 msb = get_ec_reg(4, 0x41 + channel); in lenovo_ec_do_read_fan()
220 mutex_unlock(&data->mec_mutex); in lenovo_ec_do_read_fan()
224 return -EOPNOTSUPP; in lenovo_ec_do_read_fan()
230 u32 attr, int channel, const char **str) in lenovo_ec_hwmon_read_string() argument
236 *str = state->temp_labels[channel]; in lenovo_ec_hwmon_read_string()
239 *str = state->fan_labels[channel]; in lenovo_ec_hwmon_read_string()
242 return -EOPNOTSUPP; in lenovo_ec_hwmon_read_string()
248 u32 attr, int channel, long *val) in lenovo_ec_hwmon_read() argument
254 return lenovo_ec_do_read_temp(data, attr, data->temp_map[channel], val); in lenovo_ec_hwmon_read()
256 return lenovo_ec_do_read_fan(data, attr, data->fan_map[channel], val); in lenovo_ec_hwmon_read()
258 return -EOPNOTSUPP; in lenovo_ec_hwmon_read()
264 u32 attr, int channel) in lenovo_ec_hwmon_is_visible() argument
488 struct device *dev = &pdev->dev; in lenovo_ec_probe()
494 return -ENOMEM; in lenovo_ec_probe()
496 if (!request_region(IO_REGION_START, IO_REGION_LENGTH, "LNV-WKS")) { in lenovo_ec_probe()
498 return -EIO; in lenovo_ec_probe()
505 mutex_init(&ec_data->mec_mutex); in lenovo_ec_probe()
507 mutex_lock(&ec_data->mec_mutex); in lenovo_ec_probe()
512 mutex_unlock(&ec_data->mec_mutex); in lenovo_ec_probe()
519 return -ENODEV; in lenovo_ec_probe()
524 switch ((long)dmi_id->driver_data) { in lenovo_ec_probe()
526 ec_data->fan_labels = px_ec_fan_label; in lenovo_ec_probe()
527 ec_data->temp_labels = lenovo_px_ec_temp_label; in lenovo_ec_probe()
528 ec_data->fan_map = px_fan_map; in lenovo_ec_probe()
529 ec_data->temp_map = px_temp_map; in lenovo_ec_probe()
533 ec_data->fan_labels = p7_ec_fan_label; in lenovo_ec_probe()
534 ec_data->temp_labels = lenovo_gen_ec_temp_label; in lenovo_ec_probe()
535 ec_data->fan_map = p7_fan_map; in lenovo_ec_probe()
536 ec_data->temp_map = gen_temp_map; in lenovo_ec_probe()
540 ec_data->fan_labels = p5_ec_fan_label; in lenovo_ec_probe()
541 ec_data->temp_labels = lenovo_gen_ec_temp_label; in lenovo_ec_probe()
542 ec_data->fan_map = p5_fan_map; in lenovo_ec_probe()
543 ec_data->temp_map = gen_temp_map; in lenovo_ec_probe()
547 ec_data->fan_labels = p8_ec_fan_label; in lenovo_ec_probe()
548 ec_data->temp_labels = lenovo_gen_ec_temp_label; in lenovo_ec_probe()
549 ec_data->fan_map = p8_fan_map; in lenovo_ec_probe()
550 ec_data->temp_map = gen_temp_map; in lenovo_ec_probe()
555 return -ENODEV; in lenovo_ec_probe()
567 .name = "lenovo-ec-sensors",
577 return -ENODEV; in lenovo_ec_init()