exynos_tmu.c (99d67fb993bbe2f27b0004332218108d66c78af4) exynos_tmu.c (56c64da7aa31c7e0422ec54e5d0ed60a98f28712)
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.kachhap@linaro.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 113 unchanged lines hidden (view full) ---

122 return temp;
123}
124
125static int exynos_tmu_initialize(struct platform_device *pdev)
126{
127 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
128 struct exynos_tmu_platform_data *pdata = data->pdata;
129 const struct exynos_tmu_registers *reg = pdata->registers;
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.kachhap@linaro.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 113 unchanged lines hidden (view full) ---

122 return temp;
123}
124
125static int exynos_tmu_initialize(struct platform_device *pdev)
126{
127 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
128 struct exynos_tmu_platform_data *pdata = data->pdata;
129 const struct exynos_tmu_registers *reg = pdata->registers;
130 unsigned int status, trim_info = 0, con;
130 unsigned int status, trim_info = 0, con, ctrl;
131 unsigned int rising_threshold = 0, falling_threshold = 0;
132 int ret = 0, threshold_code, i;
133
134 mutex_lock(&data->lock);
135 clk_enable(data->clk);
136 if (!IS_ERR(data->clk_sec))
137 clk_enable(data->clk_sec);
138
139 if (TMU_SUPPORTS(pdata, READY_STATUS)) {
140 status = readb(data->base + reg->tmu_status);
141 if (!status) {
142 ret = -EBUSY;
143 goto out;
144 }
145 }
146
131 unsigned int rising_threshold = 0, falling_threshold = 0;
132 int ret = 0, threshold_code, i;
133
134 mutex_lock(&data->lock);
135 clk_enable(data->clk);
136 if (!IS_ERR(data->clk_sec))
137 clk_enable(data->clk_sec);
138
139 if (TMU_SUPPORTS(pdata, READY_STATUS)) {
140 status = readb(data->base + reg->tmu_status);
141 if (!status) {
142 ret = -EBUSY;
143 goto out;
144 }
145 }
146
147 if (TMU_SUPPORTS(pdata, TRIM_RELOAD))
148 __raw_writel(1, data->base + reg->triminfo_ctrl);
147 if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) {
148 for (i = 0; i < reg->triminfo_ctrl_count; i++) {
149 if (pdata->triminfo_reload[i]) {
150 ctrl = readl(data->base +
151 reg->triminfo_ctrl[i]);
152 ctrl |= pdata->triminfo_reload[i];
153 writel(ctrl, data->base +
154 reg->triminfo_ctrl[i]);
155 }
156 }
157 }
149
150 /* Save trimming info in order to perform calibration */
151 if (data->soc == SOC_ARCH_EXYNOS5440) {
152 /*
153 * For exynos5440 soc triminfo value is swapped between TMU0 and
154 * TMU2, so the below logic is needed.
155 */
156 switch (data->id) {

--- 588 unchanged lines hidden ---
158
159 /* Save trimming info in order to perform calibration */
160 if (data->soc == SOC_ARCH_EXYNOS5440) {
161 /*
162 * For exynos5440 soc triminfo value is swapped between TMU0 and
163 * TMU2, so the below logic is needed.
164 */
165 switch (data->id) {

--- 588 unchanged lines hidden ---