Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mfd: Add support for the MediaTek MT6358 PMIC

This adds support for the MediaTek MT6358 PMIC. This is a
multifunction device with the following sub modules:

- Regulator
- RTC
- Codec
- Interrupt

It is interfaced to the host controller using SPI interface
by a proprietary hardware called PMIC wrapper or pwrap.
MT6358 MFD is a child device of the pwrap.

Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

authored by

Hsin-Hsiung Wang and committed by
Lee Jones
2b91c28f 6c3d5c97

+715 -1
+1 -1
drivers/mfd/Makefile
··· 239 239 obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC) += intel_soc_pmic_bxtwc.o 240 240 obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC) += intel_soc_pmic_chtwc.o 241 241 obj-$(CONFIG_INTEL_SOC_PMIC_CHTDC_TI) += intel_soc_pmic_chtdc_ti.o 242 - mt6397-objs := mt6397-core.o mt6397-irq.o 242 + mt6397-objs := mt6397-core.o mt6397-irq.o mt6358-irq.o 243 243 obj-$(CONFIG_MFD_MT6397) += mt6397.o 244 244 obj-$(CONFIG_INTEL_SOC_PMIC_MRFLD) += intel_soc_pmic_mrfld.o 245 245
+235
drivers/mfd/mt6358-irq.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // 3 + // Copyright (c) 2020 MediaTek Inc. 4 + 5 + #include <linux/interrupt.h> 6 + #include <linux/mfd/mt6358/core.h> 7 + #include <linux/mfd/mt6358/registers.h> 8 + #include <linux/mfd/mt6397/core.h> 9 + #include <linux/module.h> 10 + #include <linux/of.h> 11 + #include <linux/of_device.h> 12 + #include <linux/of_irq.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/regmap.h> 15 + 16 + static struct irq_top_t mt6358_ints[] = { 17 + MT6358_TOP_GEN(BUCK), 18 + MT6358_TOP_GEN(LDO), 19 + MT6358_TOP_GEN(PSC), 20 + MT6358_TOP_GEN(SCK), 21 + MT6358_TOP_GEN(BM), 22 + MT6358_TOP_GEN(HK), 23 + MT6358_TOP_GEN(AUD), 24 + MT6358_TOP_GEN(MISC), 25 + }; 26 + 27 + static void pmic_irq_enable(struct irq_data *data) 28 + { 29 + unsigned int hwirq = irqd_to_hwirq(data); 30 + struct mt6397_chip *chip = irq_data_get_irq_chip_data(data); 31 + struct pmic_irq_data *irqd = chip->irq_data; 32 + 33 + irqd->enable_hwirq[hwirq] = true; 34 + } 35 + 36 + static void pmic_irq_disable(struct irq_data *data) 37 + { 38 + unsigned int hwirq = irqd_to_hwirq(data); 39 + struct mt6397_chip *chip = irq_data_get_irq_chip_data(data); 40 + struct pmic_irq_data *irqd = chip->irq_data; 41 + 42 + irqd->enable_hwirq[hwirq] = false; 43 + } 44 + 45 + static void pmic_irq_lock(struct irq_data *data) 46 + { 47 + struct mt6397_chip *chip = irq_data_get_irq_chip_data(data); 48 + 49 + mutex_lock(&chip->irqlock); 50 + } 51 + 52 + static void pmic_irq_sync_unlock(struct irq_data *data) 53 + { 54 + unsigned int i, top_gp, gp_offset, en_reg, int_regs, shift; 55 + struct mt6397_chip *chip = irq_data_get_irq_chip_data(data); 56 + struct pmic_irq_data *irqd = chip->irq_data; 57 + 58 + for (i = 0; i < irqd->num_pmic_irqs; i++) { 59 + if (irqd->enable_hwirq[i] == irqd->cache_hwirq[i]) 60 + continue; 61 + 62 + /* Find out the IRQ group */ 63 + top_gp = 0; 64 + while ((top_gp + 1) < irqd->num_top && 65 + i >= mt6358_ints[top_gp + 1].hwirq_base) 66 + top_gp++; 67 + 68 + /* Find the IRQ registers */ 69 + gp_offset = i - mt6358_ints[top_gp].hwirq_base; 70 + int_regs = gp_offset / MT6358_REG_WIDTH; 71 + shift = gp_offset % MT6358_REG_WIDTH; 72 + en_reg = mt6358_ints[top_gp].en_reg + 73 + (mt6358_ints[top_gp].en_reg_shift * int_regs); 74 + 75 + regmap_update_bits(chip->regmap, en_reg, BIT(shift), 76 + irqd->enable_hwirq[i] << shift); 77 + 78 + irqd->cache_hwirq[i] = irqd->enable_hwirq[i]; 79 + } 80 + mutex_unlock(&chip->irqlock); 81 + } 82 + 83 + static struct irq_chip mt6358_irq_chip = { 84 + .name = "mt6358-irq", 85 + .flags = IRQCHIP_SKIP_SET_WAKE, 86 + .irq_enable = pmic_irq_enable, 87 + .irq_disable = pmic_irq_disable, 88 + .irq_bus_lock = pmic_irq_lock, 89 + .irq_bus_sync_unlock = pmic_irq_sync_unlock, 90 + }; 91 + 92 + static void mt6358_irq_sp_handler(struct mt6397_chip *chip, 93 + unsigned int top_gp) 94 + { 95 + unsigned int irq_status, sta_reg, status; 96 + unsigned int hwirq, virq; 97 + int i, j, ret; 98 + 99 + for (i = 0; i < mt6358_ints[top_gp].num_int_regs; i++) { 100 + sta_reg = mt6358_ints[top_gp].sta_reg + 101 + mt6358_ints[top_gp].sta_reg_shift * i; 102 + 103 + ret = regmap_read(chip->regmap, sta_reg, &irq_status); 104 + if (ret) { 105 + dev_err(chip->dev, 106 + "Failed to read IRQ status, ret=%d\n", ret); 107 + return; 108 + } 109 + 110 + if (!irq_status) 111 + continue; 112 + 113 + status = irq_status; 114 + do { 115 + j = __ffs(status); 116 + 117 + hwirq = mt6358_ints[top_gp].hwirq_base + 118 + MT6358_REG_WIDTH * i + j; 119 + 120 + virq = irq_find_mapping(chip->irq_domain, hwirq); 121 + if (virq) 122 + handle_nested_irq(virq); 123 + 124 + status &= ~BIT(j); 125 + } while (status); 126 + 127 + regmap_write(chip->regmap, sta_reg, irq_status); 128 + } 129 + } 130 + 131 + static irqreturn_t mt6358_irq_handler(int irq, void *data) 132 + { 133 + struct mt6397_chip *chip = data; 134 + struct pmic_irq_data *mt6358_irq_data = chip->irq_data; 135 + unsigned int bit, i, top_irq_status = 0; 136 + int ret; 137 + 138 + ret = regmap_read(chip->regmap, 139 + mt6358_irq_data->top_int_status_reg, 140 + &top_irq_status); 141 + if (ret) { 142 + dev_err(chip->dev, 143 + "Failed to read status from the device, ret=%d\n", ret); 144 + return IRQ_NONE; 145 + } 146 + 147 + for (i = 0; i < mt6358_irq_data->num_top; i++) { 148 + bit = BIT(mt6358_ints[i].top_offset); 149 + if (top_irq_status & bit) { 150 + mt6358_irq_sp_handler(chip, i); 151 + top_irq_status &= ~bit; 152 + if (!top_irq_status) 153 + break; 154 + } 155 + } 156 + 157 + return IRQ_HANDLED; 158 + } 159 + 160 + static int pmic_irq_domain_map(struct irq_domain *d, unsigned int irq, 161 + irq_hw_number_t hw) 162 + { 163 + struct mt6397_chip *mt6397 = d->host_data; 164 + 165 + irq_set_chip_data(irq, mt6397); 166 + irq_set_chip_and_handler(irq, &mt6358_irq_chip, handle_level_irq); 167 + irq_set_nested_thread(irq, 1); 168 + irq_set_noprobe(irq); 169 + 170 + return 0; 171 + } 172 + 173 + static const struct irq_domain_ops mt6358_irq_domain_ops = { 174 + .map = pmic_irq_domain_map, 175 + .xlate = irq_domain_xlate_twocell, 176 + }; 177 + 178 + int mt6358_irq_init(struct mt6397_chip *chip) 179 + { 180 + int i, j, ret; 181 + struct pmic_irq_data *irqd; 182 + 183 + irqd = devm_kzalloc(chip->dev, sizeof(*irqd), GFP_KERNEL); 184 + if (!irqd) 185 + return -ENOMEM; 186 + 187 + chip->irq_data = irqd; 188 + 189 + mutex_init(&chip->irqlock); 190 + irqd->top_int_status_reg = MT6358_TOP_INT_STATUS0; 191 + irqd->num_pmic_irqs = MT6358_IRQ_NR; 192 + irqd->num_top = ARRAY_SIZE(mt6358_ints); 193 + 194 + irqd->enable_hwirq = devm_kcalloc(chip->dev, 195 + irqd->num_pmic_irqs, 196 + sizeof(*irqd->enable_hwirq), 197 + GFP_KERNEL); 198 + if (!irqd->enable_hwirq) 199 + return -ENOMEM; 200 + 201 + irqd->cache_hwirq = devm_kcalloc(chip->dev, 202 + irqd->num_pmic_irqs, 203 + sizeof(*irqd->cache_hwirq), 204 + GFP_KERNEL); 205 + if (!irqd->cache_hwirq) 206 + return -ENOMEM; 207 + 208 + /* Disable all interrupts for initializing */ 209 + for (i = 0; i < irqd->num_top; i++) { 210 + for (j = 0; j < mt6358_ints[i].num_int_regs; j++) 211 + regmap_write(chip->regmap, 212 + mt6358_ints[i].en_reg + 213 + mt6358_ints[i].en_reg_shift * j, 0); 214 + } 215 + 216 + chip->irq_domain = irq_domain_add_linear(chip->dev->of_node, 217 + irqd->num_pmic_irqs, 218 + &mt6358_irq_domain_ops, chip); 219 + if (!chip->irq_domain) { 220 + dev_err(chip->dev, "Could not create IRQ domain\n"); 221 + return -ENODEV; 222 + } 223 + 224 + ret = devm_request_threaded_irq(chip->dev, chip->irq, NULL, 225 + mt6358_irq_handler, IRQF_ONESHOT, 226 + mt6358_irq_chip.name, chip); 227 + if (ret) { 228 + dev_err(chip->dev, "Failed to register IRQ=%d, ret=%d\n", 229 + chip->irq, ret); 230 + return ret; 231 + } 232 + 233 + enable_irq_wake(chip->irq); 234 + return ret; 235 + }
+36
drivers/mfd/mt6397-core.c
··· 12 12 #include <linux/regmap.h> 13 13 #include <linux/mfd/core.h> 14 14 #include <linux/mfd/mt6323/core.h> 15 + #include <linux/mfd/mt6358/core.h> 15 16 #include <linux/mfd/mt6397/core.h> 16 17 #include <linux/mfd/mt6323/registers.h> 18 + #include <linux/mfd/mt6358/registers.h> 17 19 #include <linux/mfd/mt6397/registers.h> 18 20 19 21 #define MT6323_RTC_BASE 0x8000 20 22 #define MT6323_RTC_SIZE 0x40 23 + 24 + #define MT6358_RTC_BASE 0x0588 25 + #define MT6358_RTC_SIZE 0x3c 21 26 22 27 #define MT6397_RTC_BASE 0xe000 23 28 #define MT6397_RTC_SIZE 0x3e ··· 33 28 static const struct resource mt6323_rtc_resources[] = { 34 29 DEFINE_RES_MEM(MT6323_RTC_BASE, MT6323_RTC_SIZE), 35 30 DEFINE_RES_IRQ(MT6323_IRQ_STATUS_RTC), 31 + }; 32 + 33 + static const struct resource mt6358_rtc_resources[] = { 34 + DEFINE_RES_MEM(MT6358_RTC_BASE, MT6358_RTC_SIZE), 35 + DEFINE_RES_IRQ(MT6358_IRQ_RTC), 36 36 }; 37 37 38 38 static const struct resource mt6397_rtc_resources[] = { ··· 84 74 }, 85 75 }; 86 76 77 + static const struct mfd_cell mt6358_devs[] = { 78 + { 79 + .name = "mt6358-regulator", 80 + .of_compatible = "mediatek,mt6358-regulator" 81 + }, { 82 + .name = "mt6358-rtc", 83 + .num_resources = ARRAY_SIZE(mt6358_rtc_resources), 84 + .resources = mt6358_rtc_resources, 85 + .of_compatible = "mediatek,mt6358-rtc", 86 + }, { 87 + .name = "mt6358-sound", 88 + .of_compatible = "mediatek,mt6358-sound" 89 + }, 90 + }; 91 + 87 92 static const struct mfd_cell mt6397_devs[] = { 88 93 { 89 94 .name = "mt6397-rtc", ··· 139 114 .cells = mt6323_devs, 140 115 .cell_size = ARRAY_SIZE(mt6323_devs), 141 116 .irq_init = mt6397_irq_init, 117 + }; 118 + 119 + static const struct chip_data mt6358_core = { 120 + .cid_addr = MT6358_SWCID, 121 + .cid_shift = 8, 122 + .cells = mt6358_devs, 123 + .cell_size = ARRAY_SIZE(mt6358_devs), 124 + .irq_init = mt6358_irq_init, 142 125 }; 143 126 144 127 static const struct chip_data mt6397_core = { ··· 215 182 { 216 183 .compatible = "mediatek,mt6323", 217 184 .data = &mt6323_core, 185 + }, { 186 + .compatible = "mediatek,mt6358", 187 + .data = &mt6358_core, 218 188 }, { 219 189 .compatible = "mediatek,mt6397", 220 190 .data = &mt6397_core,
+158
include/linux/mfd/mt6358/core.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + */ 5 + 6 + #ifndef __MFD_MT6358_CORE_H__ 7 + #define __MFD_MT6358_CORE_H__ 8 + 9 + #define MT6358_REG_WIDTH 16 10 + 11 + struct irq_top_t { 12 + int hwirq_base; 13 + unsigned int num_int_regs; 14 + unsigned int num_int_bits; 15 + unsigned int en_reg; 16 + unsigned int en_reg_shift; 17 + unsigned int sta_reg; 18 + unsigned int sta_reg_shift; 19 + unsigned int top_offset; 20 + }; 21 + 22 + struct pmic_irq_data { 23 + unsigned int num_top; 24 + unsigned int num_pmic_irqs; 25 + unsigned short top_int_status_reg; 26 + bool *enable_hwirq; 27 + bool *cache_hwirq; 28 + }; 29 + 30 + enum mt6358_irq_top_status_shift { 31 + MT6358_BUCK_TOP = 0, 32 + MT6358_LDO_TOP, 33 + MT6358_PSC_TOP, 34 + MT6358_SCK_TOP, 35 + MT6358_BM_TOP, 36 + MT6358_HK_TOP, 37 + MT6358_AUD_TOP, 38 + MT6358_MISC_TOP, 39 + }; 40 + 41 + enum mt6358_irq_numbers { 42 + MT6358_IRQ_VPROC11_OC = 0, 43 + MT6358_IRQ_VPROC12_OC, 44 + MT6358_IRQ_VCORE_OC, 45 + MT6358_IRQ_VGPU_OC, 46 + MT6358_IRQ_VMODEM_OC, 47 + MT6358_IRQ_VDRAM1_OC, 48 + MT6358_IRQ_VS1_OC, 49 + MT6358_IRQ_VS2_OC, 50 + MT6358_IRQ_VPA_OC, 51 + MT6358_IRQ_VCORE_PREOC, 52 + MT6358_IRQ_VFE28_OC = 16, 53 + MT6358_IRQ_VXO22_OC, 54 + MT6358_IRQ_VRF18_OC, 55 + MT6358_IRQ_VRF12_OC, 56 + MT6358_IRQ_VEFUSE_OC, 57 + MT6358_IRQ_VCN33_OC, 58 + MT6358_IRQ_VCN28_OC, 59 + MT6358_IRQ_VCN18_OC, 60 + MT6358_IRQ_VCAMA1_OC, 61 + MT6358_IRQ_VCAMA2_OC, 62 + MT6358_IRQ_VCAMD_OC, 63 + MT6358_IRQ_VCAMIO_OC, 64 + MT6358_IRQ_VLDO28_OC, 65 + MT6358_IRQ_VA12_OC, 66 + MT6358_IRQ_VAUX18_OC, 67 + MT6358_IRQ_VAUD28_OC, 68 + MT6358_IRQ_VIO28_OC, 69 + MT6358_IRQ_VIO18_OC, 70 + MT6358_IRQ_VSRAM_PROC11_OC, 71 + MT6358_IRQ_VSRAM_PROC12_OC, 72 + MT6358_IRQ_VSRAM_OTHERS_OC, 73 + MT6358_IRQ_VSRAM_GPU_OC, 74 + MT6358_IRQ_VDRAM2_OC, 75 + MT6358_IRQ_VMC_OC, 76 + MT6358_IRQ_VMCH_OC, 77 + MT6358_IRQ_VEMC_OC, 78 + MT6358_IRQ_VSIM1_OC, 79 + MT6358_IRQ_VSIM2_OC, 80 + MT6358_IRQ_VIBR_OC, 81 + MT6358_IRQ_VUSB_OC, 82 + MT6358_IRQ_VBIF28_OC, 83 + MT6358_IRQ_PWRKEY = 48, 84 + MT6358_IRQ_HOMEKEY, 85 + MT6358_IRQ_PWRKEY_R, 86 + MT6358_IRQ_HOMEKEY_R, 87 + MT6358_IRQ_NI_LBAT_INT, 88 + MT6358_IRQ_CHRDET, 89 + MT6358_IRQ_CHRDET_EDGE, 90 + MT6358_IRQ_VCDT_HV_DET, 91 + MT6358_IRQ_RTC = 64, 92 + MT6358_IRQ_FG_BAT0_H = 80, 93 + MT6358_IRQ_FG_BAT0_L, 94 + MT6358_IRQ_FG_CUR_H, 95 + MT6358_IRQ_FG_CUR_L, 96 + MT6358_IRQ_FG_ZCV, 97 + MT6358_IRQ_FG_BAT1_H, 98 + MT6358_IRQ_FG_BAT1_L, 99 + MT6358_IRQ_FG_N_CHARGE_L, 100 + MT6358_IRQ_FG_IAVG_H, 101 + MT6358_IRQ_FG_IAVG_L, 102 + MT6358_IRQ_FG_TIME_H, 103 + MT6358_IRQ_FG_DISCHARGE, 104 + MT6358_IRQ_FG_CHARGE, 105 + MT6358_IRQ_BATON_LV = 96, 106 + MT6358_IRQ_BATON_HT, 107 + MT6358_IRQ_BATON_BAT_IN, 108 + MT6358_IRQ_BATON_BAT_OUT, 109 + MT6358_IRQ_BIF, 110 + MT6358_IRQ_BAT_H = 112, 111 + MT6358_IRQ_BAT_L, 112 + MT6358_IRQ_BAT2_H, 113 + MT6358_IRQ_BAT2_L, 114 + MT6358_IRQ_BAT_TEMP_H, 115 + MT6358_IRQ_BAT_TEMP_L, 116 + MT6358_IRQ_AUXADC_IMP, 117 + MT6358_IRQ_NAG_C_DLTV, 118 + MT6358_IRQ_AUDIO = 128, 119 + MT6358_IRQ_ACCDET = 133, 120 + MT6358_IRQ_ACCDET_EINT0, 121 + MT6358_IRQ_ACCDET_EINT1, 122 + MT6358_IRQ_SPI_CMD_ALERT = 144, 123 + MT6358_IRQ_NR, 124 + }; 125 + 126 + #define MT6358_IRQ_BUCK_BASE MT6358_IRQ_VPROC11_OC 127 + #define MT6358_IRQ_LDO_BASE MT6358_IRQ_VFE28_OC 128 + #define MT6358_IRQ_PSC_BASE MT6358_IRQ_PWRKEY 129 + #define MT6358_IRQ_SCK_BASE MT6358_IRQ_RTC 130 + #define MT6358_IRQ_BM_BASE MT6358_IRQ_FG_BAT0_H 131 + #define MT6358_IRQ_HK_BASE MT6358_IRQ_BAT_H 132 + #define MT6358_IRQ_AUD_BASE MT6358_IRQ_AUDIO 133 + #define MT6358_IRQ_MISC_BASE MT6358_IRQ_SPI_CMD_ALERT 134 + 135 + #define MT6358_IRQ_BUCK_BITS (MT6358_IRQ_VCORE_PREOC - MT6358_IRQ_BUCK_BASE + 1) 136 + #define MT6358_IRQ_LDO_BITS (MT6358_IRQ_VBIF28_OC - MT6358_IRQ_LDO_BASE + 1) 137 + #define MT6358_IRQ_PSC_BITS (MT6358_IRQ_VCDT_HV_DET - MT6358_IRQ_PSC_BASE + 1) 138 + #define MT6358_IRQ_SCK_BITS (MT6358_IRQ_RTC - MT6358_IRQ_SCK_BASE + 1) 139 + #define MT6358_IRQ_BM_BITS (MT6358_IRQ_BIF - MT6358_IRQ_BM_BASE + 1) 140 + #define MT6358_IRQ_HK_BITS (MT6358_IRQ_NAG_C_DLTV - MT6358_IRQ_HK_BASE + 1) 141 + #define MT6358_IRQ_AUD_BITS (MT6358_IRQ_ACCDET_EINT1 - MT6358_IRQ_AUD_BASE + 1) 142 + #define MT6358_IRQ_MISC_BITS \ 143 + (MT6358_IRQ_SPI_CMD_ALERT - MT6358_IRQ_MISC_BASE + 1) 144 + 145 + #define MT6358_TOP_GEN(sp) \ 146 + { \ 147 + .hwirq_base = MT6358_IRQ_##sp##_BASE, \ 148 + .num_int_regs = \ 149 + ((MT6358_IRQ_##sp##_BITS - 1) / MT6358_REG_WIDTH) + 1, \ 150 + .num_int_bits = MT6358_IRQ_##sp##_BITS, \ 151 + .en_reg = MT6358_##sp##_TOP_INT_CON0, \ 152 + .en_reg_shift = 0x6, \ 153 + .sta_reg = MT6358_##sp##_TOP_INT_STATUS0, \ 154 + .sta_reg_shift = 0x2, \ 155 + .top_offset = MT6358_##sp##_TOP, \ 156 + } 157 + 158 + #endif /* __MFD_MT6358_CORE_H__ */
+282
include/linux/mfd/mt6358/registers.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2020 MediaTek Inc. 4 + */ 5 + 6 + #ifndef __MFD_MT6358_REGISTERS_H__ 7 + #define __MFD_MT6358_REGISTERS_H__ 8 + 9 + /* PMIC Registers */ 10 + #define MT6358_SWCID 0xa 11 + #define MT6358_MISC_TOP_INT_CON0 0x188 12 + #define MT6358_MISC_TOP_INT_STATUS0 0x194 13 + #define MT6358_TOP_INT_STATUS0 0x19e 14 + #define MT6358_SCK_TOP_INT_CON0 0x52e 15 + #define MT6358_SCK_TOP_INT_STATUS0 0x53a 16 + #define MT6358_EOSC_CALI_CON0 0x540 17 + #define MT6358_EOSC_CALI_CON1 0x542 18 + #define MT6358_RTC_MIX_CON0 0x544 19 + #define MT6358_RTC_MIX_CON1 0x546 20 + #define MT6358_RTC_MIX_CON2 0x548 21 + #define MT6358_RTC_DSN_ID 0x580 22 + #define MT6358_RTC_DSN_REV0 0x582 23 + #define MT6358_RTC_DBI 0x584 24 + #define MT6358_RTC_DXI 0x586 25 + #define MT6358_RTC_BBPU 0x588 26 + #define MT6358_RTC_IRQ_STA 0x58a 27 + #define MT6358_RTC_IRQ_EN 0x58c 28 + #define MT6358_RTC_CII_EN 0x58e 29 + #define MT6358_RTC_AL_MASK 0x590 30 + #define MT6358_RTC_TC_SEC 0x592 31 + #define MT6358_RTC_TC_MIN 0x594 32 + #define MT6358_RTC_TC_HOU 0x596 33 + #define MT6358_RTC_TC_DOM 0x598 34 + #define MT6358_RTC_TC_DOW 0x59a 35 + #define MT6358_RTC_TC_MTH 0x59c 36 + #define MT6358_RTC_TC_YEA 0x59e 37 + #define MT6358_RTC_AL_SEC 0x5a0 38 + #define MT6358_RTC_AL_MIN 0x5a2 39 + #define MT6358_RTC_AL_HOU 0x5a4 40 + #define MT6358_RTC_AL_DOM 0x5a6 41 + #define MT6358_RTC_AL_DOW 0x5a8 42 + #define MT6358_RTC_AL_MTH 0x5aa 43 + #define MT6358_RTC_AL_YEA 0x5ac 44 + #define MT6358_RTC_OSC32CON 0x5ae 45 + #define MT6358_RTC_POWERKEY1 0x5b0 46 + #define MT6358_RTC_POWERKEY2 0x5b2 47 + #define MT6358_RTC_PDN1 0x5b4 48 + #define MT6358_RTC_PDN2 0x5b6 49 + #define MT6358_RTC_SPAR0 0x5b8 50 + #define MT6358_RTC_SPAR1 0x5ba 51 + #define MT6358_RTC_PROT 0x5bc 52 + #define MT6358_RTC_DIFF 0x5be 53 + #define MT6358_RTC_CALI 0x5c0 54 + #define MT6358_RTC_WRTGR 0x5c2 55 + #define MT6358_RTC_CON 0x5c4 56 + #define MT6358_RTC_SEC_CTRL 0x5c6 57 + #define MT6358_RTC_INT_CNT 0x5c8 58 + #define MT6358_RTC_SEC_DAT0 0x5ca 59 + #define MT6358_RTC_SEC_DAT1 0x5cc 60 + #define MT6358_RTC_SEC_DAT2 0x5ce 61 + #define MT6358_RTC_SEC_DSN_ID 0x600 62 + #define MT6358_RTC_SEC_DSN_REV0 0x602 63 + #define MT6358_RTC_SEC_DBI 0x604 64 + #define MT6358_RTC_SEC_DXI 0x606 65 + #define MT6358_RTC_TC_SEC_SEC 0x608 66 + #define MT6358_RTC_TC_MIN_SEC 0x60a 67 + #define MT6358_RTC_TC_HOU_SEC 0x60c 68 + #define MT6358_RTC_TC_DOM_SEC 0x60e 69 + #define MT6358_RTC_TC_DOW_SEC 0x610 70 + #define MT6358_RTC_TC_MTH_SEC 0x612 71 + #define MT6358_RTC_TC_YEA_SEC 0x614 72 + #define MT6358_RTC_SEC_CK_PDN 0x616 73 + #define MT6358_RTC_SEC_WRTGR 0x618 74 + #define MT6358_PSC_TOP_INT_CON0 0x910 75 + #define MT6358_PSC_TOP_INT_STATUS0 0x91c 76 + #define MT6358_BM_TOP_INT_CON0 0xc32 77 + #define MT6358_BM_TOP_INT_CON1 0xc38 78 + #define MT6358_BM_TOP_INT_STATUS0 0xc4a 79 + #define MT6358_BM_TOP_INT_STATUS1 0xc4c 80 + #define MT6358_HK_TOP_INT_CON0 0xf92 81 + #define MT6358_HK_TOP_INT_STATUS0 0xf9e 82 + #define MT6358_BUCK_TOP_INT_CON0 0x1318 83 + #define MT6358_BUCK_TOP_INT_STATUS0 0x1324 84 + #define MT6358_BUCK_VPROC11_CON0 0x1388 85 + #define MT6358_BUCK_VPROC11_DBG0 0x139e 86 + #define MT6358_BUCK_VPROC11_DBG1 0x13a0 87 + #define MT6358_BUCK_VPROC11_ELR0 0x13a6 88 + #define MT6358_BUCK_VPROC12_CON0 0x1408 89 + #define MT6358_BUCK_VPROC12_DBG0 0x141e 90 + #define MT6358_BUCK_VPROC12_DBG1 0x1420 91 + #define MT6358_BUCK_VPROC12_ELR0 0x1426 92 + #define MT6358_BUCK_VCORE_CON0 0x1488 93 + #define MT6358_BUCK_VCORE_DBG0 0x149e 94 + #define MT6358_BUCK_VCORE_DBG1 0x14a0 95 + #define MT6358_BUCK_VCORE_ELR0 0x14aa 96 + #define MT6358_BUCK_VGPU_CON0 0x1508 97 + #define MT6358_BUCK_VGPU_DBG0 0x151e 98 + #define MT6358_BUCK_VGPU_DBG1 0x1520 99 + #define MT6358_BUCK_VGPU_ELR0 0x1526 100 + #define MT6358_BUCK_VMODEM_CON0 0x1588 101 + #define MT6358_BUCK_VMODEM_DBG0 0x159e 102 + #define MT6358_BUCK_VMODEM_DBG1 0x15a0 103 + #define MT6358_BUCK_VMODEM_ELR0 0x15a6 104 + #define MT6358_BUCK_VDRAM1_CON0 0x1608 105 + #define MT6358_BUCK_VDRAM1_DBG0 0x161e 106 + #define MT6358_BUCK_VDRAM1_DBG1 0x1620 107 + #define MT6358_BUCK_VDRAM1_ELR0 0x1626 108 + #define MT6358_BUCK_VS1_CON0 0x1688 109 + #define MT6358_BUCK_VS1_DBG0 0x169e 110 + #define MT6358_BUCK_VS1_DBG1 0x16a0 111 + #define MT6358_BUCK_VS1_ELR0 0x16ae 112 + #define MT6358_BUCK_VS2_CON0 0x1708 113 + #define MT6358_BUCK_VS2_DBG0 0x171e 114 + #define MT6358_BUCK_VS2_DBG1 0x1720 115 + #define MT6358_BUCK_VS2_ELR0 0x172e 116 + #define MT6358_BUCK_VPA_CON0 0x1788 117 + #define MT6358_BUCK_VPA_CON1 0x178a 118 + #define MT6358_BUCK_VPA_ELR0 MT6358_BUCK_VPA_CON1 119 + #define MT6358_BUCK_VPA_DBG0 0x1792 120 + #define MT6358_BUCK_VPA_DBG1 0x1794 121 + #define MT6358_VPROC_ANA_CON0 0x180c 122 + #define MT6358_VCORE_VGPU_ANA_CON0 0x1828 123 + #define MT6358_VMODEM_ANA_CON0 0x1888 124 + #define MT6358_VDRAM1_ANA_CON0 0x1896 125 + #define MT6358_VS1_ANA_CON0 0x18a2 126 + #define MT6358_VS2_ANA_CON0 0x18ae 127 + #define MT6358_VPA_ANA_CON0 0x18ba 128 + #define MT6358_LDO_TOP_INT_CON0 0x1a50 129 + #define MT6358_LDO_TOP_INT_CON1 0x1a56 130 + #define MT6358_LDO_TOP_INT_STATUS0 0x1a68 131 + #define MT6358_LDO_TOP_INT_STATUS1 0x1a6a 132 + #define MT6358_LDO_VXO22_CON0 0x1a88 133 + #define MT6358_LDO_VXO22_CON1 0x1a96 134 + #define MT6358_LDO_VA12_CON0 0x1a9c 135 + #define MT6358_LDO_VA12_CON1 0x1aaa 136 + #define MT6358_LDO_VAUX18_CON0 0x1ab0 137 + #define MT6358_LDO_VAUX18_CON1 0x1abe 138 + #define MT6358_LDO_VAUD28_CON0 0x1ac4 139 + #define MT6358_LDO_VAUD28_CON1 0x1ad2 140 + #define MT6358_LDO_VIO28_CON0 0x1ad8 141 + #define MT6358_LDO_VIO28_CON1 0x1ae6 142 + #define MT6358_LDO_VIO18_CON0 0x1aec 143 + #define MT6358_LDO_VIO18_CON1 0x1afa 144 + #define MT6358_LDO_VDRAM2_CON0 0x1b08 145 + #define MT6358_LDO_VDRAM2_CON1 0x1b16 146 + #define MT6358_LDO_VEMC_CON0 0x1b1c 147 + #define MT6358_LDO_VEMC_CON1 0x1b2a 148 + #define MT6358_LDO_VUSB_CON0_0 0x1b30 149 + #define MT6358_LDO_VUSB_CON1 0x1b40 150 + #define MT6358_LDO_VSRAM_PROC11_CON0 0x1b46 151 + #define MT6358_LDO_VSRAM_PROC11_DBG0 0x1b60 152 + #define MT6358_LDO_VSRAM_PROC11_DBG1 0x1b62 153 + #define MT6358_LDO_VSRAM_PROC11_TRACKING_CON0 0x1b64 154 + #define MT6358_LDO_VSRAM_PROC11_TRACKING_CON1 0x1b66 155 + #define MT6358_LDO_VSRAM_PROC11_TRACKING_CON2 0x1b68 156 + #define MT6358_LDO_VSRAM_PROC11_TRACKING_CON3 0x1b6a 157 + #define MT6358_LDO_VSRAM_PROC12_TRACKING_CON0 0x1b6c 158 + #define MT6358_LDO_VSRAM_PROC12_TRACKING_CON1 0x1b6e 159 + #define MT6358_LDO_VSRAM_PROC12_TRACKING_CON2 0x1b70 160 + #define MT6358_LDO_VSRAM_PROC12_TRACKING_CON3 0x1b72 161 + #define MT6358_LDO_VSRAM_WAKEUP_CON0 0x1b74 162 + #define MT6358_LDO_GON1_ELR_NUM 0x1b76 163 + #define MT6358_LDO_VDRAM2_ELR0 0x1b78 164 + #define MT6358_LDO_VSRAM_PROC12_CON0 0x1b88 165 + #define MT6358_LDO_VSRAM_PROC12_DBG0 0x1ba2 166 + #define MT6358_LDO_VSRAM_PROC12_DBG1 0x1ba4 167 + #define MT6358_LDO_VSRAM_OTHERS_CON0 0x1ba6 168 + #define MT6358_LDO_VSRAM_OTHERS_DBG0 0x1bc0 169 + #define MT6358_LDO_VSRAM_OTHERS_DBG1 0x1bc2 170 + #define MT6358_LDO_VSRAM_GPU_CON0 0x1bc8 171 + #define MT6358_LDO_VSRAM_GPU_DBG0 0x1be2 172 + #define MT6358_LDO_VSRAM_GPU_DBG1 0x1be4 173 + #define MT6358_LDO_VSRAM_CON0 0x1bee 174 + #define MT6358_LDO_VSRAM_CON1 0x1bf0 175 + #define MT6358_LDO_VSRAM_CON2 0x1bf2 176 + #define MT6358_LDO_VSRAM_CON3 0x1bf4 177 + #define MT6358_LDO_VFE28_CON0 0x1c08 178 + #define MT6358_LDO_VFE28_CON1 0x1c16 179 + #define MT6358_LDO_VFE28_CON2 0x1c18 180 + #define MT6358_LDO_VFE28_CON3 0x1c1a 181 + #define MT6358_LDO_VRF18_CON0 0x1c1c 182 + #define MT6358_LDO_VRF18_CON1 0x1c2a 183 + #define MT6358_LDO_VRF18_CON2 0x1c2c 184 + #define MT6358_LDO_VRF18_CON3 0x1c2e 185 + #define MT6358_LDO_VRF12_CON0 0x1c30 186 + #define MT6358_LDO_VRF12_CON1 0x1c3e 187 + #define MT6358_LDO_VRF12_CON2 0x1c40 188 + #define MT6358_LDO_VRF12_CON3 0x1c42 189 + #define MT6358_LDO_VEFUSE_CON0 0x1c44 190 + #define MT6358_LDO_VEFUSE_CON1 0x1c52 191 + #define MT6358_LDO_VEFUSE_CON2 0x1c54 192 + #define MT6358_LDO_VEFUSE_CON3 0x1c56 193 + #define MT6358_LDO_VCN18_CON0 0x1c58 194 + #define MT6358_LDO_VCN18_CON1 0x1c66 195 + #define MT6358_LDO_VCN18_CON2 0x1c68 196 + #define MT6358_LDO_VCN18_CON3 0x1c6a 197 + #define MT6358_LDO_VCAMA1_CON0 0x1c6c 198 + #define MT6358_LDO_VCAMA1_CON1 0x1c7a 199 + #define MT6358_LDO_VCAMA1_CON2 0x1c7c 200 + #define MT6358_LDO_VCAMA1_CON3 0x1c7e 201 + #define MT6358_LDO_VCAMA2_CON0 0x1c88 202 + #define MT6358_LDO_VCAMA2_CON1 0x1c96 203 + #define MT6358_LDO_VCAMA2_CON2 0x1c98 204 + #define MT6358_LDO_VCAMA2_CON3 0x1c9a 205 + #define MT6358_LDO_VCAMD_CON0 0x1c9c 206 + #define MT6358_LDO_VCAMD_CON1 0x1caa 207 + #define MT6358_LDO_VCAMD_CON2 0x1cac 208 + #define MT6358_LDO_VCAMD_CON3 0x1cae 209 + #define MT6358_LDO_VCAMIO_CON0 0x1cb0 210 + #define MT6358_LDO_VCAMIO_CON1 0x1cbe 211 + #define MT6358_LDO_VCAMIO_CON2 0x1cc0 212 + #define MT6358_LDO_VCAMIO_CON3 0x1cc2 213 + #define MT6358_LDO_VMC_CON0 0x1cc4 214 + #define MT6358_LDO_VMC_CON1 0x1cd2 215 + #define MT6358_LDO_VMC_CON2 0x1cd4 216 + #define MT6358_LDO_VMC_CON3 0x1cd6 217 + #define MT6358_LDO_VMCH_CON0 0x1cd8 218 + #define MT6358_LDO_VMCH_CON1 0x1ce6 219 + #define MT6358_LDO_VMCH_CON2 0x1ce8 220 + #define MT6358_LDO_VMCH_CON3 0x1cea 221 + #define MT6358_LDO_VIBR_CON0 0x1d08 222 + #define MT6358_LDO_VIBR_CON1 0x1d16 223 + #define MT6358_LDO_VIBR_CON2 0x1d18 224 + #define MT6358_LDO_VIBR_CON3 0x1d1a 225 + #define MT6358_LDO_VCN33_CON0_0 0x1d1c 226 + #define MT6358_LDO_VCN33_CON0_1 0x1d2a 227 + #define MT6358_LDO_VCN33_CON1 0x1d2c 228 + #define MT6358_LDO_VCN33_BT_CON1 MT6358_LDO_VCN33_CON1 229 + #define MT6358_LDO_VCN33_WIFI_CON1 MT6358_LDO_VCN33_CON1 230 + #define MT6358_LDO_VCN33_CON2 0x1d2e 231 + #define MT6358_LDO_VCN33_CON3 0x1d30 232 + #define MT6358_LDO_VLDO28_CON0_0 0x1d32 233 + #define MT6358_LDO_VLDO28_CON0_1 0x1d40 234 + #define MT6358_LDO_VLDO28_CON1 0x1d42 235 + #define MT6358_LDO_VLDO28_CON2 0x1d44 236 + #define MT6358_LDO_VLDO28_CON3 0x1d46 237 + #define MT6358_LDO_VSIM1_CON0 0x1d48 238 + #define MT6358_LDO_VSIM1_CON1 0x1d56 239 + #define MT6358_LDO_VSIM1_CON2 0x1d58 240 + #define MT6358_LDO_VSIM1_CON3 0x1d5a 241 + #define MT6358_LDO_VSIM2_CON0 0x1d5c 242 + #define MT6358_LDO_VSIM2_CON1 0x1d6a 243 + #define MT6358_LDO_VSIM2_CON2 0x1d6c 244 + #define MT6358_LDO_VSIM2_CON3 0x1d6e 245 + #define MT6358_LDO_VCN28_CON0 0x1d88 246 + #define MT6358_LDO_VCN28_CON1 0x1d96 247 + #define MT6358_LDO_VCN28_CON2 0x1d98 248 + #define MT6358_LDO_VCN28_CON3 0x1d9a 249 + #define MT6358_VRTC28_CON0 0x1d9c 250 + #define MT6358_LDO_VBIF28_CON0 0x1d9e 251 + #define MT6358_LDO_VBIF28_CON1 0x1dac 252 + #define MT6358_LDO_VBIF28_CON2 0x1dae 253 + #define MT6358_LDO_VBIF28_CON3 0x1db0 254 + #define MT6358_VCAMA1_ANA_CON0 0x1e08 255 + #define MT6358_VCAMA2_ANA_CON0 0x1e0c 256 + #define MT6358_VCN33_ANA_CON0 0x1e28 257 + #define MT6358_VSIM1_ANA_CON0 0x1e2c 258 + #define MT6358_VSIM2_ANA_CON0 0x1e30 259 + #define MT6358_VUSB_ANA_CON0 0x1e34 260 + #define MT6358_VEMC_ANA_CON0 0x1e38 261 + #define MT6358_VLDO28_ANA_CON0 0x1e3c 262 + #define MT6358_VIO28_ANA_CON0 0x1e40 263 + #define MT6358_VIBR_ANA_CON0 0x1e44 264 + #define MT6358_VMCH_ANA_CON0 0x1e48 265 + #define MT6358_VMC_ANA_CON0 0x1e4c 266 + #define MT6358_VRF18_ANA_CON0 0x1e88 267 + #define MT6358_VCN18_ANA_CON0 0x1e8c 268 + #define MT6358_VCAMIO_ANA_CON0 0x1e90 269 + #define MT6358_VIO18_ANA_CON0 0x1e94 270 + #define MT6358_VEFUSE_ANA_CON0 0x1e98 271 + #define MT6358_VRF12_ANA_CON0 0x1e9c 272 + #define MT6358_VSRAM_PROC11_ANA_CON0 0x1ea0 273 + #define MT6358_VSRAM_PROC12_ANA_CON0 0x1ea4 274 + #define MT6358_VSRAM_OTHERS_ANA_CON0 0x1ea6 275 + #define MT6358_VSRAM_GPU_ANA_CON0 0x1ea8 276 + #define MT6358_VDRAM2_ANA_CON0 0x1eaa 277 + #define MT6358_VCAMD_ANA_CON0 0x1eae 278 + #define MT6358_VA12_ANA_CON0 0x1eb2 279 + #define MT6358_AUD_TOP_INT_CON0 0x2228 280 + #define MT6358_AUD_TOP_INT_STATUS0 0x2234 281 + 282 + #endif /* __MFD_MT6358_REGISTERS_H__ */
+3
include/linux/mfd/mt6397/core.h
··· 12 12 13 13 enum chip_id { 14 14 MT6323_CHIP_ID = 0x23, 15 + MT6358_CHIP_ID = 0x58, 15 16 MT6391_CHIP_ID = 0x91, 16 17 MT6397_CHIP_ID = 0x97, 17 18 }; ··· 66 65 u16 int_con[2]; 67 66 u16 int_status[2]; 68 67 u16 chip_id; 68 + void *irq_data; 69 69 }; 70 70 71 + int mt6358_irq_init(struct mt6397_chip *chip); 71 72 int mt6397_irq_init(struct mt6397_chip *chip); 72 73 73 74 #endif /* __MFD_MT6397_CORE_H__ */