13d0407baSopenharmony_ci/*
23d0407baSopenharmony_ci * Copyright (c) 2011, NVIDIA Corporation.
33d0407baSopenharmony_ci *
43d0407baSopenharmony_ci * This program is free software; you can redistribute it and/or modify
53d0407baSopenharmony_ci * it under the terms of the GNU General Public License as published by
63d0407baSopenharmony_ci * the Free Software Foundation; either version 2 of the License, or
73d0407baSopenharmony_ci * (at your option) any later version.
83d0407baSopenharmony_ci *
93d0407baSopenharmony_ci * This program is distributed in the hope that it will be useful, but WITHOUT
103d0407baSopenharmony_ci * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
113d0407baSopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
123d0407baSopenharmony_ci * more details.
133d0407baSopenharmony_ci *
143d0407baSopenharmony_ci * You should have received a copy of the GNU General Public License along
153d0407baSopenharmony_ci * with this program; if not, write to the Free Software Foundation, Inc.,
163d0407baSopenharmony_ci * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
173d0407baSopenharmony_ci */
183d0407baSopenharmony_ci
193d0407baSopenharmony_ci
203d0407baSopenharmony_ci#ifndef __RFKILL_GPIO_H
213d0407baSopenharmony_ci#define __RFKILL_GPIO_H
223d0407baSopenharmony_ci
233d0407baSopenharmony_ci#include <linux/types.h>
243d0407baSopenharmony_ci#include <linux/rfkill.h>
253d0407baSopenharmony_ci#include <linux/clk.h>
263d0407baSopenharmony_ci
273d0407baSopenharmony_ci#define RFKILL_RK_GPIO_NAME_SIZE   64
283d0407baSopenharmony_ci
293d0407baSopenharmony_ci//struct rfkill_rk_iomux {
303d0407baSopenharmony_ci//    char    *name;
313d0407baSopenharmony_ci//    int     fgpio;
323d0407baSopenharmony_ci//    int     fmux;
333d0407baSopenharmony_ci//};
343d0407baSopenharmony_ci
353d0407baSopenharmony_cistruct rfkill_rk_gpio {
363d0407baSopenharmony_ci    int     io;
373d0407baSopenharmony_ci    char    name[RFKILL_RK_GPIO_NAME_SIZE];
383d0407baSopenharmony_ci    int     enable; // disable = !enable
393d0407baSopenharmony_ci    struct  pinctrl_state    *gpio_state;
403d0407baSopenharmony_ci    struct  pinctrl_state    *default_state;
413d0407baSopenharmony_ci};
423d0407baSopenharmony_ci
433d0407baSopenharmony_cistruct rfkill_rk_irq {
443d0407baSopenharmony_ci    char                    name[RFKILL_RK_GPIO_NAME_SIZE];
453d0407baSopenharmony_ci    struct rfkill_rk_gpio   gpio;
463d0407baSopenharmony_ci    int                     irq;
473d0407baSopenharmony_ci};
483d0407baSopenharmony_ci
493d0407baSopenharmony_ci/**
503d0407baSopenharmony_ci * struct rfkill_rk_platform_data - platform data for rfkill gpio device.
513d0407baSopenharmony_ci * for unused gpio's, the expected value is -1.
523d0407baSopenharmony_ci * @name:               name for the gpio rf kill instance
533d0407baSopenharmony_ci * @reset_gpio:         GPIO which is used for reseting rfkill switch
543d0407baSopenharmony_ci * @shutdown_gpio:      GPIO which is used for shutdown of rfkill switch
553d0407baSopenharmony_ci */
563d0407baSopenharmony_ci
573d0407baSopenharmony_cistruct rfkill_rk_platform_data {
583d0407baSopenharmony_ci    char                    *name;
593d0407baSopenharmony_ci    enum rfkill_type        type;
603d0407baSopenharmony_ci    bool                    power_toggle;
613d0407baSopenharmony_ci    struct pinctrl          *pinctrl;
623d0407baSopenharmony_ci    struct rfkill_rk_gpio   poweron_gpio;
633d0407baSopenharmony_ci    struct rfkill_rk_gpio   reset_gpio;
643d0407baSopenharmony_ci    struct rfkill_rk_gpio   wake_gpio;      // Host wake or sleep BT
653d0407baSopenharmony_ci    struct rfkill_rk_irq    wake_host_irq;  // BT wakeup host
663d0407baSopenharmony_ci    struct rfkill_rk_gpio   rts_gpio;
673d0407baSopenharmony_ci    struct clk              *ext_clk;
683d0407baSopenharmony_ci};
693d0407baSopenharmony_ci
703d0407baSopenharmony_ciint rfkill_get_bt_power_state(int *power, bool *toggle);
713d0407baSopenharmony_civoid rfkill_rk_sleep_bt(bool sleep);
723d0407baSopenharmony_ci
733d0407baSopenharmony_ci#endif /* __RFKILL_GPIO_H */
743d0407baSopenharmony_ci
75