|
31 | 31 | #define AUXADC_CON2_V 0x010 |
32 | 32 | #define AUXADC_DATA(channel) (0x14 + (channel) * 4) |
33 | 33 |
|
| 34 | +#define APMIXED_SYS_TS_CON0 0x600 |
34 | 35 | #define APMIXED_SYS_TS_CON1 0x604 |
35 | 36 |
|
36 | 37 | /* Thermal Controller Registers */ |
@@ -281,6 +282,17 @@ enum mtk_thermal_version { |
281 | 282 | /* The calibration coefficient of sensor */ |
282 | 283 | #define MT7986_CALIBRATION 165 |
283 | 284 |
|
| 285 | +/* MT8365 */ |
| 286 | +#define MT8365_TEMP_AUXADC_CHANNEL 11 |
| 287 | +#define MT8365_CALIBRATION 164 |
| 288 | +#define MT8365_NUM_CONTROLLER 1 |
| 289 | +#define MT8365_NUM_BANKS 1 |
| 290 | +#define MT8365_NUM_SENSORS 3 |
| 291 | +#define MT8365_NUM_SENSORS_PER_ZONE 3 |
| 292 | +#define MT8365_TS1 0 |
| 293 | +#define MT8365_TS2 1 |
| 294 | +#define MT8365_TS3 2 |
| 295 | + |
284 | 296 | struct mtk_thermal; |
285 | 297 |
|
286 | 298 | struct thermal_bank_cfg { |
@@ -435,6 +447,24 @@ static const int mt7986_mux_values[MT7986_NUM_SENSORS] = { 0, }; |
435 | 447 | static const int mt7986_vts_index[MT7986_NUM_SENSORS] = { VTS1 }; |
436 | 448 | static const int mt7986_tc_offset[MT7986_NUM_CONTROLLER] = { 0x0, }; |
437 | 449 |
|
| 450 | +/* MT8365 thermal sensor data */ |
| 451 | +static const int mt8365_bank_data[MT8365_NUM_SENSORS] = { |
| 452 | + MT8365_TS1, MT8365_TS2, MT8365_TS3 |
| 453 | +}; |
| 454 | + |
| 455 | +static const int mt8365_msr[MT8365_NUM_SENSORS_PER_ZONE] = { |
| 456 | + TEMP_MSR0, TEMP_MSR1, TEMP_MSR2 |
| 457 | +}; |
| 458 | + |
| 459 | +static const int mt8365_adcpnp[MT8365_NUM_SENSORS_PER_ZONE] = { |
| 460 | + TEMP_ADCPNP0, TEMP_ADCPNP1, TEMP_ADCPNP2 |
| 461 | +}; |
| 462 | + |
| 463 | +static const int mt8365_mux_values[MT8365_NUM_SENSORS] = { 0, 1, 2 }; |
| 464 | +static const int mt8365_tc_offset[MT8365_NUM_CONTROLLER] = { 0 }; |
| 465 | + |
| 466 | +static const int mt8365_vts_index[MT8365_NUM_SENSORS] = { VTS1, VTS2, VTS3 }; |
| 467 | + |
438 | 468 | /* |
439 | 469 | * The MT8173 thermal controller has four banks. Each bank can read up to |
440 | 470 | * four temperature sensors simultaneously. The MT8173 has a total of 5 |
@@ -509,6 +539,40 @@ static const struct mtk_thermal_data mt2701_thermal_data = { |
509 | 539 | .version = MTK_THERMAL_V1, |
510 | 540 | }; |
511 | 541 |
|
| 542 | +/* |
| 543 | + * The MT8365 thermal controller has one bank, which can read up to |
| 544 | + * four temperature sensors simultaneously. The MT8365 has a total of 3 |
| 545 | + * temperature sensors. |
| 546 | + * |
| 547 | + * The thermal core only gets the maximum temperature of this one bank, |
| 548 | + * so the bank concept wouldn't be necessary here. However, the SVS (Smart |
| 549 | + * Voltage Scaling) unit makes its decisions based on the same bank |
| 550 | + * data. |
| 551 | + */ |
| 552 | +static const struct mtk_thermal_data mt8365_thermal_data = { |
| 553 | + .auxadc_channel = MT8365_TEMP_AUXADC_CHANNEL, |
| 554 | + .num_banks = MT8365_NUM_BANKS, |
| 555 | + .num_sensors = MT8365_NUM_SENSORS, |
| 556 | + .vts_index = mt8365_vts_index, |
| 557 | + .cali_val = MT8365_CALIBRATION, |
| 558 | + .num_controller = MT8365_NUM_CONTROLLER, |
| 559 | + .controller_offset = mt8365_tc_offset, |
| 560 | + .need_switch_bank = false, |
| 561 | + .bank_data = { |
| 562 | + { |
| 563 | + .num_sensors = MT8365_NUM_SENSORS, |
| 564 | + .sensors = mt8365_bank_data |
| 565 | + }, |
| 566 | + }, |
| 567 | + .msr = mt8365_msr, |
| 568 | + .adcpnp = mt8365_adcpnp, |
| 569 | + .sensor_mux_values = mt8365_mux_values, |
| 570 | + .version = MTK_THERMAL_V1, |
| 571 | + .apmixed_buffer_ctl_reg = APMIXED_SYS_TS_CON0, |
| 572 | + .apmixed_buffer_ctl_mask = (u32) ~GENMASK(29, 28), |
| 573 | + .apmixed_buffer_ctl_set = 0, |
| 574 | +}; |
| 575 | + |
512 | 576 | /* |
513 | 577 | * The MT2712 thermal controller has one bank, which can read up to |
514 | 578 | * four temperature sensors simultaneously. The MT2712 has a total of 4 |
@@ -1080,6 +1144,10 @@ static const struct of_device_id mtk_thermal_of_match[] = { |
1080 | 1144 | { |
1081 | 1145 | .compatible = "mediatek,mt8183-thermal", |
1082 | 1146 | .data = (void *)&mt8183_thermal_data, |
| 1147 | + }, |
| 1148 | + { |
| 1149 | + .compatible = "mediatek,mt8365-thermal", |
| 1150 | + .data = (void *)&mt8365_thermal_data, |
1083 | 1151 | }, { |
1084 | 1152 | }, |
1085 | 1153 | }; |
|
0 commit comments