Lines Matching +full:mt6360 +full:- +full:regulator
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()
405 struct i2c_client *i2c = ddata->i2c[bank]; in mt6360_regmap_read()
423 return -ENOMEM; in mt6360_regmap_read()
425 buf[0] = I2C_ADDR_XLATE_8BIT(i2c->addr, I2C_SMBUS_READ); in mt6360_regmap_read()
433 ret = -EIO; in mt6360_regmap_read()
438 crc = crc8(ddata->crc8_tbl, buf, val_size + MT6360_CRC_PREDATA_OFFSET, 0); in mt6360_regmap_read()
440 ret = -EIO; in mt6360_regmap_read()
456 struct i2c_client *i2c = ddata->i2c[bank]; in mt6360_regmap_write()
460 int write_size = val_size - MT6360_REGMAP_REG_BYTE_SIZE; in mt6360_regmap_write()
465 ret = mt6360_xlate_pmicldo_addr(®_addr, val_size - MT6360_REGMAP_REG_BYTE_SIZE); in mt6360_regmap_write()
472 return -ENOMEM; in mt6360_regmap_write()
474 buf[0] = I2C_ADDR_XLATE_8BIT(i2c->addr, I2C_SMBUS_WRITE); in mt6360_regmap_write()
479 buf[val_size] = crc8(ddata->crc8_tbl, buf, val_size, 0); in mt6360_regmap_write()
529 ddata = devm_kzalloc(&client->dev, sizeof(*ddata), GFP_KERNEL); in mt6360_probe()
531 return -ENOMEM; in mt6360_probe()
533 ddata->dev = &client->dev; in mt6360_probe()
536 for (i = 0; i < MT6360_SLAVE_MAX - 1; i++) { in mt6360_probe()
537 ddata->i2c[i] = devm_i2c_new_dummy_device(&client->dev, in mt6360_probe()
538 client->adapter, in mt6360_probe()
540 if (IS_ERR(ddata->i2c[i])) { in mt6360_probe()
541 dev_err(&client->dev, in mt6360_probe()
544 return PTR_ERR(ddata->i2c[i]); in mt6360_probe()
547 ddata->i2c[MT6360_SLAVE_MAX - 1] = client; in mt6360_probe()
549 crc8_populate_msb(ddata->crc8_tbl, MT6360_CRC8_POLYNOMIAL); in mt6360_probe()
550 ddata->regmap = devm_regmap_init(ddata->dev, &mt6360_regmap_bus, ddata, in mt6360_probe()
552 if (IS_ERR(ddata->regmap)) { in mt6360_probe()
553 dev_err(&client->dev, "Failed to register regmap\n"); in mt6360_probe()
554 return PTR_ERR(ddata->regmap); in mt6360_probe()
561 ret = devm_regmap_add_irq_chip(&client->dev, ddata->regmap, client->irq, in mt6360_probe()
563 &ddata->irq_data); in mt6360_probe()
565 dev_err(&client->dev, "Failed to add Regmap IRQ Chip\n"); in mt6360_probe()
569 ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO, in mt6360_probe()
571 0, regmap_irq_get_domain(ddata->irq_data)); in mt6360_probe()
573 dev_err(&client->dev, in mt6360_probe()
586 enable_irq_wake(i2c->irq); in mt6360_suspend()
597 disable_irq_wake(i2c->irq); in mt6360_resume()
605 { .compatible = "mediatek,mt6360", },
612 .name = "mt6360",
621 MODULE_DESCRIPTION("MT6360 I2C Driver");