Subject: cell: rename thermal module to cbe_thermal Signed-off-by: Christian Krafft Index: linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c =================================================================== --- /dev/null +++ linux-2.6/arch/powerpc/platforms/cell/cbe_thermal.c @@ -0,0 +1,131 @@ +/* + * thermal support for the cell processor + * + * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 + * + * Author: Christian Krafft + * + * 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, 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 +#include +#include +#include +#include +#include +#include + +#include "cbe_regs.h" + +static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) +{ + struct spu *spu = container_of(sysdev, struct spu, sysdev); + struct cbe_pmd_regs *pmd_regs; + struct device_node *devnode; + u64 value; + unsigned int *id; + + devnode = spu->devnode; + pmd_regs = cbe_get_pmd_regs(devnode); + value = in_be64(&pmd_regs->ts_ctsr1); + + id = (unsigned int *)get_property(spu->devnode, "reg", NULL); + + /* access the corresponding byte */ + value >>= ((*id)*8); + /* clear all other bits */ + value &= 0x3F; + /* temp is stored in steps of 2 degrees */ + value *= 2; + /* base temp is 65 degrees */ + value += 65; + + return sprintf(buf, "%d\n", (int) value); +} + +static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) +{ + struct cbe_pmd_regs *pmd_regs; + u64 value; + + pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); + value = in_be64(&pmd_regs->ts_ctsr2); + + /* access the corresponding byte */ + value >>= pos; + /* clear all other bits */ + value &= 0x3F; + /* temp is stored in steps of 2 degrees */ + value *= 2; + /* base temp is 65 degrees */ + value += 65; + + return sprintf(buf, "%d\n", (int) value); +} + + +/* shows the temperature of the DTS on the PPE, + * located near the linear thermal sensor */ +static ssize_t ppe_show_temp0(struct sys_device *sysdev, char *buf) +{ + return ppe_show_temp(sysdev, buf, 32); +} + +/* shows the temperature of the second DTS on the PPE */ +static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf) +{ + return ppe_show_temp(sysdev, buf, 0); +} + +static struct sysdev_attribute attr_spu_temperature = { + .attr = {.name = "temperature", .mode = 0400 }, + .show = spu_show_temp, + .store = NULL, +}; + +static struct sysdev_attribute attr_ppe_temperature0 = { + .attr = {.name = "temperature0", .mode = 0400 }, + .show = ppe_show_temp0, + .store = NULL, +}; + + +static struct sysdev_attribute attr_ppe_temperature1 = { + .attr = {.name = "temperature1", .mode = 0400 }, + .show = ppe_show_temp1, + .store = NULL, +}; + +static int __init thermal_init(void) +{ + spu_add_sysdev_attr(&attr_spu_temperature); + cpu_add_sysdev_attr(&attr_ppe_temperature0); + cpu_add_sysdev_attr(&attr_ppe_temperature1); + return 0; +} +module_init(thermal_init); + +static void __exit thermal_exit(void) +{ + spu_remove_sysdev_attr(&attr_spu_temperature); + cpu_remove_sysdev_attr(&attr_ppe_temperature0); + cpu_remove_sysdev_attr(&attr_ppe_temperature1); +} +module_exit(thermal_exit); + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Krafft "); + Index: linux-2.6/arch/powerpc/platforms/cell/thermal.c =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/thermal.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * thermal support for the cell processor - * - * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 - * - * Author: Christian Krafft - * - * 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, 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 -#include -#include -#include -#include -#include -#include - -#include "cbe_regs.h" - -static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) -{ - struct spu *spu = container_of(sysdev, struct spu, sysdev); - struct cbe_pmd_regs *pmd_regs; - struct device_node *devnode; - u64 value; - unsigned int *id; - - devnode = spu->devnode; - pmd_regs = cbe_get_pmd_regs(devnode); - value = in_be64(&pmd_regs->ts_ctsr1); - - id = (unsigned int *)get_property(spu->devnode, "reg", NULL); - - /* access the corresponding byte */ - value >>= ((*id)*8); - /* clear all other bits */ - value &= 0x3F; - /* temp is stored in steps of 2 degrees */ - value *= 2; - /* base temp is 65 degrees */ - value += 65; - - return sprintf(buf, "%d\n", (int) value); -} - -static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) -{ - struct cbe_pmd_regs *pmd_regs; - u64 value; - - pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); - value = in_be64(&pmd_regs->ts_ctsr2); - - /* access the corresponding byte */ - value >>= pos; - /* clear all other bits */ - value &= 0x3F; - /* temp is stored in steps of 2 degrees */ - value *= 2; - /* base temp is 65 degrees */ - value += 65; - - return sprintf(buf, "%d\n", (int) value); -} - - -/* shows the temperature of the DTS on the PPE, - * located near the linear thermal sensor */ -static ssize_t ppe_show_temp0(struct sys_device *sysdev, char *buf) -{ - return ppe_show_temp(sysdev, buf, 32); -} - -/* shows the temperature of the second DTS on the PPE */ -static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf) -{ - return ppe_show_temp(sysdev, buf, 0); -} - -static struct sysdev_attribute attr_spu_temperature = { - .attr = {.name = "temperature", .mode = 0400 }, - .show = spu_show_temp, - .store = NULL, -}; - -static struct sysdev_attribute attr_ppe_temperature0 = { - .attr = {.name = "temperature0", .mode = 0400 }, - .show = ppe_show_temp0, - .store = NULL, -}; - - -static struct sysdev_attribute attr_ppe_temperature1 = { - .attr = {.name = "temperature1", .mode = 0400 }, - .show = ppe_show_temp1, - .store = NULL, -}; - -static int __init thermal_init(void) -{ - spu_add_sysdev_attr(&attr_spu_temperature); - cpu_add_sysdev_attr(&attr_ppe_temperature0); - cpu_add_sysdev_attr(&attr_ppe_temperature1); - return 0; -} -module_init(thermal_init); - -static void __exit thermal_exit(void) -{ - spu_remove_sysdev_attr(&attr_spu_temperature); - cpu_remove_sysdev_attr(&attr_ppe_temperature0); - cpu_remove_sysdev_attr(&attr_ppe_temperature1); -} -module_exit(thermal_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Christian Krafft "); - Index: linux-2.6/arch/powerpc/platforms/cell/Makefile =================================================================== --- linux-2.6.orig/arch/powerpc/platforms/cell/Makefile +++ linux-2.6/arch/powerpc/platforms/cell/Makefile @@ -2,7 +2,7 @@ obj-$(CONFIG_PPC_CELL_NATIVE) += interr cbe_regs.o spider-pic.o pervasive.o obj-$(CONFIG_CBE_RAS) += ras.o -obj-$(CONFIG_CBE_THERM) += thermal.o +obj-$(CONFIG_CBE_THERM) += cbe_thermal.o obj-$(CONFIG_CBE_CPUFREQ) += cbe_cpufreq.o ifeq ($(CONFIG_SMP),y)