arm: tegra: roth: Change thermal trip points
[linux-3.10.git] / arch / arm / mach-tegra / board-roth-fan.c
1 /*
2  * arch/arm/mach-tegra/board-roth-fan.c
3  *
4  * Copyright (c) 2012-2013 NVIDIA CORPORATION, All rights reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 #include <linux/gpio.h>
21 #include <linux/platform_data/pwm_fan.h>
22 #include <linux/platform_device.h>
23
24 #include <mach/gpio-tegra.h>
25
26 #include "gpio-names.h"
27 #include "devices.h"
28 #include "board.h"
29 #include "board-common.h"
30 #include "board-roth.h"
31 #include "tegra-board-id.h"
32
33 static struct pwm_fan_platform_data fan_data_yltc_8k = {
34         .active_steps = MAX_ACTIVE_STATES,
35         .active_rpm = {
36                 0, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000},
37         .active_pwm = {0, 158*1024, 227*1024 , 230*1024, 235*1024, 240*1024,
38                                 245*1024, 250*1024, 252*1024, 255*1024},
39         .active_rru = {1024*50, 1024, 1024, 256, 256, 256, 256, 256, 256, 256},
40         .active_rrd = {1024*50, 1024, 1024, 256, 256, 256, 256, 128, 128, 128},
41         .pwm_period = 256,
42         .pwm_id = 0,
43         .step_time = 100, /*msecs*/
44         .state_cap = 1,
45         .precision_multiplier = 1024,
46         .tach_gpio = -1,
47 };
48
49 static struct pwm_fan_platform_data fan_data_delta_6k = {
50         .active_steps = MAX_ACTIVE_STATES,
51         .active_rpm = {
52                 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 10000, 11000},
53         .active_pwm = {0, 107*1024, 150*1024 , 230*1024, 235*1024, 240*1024,
54                                 245*1024, 250*1024, 252*1024, 255*1024},
55         .active_rru = {1024*40, 1024*2, 1024, 256,
56                                                 256, 256, 256, 256, 256, 256},
57         .active_rrd = {1024*40, 1024*2, 1024, 256, 256,
58                                                 256, 256, 128, 128, 128},
59         .pwm_period = 256,
60         .pwm_id = 0,
61         .step_time = 100, /*msecs*/
62         .state_cap = 1,
63         .precision_multiplier = 1024,
64         .tach_gpio = TEGRA_GPIO_PU2,
65 };
66
67 static struct platform_device pwm_fan_therm_cooling_device_yltc_8k = {
68         .name = "pwm-fan",
69         .id = -1,
70         .num_resources = 0,
71         .dev = {
72                 .platform_data = &fan_data_yltc_8k,
73         },
74 };
75
76 static struct platform_device pwm_fan_therm_cooling_device_delta_6k = {
77         .name = "pwm-fan",
78         .id = -1,
79         .num_resources = 0,
80         .dev = {
81                 .platform_data = &fan_data_delta_6k,
82         },
83 };
84
85 int __init roth_fan_init(void)
86 {
87         int err;
88         struct board_info board_info;
89
90         tegra_get_board_info(&board_info);
91
92         err = gpio_request(TEGRA_GPIO_PU3, "pwm-fan");
93         if (err < 0) {
94                 pr_err("FAN:gpio request failed\n");
95                 return err;
96         }
97         gpio_free(TEGRA_GPIO_PU3);
98
99         if (board_info.board_id == BOARD_P2560) {
100                 platform_device_register(
101                                 &pwm_fan_therm_cooling_device_delta_6k);
102                 pr_info("FAN:registering for P2560\n");
103         } else {
104                 platform_device_register(&pwm_fan_therm_cooling_device_yltc_8k);
105                 pr_info("FAN:registering for P2454\n");
106         }
107         return 0;
108 }