@@ -152,7 +152,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
goto out;
}
- if (data->soc == SOC_ARCH_EXYNOS)
+ if (TMU_SUPPORTS(pdata, TRIM_RELOAD))
__raw_writel(1, data->base + reg->triminfo_ctrl);
/* Save trimming info in order to perform calibration */
@@ -261,7 +261,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)
pdata->trigger_enable[2] << reg->inten_rise2_shift |
pdata->trigger_enable[1] << reg->inten_rise1_shift |
pdata->trigger_enable[0] << reg->inten_rise0_shift;
- if (pdata->threshold_falling)
+ if (TMU_SUPPORTS(pdata, FALLING_TRIP))
interrupt_en |=
interrupt_en << reg->inten_fall0_shift;
} else {
@@ -303,7 +303,7 @@ static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp)
unsigned int val;
int ret = -EINVAL;
- if (data->soc == SOC_ARCH_EXYNOS4210)
+ if (!TMU_SUPPORTS(pdata, EMULATION))
goto out;
if (temp && temp < MCELSIUS)
@@ -46,6 +46,25 @@ enum soc_type {
};
/**
+ * EXYNOS TMU supported features.
+ * TMU_SUPPORT_EMULATION - This features is used to set user defined
+ * temperature to the TMU controller.
+ * TMU_SUPPORT_MULTI_INST - This features denotes that the soc
+ * has many instances of TMU.
+ * TMU_SUPPORT_TRIM_RELOAD - This features shows that trimming can
+ * be reloaded.
+ * TMU_SUPPORT_FALLING_TRIP - This features shows that interrupt can
+ * be registered for falling trips also.
+ * TMU_SUPPORT - macro to compare the above features with the supplied.
+ */
+#define TMU_SUPPORT_EMULATION BIT(0)
+#define TMU_SUPPORT_MULTI_INST BIT(1)
+#define TMU_SUPPORT_TRIM_RELOAD BIT(2)
+#define TMU_SUPPORT_FALLING_TRIP BIT(3)
+
+#define TMU_SUPPORTS(a, b) (a->features & TMU_SUPPORT_ ## b)
+
+/**
* struct exynos_tmu_register - register descriptors to access registers and
* bitfields. The register validity, offsets and bitfield values may vary
* slightly across different exynos SOC's.
@@ -166,6 +185,8 @@ struct exynos_tmu_registers {
* @freq_clip_table: Table representing frequency reduction percentage.
* @freq_tab_count: Count of the above table as frequency reduction may
* applicable to only some of the trigger levels.
+ * @features: a bitfield value indicating the features supported in SOC like
+ * emulation, multi instance etc
*
* This structure is required for configuration of exynos_tmu driver.
*/
@@ -192,5 +213,6 @@ struct exynos_tmu_platform_data {
struct freq_clip_table freq_tab[4];
unsigned int freq_tab_count;
struct exynos_tmu_registers *registers;
+ unsigned int features;
};
#endif /* _LINUX_EXYNOS_THERMAL_H */
@@ -154,5 +154,7 @@ struct exynos_tmu_platform_data const exynos5250_default_tmu_data = {
.freq_tab_count = 2,
.type = SOC_ARCH_EXYNOS,
.registers = &exynos5250_tmu_registers,
+ .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD |
+ TMU_SUPPORT_FALLING_TRIP),
};
#endif