linux/include/linux/mfd/lp8788.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * TI LP8788 MFD Device
 *
 * Copyright 2012 Texas Instruments
 *
 * Author: Milo(Woogyom) Kim <[email protected]>
 */

#ifndef __MFD_LP8788_H__
#define __MFD_LP8788_H__

#include <linux/irqdomain.h>
#include <linux/regmap.h>

#define LP8788_DEV_BUCK
#define LP8788_DEV_DLDO
#define LP8788_DEV_ALDO
#define LP8788_DEV_CHARGER
#define LP8788_DEV_RTC
#define LP8788_DEV_BACKLIGHT
#define LP8788_DEV_VIBRATOR
#define LP8788_DEV_KEYLED
#define LP8788_DEV_ADC

#define LP8788_NUM_BUCKS
#define LP8788_NUM_DLDOS
#define LP8788_NUM_ALDOS
#define LP8788_NUM_BUCK2_DVS

#define LP8788_CHG_IRQ
#define LP8788_PRSW_IRQ
#define LP8788_BATT_IRQ
#define LP8788_ALM_IRQ

enum lp8788_int_id {};

enum lp8788_dvs_sel {};

enum lp8788_ext_ldo_en_id {};

enum lp8788_charger_event {};

enum lp8788_bl_dim_mode {};

enum lp8788_bl_full_scale_current {};

enum lp8788_bl_ramp_step {};

enum lp8788_isink_scale {};

enum lp8788_isink_number {};

enum lp8788_alarm_sel {};

enum lp8788_adc_id {};

struct lp8788;

/*
 * lp8788_buck1_dvs
 * @vsel         : dvs selector for buck v1 register
 */
struct lp8788_buck1_dvs {};

/*
 * lp8788_buck2_dvs
 * @vsel         : dvs selector for buck v2 register
 */
struct lp8788_buck2_dvs {};

/*
 * struct lp8788_chg_param
 * @addr         : charging control register address (range : 0x11 ~ 0x1C)
 * @val          : charging parameter value
 */
struct lp8788_chg_param {};

/*
 * struct lp8788_charger_platform_data
 * @adc_vbatt         : adc channel name for battery voltage
 * @adc_batt_temp     : adc channel name for battery temperature
 * @max_vbatt_mv      : used for calculating battery capacity
 * @chg_params        : initial charging parameters
 * @num_chg_params    : numbers of charging parameters
 * @charger_event     : the charger event can be reported to the platform side
 */
struct lp8788_charger_platform_data {};

/*
 * struct lp8788_led_platform_data
 * @name         : led driver name. (default: "keyboard-backlight")
 * @scale        : current scale
 * @num          : current sink number
 * @iout_code    : current output value (Addr 9Ah ~ 9Bh)
 */
struct lp8788_led_platform_data {};

/*
 * struct lp8788_vib_platform_data
 * @name         : vibrator driver name
 * @scale        : current scale
 * @num          : current sink number
 * @iout_code    : current output value (Addr 9Ah ~ 9Bh)
 * @pwm_code     : PWM code value (Addr 9Ch ~ 9Eh)
 */
struct lp8788_vib_platform_data {};

/*
 * struct lp8788_platform_data
 * @init_func    : used for initializing registers
 *                 before mfd driver is registered
 * @buck_data    : regulator initial data for buck
 * @dldo_data    : regulator initial data for digital ldo
 * @aldo_data    : regulator initial data for analog ldo
 * @buck1_dvs    : configurations for buck1 dvs
 * @buck2_dvs    : configurations for buck2 dvs
 * @chg_pdata    : platform data for charger driver
 * @alarm_sel    : rtc alarm selection (1 or 2)
 * @led_pdata    : configurable data for led driver
 * @vib_pdata    : configurable data for vibrator driver
 * @adc_pdata    : iio map data for adc driver
 */
struct lp8788_platform_data {};

/*
 * struct lp8788
 * @dev          : parent device pointer
 * @regmap       : used for i2c communcation on accessing registers
 * @irqdm        : interrupt domain for handling nested interrupt
 * @irq          : pin number of IRQ_N
 * @pdata        : lp8788 platform specific data
 */
struct lp8788 {};

int lp8788_irq_init(struct lp8788 *lp, int chip_irq);
void lp8788_irq_exit(struct lp8788 *lp);
int lp8788_read_byte(struct lp8788 *lp, u8 reg, u8 *data);
int lp8788_read_multi_bytes(struct lp8788 *lp, u8 reg, u8 *data, size_t count);
int lp8788_write_byte(struct lp8788 *lp, u8 reg, u8 data);
int lp8788_update_bits(struct lp8788 *lp, u8 reg, u8 mask, u8 data);
#endif