diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-06 20:54:07 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-06 20:54:07 +0300 |
commit | b62e419707ce082845c34161fe684d0c743b7953 (patch) | |
tree | 9ecad0aef86a55ca33a0a355c627ff2b4acc4756 /drivers/platform | |
parent | 40ddad19131999161c39564815b8df2faff0fc7c (diff) | |
parent | 6c86a3029ce3b44597526909f2e39a77a497f640 (diff) | |
download | linux-b62e419707ce082845c34161fe684d0c743b7953.tar.xz |
Merge tag 'mips_5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Pull MIPS upates from Thomas Bogendoerfer:
- improvements for Loongson64
- extended ingenic support
- removal of not maintained paravirt system type
- cleanups and fixes
* tag 'mips_5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (81 commits)
MIPS: SGI-IP27: always enable NUMA in Kconfig
MAINTAINERS: Update KVM/MIPS maintainers
MIPS: Update default config file for Loongson-3
MIPS: KVM: Add kvm guest support for Loongson-3
dt-bindings: mips: Document Loongson kvm guest board
MIPS: handle Loongson-specific GSExc exception
MIPS: add definitions for Loongson-specific CP0.Diag1 register
MIPS: only register FTLBPar exception handler for supported models
MIPS: ingenic: Hardcode mem size for qi,lb60 board
MIPS: DTS: ingenic/qi,lb60: Add model and memory node
MIPS: ingenic: Use fw_passed_dtb even if CONFIG_BUILTIN_DTB
MIPS: head.S: Init fw_passed_dtb to builtin DTB
of: address: Fix parser address/size cells initialization
of_address: Guard of_bus_pci_get_flags with CONFIG_PCI
MIPS: DTS: Fix number of msi vectors for Loongson64G
MIPS: Loongson64: Add ISA node for LS7A PCH
MIPS: Loongson64: DTS: Fix ISA and PCI I/O ranges for RS780E PCH
MIPS: Loongson64: Enlarge IO_SPACE_LIMIT
MIPS: Loongson64: Process ISA Node in DeviceTree
of_address: Add bus type match for pci ranges parser
...
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/mips/cpu_hwmon.c | 66 | ||||
-rw-r--r-- | drivers/platform/mips/rs780e-acpi.c | 2 |
2 files changed, 26 insertions, 42 deletions
diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c index 0d27cb7a9e3c..386389ffec41 100644 --- a/drivers/platform/mips/cpu_hwmon.c +++ b/drivers/platform/mips/cpu_hwmon.c @@ -11,7 +11,7 @@ #include <loongson_hwmon.h> #include <loongson_regs.h> -static int csr_temp_enable = 0; +static int csr_temp_enable; /* * Loongson-3 series cpu has two sensors inside, @@ -44,7 +44,7 @@ int loongson3_cpu_temp(int cpu) case PRID_REV_LOONGSON3A_R3_0: case PRID_REV_LOONGSON3A_R3_1: default: - reg = (reg & 0xffff)*731/0x4000 - 273; + reg = (reg & 0xffff) * 731 / 0x4000 - 273; break; } @@ -55,9 +55,7 @@ out: static int nr_packages; static struct device *cpu_hwmon_dev; -static ssize_t get_hwmon_name(struct device *dev, - struct device_attribute *attr, char *buf); -static SENSOR_DEVICE_ATTR(name, S_IRUGO, get_hwmon_name, NULL, 0); +static SENSOR_DEVICE_ATTR(name, 0444, NULL, NULL, 0); static struct attribute *cpu_hwmon_attributes[] = { &sensor_dev_attr_name.dev_attr.attr, @@ -69,26 +67,19 @@ static struct attribute_group cpu_hwmon_attribute_group = { .attrs = cpu_hwmon_attributes, }; -/* Hwmon device get name */ -static ssize_t get_hwmon_name(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return sprintf(buf, "cpu-hwmon\n"); -} - static ssize_t get_cpu_temp(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t cpu_temp_label(struct device *dev, struct device_attribute *attr, char *buf); -static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, get_cpu_temp, NULL, 1); -static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, cpu_temp_label, NULL, 1); -static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, get_cpu_temp, NULL, 2); -static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, cpu_temp_label, NULL, 2); -static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, get_cpu_temp, NULL, 3); -static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, cpu_temp_label, NULL, 3); -static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, get_cpu_temp, NULL, 4); -static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, cpu_temp_label, NULL, 4); +static SENSOR_DEVICE_ATTR(temp1_input, 0444, get_cpu_temp, NULL, 1); +static SENSOR_DEVICE_ATTR(temp1_label, 0444, cpu_temp_label, NULL, 1); +static SENSOR_DEVICE_ATTR(temp2_input, 0444, get_cpu_temp, NULL, 2); +static SENSOR_DEVICE_ATTR(temp2_label, 0444, cpu_temp_label, NULL, 2); +static SENSOR_DEVICE_ATTR(temp3_input, 0444, get_cpu_temp, NULL, 3); +static SENSOR_DEVICE_ATTR(temp3_label, 0444, cpu_temp_label, NULL, 3); +static SENSOR_DEVICE_ATTR(temp4_input, 0444, get_cpu_temp, NULL, 4); +static SENSOR_DEVICE_ATTR(temp4_label, 0444, cpu_temp_label, NULL, 4); static const struct attribute *hwmon_cputemp[4][3] = { { @@ -117,6 +108,7 @@ static ssize_t cpu_temp_label(struct device *dev, struct device_attribute *attr, char *buf) { int id = (to_sensor_dev_attr(attr))->index - 1; + return sprintf(buf, "CPU %d Temperature\n", id); } @@ -125,6 +117,7 @@ static ssize_t get_cpu_temp(struct device *dev, { int id = (to_sensor_dev_attr(attr))->index - 1; int value = loongson3_cpu_temp(id); + return sprintf(buf, "%d\n", value); } @@ -132,7 +125,7 @@ static int create_sysfs_cputemp_files(struct kobject *kobj) { int i, ret = 0; - for (i=0; i<nr_packages; i++) + for (i = 0; i < nr_packages; i++) ret = sysfs_create_files(kobj, hwmon_cputemp[i]); return ret; @@ -142,7 +135,7 @@ static void remove_sysfs_cputemp_files(struct kobject *kobj) { int i; - for (i=0; i<nr_packages; i++) + for (i = 0; i < nr_packages; i++) sysfs_remove_files(kobj, hwmon_cputemp[i]); } @@ -151,18 +144,17 @@ static struct delayed_work thermal_work; static void do_thermal_timer(struct work_struct *work) { - int i, value, temp_max = 0; + int i, value; - for (i=0; i<nr_packages; i++) { + for (i = 0; i < nr_packages; i++) { value = loongson3_cpu_temp(i); - if (value > temp_max) - temp_max = value; + if (value > CPU_THERMAL_THRESHOLD) { + pr_emerg("Power off due to high temp: %d\n", value); + orderly_poweroff(true); + } } - if (temp_max <= CPU_THERMAL_THRESHOLD) - schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000)); - else - orderly_poweroff(true); + schedule_delayed_work(&thermal_work, msecs_to_jiffies(5000)); } static int __init loongson_hwmon_init(void) @@ -172,9 +164,10 @@ static int __init loongson_hwmon_init(void) pr_info("Loongson Hwmon Enter...\n"); if (cpu_has_csr()) - csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) & LOONGSON_CSRF_TEMP; + csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) & + LOONGSON_CSRF_TEMP; - cpu_hwmon_dev = hwmon_device_register(NULL); + cpu_hwmon_dev = hwmon_device_register_with_info(NULL, "cpu_hwmon", NULL, NULL, NULL); if (IS_ERR(cpu_hwmon_dev)) { ret = PTR_ERR(cpu_hwmon_dev); pr_err("hwmon_device_register fail!\n"); @@ -184,13 +177,6 @@ static int __init loongson_hwmon_init(void) nr_packages = loongson_sysconf.nr_cpus / loongson_sysconf.cores_per_package; - ret = sysfs_create_group(&cpu_hwmon_dev->kobj, - &cpu_hwmon_attribute_group); - if (ret) { - pr_err("fail to create loongson hwmon!\n"); - goto fail_sysfs_create_group_hwmon; - } - ret = create_sysfs_cputemp_files(&cpu_hwmon_dev->kobj); if (ret) { pr_err("fail to create cpu temperature interface!\n"); @@ -205,8 +191,6 @@ static int __init loongson_hwmon_init(void) fail_create_sysfs_cputemp_files: sysfs_remove_group(&cpu_hwmon_dev->kobj, &cpu_hwmon_attribute_group); - -fail_sysfs_create_group_hwmon: hwmon_device_unregister(cpu_hwmon_dev); fail_hwmon_device_register: diff --git a/drivers/platform/mips/rs780e-acpi.c b/drivers/platform/mips/rs780e-acpi.c index e5a643b78ac9..bb0e8ae0eefd 100644 --- a/drivers/platform/mips/rs780e-acpi.c +++ b/drivers/platform/mips/rs780e-acpi.c @@ -69,7 +69,7 @@ static void acpi_hw_clear_status(void) outl(inl(ACPI_GPE0_BLK), ACPI_GPE0_BLK); } -void acpi_registers_setup(void) +static void acpi_registers_setup(void) { u32 value; |