linux/include/linux/mfd/ezx-pcap.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright 2009 Daniel Ribeiro <[email protected]>
 *
 * For further information, please see http://wiki.openezx.org/PCAP2
 */

#ifndef EZX_PCAP_H
#define EZX_PCAP_H

struct pcap_subdev {};

struct pcap_platform_data {};

struct pcap_chip;

int ezx_pcap_write(struct pcap_chip *, u8, u32);
int ezx_pcap_read(struct pcap_chip *, u8, u32 *);
int ezx_pcap_set_bits(struct pcap_chip *, u8, u32, u32);
int pcap_to_irq(struct pcap_chip *, int);
int irq_to_pcap(struct pcap_chip *, int);
int pcap_adc_async(struct pcap_chip *, u8, u32, u8[], void *, void *);
int pcap_adc_sync(struct pcap_chip *, u8, u32, u8[], u16[]);
void pcap_set_ts_bits(struct pcap_chip *, u32);

#define PCAP_SECOND_PORT
#define PCAP_CS_AH

#define PCAP_REGISTER_WRITE_OP_BIT
#define PCAP_REGISTER_READ_OP_BIT

#define PCAP_REGISTER_VALUE_MASK
#define PCAP_REGISTER_ADDRESS_MASK
#define PCAP_REGISTER_ADDRESS_SHIFT
#define PCAP_REGISTER_NUMBER
#define PCAP_CLEAR_INTERRUPT_REGISTER
#define PCAP_MASK_ALL_INTERRUPT

/* registers accessible by both pcap ports */
#define PCAP_REG_ISR
#define PCAP_REG_MSR
#define PCAP_REG_PSTAT
#define PCAP_REG_VREG2
#define PCAP_REG_AUXVREG
#define PCAP_REG_BATT
#define PCAP_REG_ADC
#define PCAP_REG_ADR
#define PCAP_REG_CODEC
#define PCAP_REG_RX_AMPS
#define PCAP_REG_ST_DAC
#define PCAP_REG_BUSCTRL
#define PCAP_REG_PERIPH
#define PCAP_REG_LOWPWR
#define PCAP_REG_TX_AMPS
#define PCAP_REG_GP
#define PCAP_REG_TEST1
#define PCAP_REG_TEST2
#define PCAP_REG_VENDOR_TEST1
#define PCAP_REG_VENDOR_TEST2

/* registers accessible by pcap port 1 only (a1200, e2 & e6) */
#define PCAP_REG_INT_SEL
#define PCAP_REG_SWCTRL
#define PCAP_REG_VREG1
#define PCAP_REG_RTC_TOD
#define PCAP_REG_RTC_TODA
#define PCAP_REG_RTC_DAY
#define PCAP_REG_RTC_DAYA
#define PCAP_REG_MTRTMR
#define PCAP_REG_PWR
#define PCAP_REG_AUXVREG_MASK
#define PCAP_REG_VENDOR_REV
#define PCAP_REG_PERIPH_MASK

/* PCAP2 Interrupts */
#define PCAP_NIRQS
#define PCAP_IRQ_ADCDONE
#define PCAP_IRQ_TS
#define PCAP_IRQ_1HZ
#define PCAP_IRQ_WH
#define PCAP_IRQ_WL
#define PCAP_IRQ_TODA
#define PCAP_IRQ_USB4V
#define PCAP_IRQ_ONOFF
#define PCAP_IRQ_ONOFF2
#define PCAP_IRQ_USB1V
#define PCAP_IRQ_MOBPORT
#define PCAP_IRQ_MIC
#define PCAP_IRQ_HS
#define PCAP_IRQ_ST
#define PCAP_IRQ_PC
#define PCAP_IRQ_WARM
#define PCAP_IRQ_EOL
#define PCAP_IRQ_CLK
#define PCAP_IRQ_SYSRST
#define PCAP_IRQ_DUMMY
#define PCAP_IRQ_ADCDONE2
#define PCAP_IRQ_SOFTRESET
#define PCAP_IRQ_MNEXB

/* voltage regulators */
#define V1
#define V2
#define V3
#define V4
#define V5
#define V6
#define V7
#define V8
#define V9
#define V10
#define VAUX1
#define VAUX2
#define VAUX3
#define VAUX4
#define VSIM
#define VSIM2
#define VVIB
#define SW1
#define SW2
#define SW3
#define SW1S
#define SW2S

#define PCAP_BATT_DAC_MASK
#define PCAP_BATT_DAC_SHIFT
#define PCAP_BATT_B_FDBK
#define PCAP_BATT_EXT_ISENSE
#define PCAP_BATT_V_COIN_MASK
#define PCAP_BATT_V_COIN_SHIFT
#define PCAP_BATT_I_COIN
#define PCAP_BATT_COIN_CH_EN
#define PCAP_BATT_EOL_SEL_MASK
#define PCAP_BATT_EOL_SEL_SHIFT
#define PCAP_BATT_EOL_CMP_EN
#define PCAP_BATT_BATT_DET_EN
#define PCAP_BATT_THERMBIAS_CTRL

#define PCAP_ADC_ADEN
#define PCAP_ADC_RAND
#define PCAP_ADC_AD_SEL1
#define PCAP_ADC_AD_SEL2
#define PCAP_ADC_ADA1_MASK
#define PCAP_ADC_ADA1_SHIFT
#define PCAP_ADC_ADA2_MASK
#define PCAP_ADC_ADA2_SHIFT
#define PCAP_ADC_ATO_MASK
#define PCAP_ADC_ATO_SHIFT
#define PCAP_ADC_ATOX
#define PCAP_ADC_MTR1
#define PCAP_ADC_MTR2
#define PCAP_ADC_TS_M_MASK
#define PCAP_ADC_TS_M_SHIFT
#define PCAP_ADC_TS_REF_LOWPWR
#define PCAP_ADC_TS_REFENB
#define PCAP_ADC_BATT_I_POLARITY
#define PCAP_ADC_BATT_I_ADC

#define PCAP_ADC_BANK_0
#define PCAP_ADC_BANK_1
/* ADC bank 0 */
#define PCAP_ADC_CH_COIN
#define PCAP_ADC_CH_BATT
#define PCAP_ADC_CH_BPLUS
#define PCAP_ADC_CH_MOBPORTB
#define PCAP_ADC_CH_TEMPERATURE
#define PCAP_ADC_CH_CHARGER_ID
#define PCAP_ADC_CH_AD6
/* ADC bank 1 */
#define PCAP_ADC_CH_AD7
#define PCAP_ADC_CH_AD8
#define PCAP_ADC_CH_AD9
#define PCAP_ADC_CH_TS_X1
#define PCAP_ADC_CH_TS_X2
#define PCAP_ADC_CH_TS_Y1
#define PCAP_ADC_CH_TS_Y2

#define PCAP_ADC_T_NOW
#define PCAP_ADC_T_IN_BURST
#define PCAP_ADC_T_OUT_BURST

#define PCAP_ADC_ATO_IN_BURST
#define PCAP_ADC_ATO_OUT_BURST

#define PCAP_ADC_TS_M_XY
#define PCAP_ADC_TS_M_PRESSURE
#define PCAP_ADC_TS_M_PLATE_X
#define PCAP_ADC_TS_M_PLATE_Y
#define PCAP_ADC_TS_M_STANDBY
#define PCAP_ADC_TS_M_NONTS

#define PCAP_ADR_ADD1_MASK
#define PCAP_ADR_ADD1_SHIFT
#define PCAP_ADR_ADD2_MASK
#define PCAP_ADR_ADD2_SHIFT
#define PCAP_ADR_ADINC1
#define PCAP_ADR_ADINC2
#define PCAP_ADR_ASC
#define PCAP_ADR_ONESHOT

#define PCAP_BUSCTRL_FSENB
#define PCAP_BUSCTRL_USB_SUSPEND
#define PCAP_BUSCTRL_USB_PU
#define PCAP_BUSCTRL_USB_PD
#define PCAP_BUSCTRL_VUSB_EN
#define PCAP_BUSCTRL_USB_PS
#define PCAP_BUSCTRL_VUSB_MSTR_EN
#define PCAP_BUSCTRL_VBUS_PD_ENB
#define PCAP_BUSCTRL_CURRLIM
#define PCAP_BUSCTRL_RS232ENB
#define PCAP_BUSCTRL_RS232_DIR
#define PCAP_BUSCTRL_SE0_CONN
#define PCAP_BUSCTRL_USB_PDM
#define PCAP_BUSCTRL_BUS_PRI_ADJ

/* leds */
#define PCAP_LED0
#define PCAP_LED1
#define PCAP_BL0
#define PCAP_BL1
#define PCAP_LED_3MA
#define PCAP_LED_4MA
#define PCAP_LED_5MA
#define PCAP_LED_9MA
#define PCAP_LED_T_MASK
#define PCAP_LED_C_MASK
#define PCAP_BL_MASK
#define PCAP_BL0_SHIFT
#define PCAP_LED0_EN
#define PCAP_LED1_EN
#define PCAP_LED0_T_SHIFT
#define PCAP_LED1_T_SHIFT
#define PCAP_LED0_C_SHIFT
#define PCAP_LED1_C_SHIFT
#define PCAP_BL1_SHIFT

/* RTC */
#define PCAP_RTC_DAY_MASK
#define PCAP_RTC_TOD_MASK
#define PCAP_RTC_PC_MASK
#define SEC_PER_DAY

#endif