linux/include/linux/mfd/stmfx.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2019 STMicroelectronics
 * Author(s): Amelie Delaunay <[email protected]>.
 */

#ifndef MFD_STMFX_H
#define MFD_STMFX_H

#include <linux/regmap.h>

/* General */
#define STMFX_REG_CHIP_ID
#define STMFX_REG_FW_VERSION_MSB
#define STMFX_REG_FW_VERSION_LSB
#define STMFX_REG_SYS_CTRL
/* IRQ output management */
#define STMFX_REG_IRQ_OUT_PIN
#define STMFX_REG_IRQ_SRC_EN
#define STMFX_REG_IRQ_PENDING
#define STMFX_REG_IRQ_ACK
/* GPIO management */
#define STMFX_REG_IRQ_GPI_PENDING1
#define STMFX_REG_IRQ_GPI_PENDING2
#define STMFX_REG_IRQ_GPI_PENDING3
#define STMFX_REG_GPIO_STATE1
#define STMFX_REG_GPIO_STATE2
#define STMFX_REG_GPIO_STATE3
#define STMFX_REG_IRQ_GPI_SRC1
#define STMFX_REG_IRQ_GPI_SRC2
#define STMFX_REG_IRQ_GPI_SRC3
#define STMFX_REG_IRQ_GPI_EVT1
#define STMFX_REG_IRQ_GPI_EVT2
#define STMFX_REG_IRQ_GPI_EVT3
#define STMFX_REG_IRQ_GPI_TYPE1
#define STMFX_REG_IRQ_GPI_TYPE2
#define STMFX_REG_IRQ_GPI_TYPE3
#define STMFX_REG_IRQ_GPI_ACK1
#define STMFX_REG_IRQ_GPI_ACK2
#define STMFX_REG_IRQ_GPI_ACK3
#define STMFX_REG_GPIO_DIR1
#define STMFX_REG_GPIO_DIR2
#define STMFX_REG_GPIO_DIR3
#define STMFX_REG_GPIO_TYPE1
#define STMFX_REG_GPIO_TYPE2
#define STMFX_REG_GPIO_TYPE3
#define STMFX_REG_GPIO_PUPD1
#define STMFX_REG_GPIO_PUPD2
#define STMFX_REG_GPIO_PUPD3
#define STMFX_REG_GPO_SET1
#define STMFX_REG_GPO_SET2
#define STMFX_REG_GPO_SET3
#define STMFX_REG_GPO_CLR1
#define STMFX_REG_GPO_CLR2
#define STMFX_REG_GPO_CLR3

#define STMFX_REG_MAX

/* MFX boot time is around 10ms, so after reset, we have to wait this delay */
#define STMFX_BOOT_TIME_MS

/* STMFX_REG_CHIP_ID bitfields */
#define STMFX_REG_CHIP_ID_MASK

/* STMFX_REG_SYS_CTRL bitfields */
#define STMFX_REG_SYS_CTRL_GPIO_EN
#define STMFX_REG_SYS_CTRL_TS_EN
#define STMFX_REG_SYS_CTRL_IDD_EN
#define STMFX_REG_SYS_CTRL_ALTGPIO_EN
#define STMFX_REG_SYS_CTRL_SWRST

/* STMFX_REG_IRQ_OUT_PIN bitfields */
#define STMFX_REG_IRQ_OUT_PIN_TYPE
#define STMFX_REG_IRQ_OUT_PIN_POL

/* STMFX_REG_IRQ_(SRC_EN/PENDING/ACK) bit shift */
enum stmfx_irqs {};

enum stmfx_functions {};

/**
 * struct stmfx_ddata - STMFX MFD structure
 * @device:		device reference used for logs
 * @map:		register map
 * @vdd:		STMFX power supply
 * @irq_domain:		IRQ domain
 * @lock:		IRQ bus lock
 * @irq_src:		cache of IRQ_SRC_EN register for bus_lock
 * @bkp_sysctrl:	backup of SYS_CTRL register for suspend/resume
 * @bkp_irqoutpin:	backup of IRQ_OUT_PIN register for suspend/resume
 */
struct stmfx {};

int stmfx_function_enable(struct stmfx *stmfx, u32 func);
int stmfx_function_disable(struct stmfx *stmfx, u32 func);
#endif