From: Anshul Jain Date: Tue, 13 Aug 2013 02:17:33 +0000 (-0700) Subject: arm: tegra12: loki: PWM fan device added X-Git-Tag: daily-2014.03.25.0_l4t/l4t-r19.1~2069^2~125 X-Git-Url: https://nv-tegra.nvidia.com/r/gitweb?p=linux-3.10.git;a=commitdiff_plain;h=a6c922184ec0387b0aa06df06def15b9301d0445 arm: tegra12: loki: PWM fan device added This change add the PWM fan device. Bug 1364451 Change-Id: I53e9493efdbbf0507a5cda97dea3a5c2c0898c8e Signed-off-by: Anshul Jain Reviewed-on: http://git-master/r/274643 Reviewed-by: Diwakar Tundlam Tested-by: Diwakar Tundlam --- diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index b114c9482f2..658af051a7f 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -278,6 +278,7 @@ obj-${CONFIG_MACH_LOKI} += board-loki-sensors.o obj-${CONFIG_MACH_LOKI} += board-loki-panel.o obj-${CONFIG_MACH_LOKI} += board-loki-pinmux.o obj-${CONFIG_MACH_LOKI} += board-loki-power.o +obj-${CONFIG_MACH_LOKI} += board-loki-fan.o obj-${CONFIG_MACH_LOKI} += board-tn8-power.o obj-${CONFIG_MACH_LOKI} += board-loki-powermon.o obj-${CONFIG_MACH_LOKI} += board-loki-sdhci.o diff --git a/arch/arm/mach-tegra/board-loki-fan.c b/arch/arm/mach-tegra/board-loki-fan.c new file mode 100644 index 00000000000..b493a908b96 --- /dev/null +++ b/arch/arm/mach-tegra/board-loki-fan.c @@ -0,0 +1,79 @@ +/* + * arch/arm/mach-tegra/board-loki-fan.c + * + * Copyright (c) 2013 NVIDIA CORPORATION, All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include + +#include + +#include "gpio-names.h" +#include "devices.h" +#include "board.h" +#include "board-common.h" +#include "board-loki.h" +#include "tegra-board-id.h" + +static struct pwm_fan_platform_data fan_data_delta_6k = { + .active_steps = MAX_ACTIVE_STATES, + .active_rpm = { + 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 10000, 11000}, + .active_pwm = {0, 80*1024, 110*1024 , 150*1024, 235*1024, 240*1024, + 245*1024, 250*1024, 252*1024, 255*1024}, + .active_rru = {1024*40, 1024*2, 1024, 256, + 256, 256, 256, 256, 256, 256}, + .active_rrd = {1024*40, 1024*2, 1024, 256, 256, + 256, 256, 128, 128, 128}, + .state_cap_lookup = {2, 2, 2, 2, 2, 2, 2, 3, 3, 3}, + .pwm_period = 256, + .pwm_id = 0, + .step_time = 100, /*msecs*/ + .state_cap = 2, + .precision_multiplier = 1024, + .tach_gpio = TEGRA_GPIO_PU2, +}; + +static struct platform_device pwm_fan_therm_cooling_device_delta_6k = { + .name = "pwm-fan", + .id = -1, + .num_resources = 0, + .dev = { + .platform_data = &fan_data_delta_6k, + }, +}; + +int __init loki_fan_init(void) +{ + int err; + struct board_info board_info; + + tegra_get_board_info(&board_info); + + err = gpio_request(TEGRA_GPIO_PU3, "pwm-fan"); + if (err < 0) { + pr_err("FAN:gpio request failed\n"); + return err; + } + gpio_free(TEGRA_GPIO_PU3); + + platform_device_register( + &pwm_fan_therm_cooling_device_delta_6k); + pr_info("Registering Fan!\n"); + return 0; +} diff --git a/arch/arm/mach-tegra/board-loki.c b/arch/arm/mach-tegra/board-loki.c index 85c83327fae..6369c761964 100644 --- a/arch/arm/mach-tegra/board-loki.c +++ b/arch/arm/mach-tegra/board-loki.c @@ -826,6 +826,7 @@ static void __init tegra_loki_late_init(void) tegra_serial_debug_init(TEGRA_UARTD_BASE, INT_WDT_CPU, NULL, -1, -1); loki_sensors_init(); + loki_fan_init(); #if 0 loki_soctherm_init(); #endif diff --git a/arch/arm/mach-tegra/board-loki.h b/arch/arm/mach-tegra/board-loki.h index 91177172da5..78b6ae26a52 100644 --- a/arch/arm/mach-tegra/board-loki.h +++ b/arch/arm/mach-tegra/board-loki.h @@ -140,5 +140,6 @@ GPIO, also the GPIO is same for T114 interposer and T124*/ /* TN8 specific */ int tn8_regulator_init(void); +int loki_fan_init(void); #endif