From f70575805708cabdedea7498aaa3f710fde4d920 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 31 Jan 2024 03:29:01 +0000 Subject: [PATCH] add lvds1024*800 --- kernel/drivers/hwmon/max6639.c | 112 +++++++++++++++++++++++--------------------------------- 1 files changed, 46 insertions(+), 66 deletions(-) diff --git a/kernel/drivers/hwmon/max6639.c b/kernel/drivers/hwmon/max6639.c index f98a83c..b71899c 100644 --- a/kernel/drivers/hwmon/max6639.c +++ b/kernel/drivers/hwmon/max6639.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * max6639.c - Support for Maxim MAX6639 * @@ -7,20 +8,6 @@ * * based on the initial MAX6639 support from semptian.net * by He Changqing <hechangqing@semptian.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/module.h> @@ -162,7 +149,7 @@ return ret; } -static ssize_t show_temp_input(struct device *dev, +static ssize_t temp_input_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { long temp; @@ -176,7 +163,7 @@ return sprintf(buf, "%ld\n", temp); } -static ssize_t show_temp_fault(struct device *dev, +static ssize_t temp_fault_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { struct max6639_data *data = max6639_update_device(dev); @@ -188,7 +175,7 @@ return sprintf(buf, "%d\n", data->temp_fault[attr->index]); } -static ssize_t show_temp_max(struct device *dev, +static ssize_t temp_max_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); @@ -197,9 +184,9 @@ return sprintf(buf, "%d\n", (data->temp_therm[attr->index] * 1000)); } -static ssize_t set_temp_max(struct device *dev, - struct device_attribute *dev_attr, - const char *buf, size_t count) +static ssize_t temp_max_store(struct device *dev, + struct device_attribute *dev_attr, + const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct max6639_data *data = dev_get_drvdata(dev); @@ -220,7 +207,7 @@ return count; } -static ssize_t show_temp_crit(struct device *dev, +static ssize_t temp_crit_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); @@ -229,9 +216,9 @@ return sprintf(buf, "%d\n", (data->temp_alert[attr->index] * 1000)); } -static ssize_t set_temp_crit(struct device *dev, - struct device_attribute *dev_attr, - const char *buf, size_t count) +static ssize_t temp_crit_store(struct device *dev, + struct device_attribute *dev_attr, + const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct max6639_data *data = dev_get_drvdata(dev); @@ -252,7 +239,7 @@ return count; } -static ssize_t show_temp_emergency(struct device *dev, +static ssize_t temp_emergency_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { @@ -262,9 +249,9 @@ return sprintf(buf, "%d\n", (data->temp_ot[attr->index] * 1000)); } -static ssize_t set_temp_emergency(struct device *dev, - struct device_attribute *dev_attr, - const char *buf, size_t count) +static ssize_t temp_emergency_store(struct device *dev, + struct device_attribute *dev_attr, + const char *buf, size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct max6639_data *data = dev_get_drvdata(dev); @@ -285,8 +272,8 @@ return count; } -static ssize_t show_pwm(struct device *dev, - struct device_attribute *dev_attr, char *buf) +static ssize_t pwm_show(struct device *dev, struct device_attribute *dev_attr, + char *buf) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct max6639_data *data = dev_get_drvdata(dev); @@ -294,9 +281,9 @@ return sprintf(buf, "%d\n", data->pwm[attr->index] * 255 / 120); } -static ssize_t set_pwm(struct device *dev, - struct device_attribute *dev_attr, - const char *buf, size_t count) +static ssize_t pwm_store(struct device *dev, + struct device_attribute *dev_attr, const char *buf, + size_t count) { struct sensor_device_attribute *attr = to_sensor_dev_attr(dev_attr); struct max6639_data *data = dev_get_drvdata(dev); @@ -319,7 +306,7 @@ return count; } -static ssize_t show_fan_input(struct device *dev, +static ssize_t fan_input_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { struct max6639_data *data = max6639_update_device(dev); @@ -332,7 +319,7 @@ data->rpm_range)); } -static ssize_t show_alarm(struct device *dev, +static ssize_t alarm_show(struct device *dev, struct device_attribute *dev_attr, char *buf) { struct max6639_data *data = max6639_update_device(dev); @@ -344,34 +331,28 @@ return sprintf(buf, "%d\n", !!(data->status & (1 << attr->index))); } -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp_input, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_fault, S_IRUGO, show_temp_fault, NULL, 0); -static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_temp_fault, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 0); -static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, - set_temp_max, 1); -static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, show_temp_crit, - set_temp_crit, 0); -static SENSOR_DEVICE_ATTR(temp2_crit, S_IWUSR | S_IRUGO, show_temp_crit, - set_temp_crit, 1); -static SENSOR_DEVICE_ATTR(temp1_emergency, S_IWUSR | S_IRUGO, - show_temp_emergency, set_temp_emergency, 0); -static SENSOR_DEVICE_ATTR(temp2_emergency, S_IWUSR | S_IRUGO, - show_temp_emergency, set_temp_emergency, 1); -static SENSOR_DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 0); -static SENSOR_DEVICE_ATTR(pwm2, S_IWUSR | S_IRUGO, show_pwm, set_pwm, 1); -static SENSOR_DEVICE_ATTR(fan1_input, S_IRUGO, show_fan_input, NULL, 0); -static SENSOR_DEVICE_ATTR(fan2_input, S_IRUGO, show_fan_input, NULL, 1); -static SENSOR_DEVICE_ATTR(fan1_fault, S_IRUGO, show_alarm, NULL, 1); -static SENSOR_DEVICE_ATTR(fan2_fault, S_IRUGO, show_alarm, NULL, 0); -static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 3); -static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 2); -static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 7); -static SENSOR_DEVICE_ATTR(temp2_crit_alarm, S_IRUGO, show_alarm, NULL, 6); -static SENSOR_DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO, show_alarm, NULL, 5); -static SENSOR_DEVICE_ATTR(temp2_emergency_alarm, S_IRUGO, show_alarm, NULL, 4); +static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_input, temp_input, 1); +static SENSOR_DEVICE_ATTR_RO(temp1_fault, temp_fault, 0); +static SENSOR_DEVICE_ATTR_RO(temp2_fault, temp_fault, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_crit, temp_crit, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_crit, temp_crit, 1); +static SENSOR_DEVICE_ATTR_RW(temp1_emergency, temp_emergency, 0); +static SENSOR_DEVICE_ATTR_RW(temp2_emergency, temp_emergency, 1); +static SENSOR_DEVICE_ATTR_RW(pwm1, pwm, 0); +static SENSOR_DEVICE_ATTR_RW(pwm2, pwm, 1); +static SENSOR_DEVICE_ATTR_RO(fan1_input, fan_input, 0); +static SENSOR_DEVICE_ATTR_RO(fan2_input, fan_input, 1); +static SENSOR_DEVICE_ATTR_RO(fan1_fault, alarm, 1); +static SENSOR_DEVICE_ATTR_RO(fan2_fault, alarm, 0); +static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 3); +static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 2); +static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, alarm, 7); +static SENSOR_DEVICE_ATTR_RO(temp2_crit_alarm, alarm, 6); +static SENSOR_DEVICE_ATTR_RO(temp1_emergency_alarm, alarm, 5); +static SENSOR_DEVICE_ATTR_RO(temp2_emergency_alarm, alarm, 4); static struct attribute *max6639_attrs[] = { @@ -535,8 +516,7 @@ return 0; } -static int max6639_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int max6639_probe(struct i2c_client *client) { struct device *dev = &client->dev; struct max6639_data *data; @@ -600,7 +580,7 @@ .name = "max6639", .pm = &max6639_pm_ops, }, - .probe = max6639_probe, + .probe_new = max6639_probe, .id_table = max6639_id, .detect = max6639_detect, .address_list = normal_i2c, -- Gitblit v1.6.2