On 7/20/2018 5:48 PM, Mark Brown wrote: > On Fri, Jul 20, 2018 at 02:38:11PM +0800, Akshu Agrawal wrote: > >> static int cz_probe(struct platform_device *pdev) >> { >> int ret; >> struct snd_soc_card *card; >> struct acp_platform_info *machine; >> + static bool regulators_registered; >> + >> + if (!regulators_registered) { >> + ret = platform_device_register(&acp_da7219_regulator); >> + if (ret) { >> + dev_err(&pdev->dev, "Failed to register regulator: %d\n", >> + ret); >> + return ret; >> + } >> + regulators_registered = true; >> + } > > You should be unregistering the regulator in your remove function, not > doing this hack here. I'd also expect to see the card made the parent > of the device that gets registered. > This approach shows inconsistencies and in some boot cycles da7219 fails to get regulator. Form the logs (below) it shows time gap between the time we call “platform_device_register(&acp_da7219_regulator);” and when the regulator actually gets registered. [ 12.594237] regulator registered **print after calling “platform_device_register(&acp_da7219_regulator);” ... [ 13.583689] da7219 i2c-DLGS7219:00: i2c-DLGS7219:00 supply VDD not found, using dummy regulator [ 13.593818] da7219 i2c-DLGS7219:00: i2c-DLGS7219:00 supply VDDMIC not found, using dummy regulator [ 13.603242] da7219 i2c-DLGS7219:00: i2c-DLGS7219:00 supply VDDIO not found, using dummy regulator [ 13.612626] da7219 i2c-DLGS7219:00: Invalid VDDIO voltage **Above DA7219 gets probed and does not find the regulator** ... [ 13.750894] reg_fixed_voltage_probe: Supply -> reg-fixed-1.8V [ 13.766746] reg-fixed-1.8V supplying 1800000uV **Regulator actually gets registered** Alternate and consistent approach to this is pushed by Daniel here: https://patchwork.kernel.org/patch/10539485/ Thanks, Akshu _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel