Hi Biju, On Thu, May 18, 2023 at 1:37 PM Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote: > > The RAA215300 is a 9-channel PMIC that consists of > * Internally compensated regulators > * built-in Real Time Clock (RTC) > * 32kHz crystal oscillator > * coin cell battery charger > > The RTC on RAA215300 is similar to the IP found in the ISL1208. > The existing driver for the ISL1208 works for this PMIC too, > however the RAA215300 exposes two devices via I2C, one for the RTC > IP, and one for everything else. The RTC IP has to be enabled > by the other I2C device, therefore this driver is necessary to get > the RTC to work. > > The external oscillator bit is inverted on PMIC version 0x11. > > Add PMIC RAA215300 driver for enabling RTC block and instantiating > RTC device based on PMIC version. > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > --- > v3->v4: > * Moved from mfd->regulator as it doesn't use MFD APIs > * Dropped handling "renesas,rtc-enabled" property and instead used > clock-names to determine RTC is enabled or not and then instantiating > RTC device. Thanks for your patch! > --- /dev/null > +++ b/drivers/regulator/raa215300.c > + xin = devm_clk_get_optional(&client->dev, "xin"); > + if (IS_ERR_OR_NULL(xin)) { > + clkin = devm_clk_get(&client->dev, "clkin"); > + if (IS_ERR(clkin)) > + return PTR_ERR(clkin); > + > + int_osc_en = false; > + xin = NULL; > + } else { > + clkin = NULL; > + } > + > + if (xin || clkin) { Perhaps just "if (of_property_present(np, "clocks"))"? > + struct i2c_client *rtc_client; > + > + /* Enable RTC block */ > + regmap_update_bits(regmap, RAA215300_REG_BLOCK_EN, > + RAA215300_REG_BLOCK_EN_RTC_EN, > + RAA215300_REG_BLOCK_EN_RTC_EN); > + > + rtc_client = i2c_new_ancillary_device(client, "rtc", > + RAA215300_RTC_DEFAULT_ADDR, > + pmic_version >= 0x12 ? > + "isl1208" : "raa215300_a0"); > + if (IS_ERR(rtc_client)) > + return PTR_ERR(rtc_client); > + > + ret = devm_add_action_or_reset(dev, > + raa215300_rtc_unregister_device, > + rtc_client); > + if (ret < 0) > + return ret; > + } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds