2 * Copyright (C) 2010 Motorola, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 #include <linux/gpio.h>
20 #include <linux/gps-gpio-brcm4750.h>
21 #include <linux/kernel.h>
22 #include <linux/platform_device.h>
23 #include "board-stingray.h"
24 #include "gpio-names.h"
26 #define STINGRAY_GPS_RESET TEGRA_GPIO_PH0
27 #define STINGRAY_GPS_STANDBY TEGRA_GPIO_PH1
28 #define STINGRAY_GPS_UART_CTS TEGRA_GPIO_PY6
30 static void stingray_gps_reset_gpio(unsigned int gpio_val)
32 pr_info("%s: setting GPS Reset GPIO to %d\n", __func__, gpio_val);
33 gpio_set_value(STINGRAY_GPS_RESET, gpio_val);
36 static void stingray_gps_standby_gpio(unsigned int gpio_val)
38 pr_info("%s: setting GPS standby GPIO to %d\n", __func__, gpio_val);
39 gpio_set_value(STINGRAY_GPS_STANDBY, gpio_val);
42 static void stingray_gps_gpio_release(void)
44 gpio_free(STINGRAY_GPS_RESET);
45 gpio_free(STINGRAY_GPS_STANDBY);
48 static void stingray_gps_gpio_init(void)
50 tegra_gpio_enable(STINGRAY_GPS_RESET);
51 gpio_request(STINGRAY_GPS_RESET, "gps_rst");
52 gpio_direction_output(STINGRAY_GPS_RESET, 0);
54 tegra_gpio_enable(STINGRAY_GPS_STANDBY);
55 gpio_request(STINGRAY_GPS_STANDBY, "gps_stdby");
56 gpio_direction_output(STINGRAY_GPS_STANDBY, 0);
58 if (stingray_revision() < STINGRAY_REVISION_P3) {
59 tegra_gpio_enable(STINGRAY_GPS_UART_CTS);
60 gpio_request(STINGRAY_GPS_UART_CTS, "uarte_cts");
61 gpio_direction_output(STINGRAY_GPS_UART_CTS, 0);
62 gpio_set_value(STINGRAY_GPS_UART_CTS, 0);
66 struct gps_gpio_brcm4750_platform_data stingray_gps_gpio_data = {
67 .set_reset_gpio = stingray_gps_reset_gpio,
68 .set_standby_gpio = stingray_gps_standby_gpio,
69 .free_gpio = stingray_gps_gpio_release,
72 static struct platform_device stingray_gps_device = {
73 .name = GPS_GPIO_DRIVER_NAME,
76 .platform_data = &stingray_gps_gpio_data,
80 void __init stingray_gps_init(void)
82 stingray_gps_gpio_init();
83 platform_device_register(&stingray_gps_device);