Commit 63745aa7 authored by Zhang Rui's avatar Zhang Rui

Merge branches 'armada-375-380-soc-support', 'eduardo-thermal-soc-fixes',...

Merge branches 'armada-375-380-soc-support', 'eduardo-thermal-soc-fixes', 'intel-soc-dts-thermal' and 'thermal-soc-fixes' of .git into next
...@@ -6,16 +6,35 @@ ...@@ -6,16 +6,35 @@
"samsung,exynos4412-tmu" "samsung,exynos4412-tmu"
"samsung,exynos4210-tmu" "samsung,exynos4210-tmu"
"samsung,exynos5250-tmu" "samsung,exynos5250-tmu"
"samsung,exynos5260-tmu"
"samsung,exynos5420-tmu" for TMU channel 0, 1 on Exynos5420
"samsung,exynos5420-tmu-ext-triminfo" for TMU channels 2, 3 and 4
Exynos5420 (Must pass triminfo base and triminfo clock)
"samsung,exynos5440-tmu" "samsung,exynos5440-tmu"
- interrupt-parent : The phandle for the interrupt controller - interrupt-parent : The phandle for the interrupt controller
- reg : Address range of the thermal registers. For soc's which has multiple - reg : Address range of the thermal registers. For soc's which has multiple
instances of TMU and some registers are shared across all TMU's like instances of TMU and some registers are shared across all TMU's like
interrupt related then 2 set of register has to supplied. First set interrupt related then 2 set of register has to supplied. First set
belongs to each instance of TMU and second set belongs to common TMU belongs to register set of TMU instance and second set belongs to
registers. registers shared with the TMU instance.
NOTE: On Exynos5420, the TRIMINFO register is misplaced for TMU
channels 2, 3 and 4
Use "samsung,exynos5420-tmu-ext-triminfo" in cases, there is a misplaced
register, also provide clock to access that base.
TRIMINFO at 0x1006c000 contains data for TMU channel 3
TRIMINFO at 0x100a0000 contains data for TMU channel 4
TRIMINFO at 0x10068000 contains data for TMU channel 2
- interrupts : Should contain interrupt for thermal system - interrupts : Should contain interrupt for thermal system
- clocks : The main clock for TMU device - clocks : The main clocks for TMU device
-- 1. operational clock for TMU channel
-- 2. optional clock to access the shared registers of TMU channel
- clock-names : Thermal system clock name - clock-names : Thermal system clock name
-- "tmu_apbif" operational clock for current TMU channel
-- "tmu_triminfo_apbif" clock to access the shared triminfo register
for current TMU channel
- vtmu-supply: This entry is optional and provides the regulator node supplying - vtmu-supply: This entry is optional and provides the regulator node supplying
voltage to TMU. If needed this entry can be placed inside voltage to TMU. If needed this entry can be placed inside
board/platform specific dts file. board/platform specific dts file.
...@@ -43,6 +62,31 @@ Example 2): ...@@ -43,6 +62,31 @@ Example 2):
clock-names = "tmu_apbif"; clock-names = "tmu_apbif";
}; };
Example 3): (In case of Exynos5420 "with misplaced TRIMINFO register")
tmu_cpu2: tmu@10068000 {
compatible = "samsung,exynos5420-tmu-ext-triminfo";
reg = <0x10068000 0x100>, <0x1006c000 0x4>;
interrupts = <0 184 0>;
clocks = <&clock 318>, <&clock 318>;
clock-names = "tmu_apbif", "tmu_triminfo_apbif";
};
tmu_cpu3: tmu@1006c000 {
compatible = "samsung,exynos5420-tmu-ext-triminfo";
reg = <0x1006c000 0x100>, <0x100a0000 0x4>;
interrupts = <0 185 0>;
clocks = <&clock 318>, <&clock 319>;
clock-names = "tmu_apbif", "tmu_triminfo_apbif";
};
tmu_gpu: tmu@100a0000 {
compatible = "samsung,exynos5420-tmu-ext-triminfo";
reg = <0x100a0000 0x100>, <0x10068000 0x4>;
interrupts = <0 215 0>;
clocks = <&clock 319>, <&clock 318>;
clock-names = "tmu_apbif", "tmu_triminfo_apbif";
};
Note: For multi-instance tmu each instance should have an alias correctly Note: For multi-instance tmu each instance should have an alias correctly
numbered in "aliases" node. numbered in "aliases" node.
......
...@@ -222,12 +222,24 @@ config ACPI_INT3403_THERMAL ...@@ -222,12 +222,24 @@ config ACPI_INT3403_THERMAL
the Intel Thermal Daemon can use this information to allow the user the Intel Thermal Daemon can use this information to allow the user
to select his laptop to run without turning on the fans. to select his laptop to run without turning on the fans.
config INTEL_SOC_DTS_THERMAL
tristate "Intel SoCs DTS thermal driver"
depends on X86 && IOSF_MBI
help
Enable this to register Intel SoCs (e.g. Bay Trail) platform digital
temperature sensor (DTS). These SoCs have two additional DTSs in
addition to DTSs on CPU cores. Each DTS will be registered as a
thermal zone. There are two trip points. One of the trip point can
be set by user mode programs to get notifications via Linux thermal
notification methods.The other trip is a critical trip point, which
was set by the driver based on the TJ MAX temperature.
menu "Texas Instruments thermal drivers" menu "Texas Instruments thermal drivers"
source "drivers/thermal/ti-soc-thermal/Kconfig" source "drivers/thermal/ti-soc-thermal/Kconfig"
endmenu endmenu
menu "Samsung thermal drivers" menu "Samsung thermal drivers"
depends on PLAT_SAMSUNG depends on ARCH_EXYNOS
source "drivers/thermal/samsung/Kconfig" source "drivers/thermal/samsung/Kconfig"
endmenu endmenu
......
...@@ -29,5 +29,6 @@ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o ...@@ -29,5 +29,6 @@ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o obj-$(CONFIG_DB8500_CPUFREQ_COOLING) += db8500_cpufreq_cooling.o
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o
obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/ obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
obj-$(CONFIG_ACPI_INT3403_THERMAL) += int3403_thermal.o obj-$(CONFIG_ACPI_INT3403_THERMAL) += int3403_thermal.o
...@@ -62,7 +62,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone, ...@@ -62,7 +62,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone,
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -EIO; return -EIO;
*temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET); /*
* Thermal hysteresis represents a temperature difference.
* Kelvin and Celsius have same degree size. So the
* conversion here between tenths of degree Kelvin unit
* and Milli-Celsius unit is just to multiply 100.
*/
*temp = hyst * 100;
return 0; return 0;
} }
......
...@@ -681,8 +681,10 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = { ...@@ -681,8 +681,10 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = {
{ X86_VENDOR_INTEL, 6, 0x2d}, { X86_VENDOR_INTEL, 6, 0x2d},
{ X86_VENDOR_INTEL, 6, 0x2e}, { X86_VENDOR_INTEL, 6, 0x2e},
{ X86_VENDOR_INTEL, 6, 0x2f}, { X86_VENDOR_INTEL, 6, 0x2f},
{ X86_VENDOR_INTEL, 6, 0x37},
{ X86_VENDOR_INTEL, 6, 0x3a}, { X86_VENDOR_INTEL, 6, 0x3a},
{ X86_VENDOR_INTEL, 6, 0x3c}, { X86_VENDOR_INTEL, 6, 0x3c},
{ X86_VENDOR_INTEL, 6, 0x3d},
{ X86_VENDOR_INTEL, 6, 0x3e}, { X86_VENDOR_INTEL, 6, 0x3e},
{ X86_VENDOR_INTEL, 6, 0x3f}, { X86_VENDOR_INTEL, 6, 0x3f},
{ X86_VENDOR_INTEL, 6, 0x45}, { X86_VENDOR_INTEL, 6, 0x45},
......
This diff is collapsed.
...@@ -374,10 +374,8 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -374,10 +374,8 @@ static int rcar_thermal_probe(struct platform_device *pdev)
int idle = IDLE_INTERVAL; int idle = IDLE_INTERVAL;
common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL); common = devm_kzalloc(dev, sizeof(*common), GFP_KERNEL);
if (!common) { if (!common)
dev_err(dev, "Could not allocate common\n");
return -ENOMEM; return -ENOMEM;
}
INIT_LIST_HEAD(&common->head); INIT_LIST_HEAD(&common->head);
spin_lock_init(&common->lock); spin_lock_init(&common->lock);
...@@ -423,7 +421,6 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -423,7 +421,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv) { if (!priv) {
dev_err(dev, "Could not allocate priv\n");
ret = -ENOMEM; ret = -ENOMEM;
goto error_unregister; goto error_unregister;
} }
...@@ -470,7 +467,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) ...@@ -470,7 +467,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
rcar_thermal_irq_disable(priv); rcar_thermal_irq_disable(priv);
} }
pm_runtime_put_sync(dev); pm_runtime_put(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
return ret; return ret;
...@@ -488,7 +485,7 @@ static int rcar_thermal_remove(struct platform_device *pdev) ...@@ -488,7 +485,7 @@ static int rcar_thermal_remove(struct platform_device *pdev)
rcar_thermal_irq_disable(priv); rcar_thermal_irq_disable(priv);
} }
pm_runtime_put_sync(dev); pm_runtime_put(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
return 0; return 0;
......
...@@ -41,12 +41,13 @@ ...@@ -41,12 +41,13 @@
* @id: identifier of the one instance of the TMU controller. * @id: identifier of the one instance of the TMU controller.
* @pdata: pointer to the tmu platform/configuration data * @pdata: pointer to the tmu platform/configuration data
* @base: base address of the single instance of the TMU controller. * @base: base address of the single instance of the TMU controller.
* @base_common: base address of the common registers of the TMU controller. * @base_second: base address of the common registers of the TMU controller.
* @irq: irq number of the TMU controller. * @irq: irq number of the TMU controller.
* @soc: id of the SOC type. * @soc: id of the SOC type.
* @irq_work: pointer to the irq work structure. * @irq_work: pointer to the irq work structure.
* @lock: lock to implement synchronization. * @lock: lock to implement synchronization.
* @clk: pointer to the clock structure. * @clk: pointer to the clock structure.
* @clk_sec: pointer to the clock structure for accessing the base_second.
* @temp_error1: fused value of the first point trim. * @temp_error1: fused value of the first point trim.
* @temp_error2: fused value of the second point trim. * @temp_error2: fused value of the second point trim.
* @regulator: pointer to the TMU regulator structure. * @regulator: pointer to the TMU regulator structure.
...@@ -56,12 +57,12 @@ struct exynos_tmu_data { ...@@ -56,12 +57,12 @@ struct exynos_tmu_data {
int id; int id;
struct exynos_tmu_platform_data *pdata; struct exynos_tmu_platform_data *pdata;
void __iomem *base; void __iomem *base;
void __iomem *base_common; void __iomem *base_second;
int irq; int irq;
enum soc_type soc; enum soc_type soc;
struct work_struct irq_work; struct work_struct irq_work;
struct mutex lock; struct mutex lock;
struct clk *clk; struct clk *clk, *clk_sec;
u8 temp_error1, temp_error2; u8 temp_error1, temp_error2;
struct regulator *regulator; struct regulator *regulator;
struct thermal_sensor_conf *reg_conf; struct thermal_sensor_conf *reg_conf;
...@@ -152,6 +153,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -152,6 +153,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
mutex_lock(&data->lock); mutex_lock(&data->lock);
clk_enable(data->clk); clk_enable(data->clk);
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
if (TMU_SUPPORTS(pdata, READY_STATUS)) { if (TMU_SUPPORTS(pdata, READY_STATUS)) {
status = readb(data->base + reg->tmu_status); status = readb(data->base + reg->tmu_status);
...@@ -186,7 +189,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -186,7 +189,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data); EXYNOS5440_EFUSE_SWAP_OFFSET + reg->triminfo_data);
} }
} else { } else {
trim_info = readl(data->base + reg->triminfo_data); /* On exynos5420 the triminfo register is in the shared space */
if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO)
trim_info = readl(data->base_second +
reg->triminfo_data);
else
trim_info = readl(data->base + reg->triminfo_data);
} }
data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK;
data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) & data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) &
...@@ -225,6 +233,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -225,6 +233,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
trigger_levs++; trigger_levs++;
} }
rising_threshold = readl(data->base + reg->threshold_th0);
if (data->soc == SOC_ARCH_EXYNOS4210) { if (data->soc == SOC_ARCH_EXYNOS4210) {
/* Write temperature code for threshold */ /* Write temperature code for threshold */
threshold_code = temp_to_code(data, pdata->threshold); threshold_code = temp_to_code(data, pdata->threshold);
...@@ -238,7 +248,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -238,7 +248,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
writeb(pdata->trigger_levels[i], data->base + writeb(pdata->trigger_levels[i], data->base +
reg->threshold_th0 + i * sizeof(reg->threshold_th0)); reg->threshold_th0 + i * sizeof(reg->threshold_th0));
writel(reg->inten_rise_mask, data->base + reg->tmu_intclear); writel(reg->intclr_rise_mask, data->base + reg->tmu_intclear);
} else { } else {
/* Write temperature code for rising and falling threshold */ /* Write temperature code for rising and falling threshold */
for (i = 0; for (i = 0;
...@@ -249,6 +259,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -249,6 +259,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
ret = threshold_code; ret = threshold_code;
goto out; goto out;
} }
rising_threshold &= ~(0xff << 8 * i);
rising_threshold |= threshold_code << 8 * i; rising_threshold |= threshold_code << 8 * i;
if (pdata->threshold_falling) { if (pdata->threshold_falling) {
threshold_code = temp_to_code(data, threshold_code = temp_to_code(data,
...@@ -265,8 +276,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -265,8 +276,8 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
writel(falling_threshold, writel(falling_threshold,
data->base + reg->threshold_th1); data->base + reg->threshold_th1);
writel((reg->inten_rise_mask << reg->inten_rise_shift) | writel((reg->intclr_rise_mask << reg->intclr_rise_shift) |
(reg->inten_fall_mask << reg->inten_fall_shift), (reg->intclr_fall_mask << reg->intclr_fall_shift),
data->base + reg->tmu_intclear); data->base + reg->tmu_intclear);
/* if last threshold limit is also present */ /* if last threshold limit is also present */
...@@ -281,6 +292,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -281,6 +292,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
} }
if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) {
/* 1-4 level to be assigned in th0 reg */ /* 1-4 level to be assigned in th0 reg */
rising_threshold &= ~(0xff << 8 * i);
rising_threshold |= threshold_code << 8 * i; rising_threshold |= threshold_code << 8 * i;
writel(rising_threshold, writel(rising_threshold,
data->base + reg->threshold_th0); data->base + reg->threshold_th0);
...@@ -298,10 +310,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev) ...@@ -298,10 +310,12 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
} }
/*Clear the PMIN in the common TMU register*/ /*Clear the PMIN in the common TMU register*/
if (reg->tmu_pmin && !data->id) if (reg->tmu_pmin && !data->id)
writel(0, data->base_common + reg->tmu_pmin); writel(0, data->base_second + reg->tmu_pmin);
out: out:
clk_disable(data->clk); clk_disable(data->clk);
mutex_unlock(&data->lock); mutex_unlock(&data->lock);
if (!IS_ERR(data->clk_sec))
clk_disable(data->clk_sec);
return ret; return ret;
} }
...@@ -453,12 +467,16 @@ static void exynos_tmu_work(struct work_struct *work) ...@@ -453,12 +467,16 @@ static void exynos_tmu_work(struct work_struct *work)
const struct exynos_tmu_registers *reg = pdata->registers; const struct exynos_tmu_registers *reg = pdata->registers;
unsigned int val_irq, val_type; unsigned int val_irq, val_type;
if (!IS_ERR(data->clk_sec))
clk_enable(data->clk_sec);
/* Find which sensor generated this interrupt */ /* Find which sensor generated this interrupt */
if (reg->tmu_irqstatus) { if (reg->tmu_irqstatus) {
val_type = readl(data->base_common + reg->tmu_irqstatus); val_type = readl(data->base_second + reg->tmu_irqstatus);
if (!((val_type >> data->id) & 0x1)) if (!((val_type >> data->id) & 0x1))
goto out; goto out;
} }
if (!IS_ERR(data->clk_sec))
clk_disable(data->clk_sec);
exynos_report_trigger(data->reg_conf); exynos_report_trigger(data->reg_conf);
mutex_lock(&data->lock); mutex_lock(&data->lock);
...@@ -498,6 +516,18 @@ static const struct of_device_id exynos_tmu_match[] = { ...@@ -498,6 +516,18 @@ static const struct of_device_id exynos_tmu_match[] = {
.compatible = "samsung,exynos5250-tmu", .compatible = "samsung,exynos5250-tmu",
.data = (void *)EXYNOS5250_TMU_DRV_DATA, .data = (void *)EXYNOS5250_TMU_DRV_DATA,
}, },
{
.compatible = "samsung,exynos5260-tmu",
.data = (void *)EXYNOS5260_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos5420-tmu",
.data = (void *)EXYNOS5420_TMU_DRV_DATA,
},
{
.compatible = "samsung,exynos5420-tmu-ext-triminfo",
.data = (void *)EXYNOS5420_TMU_DRV_DATA,
},
{ {
.compatible = "samsung,exynos5440-tmu", .compatible = "samsung,exynos5440-tmu",
.data = (void *)EXYNOS5440_TMU_DRV_DATA, .data = (void *)EXYNOS5440_TMU_DRV_DATA,
...@@ -580,7 +610,7 @@ static int exynos_map_dt_data(struct platform_device *pdev) ...@@ -580,7 +610,7 @@ static int exynos_map_dt_data(struct platform_device *pdev)
* Check if the TMU shares some registers and then try to map the * Check if the TMU shares some registers and then try to map the
* memory of common registers. * memory of common registers.
*/ */
if (!TMU_SUPPORTS(pdata, SHARED_MEMORY)) if (!TMU_SUPPORTS(pdata, ADDRESS_MULTIPLE))
return 0; return 0;
if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { if (of_address_to_resource(pdev->dev.of_node, 1, &res)) {
...@@ -588,9 +618,9 @@ static int exynos_map_dt_data(struct platform_device *pdev) ...@@ -588,9 +618,9 @@ static int exynos_map_dt_data(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
data->base_common = devm_ioremap(&pdev->dev, res.start, data->base_second = devm_ioremap(&pdev->dev, res.start,
resource_size(&res)); resource_size(&res));
if (!data->base_common) { if (!data->base_second) {
dev_err(&pdev->dev, "Failed to ioremap memory\n"); dev_err(&pdev->dev, "Failed to ioremap memory\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -607,10 +637,8 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -607,10 +637,8 @@ static int exynos_tmu_probe(struct platform_device *pdev)
data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data),
GFP_KERNEL); GFP_KERNEL);
if (!data) { if (!data)
dev_err(&pdev->dev, "Failed to allocate driver structure\n");
return -ENOMEM; return -ENOMEM;
}
platform_set_drvdata(pdev, data); platform_set_drvdata(pdev, data);
mutex_init(&data->lock); mutex_init(&data->lock);
...@@ -629,13 +657,31 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -629,13 +657,31 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return PTR_ERR(data->clk); return PTR_ERR(data->clk);
} }
data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif");
if (IS_ERR(data->clk_sec)) {
if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) {
dev_err(&pdev->dev, "Failed to get triminfo clock\n");
return PTR_ERR(data->clk_sec);
}
} else {
ret = clk_prepare(data->clk_sec);
if (ret) {
dev_err(&pdev->dev, "Failed to get clock\n");
return ret;
}
}
ret = clk_prepare(data->clk); ret = clk_prepare(data->clk);
if (ret) if (ret) {
return ret; dev_err(&pdev->dev, "Failed to get clock\n");
goto err_clk_sec;
}
if (pdata->type == SOC_ARCH_EXYNOS4210 || if (pdata->type == SOC_ARCH_EXYNOS4210 ||
pdata->type == SOC_ARCH_EXYNOS4412 || pdata->type == SOC_ARCH_EXYNOS4412 ||
pdata->type == SOC_ARCH_EXYNOS5250 || pdata->type == SOC_ARCH_EXYNOS5250 ||
pdata->type == SOC_ARCH_EXYNOS5260 ||
pdata->type == SOC_ARCH_EXYNOS5420_TRIMINFO ||
pdata->type == SOC_ARCH_EXYNOS5440) pdata->type == SOC_ARCH_EXYNOS5440)
data->soc = pdata->type; data->soc = pdata->type;
else { else {
...@@ -656,7 +702,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -656,7 +702,6 @@ static int exynos_tmu_probe(struct platform_device *pdev)
sensor_conf = devm_kzalloc(&pdev->dev, sensor_conf = devm_kzalloc(&pdev->dev,
sizeof(struct thermal_sensor_conf), GFP_KERNEL); sizeof(struct thermal_sensor_conf), GFP_KERNEL);
if (!sensor_conf) { if (!sensor_conf) {
dev_err(&pdev->dev, "Failed to allocate registration struct\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_clk; goto err_clk;
} }
...@@ -704,6 +749,9 @@ static int exynos_tmu_probe(struct platform_device *pdev) ...@@ -704,6 +749,9 @@ static int exynos_tmu_probe(struct platform_device *pdev)
return 0; return 0;
err_clk: err_clk:
clk_unprepare(data->clk); clk_unprepare(data->clk);
err_clk_sec:
if (!IS_ERR(data->clk_sec))
clk_unprepare(data->clk_sec);
return ret; return ret;
} }
...@@ -716,6 +764,8 @@ static int exynos_tmu_remove(struct platform_device *pdev) ...@@ -716,6 +764,8 @@ static int exynos_tmu_remove(struct platform_device *pdev)
exynos_unregister_thermal(data->reg_conf); exynos_unregister_thermal(data->reg_conf);
clk_unprepare(data->clk); clk_unprepare(data->clk);
if (!IS_ERR(data->clk_sec))
clk_unprepare(data->clk_sec);
if (!IS_ERR(data->regulator)) if (!IS_ERR(data->regulator))
regulator_disable(data->regulator); regulator_disable(data->regulator);
......
...@@ -43,6 +43,8 @@ enum soc_type { ...@@ -43,6 +43,8 @@ enum soc_type {
SOC_ARCH_EXYNOS4210 = 1, SOC_ARCH_EXYNOS4210 = 1,
SOC_ARCH_EXYNOS4412, SOC_ARCH_EXYNOS4412,
SOC_ARCH_EXYNOS5250, SOC_ARCH_EXYNOS5250,
SOC_ARCH_EXYNOS5260,
SOC_ARCH_EXYNOS5420_TRIMINFO,
SOC_ARCH_EXYNOS5440, SOC_ARCH_EXYNOS5440,
}; };
...@@ -60,7 +62,7 @@ enum soc_type { ...@@ -60,7 +62,7 @@ enum soc_type {
* state(active/idle) can be checked. * state(active/idle) can be checked.
* TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation * TMU_SUPPORT_EMUL_TIME - This features allows to set next temp emulation
* sample time. * sample time.
* TMU_SUPPORT_SHARED_MEMORY - This feature tells that the different TMU * TMU_SUPPORT_ADDRESS_MULTIPLE - This feature tells that the different TMU
* sensors shares some common registers. * sensors shares some common registers.
* TMU_SUPPORT - macro to compare the above features with the supplied. * TMU_SUPPORT - macro to compare the above features with the supplied.
*/ */
...@@ -70,7 +72,7 @@ enum soc_type { ...@@ -70,7 +72,7 @@ enum soc_type {
#define TMU_SUPPORT_FALLING_TRIP BIT(3) #define TMU_SUPPORT_FALLING_TRIP BIT(3)
#define TMU_SUPPORT_READY_STATUS BIT(4) #define TMU_SUPPORT_READY_STATUS BIT(4)
#define TMU_SUPPORT_EMUL_TIME BIT(5) #define TMU_SUPPORT_EMUL_TIME BIT(5)
#define TMU_SUPPORT_SHARED_MEMORY BIT(6) #define TMU_SUPPORT_ADDRESS_MULTIPLE BIT(6)
#define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b) #define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
...@@ -122,10 +124,6 @@ enum soc_type { ...@@ -122,10 +124,6 @@ enum soc_type {
* @threshold_th3_l0_shift: shift bits of level0 threshold temperature. * @threshold_th3_l0_shift: shift bits of level0 threshold temperature.
* @tmu_inten: register containing the different threshold interrupt * @tmu_inten: register containing the different threshold interrupt
enable bits. enable bits.
* @inten_rise_shift: shift bits of all rising interrupt bits.
* @inten_rise_mask: mask bits of all rising interrupt bits.
* @inten_fall_shift: shift bits of all rising interrupt bits.
* @inten_fall_mask: mask bits of all rising interrupt bits.
* @inten_rise0_shift: shift bits of rising 0 interrupt bits. * @inten_rise0_shift: shift bits of rising 0 interrupt bits.
* @inten_rise1_shift: shift bits of rising 1 interrupt bits. * @inten_rise1_shift: shift bits of rising 1 interrupt bits.
* @inten_rise2_shift: shift bits of rising 2 interrupt bits. * @inten_rise2_shift: shift bits of rising 2 interrupt bits.
...@@ -136,6 +134,10 @@ enum soc_type { ...@@ -136,6 +134,10 @@ enum soc_type {
* @inten_fall3_shift: shift bits of falling 3 interrupt bits. * @inten_fall3_shift: shift bits of falling 3 interrupt bits.
* @tmu_intstat: Register containing the interrupt status values. * @tmu_intstat: Register containing the interrupt status values.
* @tmu_intclear: Register for clearing the raised interrupt status. * @tmu_intclear: Register for clearing the raised interrupt status.
* @intclr_fall_shift: shift bits for interrupt clear fall 0
* @intclr_rise_shift: shift bits of all rising interrupt bits.
* @intclr_rise_mask: mask bits of all rising interrupt bits.
* @intclr_fall_mask: mask bits of all rising interrupt bits.
* @emul_con: TMU emulation controller register. * @emul_con: TMU emulation controller register.
* @emul_temp_shift: shift bits of emulation temperature. * @emul_temp_shift: shift bits of emulation temperature.
* @emul_time_shift: shift bits of emulation time. * @emul_time_shift: shift bits of emulation time.
...@@ -149,6 +151,7 @@ struct exynos_tmu_registers { ...@@ -149,6 +151,7 @@ struct exynos_tmu_registers {
u32 triminfo_85_shift; u32 triminfo_85_shift;
u32 triminfo_ctrl; u32 triminfo_ctrl;
u32 triminfo_ctrl1;
u32 triminfo_reload_shift; u32 triminfo_reload_shift;
u32 tmu_ctrl; u32 tmu_ctrl;
...@@ -191,10 +194,6 @@ struct exynos_tmu_registers { ...@@ -191,10 +194,6 @@ struct exynos_tmu_registers {
u32 threshold_th3_l0_shift; u32 threshold_th3_l0_shift;
u32 tmu_inten; u32 tmu_inten;
u32 inten_rise_shift;
u32 inten_rise_mask;
u32 inten_fall_shift;
u32 inten_fall_mask;
u32 inten_rise0_shift; u32 inten_rise0_shift;
u32 inten_rise1_shift; u32 inten_rise1_shift;
u32 inten_rise2_shift; u32 inten_rise2_shift;
...@@ -207,6 +206,10 @@ struct exynos_tmu_registers { ...@@ -207,6 +206,10 @@ struct exynos_tmu_registers {
u32 tmu_intstat; u32 tmu_intstat;
u32 tmu_intclear; u32 tmu_intclear;
u32 intclr_fall_shift;
u32 intclr_rise_shift;
u32 intclr_fall_mask;
u32 intclr_rise_mask;
u32 emul_con; u32 emul_con;
u32 emul_temp_shift; u32 emul_temp_shift;
......
This diff is collapsed.
...@@ -69,9 +69,11 @@ ...@@ -69,9 +69,11 @@
#define EXYNOS_TMU_RISE_INT_MASK 0x111 #define EXYNOS_TMU_RISE_INT_MASK 0x111
#define EXYNOS_TMU_RISE_INT_SHIFT 0 #define EXYNOS_TMU_RISE_INT_SHIFT 0
#define EXYNOS_TMU_FALL_INT_MASK 0x111 #define EXYNOS_TMU_FALL_INT_MASK 0x111
#define EXYNOS_TMU_FALL_INT_SHIFT 12
#define EXYNOS_TMU_CLEAR_RISE_INT 0x111 #define EXYNOS_TMU_CLEAR_RISE_INT 0x111
#define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12) #define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12)
#define EXYNOS_TMU_CLEAR_FALL_INT_SHIFT 12
#define EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT 16
#define EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT 4
#define EXYNOS_TMU_TRIP_MODE_SHIFT 13 #define EXYNOS_TMU_TRIP_MODE_SHIFT 13
#define EXYNOS_TMU_TRIP_MODE_MASK 0x7 #define EXYNOS_TMU_TRIP_MODE_MASK 0x7
#define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12
...@@ -85,6 +87,7 @@ ...@@ -85,6 +87,7 @@
#define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16
#define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20
#define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24
#define EXYNOS_TMU_INTEN_FALL3_SHIFT 28
#define EXYNOS_EMUL_TIME 0x57F0 #define EXYNOS_EMUL_TIME 0x57F0
#define EXYNOS_EMUL_TIME_MASK 0xffff #define EXYNOS_EMUL_TIME_MASK 0xffff
...@@ -95,6 +98,17 @@ ...@@ -95,6 +98,17 @@
#define EXYNOS_MAX_TRIGGER_PER_REG 4 #define EXYNOS_MAX_TRIGGER_PER_REG 4
/* Exynos5260 specific */
#define EXYNOS_TMU_REG_CONTROL1 0x24
#define EXYNOS5260_TMU_REG_INTEN 0xC0
#define EXYNOS5260_TMU_REG_INTSTAT 0xC4
#define EXYNOS5260_TMU_REG_INTCLEAR 0xC8
#define EXYNOS5260_TMU_CLEAR_RISE_INT 0x1111
#define EXYNOS5260_TMU_CLEAR_FALL_INT (0x1111 << 16)
#define EXYNOS5260_TMU_RISE_INT_MASK 0x1111
#define EXYNOS5260_TMU_FALL_INT_MASK 0x1111
#define EXYNOS5260_EMUL_CON 0x100
/* Exynos4412 specific */ /* Exynos4412 specific */
#define EXYNOS4412_MUX_ADDR_VALUE 6 #define EXYNOS4412_MUX_ADDR_VALUE 6
#define EXYNOS4412_MUX_ADDR_SHIFT 20 #define EXYNOS4412_MUX_ADDR_SHIFT 20
...@@ -119,7 +133,6 @@ ...@@ -119,7 +133,6 @@
#define EXYNOS5440_TMU_RISE_INT_MASK 0xf #define EXYNOS5440_TMU_RISE_INT_MASK 0xf
#define EXYNOS5440_TMU_RISE_INT_SHIFT 0 #define EXYNOS5440_TMU_RISE_INT_SHIFT 0
#define EXYNOS5440_TMU_FALL_INT_MASK 0xf #define EXYNOS5440_TMU_FALL_INT_MASK 0xf
#define EXYNOS5440_TMU_FALL_INT_SHIFT 4
#define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 #define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0
#define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 #define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1
#define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2
...@@ -156,6 +169,20 @@ extern struct exynos_tmu_init_data const exynos5250_default_tmu_data; ...@@ -156,6 +169,20 @@ extern struct exynos_tmu_init_data const exynos5250_default_tmu_data;
#define EXYNOS5250_TMU_DRV_DATA (NULL) #define EXYNOS5250_TMU_DRV_DATA (NULL)
#endif #endif
#if defined(CONFIG_SOC_EXYNOS5260)
extern struct exynos_tmu_init_data const exynos5260_default_tmu_data;
#define EXYNOS5260_TMU_DRV_DATA (&exynos5260_default_tmu_data)
#else
#define EXYNOS5260_TMU_DRV_DATA (NULL)
#endif
#if defined(CONFIG_SOC_EXYNOS5420)
extern struct exynos_tmu_init_data const exynos5420_default_tmu_data;
#define EXYNOS5420_TMU_DRV_DATA (&exynos5420_default_tmu_data)
#else
#define EXYNOS5420_TMU_DRV_DATA (NULL)
#endif
#if defined(CONFIG_SOC_EXYNOS5440) #if defined(CONFIG_SOC_EXYNOS5440)
extern struct exynos_tmu_init_data const exynos5440_default_tmu_data; extern struct exynos_tmu_init_data const exynos5440_default_tmu_data;
#define EXYNOS5440_TMU_DRV_DATA (&exynos5440_default_tmu_data) #define EXYNOS5440_TMU_DRV_DATA (&exynos5440_default_tmu_data)
......
...@@ -113,10 +113,8 @@ static int spear_thermal_probe(struct platform_device *pdev) ...@@ -113,10 +113,8 @@ static int spear_thermal_probe(struct platform_device *pdev)
} }
stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL); stdev = devm_kzalloc(&pdev->dev, sizeof(*stdev), GFP_KERNEL);
if (!stdev) { if (!stdev)
dev_err(&pdev->dev, "kzalloc fail\n");
return -ENOMEM; return -ENOMEM;
}
/* Enable thermal sensor */ /* Enable thermal sensor */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
...@@ -1248,7 +1248,7 @@ int ti_bandgap_probe(struct platform_device *pdev) ...@@ -1248,7 +1248,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
clk_rate = clk_round_rate(bgp->div_clk, clk_rate = clk_round_rate(bgp->div_clk,
bgp->conf->sensors[0].ts_data->max_freq); bgp->conf->sensors[0].ts_data->max_freq);
if (clk_rate < bgp->conf->sensors[0].ts_data->min_freq || if (clk_rate < bgp->conf->sensors[0].ts_data->min_freq ||
clk_rate == 0xffffffff) { clk_rate <= 0) {
ret = -ENODEV; ret = -ENODEV;
dev_err(&pdev->dev, "wrong clock rate (%d)\n", clk_rate); dev_err(&pdev->dev, "wrong clock rate (%d)\n", clk_rate);
goto put_clks; goto put_clks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment