linux/include/linux/mfd/wm8350/gpio.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * gpio.h  --  GPIO Driver for Wolfson WM8350 PMIC
 *
 * Copyright 2007 Wolfson Microelectronics PLC
 */

#ifndef __LINUX_MFD_WM8350_GPIO_H_
#define __LINUX_MFD_WM8350_GPIO_H_

#include <linux/platform_device.h>

/*
 * GPIO Registers.
 */
#define WM8350_GPIO_DEBOUNCE
#define WM8350_GPIO_PIN_PULL_UP_CONTROL
#define WM8350_GPIO_PULL_DOWN_CONTROL
#define WM8350_GPIO_INT_MODE
#define WM8350_GPIO_CONTROL
#define WM8350_GPIO_CONFIGURATION_I_O
#define WM8350_GPIO_PIN_POLARITY_TYPE
#define WM8350_GPIO_FUNCTION_SELECT_1
#define WM8350_GPIO_FUNCTION_SELECT_2
#define WM8350_GPIO_FUNCTION_SELECT_3
#define WM8350_GPIO_FUNCTION_SELECT_4
#define WM8350_GPIO_LEVEL

/*
 * GPIO Functions
 */
#define WM8350_GPIO0_GPIO_IN
#define WM8350_GPIO0_GPIO_OUT
#define WM8350_GPIO0_PWR_ON_IN
#define WM8350_GPIO0_PWR_ON_OUT
#define WM8350_GPIO0_LDO_EN_IN
#define WM8350_GPIO0_VRTC_OUT
#define WM8350_GPIO0_LPWR1_IN
#define WM8350_GPIO0_POR_B_OUT

#define WM8350_GPIO1_GPIO_IN
#define WM8350_GPIO1_GPIO_OUT
#define WM8350_GPIO1_PWR_ON_IN
#define WM8350_GPIO1_DO_CONF_OUT
#define WM8350_GPIO1_LDO_EN_IN
#define WM8350_GPIO1_RESET_OUT
#define WM8350_GPIO1_LPWR2_IN
#define WM8350_GPIO1_MEMRST_OUT

#define WM8350_GPIO2_GPIO_IN
#define WM8350_GPIO2_GPIO_OUT
#define WM8350_GPIO2_PWR_ON_IN
#define WM8350_GPIO2_PWR_ON_OUT
#define WM8350_GPIO2_WAKE_UP_IN
#define WM8350_GPIO2_VRTC_OUT
#define WM8350_GPIO2_32KHZ_IN
#define WM8350_GPIO2_32KHZ_OUT

#define WM8350_GPIO3_GPIO_IN
#define WM8350_GPIO3_GPIO_OUT
#define WM8350_GPIO3_PWR_ON_IN
#define WM8350_GPIO3_P_CLK_OUT
#define WM8350_GPIO3_LDO_EN_IN
#define WM8350_GPIO3_VRTC_OUT
#define WM8350_GPIO3_PWR_OFF_IN
#define WM8350_GPIO3_32KHZ_OUT

#define WM8350_GPIO4_GPIO_IN
#define WM8350_GPIO4_GPIO_OUT
#define WM8350_GPIO4_MR_IN
#define WM8350_GPIO4_MEM_RST_OUT
#define WM8350_GPIO4_FLASH_IN
#define WM8350_GPIO4_ADA_OUT
#define WM8350_GPIO4_HIBERNATE_IN
#define WM8350_GPIO4_FLASH_OUT
#define WM8350_GPIO4_MICDET_OUT
#define WM8350_GPIO4_MICSHT_OUT

#define WM8350_GPIO5_GPIO_IN
#define WM8350_GPIO5_GPIO_OUT
#define WM8350_GPIO5_LPWR1_IN
#define WM8350_GPIO5_P_CLK_OUT
#define WM8350_GPIO5_ADCLRCLK_IN
#define WM8350_GPIO5_ADCLRCLK_OUT
#define WM8350_GPIO5_HIBERNATE_IN
#define WM8350_GPIO5_32KHZ_OUT
#define WM8350_GPIO5_MICDET_OUT
#define WM8350_GPIO5_MICSHT_OUT
#define WM8350_GPIO5_ADA_OUT
#define WM8350_GPIO5_OPCLK_OUT

#define WM8350_GPIO6_GPIO_IN
#define WM8350_GPIO6_GPIO_OUT
#define WM8350_GPIO6_LPWR2_IN
#define WM8350_GPIO6_MEMRST_OUT
#define WM8350_GPIO6_FLASH_IN
#define WM8350_GPIO6_ADA_OUT
#define WM8350_GPIO6_HIBERNATE_IN
#define WM8350_GPIO6_RTC_OUT
#define WM8350_GPIO6_MICDET_OUT
#define WM8350_GPIO6_MICSHT_OUT
#define WM8350_GPIO6_ADCLRCLKB_OUT
#define WM8350_GPIO6_SDOUT_OUT

#define WM8350_GPIO7_GPIO_IN
#define WM8350_GPIO7_GPIO_OUT
#define WM8350_GPIO7_LPWR3_IN
#define WM8350_GPIO7_P_CLK_OUT
#define WM8350_GPIO7_MASK_IN
#define WM8350_GPIO7_VCC_FAULT_OUT
#define WM8350_GPIO7_HIBERNATE_IN
#define WM8350_GPIO7_BATT_FAULT_OUT
#define WM8350_GPIO7_MICDET_OUT
#define WM8350_GPIO7_MICSHT_OUT
#define WM8350_GPIO7_ADA_OUT
#define WM8350_GPIO7_CSB_IN

#define WM8350_GPIO8_GPIO_IN
#define WM8350_GPIO8_GPIO_OUT
#define WM8350_GPIO8_MR_IN
#define WM8350_GPIO8_VCC_FAULT_OUT
#define WM8350_GPIO8_ADCBCLK_IN
#define WM8350_GPIO8_ADCBCLK_OUT
#define WM8350_GPIO8_PWR_OFF_IN
#define WM8350_GPIO8_BATT_FAULT_OUT
#define WM8350_GPIO8_ALTSCL_IN

#define WM8350_GPIO9_GPIO_IN
#define WM8350_GPIO9_GPIO_OUT
#define WM8350_GPIO9_HEARTBEAT_IN
#define WM8350_GPIO9_VCC_FAULT_OUT
#define WM8350_GPIO9_MASK_IN
#define WM8350_GPIO9_LINE_GT_BATT_OUT
#define WM8350_GPIO9_PWR_OFF_IN
#define WM8350_GPIO9_BATT_FAULT_OUT
#define WM8350_GPIO9_ALTSDA_OUT

#define WM8350_GPIO10_GPIO_IN
#define WM8350_GPIO10_GPIO_OUT
#define WM8350_GPIO10_ISINKC_OUT
#define WM8350_GPIO10_PWR_OFF_IN
#define WM8350_GPIO10_LINE_GT_BATT_OUT
#define WM8350_GPIO10_CHD_IND_IN

#define WM8350_GPIO11_GPIO_IN
#define WM8350_GPIO11_GPIO_OUT
#define WM8350_GPIO11_ISINKD_OUT
#define WM8350_GPIO11_WAKEUP_IN
#define WM8350_GPIO11_LINE_GT_BATT_OUT
#define WM8350_GPIO11_CHD_IND_IN

#define WM8350_GPIO12_GPIO_IN
#define WM8350_GPIO12_GPIO_OUT
#define WM8350_GPIO12_ISINKE_OUT
#define WM8350_GPIO12_LINE_GT_BATT_OUT
#define WM8350_GPIO12_LINE_EN_OUT
#define WM8350_GPIO12_32KHZ_OUT

#define WM8350_GPIO_DIR_IN
#define WM8350_GPIO_DIR_OUT
#define WM8350_GPIO_ACTIVE_LOW
#define WM8350_GPIO_ACTIVE_HIGH
#define WM8350_GPIO_PULL_NONE
#define WM8350_GPIO_PULL_UP
#define WM8350_GPIO_PULL_DOWN
#define WM8350_GPIO_INVERT_OFF
#define WM8350_GPIO_INVERT_ON
#define WM8350_GPIO_DEBOUNCE_OFF
#define WM8350_GPIO_DEBOUNCE_ON

/*
 * R30 (0x1E) - GPIO Interrupt Status
 */
#define WM8350_GP12_EINT
#define WM8350_GP11_EINT
#define WM8350_GP10_EINT
#define WM8350_GP9_EINT
#define WM8350_GP8_EINT
#define WM8350_GP7_EINT
#define WM8350_GP6_EINT
#define WM8350_GP5_EINT
#define WM8350_GP4_EINT
#define WM8350_GP3_EINT
#define WM8350_GP2_EINT
#define WM8350_GP1_EINT
#define WM8350_GP0_EINT


/*
 * R128 (0x80) - GPIO Debounce
 */
#define WM8350_GP12_DB
#define WM8350_GP11_DB
#define WM8350_GP10_DB
#define WM8350_GP9_DB
#define WM8350_GP8_DB
#define WM8350_GP7_DB
#define WM8350_GP6_DB
#define WM8350_GP5_DB
#define WM8350_GP4_DB
#define WM8350_GP3_DB
#define WM8350_GP2_DB
#define WM8350_GP1_DB
#define WM8350_GP0_DB

