Lines Matching +full:mt6360 +full:- +full:chg
1 // SPDX-License-Identifier: GPL-2.0
79 /* reg 0 -> 0 ~ 7 */
84 /* REG 1 -> 8 ~ 15 */
91 /* REG 2 -> 16 ~ 23 */
92 /* REG 3 -> 24 ~ 31 */
99 /* REG 4 -> 32 ~ 39 */
107 /* REG 5 -> 40 ~ 47 */
116 /* REG 6 -> 48 ~ 55 */
124 /* REG 7 -> 56 ~ 63 */
133 /* REG 8 -> 64 ~ 71 */
142 /* REG 9 -> 72 ~ 79 */
149 /* REG 10 -> 80 ~ 87 */
156 /* REG 11 -> 88 ~ 95 */
157 /* REG 12 -> 96 ~ 103 */
162 /* REG 13 -> 104 ~ 111 */
167 /* REG 14 -> 112 ~ 119 */
174 /* REG 15 -> 120 ~ 127 */
338 MFD_CELL_OF("mt6360-adc", mt6360_adc_resources,
339 NULL, 0, 0, "mediatek,mt6360-adc"),
340 MFD_CELL_OF("mt6360-chg", mt6360_chg_resources,
341 NULL, 0, 0, "mediatek,mt6360-chg"),
342 MFD_CELL_OF("mt6360-led", mt6360_led_resources,
343 NULL, 0, 0, "mediatek,mt6360-led"),
344 MFD_CELL_RES("mt6360-regulator", mt6360_regulator_resources),
345 MFD_CELL_OF("mt6360-tcpc", NULL,
346 NULL, 0, 0, "mediatek,mt6360-tcpc"),
354 ret = regmap_read(ddata->regmap, MT6360_PMU_DEV_INFO, &info); in mt6360_check_vendor_info()
359 dev_err(ddata->dev, "Device not supported\n"); in mt6360_check_vendor_info()
360 return -ENODEV; in mt6360_check_vendor_info()
363 ddata->chip_rev = info & CHIP_REV_MASK; in mt6360_check_vendor_info()
394 return -EINVAL; in mt6360_xlate_pmicldo_addr()
414 return -EINVAL; in mt6360_regmap_read()
416 i2c = ddata->i2c[bank]; in mt6360_regmap_read()
428 return -ENOMEM; in mt6360_regmap_read()
430 buf[0] = I2C_ADDR_XLATE_8BIT(i2c->addr, I2C_SMBUS_READ); in mt6360_regmap_read()
438 return -EIO; in mt6360_regmap_read()
441 crc = crc8(ddata->crc8_tbl, buf, val_size + MT6360_CRC_PREDATA_OFFSET, 0); in mt6360_regmap_read()
443 return -EIO; in mt6360_regmap_read()
460 int write_size = val_size - MT6360_REGMAP_REG_BYTE_SIZE; in mt6360_regmap_write()
464 return -EINVAL; in mt6360_regmap_write()
466 i2c = ddata->i2c[bank]; in mt6360_regmap_write()
470 ret = mt6360_xlate_pmicldo_addr(®_addr, val_size - MT6360_REGMAP_REG_BYTE_SIZE); in mt6360_regmap_write()
477 return -ENOMEM; in mt6360_regmap_write()
479 buf[0] = I2C_ADDR_XLATE_8BIT(i2c->addr, I2C_SMBUS_WRITE); in mt6360_regmap_write()
484 buf[val_size] = crc8(ddata->crc8_tbl, buf, val_size, 0); in mt6360_regmap_write()
534 ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); in mt6360_probe()
536 return -ENOMEM; in mt6360_probe()
538 ddata->dev = &client->dev; in mt6360_probe()
541 for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) { in mt6360_probe()
542 ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev, in mt6360_probe()
543 client->adapter, in mt6360_probe()
545 if (IS_ERR(ddata->i2c[i])) { in mt6360_probe()
546 dev_err(&client->dev, in mt6360_probe()
549 return PTR_ERR(ddata->i2c[i]); in mt6360_probe()
552 ddata->i2c[MT6360_SLAVE_MAX - 1] = client; in mt6360_probe()
554 crc8_populate_msb(ddata->crc8_tbl, MT6360_CRC8_POLYNOMIAL); in mt6360_probe()
555 ddata->regmap = devm_regmap_init(ddata->dev, &mt6360_regmap_bus, ddata, in mt6360_probe()
557 if (IS_ERR(ddata->regmap)) { in mt6360_probe()
558 dev_err(&client->dev, "Failed to register regmap\n"); in mt6360_probe()
559 return PTR_ERR(ddata->regmap); in mt6360_probe()
566 ret = devm_regmap_add_irq_chip(&client->dev, ddata->regmap, client->irq, in mt6360_probe()
568 &ddata->irq_data); in mt6360_probe()
570 dev_err(&client->dev, "Failed to add Regmap IRQ Chip\n"); in mt6360_probe()
574 ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO, in mt6360_probe()
576 0, regmap_irq_get_domain(ddata->irq_data)); in mt6360_probe()
578 dev_err(&client->dev, in mt6360_probe()
591 enable_irq_wake(i2c->irq); in mt6360_suspend()
602 disable_irq_wake(i2c->irq); in mt6360_resume()
610 { .compatible = "mediatek,mt6360", },
617 .name = "mt6360",
626 MODULE_DESCRIPTION("MT6360 I2C Driver");