thermal: tegra: add T210-specific SOC_THERM driver
Subsystems (2)
PATCH v3 5/11 thermal: tegra: add T210-specific SOC_THERM driver
Add Tegra210 specific SOC_THERM driver.
--- drivers/thermal/tegra/Makefile | 1 + drivers/thermal/tegra/soctherm-fuse.c | 11 ++ drivers/thermal/tegra/soctherm.c | 6 + drivers/thermal/tegra/soctherm.h | 4 + drivers/thermal/tegra/tegra210-soctherm.c | 181 ++++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 drivers/thermal/tegra/tegra210-soctherm.c
drivers/thermal/tegra/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_TEGRA_SOCTHERM) += tegra-soctherm.o tegra-soctherm-y := soctherm.o soctherm-fuse.o tegra-soctherm-$(CONFIG_ARCH_TEGRA_124_SOC) += tegra124-soctherm.o +tegra-soctherm-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210-soctherm.o
drivers/thermal/tegra/soctherm-fuse.c +11 -0
@@ -28,7 +28,18 @@#define FUSE_TSENSOR_COMMON 0x180/* +* Tegra210: Layout of bits in FUSE_TSENSOR_COMMON: +* 3 2 1 0 +* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* | BASE_FT | BASE_CP | SHFT_FT | SHIFT_CP | +* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +* * Tegra12x, etc: +* In chips prior to T210, this fuse was incorrectly sized as 26 bits, +* and didn't hold SHIFT_CP in [31:26]. Therefore these missing six bits +* were obtained via the FUSE_SPARE_REALIGNMENT_REG register [5:0]. +* * FUSE_TSENSOR_COMMON: * 3 2 1 0 * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
drivers/thermal/tegra/soctherm.c +6 -0
@@ -144,6 +144,12 @@ static const struct of_device_id tegra_soctherm_of_match[] = { .data = &tegra124_soctherm, },#endif +#ifdef CONFIG_ARCH_TEGRA_210_SOC + { + .compatible = "nvidia,tegra210-soctherm", + .data = &tegra210_soctherm, + }, +#endif { }, };MODULE_DEVICE_TABLE (of, tegra_soctherm_of_match);
drivers/thermal/tegra/soctherm.h +4 -0
@@ -108,5 +108,9 @@ int tegra_soctherm_calculate_tsensor_calibration(extern struct tegra_soctherm_soc tegra124_soctherm;#endif +#ifdef CONFIG_ARCH_TEGRA_210_SOC +extern struct tegra_soctherm_soc tegra210_soctherm; +#endif +#endif
drivers/thermal/tegra/tegra210-soctherm.c new file +181 -0
181 lines not on this page · raw message
Signature · 1 line
1.9.1
Quoted 11 lines · Wei Ni
Add Tegra210 specific
SOC_THERMdriver.Signed-off-by Wei Ni <[email protected]>--- drivers/thermal/tegra/Makefile | 1 + drivers/thermal/tegra/soctherm-fuse.c | 11 ++ drivers/thermal/tegra/soctherm.c | 6 + drivers/thermal/tegra/soctherm.h | 4 + drivers/thermal/tegra/tegra210-soctherm.c | 181 ++++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 drivers/thermal/tegra/tegra210-soctherm.c
This looks pretty good, just a few minor nits...
Quoted 1 line
drivers/thermal/tegra/soctherm.h +0
-0
[...]
drivers/thermal/tegra/soctherm.h int tegra_soctherm_calculate_tsensor_calibration( · line 112
Quoted 9 lines
index
1ac66cafb392..bd0f03bc9d80100644drivers/thermal/tegra/soctherm.h +2
-0@@ -108,5 +108,9 @@ int tegra_soctherm_calculate_tsensor_calibration(extern struct tegra_soctherm_soc tegra124_soctherm;#endif +#ifdef CONFIG_ARCH_TEGRA_210_SOC +extern struct tegra_soctherm_soc tegra210_soctherm;
I would've expected this to be "const".
Quoted 1 line
drivers/thermal/tegra/tegra210-soctherm.c +0
-0
[...]
drivers/thermal/tegra/tegra210-soctherm.c line 41
Quoted 11 lines
drivers/thermal/tegra/tegra210-soctherm.c +11
-0+static const struct tegra_tsensor_group tegra210_tsensor_group_cpu = { + .id =TEGRA124_SOCTHERM_SENSOR_CPU , + .name ="cpu" , + .sensor_temp_offset =SENSOR_TEMP1 , + .sensor_temp_mask =SENSOR_TEMP1_CPU_TEMP_MASK , + .pdiv =8 , + .pdiv_ate =8 , + .pdiv_mask =SENSOR_PDIV_CPU_MASK , + .pllx_hotspot_diff =10 , + .pllx_hotspot_mask =SENSOR_HOTSPOT_CPU_MASK , +};
I prefer single spaces for padding because I find it easier to read that way. Also using tabs to make this look like a table has the drawback that you run the risk of having to adjust padding for all fields when a new field is added whose name is longer than any existing ones. Or you have to rely on excessive padding (such as in this case) to make that unlikely. So I don't see any advantage in this, but I don't have very strong objections either.
drivers/thermal/tegra/tegra210-soctherm.c line 78
Quoted 2 lines
drivers/thermal/tegra/tegra210-soctherm.c +2
-0+static const struct tegra_tsensor_group * +tegra210_tsensor_groups[] = {
Why wrap these two lines? They seem to fit on one line and within 78 columns.
Quoted 1 line
+static struct
tegra_tsensortegra210_tsensors[] = {
"static const"?
drivers/thermal/tegra/tegra210-soctherm.c line 95
Quoted 10 lines
drivers/thermal/tegra/tegra210-soctherm.c +10
-0+ { + .name = "cpu0", + .base = 0xc0, + .config = &tegra210_tsensor_config, + .calib_fuse_offset = 0x098, + .fuse_corr_alpha = 1085000, + .fuse_corr_beta = 3244200, + .group = &tegra210_tsensor_group_cpu, + }, + {
"}," and "{" can go on the same line.
Quoted 1 line
+struct
tegra_soctherm_soctegra210_soctherm= {
"const"?
Thierry
Quoted 26 lines · Thierry Reding
* PGP Signed by an unknown key
Quoted 11 lines · Wei Ni
Add Tegra210 specific
SOC_THERMdriver.Signed-off-by Wei Ni <[email protected]>--- drivers/thermal/tegra/Makefile | 1 + drivers/thermal/tegra/soctherm-fuse.c | 11 ++ drivers/thermal/tegra/soctherm.c | 6 + drivers/thermal/tegra/soctherm.h | 4 + drivers/thermal/tegra/tegra210-soctherm.c | 181 ++++++++++++++++++++++++++++++ 5 files changed, 203 insertions(+) create mode 100644 drivers/thermal/tegra/tegra210-soctherm.cThis looks pretty good, just a few minor nits...
Quoted 1 line
drivers/thermal/tegra/soctherm.h +0
-0[...]
Quoted 7 lines
index
1ac66cafb392..bd0f03bc9d80100644drivers/thermal/tegra/soctherm.h +0
-0@@ -108,5 +108,9 @@ int tegra_soctherm_calculate_tsensor_calibration(extern struct tegra_soctherm_soc tegra124_soctherm;#endif
Quoted 4 lines
drivers/thermal/tegra/soctherm.h int tegra_soctherm_calculate_tsensor_calibration( · line 112
Quoted 2 lines
drivers/thermal/tegra/soctherm.h +2
-0+#ifdef CONFIG_ARCH_TEGRA_210_SOC +extern struct tegra_soctherm_soc tegra210_soctherm;I would've expected this to be "const".
Yes, will change it.
Quoted 15 lines
Quoted 2 lines
drivers/thermal/tegra/tegra210-soctherm.c +0
-0[...]
drivers/thermal/tegra/tegra210-soctherm.c line 41
Quoted 11 lines
drivers/thermal/tegra/tegra210-soctherm.c +11
-0+static const struct tegra_tsensor_group tegra210_tsensor_group_cpu = { + .id =TEGRA124_SOCTHERM_SENSOR_CPU , + .name ="cpu" , + .sensor_temp_offset =SENSOR_TEMP1 , + .sensor_temp_mask =SENSOR_TEMP1_CPU_TEMP_MASK , + .pdiv =8 , + .pdiv_ate =8 , + .pdiv_mask =SENSOR_PDIV_CPU_MASK , + .pllx_hotspot_diff =10 , + .pllx_hotspot_mask =SENSOR_HOTSPOT_CPU_MASK , +};
Quoted 7 lines
I prefer single spaces for padding because I find it easier to read that way. Also using tabs to make this look like a table has the drawback that you run the risk of having to adjust padding for all fields when a new field is added whose name is longer than any existing ones. Or you have to rely on excessive padding (such as in this case) to make that unlikely. So I don't see any advantage in this, but I don't have very strong objections either.
Ok, will change it.
Quoted 6 lines
drivers/thermal/tegra/tegra210-soctherm.c line 78
Quoted 3 lines
drivers/thermal/tegra/tegra210-soctherm.c +2
-0+static const struct tegra_tsensor_group * +tegra210_tsensor_groups[] = {Why wrap these two lines? They seem to fit on one line and within 78 columns.
Hmm, will fix it.
Quoted 4 lines
Quoted 2 lines
+static struct
tegra_tsensortegra210_tsensors[] = {"static const"?
Will change to "const".
Quoted 13 lines
drivers/thermal/tegra/tegra210-soctherm.c line 95
Quoted 11 lines
drivers/thermal/tegra/tegra210-soctherm.c +10
-0+ { + .name = "cpu0", + .base = 0xc0, + .config = &tegra210_tsensor_config, + .calib_fuse_offset = 0x098, + .fuse_corr_alpha = 1085000, + .fuse_corr_beta = 3244200, + .group = &tegra210_tsensor_group_cpu, + }, + {"}," and "{" can go on the same line.
Will change it.
Quoted 10 lines
Quoted 2 lines
+struct
tegra_soctherm_soctegra210_soctherm= {"const"?
Thierry
* Unknown Key
*0x7F3EB3A1