summaryrefslogtreecommitdiff
path: root/bsp/spacemit/dm/include/mfd/sy8810l.h
blob: e80a9c5ba2cb6ecd0e0968c5d3f783da439b261a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
 * Copyright (c) 2006-2024, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-5-1       GuEe-GUI     first version
 */

#ifndef __SY8810L_H__
#define __SY8810L_H__

enum
{
    SY8810L_ID_DCDC1,
};

#define SPACEMIT_SY8810L_MAX_REG        0x2

#define SY8810L_BUCK_VSEL_MASK          0x3f
#define SY8810L_BUCK_EN_MASK            0x80

#define SY8810L_BUCK_CTRL_REG           0x1
#define SY8810L_BUCK_VSEL_REG           0x0

#define SY8810L_DESC(_id, _match, _supply, _nv, _vr, _vm, _er, _em, _lr) \
    SPACEMIT_PMIC_REGULATOR_DESC_COMMON(_id, _match, _supply, _nv, _vr, _vm, _er, _em, _lr, pmic_dcdc_ldo_ops)

#ifdef __SPACEMIT_REGULATOR_INTERNAL
static const struct spacemit_pmic_regulator_range sy8810l_buck_ranges[] =
{
    SPACEMIT_PMIC_REGULATOR_RANGE(600000, 0x0, 0x5a, 10000),
};

static const struct spacemit_pmic_regulator_desc sy8810l_reg[] =
{
    /* BUCK */
    SY8810L_DESC(SY8810L_ID_DCDC1, "EDCDC_REG1", "dcdc1",
        91, SY8810L_BUCK_VSEL_REG, SY8810L_BUCK_VSEL_MASK,
        SY8810L_BUCK_CTRL_REG, SY8810L_BUCK_EN_MASK, sy8810l_buck_ranges),
};

static struct spacemit_pmic_regulator_data sy8810l_regulator_data =
{
    .desc = sy8810l_reg,
    .desc_nr = RT_ARRAY_SIZE(sy8810l_reg),
};
#endif /* __SPACEMIT_REGULATOR_INTERNAL */

#ifdef __SPACEMIT_PMIC_INTERNAL
static struct spacemit_pmic_mfd_endpoint sy8810l_mfd_endpoint[] =
{
    {
        .ofw_name = "spacemit-regulator@sy8810l",
        .ofw_compatible = "pmic,regulator,sy8810l",
    },
};

static struct spacemit_pmic_mfd_data sy8810l_mfd_data =
{
    .regmap_cfg =
    {
        .reg_bits = 8,
        .val_bits = 8,
        .max_register = SPACEMIT_SY8810L_MAX_REG,
    },
    .endpoint = sy8810l_mfd_endpoint,
    .endpoint_num = RT_ARRAY_SIZE(sy8810l_mfd_endpoint),
};
#endif /* __SPACEMIT_PMIC_INTERNAL */

#endif /* __SY8810L_H__ */