linux/include/linux/mfd/adp5520.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Definitions and platform data for Analog Devices
 * ADP5520/ADP5501 MFD PMICs (Backlight, LED, GPIO and Keys)
 *
 * Copyright 2009 Analog Devices Inc.
 */


#ifndef __LINUX_MFD_ADP5520_H
#define __LINUX_MFD_ADP5520_H

#define ID_ADP5520
#define ID_ADP5501

/*
 * ADP5520/ADP5501 Register Map
 */

#define ADP5520_MODE_STATUS
#define ADP5520_INTERRUPT_ENABLE
#define ADP5520_BL_CONTROL
#define ADP5520_BL_TIME
#define ADP5520_BL_FADE
#define ADP5520_DAYLIGHT_MAX
#define ADP5520_DAYLIGHT_DIM
#define ADP5520_OFFICE_MAX
#define ADP5520_OFFICE_DIM
#define ADP5520_DARK_MAX
#define ADP5520_DARK_DIM
#define ADP5520_BL_VALUE
#define ADP5520_ALS_CMPR_CFG
#define ADP5520_L2_TRIP
#define ADP5520_L2_HYS
#define ADP5520_L3_TRIP
#define ADP5520_L3_HYS
#define ADP5520_LED_CONTROL
#define ADP5520_LED_TIME
#define ADP5520_LED_FADE
#define ADP5520_LED1_CURRENT
#define ADP5520_LED2_CURRENT
#define ADP5520_LED3_CURRENT

/*
 * ADP5520 Register Map
 */

#define ADP5520_GPIO_CFG_1
#define ADP5520_GPIO_CFG_2
#define ADP5520_GPIO_IN
#define ADP5520_GPIO_OUT
#define ADP5520_GPIO_INT_EN
#define ADP5520_GPIO_INT_STAT
#define ADP5520_GPIO_INT_LVL
#define ADP5520_GPIO_DEBOUNCE
#define ADP5520_GPIO_PULLUP
#define ADP5520_KP_INT_STAT_1
#define ADP5520_KP_INT_STAT_2
#define ADP5520_KR_INT_STAT_1
#define ADP5520_KR_INT_STAT_2
#define ADP5520_KEY_STAT_1
#define ADP5520_KEY_STAT_2

/*
 * MODE_STATUS bits
 */

#define ADP5520_nSTNBY
#define ADP5520_BL_EN
#define ADP5520_DIM_EN
#define ADP5520_OVP_INT
#define ADP5520_CMPR_INT
#define ADP5520_GPI_INT
#define ADP5520_KR_INT
#define ADP5520_KP_INT

/*
 * INTERRUPT_ENABLE bits
 */

#define ADP5520_AUTO_LD_EN
#define ADP5520_CMPR_IEN
#define ADP5520_OVP_IEN
#define ADP5520_KR_IEN
#define ADP5520_KP_IEN

/*
 * BL_CONTROL bits
 */

#define ADP5520_BL_LVL
#define ADP5520_BL_LAW
#define ADP5520_BL_AUTO_ADJ
#define ADP5520_OVP_EN
#define ADP5520_FOVR
#define ADP5520_KP_BL_EN

/*
 * ALS_CMPR_CFG bits
 */

#define ADP5520_L3_OUT
#define ADP5520_L2_OUT
#define ADP5520_L3_EN

#define ADP5020_MAX_BRIGHTNESS

#define FADE_VAL(in, out)
#define BL_CTRL_VAL(law, auto)
#define ALS_CMPR_CFG_VAL(filt, l3_en)

/*
 * LEDs subdevice bits and masks
 */

#define ADP5520_01_MAXLEDS

#define ADP5520_FLAG_LED_MASK
#define ADP5520_FLAG_OFFT_SHIFT
#define ADP5520_FLAG_OFFT_MASK

#define ADP5520_R3_MODE
#define ADP5520_C3_MODE
#define ADP5520_LED_LAW
#define ADP5520_LED3_EN
#define ADP5520_LED2_EN
#define ADP5520_LED1_EN

/*
 * GPIO subdevice bits and masks
 */

#define ADP5520_MAXGPIOS

#define ADP5520_GPIO_C3
#define ADP5520_GPIO_C2
#define ADP5520_GPIO_C1
#define ADP5520_GPIO_C0
#define ADP5520_GPIO_R3
#define ADP5520_GPIO_R2
#define ADP5520_GPIO_R1
#define ADP5520_GPIO_R0

struct adp5520_gpio_platform_data {};

/*
 * Keypad subdevice bits and masks
 */

#define ADP5520_MAXKEYS

#define ADP5520_COL_C3
#define ADP5520_COL_C2
#define ADP5520_COL_C1
#define ADP5520_COL_C0
#define ADP5520_ROW_R3
#define ADP5520_ROW_R2
#define ADP5520_ROW_R1
#define ADP5520_ROW_R0

#define ADP5520_KEY(row, col)
#define ADP5520_KEYMAPSIZE

struct adp5520_keys_platform_data {};


/*
 * LEDs subdevice platform data
 */

#define FLAG_ID_ADP5520_LED1_ADP5501_LED0
#define FLAG_ID_ADP5520_LED2_ADP5501_LED1
#define FLAG_ID_ADP5520_LED3_ADP5501_LED2

#define ADP5520_LED_DIS_BLINK
#define ADP5520_LED_OFFT_600ms
#define ADP5520_LED_OFFT_800ms
#define ADP5520_LED_OFFT_1200ms

#define ADP5520_LED_ONT_200ms
#define ADP5520_LED_ONT_600ms
#define ADP5520_LED_ONT_800ms
#define ADP5520_LED_ONT_1200ms

struct adp5520_leds_platform_data {};

/*
 * Backlight subdevice platform data
 */

#define ADP5520_FADE_T_DIS
#define ADP5520_FADE_T_300ms
#define ADP5520_FADE_T_600ms
#define ADP5520_FADE_T_900ms
#define ADP5520_FADE_T_1200ms
#define ADP5520_FADE_T_1500ms
#define ADP5520_FADE_T_1800ms
#define ADP5520_FADE_T_2100ms
#define ADP5520_FADE_T_2400ms
#define ADP5520_FADE_T_2700ms
#define ADP5520_FADE_T_3000ms
#define ADP5520_FADE_T_3500ms
#define ADP5520_FADE_T_4000ms
#define ADP5520_FADE_T_4500ms
#define ADP5520_FADE_T_5000ms
#define ADP5520_FADE_T_5500ms

#define ADP5520_BL_LAW_LINEAR
#define ADP5520_BL_LAW_SQUARE
#define ADP5520_BL_LAW_CUBIC1
#define ADP5520_BL_LAW_CUBIC2

#define ADP5520_BL_AMBL_FILT_80ms
#define ADP5520_BL_AMBL_FILT_160ms
#define ADP5520_BL_AMBL_FILT_320ms
#define ADP5520_BL_AMBL_FILT_640ms
#define ADP5520_BL_AMBL_FILT_1280ms
#define ADP5520_BL_AMBL_FILT_2560ms
#define ADP5520_BL_AMBL_FILT_5120ms
#define ADP5520_BL_AMBL_FILT_10240ms

	/*
	 * Blacklight current 0..30mA
	 */
#define ADP5520_BL_CUR_mA(I)

	/*
	 * L2 comparator current 0..1000uA
	 */
#define ADP5520_L2_COMP_CURR_uA(I)

	/*
	 * L3 comparator current 0..127uA
	 */
#define ADP5520_L3_COMP_CURR_uA(I)

struct adp5520_backlight_platform_data {};

/*
 * MFD chip platform data
 */

struct adp5520_platform_data {};

/*
 * MFD chip functions
 */

extern int adp5520_read(struct device *dev, int reg, uint8_t *val);
extern int adp5520_write(struct device *dev, int reg, u8 val);
extern int adp5520_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
extern int adp5520_set_bits(struct device *dev, int reg, uint8_t bit_mask);

extern int adp5520_register_notifier(struct device *dev,
		 struct notifier_block *nb, unsigned int events);

extern int adp5520_unregister_notifier(struct device *dev,
		struct notifier_block *nb, unsigned int events);

#endif /* __LINUX_MFD_ADP5520_H */