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