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#ifndef __RFKILL_GPIO_H
203d0407baSopenharmony_ci#define __RFKILL_GPIO_H
213d0407baSopenharmony_ci
223d0407baSopenharmony_ci#include <linux/types.h>
233d0407baSopenharmony_ci#include <linux/rfkill.h>
243d0407baSopenharmony_ci#include <linux/clk.h>
253d0407baSopenharmony_ci
263d0407baSopenharmony_ci#define RFKILL_RK_GPIO_NAME_SIZE 64
273d0407baSopenharmony_ci
283d0407baSopenharmony_cistruct rfkill_rk_gpio {
293d0407baSopenharmony_ci    int io;
303d0407baSopenharmony_ci    char name[RFKILL_RK_GPIO_NAME_SIZE];
313d0407baSopenharmony_ci    int enable; // disable = !enable
323d0407baSopenharmony_ci    struct pinctrl_state *gpio_state;
333d0407baSopenharmony_ci    struct pinctrl_state *default_state;
343d0407baSopenharmony_ci};
353d0407baSopenharmony_ci
363d0407baSopenharmony_cistruct rfkill_rk_irq {
373d0407baSopenharmony_ci    char name[RFKILL_RK_GPIO_NAME_SIZE];
383d0407baSopenharmony_ci    struct rfkill_rk_gpio gpio;
393d0407baSopenharmony_ci    int irq;
403d0407baSopenharmony_ci};
413d0407baSopenharmony_ci
423d0407baSopenharmony_ci/**
433d0407baSopenharmony_ci * struct rfkill_rk_platform_data - platform data for rfkill gpio device.
443d0407baSopenharmony_ci * for unused gpio's, the expected value is -1.
453d0407baSopenharmony_ci * @name:               name for the gpio rf kill instance
463d0407baSopenharmony_ci * @reset_gpio:         GPIO which is used for reseting rfkill switch
473d0407baSopenharmony_ci * @shutdown_gpio:      GPIO which is used for shutdown of rfkill switch
483d0407baSopenharmony_ci */
493d0407baSopenharmony_ci
503d0407baSopenharmony_cistruct rfkill_rk_platform_data {
513d0407baSopenharmony_ci    char *name;
523d0407baSopenharmony_ci    enum rfkill_type type;
533d0407baSopenharmony_ci    bool power_toggle;
543d0407baSopenharmony_ci    struct pinctrl *pinctrl;
553d0407baSopenharmony_ci    struct rfkill_rk_gpio poweron_gpio;
563d0407baSopenharmony_ci    struct rfkill_rk_gpio reset_gpio;
573d0407baSopenharmony_ci    struct rfkill_rk_gpio wake_gpio;    // Host wake or sleep BT
583d0407baSopenharmony_ci    struct rfkill_rk_irq wake_host_irq; // BT wakeup host
593d0407baSopenharmony_ci    struct rfkill_rk_gpio rts_gpio;
603d0407baSopenharmony_ci    struct clk *ext_clk;
613d0407baSopenharmony_ci};
623d0407baSopenharmony_ci
633d0407baSopenharmony_ciint rfkill_get_bt_power_state(int *power, bool *toggle);
643d0407baSopenharmony_ci
653d0407baSopenharmony_ci#endif /* __RFKILL_GPIO_H */
66