All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Eduardo Valentin <edubezval@gmail.com>, Keerthy <j-keerthy@ti.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
	linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org, b.zolnierkie@samsung.com
Subject: [PATCH 11/14] thermal: ti-soc-thermal: use OMAP5 register tables for DRA752
Date: Mon, 14 May 2018 13:42:18 +0200	[thread overview]
Message-ID: <1526298141-14045-12-git-send-email-b.zolnierkie@samsung.com> (raw)
In-Reply-To: <1526298141-14045-1-git-send-email-b.zolnierkie@samsung.com>

OMAP5 register tables for MPU, GPU & CORE sensors are almost
identical to these for DRA752 (OMAP5 ones also set value for
.tshut_threshold but it is used only when TSHUT_CONFIG feature
is enabled and DRA752 doesn't enable it) so just use them also
for DRA752 instead of duplicating them.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/thermal/ti-soc-thermal/Makefile            |  2 +-
 drivers/thermal/ti-soc-thermal/dra752-bandgap.h    |  4 ++
 .../thermal/ti-soc-thermal/dra752-thermal-data.c   | 75 +---------------------
 .../thermal/ti-soc-thermal/omap5-thermal-data.c    |  8 ++-
 4 files changed, 13 insertions(+), 76 deletions(-)

diff --git a/drivers/thermal/ti-soc-thermal/Makefile b/drivers/thermal/ti-soc-thermal/Makefile
index f180ebe..aa1c38d 100644
--- a/drivers/thermal/ti-soc-thermal/Makefile
+++ b/drivers/thermal/ti-soc-thermal/Makefile
@@ -2,7 +2,7 @@
 obj-$(CONFIG_TI_SOC_THERMAL)		+= ti-soc-thermal.o
 ti-soc-thermal-y			:= ti-bandgap.o
 ti-soc-thermal-$(CONFIG_TI_THERMAL)	+= ti-thermal-common.o
-ti-soc-thermal-$(CONFIG_DRA752_THERMAL)	+= dra752-thermal-data.o
+ti-soc-thermal-$(CONFIG_DRA752_THERMAL)	+= dra752-thermal-data.o omap5-thermal-data.o
 ti-soc-thermal-$(CONFIG_OMAP3_THERMAL)	+= omap3-thermal-data.o
 ti-soc-thermal-$(CONFIG_OMAP4_THERMAL)	+= omap4-thermal-data.o
 ti-soc-thermal-$(CONFIG_OMAP5_THERMAL)	+= omap5-thermal-data.o
diff --git a/drivers/thermal/ti-soc-thermal/dra752-bandgap.h b/drivers/thermal/ti-soc-thermal/dra752-bandgap.h
index b9d65b4..c39af38 100644
--- a/drivers/thermal/ti-soc-thermal/dra752-bandgap.h
+++ b/drivers/thermal/ti-soc-thermal/dra752-bandgap.h
@@ -84,4 +84,8 @@
 #define DRA752_BANDGAP_STATUS_2_HOT_DSPEVE_MASK			BIT(1)
 #define DRA752_BANDGAP_STATUS_2_COLD_DSPEVE_MASK		BIT(0)
 
+extern struct temp_sensor_registers omap5430_mpu_temp_sensor_registers;
+extern struct temp_sensor_registers omap5430_gpu_temp_sensor_registers;
+extern struct temp_sensor_registers omap5430_core_temp_sensor_registers;
+
 #endif /* __DRA752_BANDGAP_H */
diff --git a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
index de412a2..dcc0b10 100644
--- a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
+++ b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c
@@ -31,29 +31,6 @@
  */
 
 /*
- * DRA752 CORE thermal sensor register offsets and bit-fields
- */
-static struct temp_sensor_registers
-dra752_core_temp_sensor_registers = {
-	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_CORE_OFFSET,
-	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
-	.bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK,
-	.bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK,
-	.bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET,
-	.mask_hot_mask = OMAP5430_MASK_HOT_CORE_MASK,
-	.mask_cold_mask = OMAP5430_MASK_COLD_CORE_MASK,
-	.mask_counter_delay_mask = OMAP5430_MASK_COUNTER_DELAY_MASK,
-	.mask_freeze_mask = OMAP5430_MASK_FREEZE_CORE_MASK,
-	.bgap_threshold = OMAP5430_BGAP_THRESHOLD_CORE_OFFSET,
-	.bgap_status = OMAP5430_BGAP_STATUS_OFFSET,
-	.status_hot_mask = OMAP5430_HOT_CORE_FLAG_MASK,
-	.status_cold_mask = OMAP5430_COLD_CORE_FLAG_MASK,
-	.ctrl_dtemp_1 = OMAP5430_BGAP_DTEMP_CORE_1_OFFSET,
-	.ctrl_dtemp_2 = OMAP5430_BGAP_DTEMP_CORE_2_OFFSET,
-	.bgap_efuse = OMAP5430_FUSE_OPP_BGAP_CORE,
-};
-
-/*
  * DRA752 IVA thermal sensor register offsets and bit-fields
  */
 static struct temp_sensor_registers
@@ -77,29 +54,6 @@
 };
 
 /*
- * DRA752 MPU thermal sensor register offsets and bit-fields
- */
-static struct temp_sensor_registers
-dra752_mpu_temp_sensor_registers = {
-	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_MPU_OFFSET,
-	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
-	.bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK,
-	.bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK,
-	.bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET,
-	.mask_hot_mask = OMAP5430_MASK_HOT_MPU_MASK,
-	.mask_cold_mask = OMAP5430_MASK_COLD_MPU_MASK,
-	.mask_counter_delay_mask = OMAP5430_MASK_COUNTER_DELAY_MASK,
-	.mask_freeze_mask = OMAP5430_MASK_FREEZE_MPU_MASK,
-	.bgap_threshold = OMAP5430_BGAP_THRESHOLD_MPU_OFFSET,
-	.bgap_status = OMAP5430_BGAP_STATUS_OFFSET,
-	.status_hot_mask = OMAP5430_HOT_MPU_FLAG_MASK,
-	.status_cold_mask = OMAP5430_COLD_MPU_FLAG_MASK,
-	.ctrl_dtemp_1 = OMAP5430_BGAP_DTEMP_MPU_1_OFFSET,
-	.ctrl_dtemp_2 = OMAP5430_BGAP_DTEMP_MPU_2_OFFSET,
-	.bgap_efuse = OMAP5430_FUSE_OPP_BGAP_MPU,
-};
-
-/*
  * DRA752 DSPEVE thermal sensor register offsets and bit-fields
  */
 static struct temp_sensor_registers