/*
 * R129 (0x81) - GPIO Pin pull up Control
 */
#define WM8350_GP12_PU
#define WM8350_GP11_PU
#define WM8350_GP10_PU
#define WM8350_GP9_PU
#define WM8350_GP8_PU
#define WM8350_GP7_PU
#define WM8350_GP6_PU
#define WM8350_GP5_PU
#define WM8350_GP4_PU
#define WM8350_GP3_PU
#define WM8350_GP2_PU
#define WM8350_GP1_PU
#define WM8350_GP0_PU

/*
 * R130 (0x82) - GPIO Pull down Control
 */
#define WM8350_GP12_PD
#define WM8350_GP11_PD
#define WM8350_GP10_PD
#define WM8350_GP9_PD
#define WM8350_GP8_PD
#define WM8350_GP7_PD
#define WM8350_GP6_PD
#define WM8350_GP5_PD
#define WM8350_GP4_PD
#define WM8350_GP3_PD
#define WM8350_GP2_PD
#define WM8350_GP1_PD
#define WM8350_GP0_PD

/*
 * R131 (0x83) - GPIO Interrupt Mode
 */
#define WM8350_GP12_INTMODE
#define WM8350_GP11_INTMODE
#define WM8350_GP10_INTMODE
#define WM8350_GP9_INTMODE
#define WM8350_GP8_INTMODE
#define WM8350_GP7_INTMODE
#define WM8350_GP6_INTMODE
#define WM8350_GP5_INTMODE
#define WM8350_GP4_INTMODE
#define WM8350_GP3_INTMODE
#define WM8350_GP2_INTMODE
#define WM8350_GP1_INTMODE
#define WM8350_GP0_INTMODE

/*
 * R133 (0x85) - GPIO Control
 */
#define WM8350_GP_DBTIME_MASK

/*
 * R134 (0x86) - GPIO Configuration (i/o)
 */
#define WM8350_GP12_DIR
#define WM8350_GP11_DIR
#define WM8350_GP10_DIR
#define WM8350_GP9_DIR
#define WM8350_GP8_DIR
#define WM8350_GP7_DIR
#define WM8350_GP6_DIR
#define WM8350_GP5_DIR
#define WM8350_GP4_DIR
#define WM8350_GP3_DIR
#define WM8350_GP2_DIR
#define WM8350_GP1_DIR
#define WM8350_GP0_DIR

/*
 * R135 (0x87) - GPIO Pin Polarity / Type
 */
#define WM8350_GP12_CFG
#define WM8350_GP11_CFG
#define WM8350_GP10_CFG
#define WM8350_GP9_CFG
#define WM8350_GP8_CFG
#define WM8350_GP7_CFG
#define WM8350_GP6_CFG
#define WM8350_GP5_CFG
#define WM8350_GP4_CFG
#define WM8350_GP3_CFG
#define WM8350_GP2_CFG
#define WM8350_GP1_CFG
#define WM8350_GP0_CFG

/*
 * R140 (0x8C) - GPIO Function Select 1
 */
#define WM8350_GP3_FN_MASK
#define WM8350_GP2_FN_MASK
#define WM8350_GP1_FN_MASK
#define WM8350_GP0_FN_MASK

/*
 * R141 (0x8D) - GPIO Function Select 2
 */
#define WM8350_GP7_FN_MASK
#define WM8350_GP6_FN_MASK
#define WM8350_GP5_FN_MASK
#define WM8350_GP4_FN_MASK

/*
 * R142 (0x8E) - GPIO Function Select 3
 */
#define WM8350_GP11_FN_MASK
#define WM8350_GP10_FN_MASK
#define WM8350_GP9_FN_MASK
#define WM8350_GP8_FN_MASK

/*
 * R143 (0x8F) - GPIO Function Select 4
 */
#define WM8350_GP12_FN_MASK

/*
 * R230 (0xE6) - GPIO Pin Status
 */
#define WM8350_GP12_LVL
#define WM8350_GP11_LVL
#define WM8350_GP10_LVL
#define WM8350_GP9_LVL
#define WM8350_GP8_LVL
#define WM8350_GP7_LVL
#define WM8350_GP6_LVL
#define WM8350_GP5_LVL
#define WM8350_GP4_LVL
#define WM8350_GP3_LVL
#define WM8350_GP2_LVL
#define WM8350_GP1_LVL
#define WM8350_GP0_LVL

struct wm8350;

int wm8350_gpio_config(struct wm8350 *wm8350, int gpio, int dir, int func,
		       int pol, int pull, int invert, int debounce);

struct wm8350_gpio {};

/*
 * GPIO Interrupts
 */
#define WM8350_IRQ_GPIO(x)

#endif