/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */
/*
 * This header provides macros for MAXIM MAX77851 device bindings.
 */

#ifndef _DT_BINDINGS_MFD_MAX77851_H
#define _DT_BINDINGS_MFD_MAX77851_H

/* MAX77851 interrupts */
#define MAX77851_IRQ_TOP_GLBL		0 /* Low-Battery */
#define MAX77851_IRQ_TOP_SD		1 /* SD power fail */
#define MAX77851_IRQ_TOP_LDO		2 /* LDO power fail */
#define MAX77851_IRQ_TOP_GPIO		3 /* GPIO internal int to MAX77851 */
#define MAX77851_IRQ_TOP_RTC		4 /* RTC */
#define MAX77851_IRQ_TOP_32K		5 /* 32kHz oscillator */
#define MAX77851_IRQ_TOP_ONOFF		6 /* ON/OFF oscillator */
#define MAX77851_IRQ_LBT_MBATLOW	7 /* Thermal alarm status, > 120C */
#define MAX77851_IRQ_LBT_TJALRM1	8 /* Thermal alarm status, > 120C */
#define MAX77851_IRQ_LBT_TJALRM2	9 /* Thermal alarm status, > 140C */

/* FPS event source */
#define MAX77851_FPS_EVENT_SRC_EN0		0
#define MAX77851_FPS_EVENT_SRC_EN1		1
#define MAX77851_FPS_EVENT_SRC_SW		2

/* Device state when FPS event LOW  */
#define MAX77851_FPS_INACTIVE_STATE_SLEEP	0
#define MAX77851_FPS_INACTIVE_STATE_LOW_POWER	1

/* FPS source */
#define MAX77851_FPS_SRC_0			0
#define MAX77851_FPS_SRC_1			1
#define MAX77851_FPS_SRC_2			2

#define MAX77851_FPS_SRC_NONE			3
#define MAX77851_FPS_SRC_DEF			4

/* FPS Period */
#define FPS_PERIOD_32KHZ_30US     0x00
#define FPS_PERIOD_32KHZ_61US     0x01
#define FPS_PERIOD_32KHZ_122US    0x02
#define FPS_PERIOD_32KHZ_244US    0x03
#define FPS_PERIOD_32KHZ_488US    0x04
#define FPS_PERIOD_32KHZ_762US    0x05
#define FPS_PERIOD_32KHZ_1007US   0x06
#define FPS_PERIOD_32KHZ_1251US   0x07
#define FPS_PERIOD_32KHZ_1495US   0x08
#define FPS_PERIOD_32KHZ_1739US   0x09
#define FPS_PERIOD_32KHZ_2014US   0x0A
#define FPS_PERIOD_32KHZ_2990US   0x0B
#define FPS_PERIOD_32KHZ_3997US   0x0C
#define FPS_PERIOD_32KHZ_5004US   0x0D
#define FPS_PERIOD_32KHZ_6011US   0x0E
#define FPS_PERIOD_32KHZ_7995US   0x0F

#define FPS_PERIOD_4KHZ_025US     0x00
#define FPS_PERIOD_4KHZ_050US     0x01
#define FPS_PERIOD_4KHZ_1US       0x02
#define FPS_PERIOD_4KHZ_2US       0x03
#define FPS_PERIOD_4KHZ_4US       0x04
#define FPS_PERIOD_4KHZ_8US       0x05
#define FPS_PERIOD_4KHZ_16US      0x06
#define FPS_PERIOD_4KHZ_25US      0x07
#define FPS_PERIOD_4KHZ_50US      0x08
#define FPS_PERIOD_4KHZ_100US     0x09
#define FPS_PERIOD_4KHZ_250US     0x0A
#define FPS_PERIOD_4KHZ_500US     0x0B
#define FPS_PERIOD_4KHZ_1000US    0x0C
#define FPS_PERIOD_4KHZ_2000US    0x0D
#define FPS_PERIOD_4KHZ_3000US    0x0E
#define FPS_PERIOD_4KHZ_4000US    0x0F