@@ -122,29 +76,6 @@
 	.bgap_efuse = DRA752_STD_FUSE_OPP_BGAP_DSPEVE_OFFSET,
 };
 
-/*
- * DRA752 GPU thermal sensor register offsets and bit-fields
- */
-static struct temp_sensor_registers
-dra752_gpu_temp_sensor_registers = {
-	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_GPU_OFFSET,
-	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
-	.bgap_eocz_mask = OMAP5430_BGAP_TEMP_SENSOR_EOCZ_MASK,
-	.bgap_dtemp_mask = OMAP5430_BGAP_TEMP_SENSOR_DTEMP_MASK,
-	.bgap_mask_ctrl = OMAP5430_BGAP_CTRL_OFFSET,
-	.mask_hot_mask = OMAP5430_MASK_HOT_GPU_MASK,
-	.mask_cold_mask = OMAP5430_MASK_COLD_GPU_MASK,
-	.mask_counter_delay_mask = OMAP5430_MASK_COUNTER_DELAY_MASK,
-	.mask_freeze_mask = OMAP5430_MASK_FREEZE_GPU_MASK,
-	.bgap_threshold = OMAP5430_BGAP_THRESHOLD_GPU_OFFSET,
-	.bgap_status = OMAP5430_BGAP_STATUS_OFFSET,
-	.status_hot_mask = OMAP5430_HOT_GPU_FLAG_MASK,
-	.status_cold_mask = OMAP5430_COLD_GPU_FLAG_MASK,
-	.ctrl_dtemp_1 = OMAP5430_BGAP_DTEMP_GPU_1_OFFSET,
-	.ctrl_dtemp_2 = OMAP5430_BGAP_DTEMP_GPU_2_OFFSET,
-	.bgap_efuse = OMAP5430_FUSE_OPP_BGAP_GPU,
-};
-
 /* Thresholds and limits for DRA752 temperature sensor */
 static struct temp_sensor_data dra752_temp_sensor_data = {
 	.t_hot = OMAP5430_T_HOT,
@@ -297,7 +228,7 @@
 	.adc_end_val = OMAP5430_ADC_END_VALUE,
 	.sensors = {
 		{
-		.registers = &dra752_mpu_temp_sensor_registers,
+		.registers = &omap5430_mpu_temp_sensor_registers,
 		.ts_data = &dra752_temp_sensor_data,
 		.domain = "cpu",
 		.register_cooling = ti_thermal_register_cpu_cooling,
@@ -306,14 +237,14 @@
 		.constant_pcb = DRA752_GRADIENT_CONST_W_PCB,
 		},
 		{
-		.registers = &dra752_gpu_temp_sensor_registers,
+		.registers = &omap5430_gpu_temp_sensor_registers,
 		.ts_data = &dra752_temp_sensor_data,
 		.domain = "gpu",
 		.slope_pcb = DRA752_GRADIENT_SLOPE_W_PCB,
 		.constant_pcb = DRA752_GRADIENT_CONST_W_PCB,
 		},
 		{
-		.registers = &dra752_core_temp_sensor_registers,
+		.registers = &omap5430_core_temp_sensor_registers,
 		.ts_data = &dra752_temp_sensor_data,
 		.domain = "core",
 		.slope_pcb = DRA752_GRADIENT_SLOPE_W_PCB,
diff --git a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c
index defa714..fce6e30 100644
--- a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c
+++ b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c
@@ -28,7 +28,7 @@
 /*
  * OMAP5430 MPU thermal sensor register offset and bit-fields
  */
-static struct temp_sensor_registers
+struct temp_sensor_registers
 omap5430_mpu_temp_sensor_registers = {
 	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_MPU_OFFSET,
 	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
@@ -57,7 +57,7 @@
 /*
  * OMAP5430 GPU thermal sensor register offset and bit-fields
  */
-static struct temp_sensor_registers
+struct temp_sensor_registers
 omap5430_gpu_temp_sensor_registers = {
 	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_GPU_OFFSET,
 	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
@@ -87,7 +87,7 @@
 /*
  * OMAP5430 CORE thermal sensor register offset and bit-fields
  */
-static struct temp_sensor_registers
+struct temp_sensor_registers
 omap5430_core_temp_sensor_registers = {
 	.temp_sensor_ctrl = OMAP5430_TEMP_SENSOR_CORE_OFFSET,
 	.bgap_tempsoff_mask = OMAP5430_BGAP_TEMPSOFF_MASK,
@@ -114,6 +114,7 @@
 	.bgap_efuse = OMAP5430_FUSE_OPP_BGAP_CORE,
 };
 
+#ifdef CONFIG_OMAP5_THERMAL
 /* Thresholds and limits for OMAP5430 MPU/GPU/CORE temperature sensor */
 static struct temp_sensor_data omap5430_temp_sensor_data = {
 	.tshut_hot = OMAP5430_TSHUT_HOT,
@@ -266,3 +267,4 @@
 	},
 	.sensor_count = 3,
 };
+#endif /* CONFIG_OMAP5_THERMAL */
-- 
1.9.1

  parent reply	other threads:[~2018-05-14 11:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180514114255epcas1p438ea8d32c2b7fd40b86afb25c9c8f2cf@epcas1p4.samsung.com>
2018-05-14 11:42 ` [PATCH 00/14] thermal: ti-soc-thermal: simplify the driver a bit Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114302epcas1p1890ad3296302900a736262b5d67aa10e@epcas1p1.samsung.com>
2018-05-14 11:42     ` [PATCH 01/14] thermal: ti-soc-thermal: fix TALERT IRQ handling for DRA752 Bartlomiej Zolnierkiewicz
2018-07-11  2:19       ` J, KEERTHY
2018-07-11  2:19         ` J, KEERTHY
     [not found]         ` <CGME20180725142707eucas1p25bf4bc7b63babc0732db13ae9a79d983@eucas1p2.samsung.com>
2018-07-25 14:27           ` Bartlomiej Zolnierkiewicz
2018-07-27  4:43             ` Keerthy
2018-07-27  4:43               ` Keerthy
     [not found]               ` <CGME20180727143023eucas1p1adfe1860327829e7cf39bcdd3290d11c@eucas1p1.samsung.com>
2018-07-27 14:30                 ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114308epcas2p3bba580c5500889f22d50549994b227db@epcas2p3.samsung.com>
2018-05-14 11:42     ` [PATCH 02/14] thermal: ti-soc-thermal: fix comment in omap5xxx-bandgap.h Bartlomiej Zolnierkiewicz
2018-07-11  2:21       ` J, KEERTHY
2018-07-11  2:21         ` J, KEERTHY
     [not found]   ` <CGME20180514114312epcas1p19fffd35baae3018f47df0fe31ca1b1b0@epcas1p1.samsung.com>
2018-05-14 11:42     ` [PATCH 03/14] thermal: ti-soc-thermal: fix comments in omap4-thermal-data.c Bartlomiej Zolnierkiewicz
2018-07-11  2:27       ` J, KEERTHY
2018-07-11  2:27         ` J, KEERTHY
     [not found]   ` <CGME20180514114319epcas1p1921a83c1baaaf1e6f94283f462022dc5@epcas1p1.samsung.com>
2018-05-14 11:42     ` [PATCH 04/14] thermal: ti-soc-thermal: cleanup COUNTER feature handling for OMAP5 Bartlomiej Zolnierkiewicz
2018-07-11  3:38       ` J, KEERTHY
2018-07-11  3:38         ` J, KEERTHY
     [not found]         ` <CGME20180725142832eucas1p26a8b5a1226b1043d57332b70ba5caaa0@eucas1p2.samsung.com>
2018-07-25 14:28           ` Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114326epcas2p2e27987b5be7a1fe614114466c6cf30f8@epcas2p2.samsung.com>
2018-05-14 11:42     ` [PATCH 05/14] thermal: ti-soc-thermal: remove redundant methods from struct ti_bandgap_data Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114331epcas2p3d52dea1f2feda21ff2cce1548f3f5bd4@epcas2p3.samsung.com>
2018-05-14 11:42     ` [PATCH 06/14] thermal: ti-soc-thermal: remove ->threshold_[thot,tcold]_mask fields Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114334epcas1p4c1b268d8253cda369826e67b06b4c28b@epcas1p4.samsung.com>
2018-05-14 11:42     ` [PATCH 07/14] thermal: ti-soc-thermal: remove ->tshut_[hot,cold]_mask fields Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114337epcas1p1ba67790ed771ab09c0be25712c8b385f@epcas1p1.samsung.com>
2018-05-14 11:42     ` [PATCH 08/14] thermal: ti-soc-thermal: use common struct temp_sensor_data for OMAP5 Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114340epcas2p10a9a4aad3064ad752cd2bea456581a98@epcas2p1.samsung.com>
2018-05-14 11:42     ` [PATCH 09/14] thermal: ti-soc-thermal: use common struct temp_sensor_data for DRA752 Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114343epcas2p4280b4ff50611a223a1b3ae37dbe743ee@epcas2p4.samsung.com>
2018-05-14 11:42     ` [PATCH 10/14] thermal: ti-soc-thermal: use OMAP5 defines " Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114346epcas1p4a59f6760861791ae53eac48975c9172a@epcas1p4.samsung.com>
2018-05-14 11:42     ` Bartlomiej Zolnierkiewicz [this message]
     [not found]   ` <CGME20180514114350epcas1p2d29cfa8de6b19096d91362c91feb2dc5@epcas1p2.samsung.com>
2018-05-14 11:42     ` [PATCH 12/14] thermal: ti-soc-thermal: add ->adc_to_mcelsius method Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114355epcas2p4c24f87c5a76ff3d3e9ed319ddc2e78ad@epcas2p4.samsung.com>
2018-05-14 11:42     ` [PATCH 13/14] thermal: ti-soc-thermal: use short int for *_adc_to_temp[] conversion tables Bartlomiej Zolnierkiewicz
     [not found]   ` <CGME20180514114400epcas2p193e6f6643171575aab079329bed79c2c@epcas2p1.samsung.com>
2018-05-14 11:42     ` [PATCH 14/14] thermal: ti-soc-thermal: remove SoC family config options Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526298141-14045-12-git-send-email-b.zolnierkie@samsung.com \
    --to=b.zolnierkie@samsung.com \
    --cc=edubezval@gmail.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.