Lines Matching +full:mt6360 +full:- +full:chg

1 // SPDX-License-Identifier: GPL-2.0
78 /* reg 0 -> 0 ~ 7 */
83 /* REG 1 -> 8 ~ 15 */
90 /* REG 2 -> 16 ~ 23 */
91 /* REG 3 -> 24 ~ 31 */
98 /* REG 4 -> 32 ~ 39 */
106 /* REG 5 -> 40 ~ 47 */
115 /* REG 6 -> 48 ~ 55 */
123 /* REG 7 -> 56 ~ 63 */
132 /* REG 8 -> 64 ~ 71 */
141 /* REG 9 -> 72 ~ 79 */
148 /* REG 10 -> 80 ~ 87 */
155 /* REG 11 -> 88 ~ 95 */
156 /* REG 12 -> 96 ~ 103 */
161 /* REG 13 -> 104 ~ 111 */
166 /* REG 14 -> 112 ~ 119 */
173 /* REG 15 -> 120 ~ 127 */
337 MFD_CELL_OF("mt6360-adc", mt6360_adc_resources,
338 NULL, 0, 0, "mediatek,mt6360-adc"),
339 MFD_CELL_OF("mt6360-chg", mt6360_chg_resources,
340 NULL, 0, 0, "mediatek,mt6360-chg"),
341 MFD_CELL_OF("mt6360-led", mt6360_led_resources,
342 NULL, 0, 0, "mediatek,mt6360-led"),
343 MFD_CELL_RES("mt6360-regulator", mt6360_regulator_resources),
344 MFD_CELL_OF("mt6360-tcpc", NULL,
345 NULL, 0, 0, "mediatek,mt6360-tcpc"),
353 ret = regmap_read(ddata->regmap, MT6360_PMU_DEV_INFO, &info); in mt6360_check_vendor_info()
358 dev_err(ddata->dev, "Device not supported\n"); in mt6360_check_vendor_info()
359 return -ENODEV; in mt6360_check_vendor_info()
362 ddata->chip_rev = info & CHIP_REV_MASK; in mt6360_check_vendor_info()
393 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 ret = -EIO; in mt6360_regmap_read()
443 crc = crc8(ddata->crc8_tbl, buf, val_size + MT6360_CRC_PREDATA_OFFSET, 0); in mt6360_regmap_read()
445 ret = -EIO; in mt6360_regmap_read()
465 int write_size = val_size - MT6360_REGMAP_REG_BYTE_SIZE; in mt6360_regmap_write()
469 return -EINVAL; in mt6360_regmap_write()
471 i2c = ddata->i2c[bank]; in mt6360_regmap_write()
475 ret = mt6360_xlate_pmicldo_addr(&reg_addr, val_size - MT6360_REGMAP_REG_BYTE_SIZE); in mt6360_regmap_write()
482 return -ENOMEM; in mt6360_regmap_write()
484 buf[0] = I2C_ADDR_XLATE_8BIT(i2c->addr, I2C_SMBUS_WRITE); in mt6360_regmap_write()
489 buf[val_size] = crc8(ddata->crc8_tbl, buf, val_size, 0); in mt6360_regmap_write()
539 ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); in mt6360_probe()
541 return -ENOMEM; in mt6360_probe()
543 ddata->dev = &client->dev; in mt6360_probe()
546 for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) { in mt6360_probe()
547 ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev, in mt6360_probe()
548 client->adapter, in mt6360_probe()
550 if (IS_ERR(ddata->i2c[i])) { in mt6360_probe()
551 dev_err(&client->dev, in mt6360_probe()
554 return PTR_ERR(ddata->i2c[i]); in mt6360_probe()
557 ddata->i2c[MT6360_SLAVE_MAX - 1] = client; in mt6360_probe()
559 crc8_populate_msb(ddata->crc8_tbl, MT6360_CRC8_POLYNOMIAL); in mt6360_probe()
560 ddata->regmap = devm_regmap_init(ddata->dev, &mt6360_regmap_bus, ddata, in mt6360_probe()
562 if (IS_ERR(ddata->regmap)) { in mt6360_probe()
563 dev_err(&client->dev, "Failed to register regmap\n"); in mt6360_probe()
564 return PTR_ERR(ddata->regmap); in mt6360_probe()
571 ret = devm_regmap_add_irq_chip(&client->dev, ddata->regmap, client->irq, in mt6360_probe()
573 &ddata->irq_data); in mt6360_probe()
575 dev_err(&client->dev, "Failed to add Regmap IRQ Chip\n"); in mt6360_probe()
579 ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO, in mt6360_probe()
581 0, regmap_irq_get_domain(ddata->irq_data)); in mt6360_probe()
583 dev_err(&client->dev, in mt6360_probe()
596 enable_irq_wake(i2c->irq); in mt6360_suspend()
607 disable_irq_wake(i2c->irq); in mt6360_resume()
615 { .compatible = "mediatek,mt6360", },
622 .name = "mt6360",
631 MODULE_DESCRIPTION("MT6360 I2C Driver");