/* INPUT DEBOUNCE FILTER */
#define MAX77851_NO_RESYNC_NO_DEB           0x00
#define MAX77851_RESYNC_NO_DEB              0x01
#define MAX77851_RESYNC_100US_DEB           0x02
#define MAX77851_RESYNC_1MS_DEB             0x03
#define MAX77851_RESYNC_4MS_DEB             0x04
#define MAX77851_RESYNC_8MS_DEB             0x05
#define MAX77851_RESYNC_16MS_DEB            0x06
#define MAX77851_RESYNC_32MS_DEB            0x07

#define MAX77851_FPS_DISABLE      0x00
#define MAX77851_FPS_ENABLE       0x01
#define MAX77851_FPS_DEFAULT      0x02

#define MAX77851_FPS_ABORT_DISABLE   0x00
#define MAX77851_FPS_ABORT_ENABLE    0x01

#define MAX77851_FPS_SLEEP_DISABLE   0x00
#define MAX77851_FPS_SLEEP_ENABLE    0x01
#define MAX77851_FPS_SLEEP_LPM       0x02
#define MAX77851_FPS_SLEEP_ULPM      0x03

#define MAX77851_FPS_ABORT_NEXT_SLOT           0x00
#define MAX77851_FPS_ABORT_NEXT_MASTER_SLOT    0x01

#define MAX77851_FPS_16_SLOTS       0x00
#define MAX77851_FPS_12_SLOTS       0x01
#define MAX77851_FPS_10_SLOTS       0x02
#define MAX77851_FPS_08_SLOTS       0x03

#define MAX77851_FPS_MASTER_SLOT_0  0x1
#define MAX77851_FPS_MASTER_SLOT_1  0x2
#define MAX77851_FPS_MASTER_SLOT_2  0x4
#define MAX77851_FPS_MASTER_SLOT_3  0x8

#define MAX77851_FPS_MX_MASTER_SLOT_0  0x0
#define MAX77851_FPS_MX_MASTER_SLOT_1  0x1
#define MAX77851_FPS_MX_MASTER_SLOT_2  0x2
#define MAX77851_FPS_MX_MASTER_SLOT_3  0x3

#define MAX77851_FPS_SLOT_0  0x0
#define MAX77851_FPS_SLOT_1  0x1
#define MAX77851_FPS_SLOT_2  0x2
#define MAX77851_FPS_SLOT_3  0x3
#define MAX77851_FPS_SLOT_4  0x4
#define MAX77851_FPS_SLOT_5  0x5
#define MAX77851_FPS_SLOT_6  0x6
#define MAX77851_FPS_SLOT_7  0x7
#define MAX77851_FPS_SLOT_8  0x8
#define MAX77851_FPS_SLOT_9  0x9
#define MAX77851_FPS_SLOT_A  0xA
#define MAX77851_FPS_SLOT_B  0xB
#define MAX77851_FPS_SLOT_C  0xC
#define MAX77851_FPS_SLOT_D  0xD
#define MAX77851_FPS_SLOT_E  0xE
#define MAX77851_FPS_SLOT_F  0xF

#define MAX77851_LOW_BAT_ENABLE       0x01
#define MAX77851_LOW_BAT_DISABLE      0x00

#define MAX77851_LOW_BAT_ALARM_ENABLE     0x01
#define MAX77851_LOW_BAT_ALARM_AUTO_MODE  0x00

#define MAX77851_PIN_ACTIVE_HIGH 0x00
#define MAX77851_PIN_ACTIVE_LOW  0x01

#define MAX77851_INPUT_VDD 0x00
#define MAX77851_INPUT_VIO 0x01
#define MAX77851_INPUT_BAT 0x01

#define MAX77851_VOUT_RNG_LOW         0x0
#define MAX77851_VOUT_RNG_MID         0x1
#define MAX77851_VOUT_RNG_HIGH        0x2
#endif
