• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2011, NVIDIA Corporation.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17  */
18 
19 
20 #ifndef __RFKILL_GPIO_H
21 #define __RFKILL_GPIO_H
22 
23 #include <linux/types.h>
24 #include <linux/rfkill.h>
25 #include <linux/clk.h>
26 
27 #define RFKILL_RK_GPIO_NAME_SIZE   64
28 
29 //struct rfkill_rk_iomux {
30 //    char    *name;
31 //    int     fgpio;
32 //    int     fmux;
33 //};
34 
35 struct rfkill_rk_gpio {
36     int     io;
37     char    name[RFKILL_RK_GPIO_NAME_SIZE];
38     int     enable; // disable = !enable
39     struct  pinctrl_state    *gpio_state;
40     struct  pinctrl_state    *default_state;
41 };
42 
43 struct rfkill_rk_irq {
44     char                    name[RFKILL_RK_GPIO_NAME_SIZE];
45     struct rfkill_rk_gpio   gpio;
46     int                     irq;
47 };
48 
49 /**
50  * struct rfkill_rk_platform_data - platform data for rfkill gpio device.
51  * for unused gpio's, the expected value is -1.
52  * @name:               name for the gpio rf kill instance
53  * @reset_gpio:         GPIO which is used for reseting rfkill switch
54  * @shutdown_gpio:      GPIO which is used for shutdown of rfkill switch
55  */
56 
57 struct rfkill_rk_platform_data {
58     char                    *name;
59     enum rfkill_type        type;
60     bool                    power_toggle;
61     struct pinctrl          *pinctrl;
62     struct rfkill_rk_gpio   poweron_gpio;
63     struct rfkill_rk_gpio   reset_gpio;
64     struct rfkill_rk_gpio   wake_gpio;      // Host wake or sleep BT
65     struct rfkill_rk_irq    wake_host_irq;  // BT wakeup host
66     struct rfkill_rk_gpio   rts_gpio;
67     struct clk              *ext_clk;
68 };
69 
70 int rfkill_get_bt_power_state(int *power, bool *toggle);
71 void rfkill_rk_sleep_bt(bool sleep);
72 
73 #endif /* __RFKILL_GPIO_H */
74 
75