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

Configure Feed

Select the types of activity you want to include in your feed.

rtc: max77686: convert to i2c_new_ancillary_device

Convert RTC I2C device creation from devm_i2c_new_dummy_device() to
i2c_new_ancillary_device() to enable the use of a device tree-specified
RTC address instead of a hardcoded value. If the device tree does not
provide an address, use hardcoded values as a fallback.

This addresses an issue with the MAX77663 PMIC, which can have the RTC at
different I2C positions (either 0x48, like the MAX77714, or 0x68, like
the MAX77620). The MAX77620 value is used as the default. The I2C position
of the MAX77663 is factory-set and cannot be detected from the chip
itself.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Link: https://patch.msgid.link/20260312085258.11431-6-clamor95@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Svyatoslav Ryhel and committed by
Alexandre Belloni
0d65a9d9 cbf39bfd

+12 -2
+12 -2
drivers/rtc/rtc-max77686.c
··· 686 686 return ret; 687 687 } 688 688 689 + static void max77686_rtc_release_dev(void *client) 690 + { 691 + i2c_unregister_device(client); 692 + } 693 + 689 694 static int max77686_init_rtc_regmap(struct max77686_rtc_info *info) 690 695 { 691 696 struct device *parent = info->dev->parent; ··· 718 713 goto add_rtc_irq; 719 714 } 720 715 721 - client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter, 722 - info->drv_data->rtc_i2c_addr); 716 + client = i2c_new_ancillary_device(parent_i2c, "rtc", 717 + info->drv_data->rtc_i2c_addr); 723 718 if (IS_ERR(client)) 724 719 return dev_err_probe(info->dev, PTR_ERR(client), 725 720 "Failed to allocate I2C device for RTC\n"); 721 + 722 + ret = devm_add_action_or_reset(info->dev, max77686_rtc_release_dev, 723 + client); 724 + if (ret) 725 + return ret; 726 726 727 727 info->rtc_regmap = devm_regmap_init_i2c(client, 728 728 info->drv_data->regmap_config);