diff options
author | Amit Kucheria <amit.kucheria@linaro.org> | 2018-07-18 02:43:11 -0400 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2018-07-27 18:08:10 -0400 |
commit | 770324a4bf2ffbcab5692d473c3f3f0e36b5a289 (patch) | |
tree | 10b39bae2955e701a92a2cc70500e7bc0ed970b1 | |
parent | 5b1283984fa39933e094d237387ad8fd39527fc1 (diff) |
thermal: tsens: Rename tsens-8996 to tsens-v2 for reuse
The TSENS block inside the 8996 is internally classified as version 2 of
the IP. Several other SoC families use this block and can share this code.
We rename get_temp() to reflect that it can be used across the v2 family.
Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r-- | drivers/thermal/qcom/Makefile | 2 | ||||
-rw-r--r-- | drivers/thermal/qcom/tsens-v2.c (renamed from drivers/thermal/qcom/tsens-8996.c) | 25 |
2 files changed, 9 insertions, 18 deletions
diff --git a/drivers/thermal/qcom/Makefile b/drivers/thermal/qcom/Makefile index 2cc2193637e7..a821929ede0b 100644 --- a/drivers/thermal/qcom/Makefile +++ b/drivers/thermal/qcom/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o | 1 | obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o |
2 | qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-8996.o | 2 | qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o |
diff --git a/drivers/thermal/qcom/tsens-8996.c b/drivers/thermal/qcom/tsens-v2.c index 3e60cecd2c45..44d3736109d6 100644 --- a/drivers/thermal/qcom/tsens-8996.c +++ b/drivers/thermal/qcom/tsens-v2.c | |||
@@ -1,27 +1,18 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. | 3 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. |
3 | * | 4 | * Copyright (c) 2018, Linaro Limited |
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 and | ||
6 | * only version 2 as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | */ | 5 | */ |
14 | 6 | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/regmap.h> | 7 | #include <linux/regmap.h> |
17 | #include "tsens.h" | 8 | #include "tsens.h" |
18 | 9 | ||
19 | #define STATUS_OFFSET 0xa0 | 10 | #define STATUS_OFFSET 0xa0 |
20 | #define LAST_TEMP_MASK 0xfff | 11 | #define LAST_TEMP_MASK 0xfff |
21 | #define STATUS_VALID_BIT BIT(21) | 12 | #define STATUS_VALID_BIT BIT(21) |
22 | #define CODE_SIGN_BIT BIT(11) | 13 | #define CODE_SIGN_BIT BIT(11) |
23 | 14 | ||
24 | static int get_temp_8996(struct tsens_device *tmdev, int id, int *temp) | 15 | static int get_temp_tsens_v2(struct tsens_device *tmdev, int id, int *temp) |
25 | { | 16 | { |
26 | struct tsens_sensor *s = &tmdev->sensor[id]; | 17 | struct tsens_sensor *s = &tmdev->sensor[id]; |
27 | u32 code; | 18 | u32 code; |
@@ -73,12 +64,12 @@ done: | |||
73 | return 0; | 64 | return 0; |
74 | } | 65 | } |
75 | 66 | ||
76 | static const struct tsens_ops ops_8996 = { | 67 | static const struct tsens_ops ops_generic_v2 = { |
77 | .init = init_common, | 68 | .init = init_common, |
78 | .get_temp = get_temp_8996, | 69 | .get_temp = get_temp_tsens_v2, |
79 | }; | 70 | }; |
80 | 71 | ||
81 | const struct tsens_data data_8996 = { | 72 | const struct tsens_data data_8996 = { |
82 | .num_sensors = 13, | 73 | .num_sensors = 13, |
83 | .ops = &ops_8996, | 74 | .ops = &ops_generic_v2, |
84 | }; | 75 | }; |