thermal: rockchip: add rk3328 support
authorRocky Hao <rocky.hao@rock-chips.com>
Fri, 24 Feb 2017 06:51:53 +0000 (14:51 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 27 Feb 2017 06:49:58 +0000 (14:49 +0800)
Change-Id: I31f87741a874657fb7caf494ebafd53b6c0ef3b1
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
drivers/thermal/rockchip_thermal.c

index 0c937ec..cd26a1f 100644 (file)
@@ -4,6 +4,7 @@ Required properties:
 - compatible : should be "rockchip,<name>-tsadc"
    "rockchip,rk3228-tsadc": found on RK3228 SoCs
    "rockchip,rk3288-tsadc": found on RK3288 SoCs
+   "rockchip,rk3328-tsadc": found on RK3328 SoCs
    "rockchip,rk3366-tsadc": found on RK3366 SoCs
    "rockchip,rk3368-tsadc": found on RK3368 SoCs
    "rockchip,rk3399-tsadc": found on RK3399 SoCs
index fb68b74..0360d87 100644 (file)
@@ -319,6 +319,44 @@ static const struct tsadc_table rk3288_code_table[] = {
        {3421, 125000},
 };
 
+static const struct tsadc_table rk3328_code_table[] = {
+       {0, -40000},
+       {296, -40000},
+       {304, -35000},
+       {313, -30000},
+       {331, -20000},
+       {340, -15000},
+       {349, -10000},
+       {359, -5000},
+       {368, 0},
+       {378, 5000},
+       {388, 10000},
+       {398, 15000},
+       {408, 20000},
+       {418, 25000},
+       {429, 30000},
+       {440, 35000},
+       {451, 40000},
+       {462, 45000},
+       {473, 50000},
+       {485, 55000},
+       {496, 60000},
+       {508, 65000},
+       {521, 70000},
+       {533, 75000},
+       {546, 80000},
+       {559, 85000},
+       {572, 90000},
+       {586, 95000},
+       {600, 100000},
+       {614, 105000},
+       {629, 110000},
+       {644, 115000},
+       {659, 120000},
+       {675, 125000},
+       {TSADCV2_DATA_MASK, 125000},
+};
+
 static const struct tsadc_table rk3368_code_table[] = {
        {0, -40000},
        {106, -40000},
@@ -748,6 +786,29 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = {
        },
 };
 
+static const struct rockchip_tsadc_chip rk3328_tsadc_data = {
+       .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
+       .chn_num = 1, /* one channels for tsadc */
+
+       .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
+       .tshut_temp = 95000,
+
+       .initialize = rk_tsadcv2_initialize,
+       .irq_ack = rk_tsadcv3_irq_ack,
+       .control = rk_tsadcv3_control,
+       .get_temp = rk_tsadcv2_get_temp,
+       .set_alarm_temp = rk_tsadcv2_alarm_temp,
+       .set_tshut_temp = rk_tsadcv2_tshut_temp,
+       .set_tshut_mode = rk_tsadcv2_tshut_mode,
+
+       .table = {
+               .id = rk3328_code_table,
+               .length = ARRAY_SIZE(rk3328_code_table),
+               .data_mask = TSADCV2_DATA_MASK,
+               .mode = ADC_INCREMENT,
+       },
+};
+
 static const struct rockchip_tsadc_chip rk3366_tsadc_data = {
        .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
        .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
@@ -832,6 +893,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = {
                .compatible = "rockchip,rk3288-tsadc",
                .data = (void *)&rk3288_tsadc_data,
        },
+       {
+               .compatible = "rockchip,rk3328-tsadc",
+               .data = (void *)&rk3328_tsadc_data,
+       },
        {
                .compatible = "rockchip,rk3366-tsadc",
                .data = (void *)&rk3366_tsadc_data,