1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2018-2021 Emmanuel Vadot <manu@FreeBSD.org> 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * $FreeBSD$ 28 */ 29 30 #ifndef _RK808REG_H_ 31 #define _RK808REG_H_ 32 33 /* RTC registers */ 34 #define RK808_RTC_SECS 0x00 35 #define RK808_RTC_SECS_MASK 0x7f 36 #define RK808_RTC_MINUTES 0x01 37 #define RK808_RTC_MINUTES_MASK 0x7f 38 #define RK808_RTC_HOURS 0x02 39 #define RK808_RTC_HOURS_MASK 0x3f 40 #define RK808_RTC_DAYS 0x03 41 #define RK808_RTC_DAYS_MASK 0x3f 42 #define RK808_RTC_MONTHS 0x04 43 #define RK808_RTC_MONTHS_MASK 0x1f 44 #define RK808_RTC_YEARS 0x05 45 #define RK808_RTC_WEEKS 0x06 /* day of week */ 46 #define RK808_RTC_WEEKS_MASK 0x07 47 #define RK808_ALARM_SECONDS 0x8 48 #define RK808_ALARM_MINUTES 0x9 49 #define RK808_ALARM_HOURS 0xA 50 #define RK808_ALARM_DAYS 0xB 51 #define RK808_ALARM_MONTHS 0xC 52 #define RK808_ALARM_YEARS 0xD 53 #define RK808_RTC_CTRL 0x10 54 #define RK808_RTC_CTRL_STOP (1 << 0) 55 #define RK808_RTC_AMPM_MODE (1 << 3) 56 #define RK808_RTC_GET_TIME (1 << 6) 57 #define RK808_RTC_READSEL (1 << 7) 58 #define RK808_RTC_STATUS 0x11 59 #define RK808_RTC_INT 0x12 60 #define RK808_RTC_COMP_LSB 0x13 61 #define RK808_RTC_COMP_MSB 0x14 62 63 /* Misc registers*/ 64 #define RK808_CLK32KOUT 0x20 65 #define RK808_VB_MON 0x21 66 #define RK808_THERMAL 0x22 67 68 /* Power channel control and monitoring registers */ 69 #define RK808_DCDC_EN 0x23 70 #define RK808_LDO_EN 0x24 71 #define RK808_SLEEP_SET_OFF_1 0x25 72 #define RK808_SLEEP_SET_OFF_2 0x26 73 #define RK808_DCDC_UV_STS 0x27 74 #define RK808_DCDC_UV_ACT 0x28 75 #define RK808_LDO_UV_STS 0x29 76 #define RK808_LDO_UV_ACT 0x2A 77 #define RK808_DCDC_PG 0x2B 78 #define RK808_LDO_PG 0x2C 79 #define RK808_VOUT_MON_TDB 0x2D 80 81 /* Power channel configuration registers */ 82 #define RK808_BUCK1_CONFIG 0x2E 83 #define RK808_BUCK1_ON_VSEL 0x2F 84 #define RK808_BUCK1_SLP_VSEL 0x30 85 #define RK808_BUCK2_CONFIG 0x32 86 #define RK808_BUCK2_ON_VSEL 0x33 87 #define RK808_BUCK2_SLEEP_VSEL 0x34 88 #define RK808_BUCK3_CONFIG 0x36 89 #define RK808_BUCK4_CONFIG 0x37 90 #define RK808_BUCK4_ON_VSEL 0x38 91 #define RK808_BUCK4_SLEEP_VSEL 0x39 92 #define RK808_DCDC_ILMAX_REG 0x90 93 #define RK808_LDO1_ON_VSEL 0x3B 94 #define RK808_LDO1_SLEEP_VSEL 0x3C 95 #define RK808_LDO2_ON_VSEL 0x3D 96 #define RK808_LDO2_SLEEP_VSEL 0x3E 97 #define RK808_LDO3_ON_VSEL 0x3F 98 #define RK808_LDO3_SLEEP_VSEL 0x40 99 #define RK808_LDO4_ON_VSEL 0x41 100 #define RK808_LDO4_SLEEP_VSEL 0x42 101 #define RK808_LDO5_ON_VSEL 0x43 102 #define RK808_LDO5_SLEEP_VSEL 0x44 103 #define RK808_LDO6_ON_VSEL 0x45 104 #define RK808_LDO6_SLEEP_VSEL 0x46 105 #define RK808_LDO7_ON_VSEL 0x47 106 #define RK808_LDO7_SLEEP_VSEL 0x48 107 #define RK808_LDO8_ON_VSEL 0x49 108 #define RK808_LDO8_SLEEP_VSEL 0x4A 109 110 #define RK808_DEV_CTRL 0x4B 111 #define RK808_DEV_CTRL_OFF (1 << 0) 112 #define RK808_DEV_CTRL_SLP (1 << 1) 113 114 enum rk808_regulator { 115 RK808_BUCK1 = 0, 116 RK808_BUCK2, 117 RK808_BUCK3, 118 RK808_BUCK4, 119 RK808_LDO1, 120 RK808_LDO2, 121 RK808_LDO3, 122 RK808_LDO4, 123 RK808_LDO5, 124 RK808_LDO6, 125 RK808_LDO7, 126 RK808_LDO8, 127 RK808_SWITCH1, 128 RK808_SWITCH2, 129 }; 130 131 #endif /* _RK808REG_H_ */ 132