Lines Matching +full:0 +full:- +full:8

1 // SPDX-License-Identifier: GPL-2.0-only
19 #define MT6370_REG_DEV_INFO 0x100
20 #define MT6370_REG_CHG_IRQ1 0x1C0
21 #define MT6370_REG_CHG_MASK1 0x1E0
22 #define MT6370_REG_MAXADDR 0x1FF
27 #define MT6370_USBC_I2CADDR 0x4E
30 #define MT6370_VENID_RT5081 0x8
31 #define MT6370_VENID_RT5081A 0xA
32 #define MT6370_VENID_MT6370 0xE
33 #define MT6370_VENID_MT6371 0xF
34 #define MT6370_VENID_MT6372P 0x9
35 #define MT6370_VENID_MT6372CP 0xB
38 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHGON, 8),
39 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TREG, 8),
40 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_AICR, 8),
41 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_MIVR, 8),
42 REGMAP_IRQ_REG_LINE(MT6370_IRQ_PWR_RDY, 8),
43 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FL_CHG_VINOVP, 8),
44 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VSYSUV, 8),
45 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VSYSOV, 8),
46 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VBATOV, 8),
47 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_VINOVPCHG, 8),
48 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_COLD, 8),
49 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_COOL, 8),
50 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_WARM, 8),
51 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_BAT_HOT, 8),
52 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TS_STATC, 8),
53 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_FAULT, 8),
54 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_STATC, 8),
55 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TMR, 8),
56 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_BATABS, 8),
57 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_ADPBAD, 8),
58 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_RVP, 8),
59 REGMAP_IRQ_REG_LINE(MT6370_IRQ_TSHUTDOWN, 8),
60 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_IINMEAS, 8),
61 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_ICCMEAS, 8),
62 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHGDET_DONE, 8),
63 REGMAP_IRQ_REG_LINE(MT6370_IRQ_WDTMR, 8),
64 REGMAP_IRQ_REG_LINE(MT6370_IRQ_SSFINISH, 8),
65 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_RECHG, 8),
66 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_TERM, 8),
67 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHG_IEOC, 8),
68 REGMAP_IRQ_REG_LINE(MT6370_IRQ_ADC_DONE, 8),
69 REGMAP_IRQ_REG_LINE(MT6370_IRQ_PUMPX_DONE, 8),
70 REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_BATUV, 8),
71 REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_MIDOV, 8),
72 REGMAP_IRQ_REG_LINE(MT6370_IRQ_BST_OLP, 8),
73 REGMAP_IRQ_REG_LINE(MT6370_IRQ_ATTACH, 8),
74 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DETACH, 8),
75 REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_STPDONE, 8),
76 REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_VBUSDET_DONE, 8),
77 REGMAP_IRQ_REG_LINE(MT6370_IRQ_HVDCP_DET, 8),
78 REGMAP_IRQ_REG_LINE(MT6370_IRQ_CHGDET, 8),
79 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DCDT, 8),
80 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_VGOK, 8),
81 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_WDTMR, 8),
82 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_UC, 8),
83 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_OC, 8),
84 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DIRCHG_OV, 8),
85 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_SWON, 8),
86 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_UVP_D, 8),
87 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_UVP, 8),
88 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_OVP_D, 8),
89 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OVPCTRL_OVP, 8),
90 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED_STRBPIN, 8),
91 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED_TORPIN, 8),
92 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED_TX, 8),
93 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED_LVF, 8),
94 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED2_SHORT, 8),
95 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED1_SHORT, 8),
96 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED2_STRB, 8),
97 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED1_STRB, 8),
98 REGMAP_IRQ_REG_LINE(mT6370_IRQ_FLED2_STRB_TO, 8),
99 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED1_STRB_TO, 8),
100 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED2_TOR, 8),
101 REGMAP_IRQ_REG_LINE(MT6370_IRQ_FLED1_TOR, 8),
102 REGMAP_IRQ_REG_LINE(MT6370_IRQ_OTP, 8),
103 REGMAP_IRQ_REG_LINE(MT6370_IRQ_VDDA_OVP, 8),
104 REGMAP_IRQ_REG_LINE(MT6370_IRQ_VDDA_UV, 8),
105 REGMAP_IRQ_REG_LINE(MT6370_IRQ_LDO_OC, 8),
106 REGMAP_IRQ_REG_LINE(MT6370_IRQ_BLED_OCP, 8),
107 REGMAP_IRQ_REG_LINE(MT6370_IRQ_BLED_OVP, 8),
108 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DSV_VNEG_OCP, 8),
109 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DSV_VPOS_OCP, 8),
110 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DSV_BST_OCP, 8),
111 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DSV_VNEG_SCP, 8),
112 REGMAP_IRQ_REG_LINE(MT6370_IRQ_DSV_VPOS_SCP, 8),
116 .name = "mt6370-irqs",
134 MFD_CELL_OF("mt6370-adc",
135 NULL, NULL, 0, 0, "mediatek,mt6370-adc"),
136 MFD_CELL_OF("mt6370-charger",
137 NULL, NULL, 0, 0, "mediatek,mt6370-charger"),
138 MFD_CELL_OF("mt6370-flashlight",
139 NULL, NULL, 0, 0, "mediatek,mt6370-flashlight"),
140 MFD_CELL_OF("mt6370-indicator",
141 NULL, NULL, 0, 0, "mediatek,mt6370-indicator"),
142 MFD_CELL_OF("mt6370-tcpc",
143 NULL, NULL, 0, 0, "mediatek,mt6370-tcpc"),
144 MFD_CELL_RES("mt6370-regulator", mt6370_regulator_irqs),
148 MFD_CELL_OF("mt6370-backlight",
149 NULL, NULL, 0, 0, "mediatek,mt6370-backlight"),
153 MFD_CELL_OF("mt6370-backlight",
154 NULL, NULL, 0, 0, "mediatek,mt6372-backlight"),
175 return 0; in mt6370_check_vendor_info()
177 dev_err(dev, "Unknown Vendor ID 0x%02x\n", devinfo); in mt6370_check_vendor_info()
178 return -ENODEV; in mt6370_check_vendor_info()
190 bank_idx = u8_buf[0]; in mt6370_regmap_read()
193 ret = i2c_smbus_read_i2c_block_data(info->i2c[bank_idx], bank_addr, in mt6370_regmap_read()
195 if (ret < 0) in mt6370_regmap_read()
199 return -EIO; in mt6370_regmap_read()
201 return 0; in mt6370_regmap_read()
209 int len = count - MT6370_MAX_ADDRLEN; in mt6370_regmap_write()
211 bank_idx = u8_buf[0]; in mt6370_regmap_write()
214 return i2c_smbus_write_i2c_block_data(info->i2c[bank_idx], bank_addr, in mt6370_regmap_write()
225 .val_bits = 8,
235 struct device *dev = &i2c->dev; in mt6370_probe()
240 return -ENOMEM; in mt6370_probe()
242 usbc_i2c = devm_i2c_new_dummy_device(dev, i2c->adapter, in mt6370_probe()
249 info->i2c[MT6370_PMU_I2C] = i2c; in mt6370_probe()
250 info->i2c[MT6370_USBC_I2C] = usbc_i2c; in mt6370_probe()
262 ret = devm_regmap_add_irq_chip(dev, regmap, i2c->irq, in mt6370_probe()
263 IRQF_ONESHOT, -1, &mt6370_irq_chip, in mt6370_probe()
264 &info->irq_data); in mt6370_probe()
274 NULL, 0, in mt6370_probe()
275 regmap_irq_get_domain(info->irq_data)); in mt6370_probe()
281 NULL, 0, in mt6370_probe()
282 regmap_irq_get_domain(info->irq_data)); in mt6370_probe()
291 NULL, 0, in mt6370_probe()
292 regmap_irq_get_domain(info->irq_data)); in mt6370_probe()