Skip to content

Commit 5447da5

Browse files
jkrzyszttmlind
authored andcommitted
ARM: OMAP1: ams-delta: Fix MODEM initialization failure
Regulator drivers were modified to use asynchronous device probe. Since then, the board .init_late hook fails to acquire a GPIO based fixed regulator needed by an on-board voice MODEM device, and unregisters the MODEM. That in turn triggers a so far not discovered bug of device unregister function called for a device with no associated release() op. serial8250 serial8250.1: incomplete constraints, dummy supplies not allowed WARNING: CPU: 0 PID: 1 at drivers/base/core.c:2486 device_release+0x98/0xa8 Device 'serial8250.1' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst. ... put_device from platform_device_put+0x1c/0x24 platform_device_put from ams_delta_init_late+0x4c/0x68 ams_delta_init_late from init_machine_late+0x1c/0x94 init_machine_late from do_one_initcall+0x60/0x1d4 As a consequence, ASoC CODEC driver is no longer able to control its device over the voice MODEM's tty interface. cx20442-codec: ASoC: error at soc_component_write_no_lock on cx20442-codec for register: [0x00000000] -5 cx20442-codec: ASoC: error at snd_soc_component_update_bits_legacy on cx20442-codec for register: [0x00000000] -5 cx20442-codec: ASoC: error at snd_soc_component_update_bits on cx20442-codec for register: [0x00000000] -5 The regulator hangs of a GPIO pin controlled by basic-mmio-gpio driver. Unlike most GPIO drivers, that driver doesn't probe for devices before device_initcall, then GPIO pins under its control are not availabele to majority of devices probed at that phase, including regulators. On the other hand, serial8250 driver used by the MODEM device neither accepts via platform data nor handles regulators, then the board file is not able to teach that driver to return -EPROBE_DEFER when the regulator is not ready so the failed probe is retried after late_initcall. Resolve the issue by extending description of the MODEM device with a dedicated power management domain. Acquire the regulator from the domain's .activate hook and return -EPROBE_DEFER if the regulator is not available. Having that under control, add the regulator device description to the list of platform devices initialized from .init_machine and drop the no longer needed custom .init_late hook. v2: Trim down the warning for prettier git log output (Tony). Fixes: 259b93b ("regulator: Set PROBE_PREFER_ASYNCHRONOUS for drivers that existed in 4.14") Signed-off-by: Janusz Krzysztofik <[email protected]> Cc: [email protected] # v6.4+ Message-ID: <[email protected]> Signed-off-by: Tony Lindgren <[email protected]>
1 parent 7eeca8c commit 5447da5

File tree

1 file changed

+16
-44
lines changed

1 file changed

+16
-44
lines changed

arch/arm/mach-omap1/board-ams-delta.c

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,7 @@ static struct platform_device *ams_delta_devices[] __initdata = {
550550
&ams_delta_nand_device,
551551
&ams_delta_lcd_device,
552552
&cx20442_codec_device,
553+
&modem_nreset_device,
553554
};
554555

555556
static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = {
@@ -782,26 +783,28 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = {
782783
{ },
783784
};
784785

786+
static int ams_delta_modem_pm_activate(struct device *dev)
787+
{
788+
modem_priv.regulator = regulator_get(dev, "RESET#");
789+
if (IS_ERR(modem_priv.regulator))
790+
return -EPROBE_DEFER;
791+
792+
return 0;
793+
}
794+
795+
static struct dev_pm_domain ams_delta_modem_pm_domain = {
796+
.activate = ams_delta_modem_pm_activate,
797+
};
798+
785799
static struct platform_device ams_delta_modem_device = {
786800
.name = "serial8250",
787801
.id = PLAT8250_DEV_PLATFORM1,
788802
.dev = {
789803
.platform_data = ams_delta_modem_ports,
804+
.pm_domain = &ams_delta_modem_pm_domain,
790805
},
791806
};
792807

793-
static int __init modem_nreset_init(void)
794-
{
795-
int err;
796-
797-
err = platform_device_register(&modem_nreset_device);
798-
if (err)
799-
pr_err("Couldn't register the modem regulator device\n");
800-
801-
return err;
802-
}
803-
804-
805808
/*
806809
* This function expects MODEM IRQ number already assigned to the port.
807810
* The MODEM device requires its RESET# pin kept high during probe.
@@ -833,37 +836,6 @@ static int __init ams_delta_modem_init(void)
833836
}
834837
arch_initcall_sync(ams_delta_modem_init);
835838

836-
static int __init late_init(void)
837-
{
838-
int err;
839-
840-
err = modem_nreset_init();
841-
if (err)
842-
return err;
843-
844-
/*
845-
* Once the modem device is registered, the modem_nreset
846-
* regulator can be requested on behalf of that device.
847-
*/
848-
modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
849-
"RESET#");
850-
if (IS_ERR(modem_priv.regulator)) {
851-
err = PTR_ERR(modem_priv.regulator);
852-
goto unregister;
853-
}
854-
return 0;
855-
856-
unregister:
857-
platform_device_unregister(&ams_delta_modem_device);
858-
return err;
859-
}
860-
861-
static void __init ams_delta_init_late(void)
862-
{
863-
omap1_init_late();
864-
late_init();
865-
}
866-
867839
static void __init ams_delta_map_io(void)
868840
{
869841
omap1_map_io();
@@ -877,7 +849,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
877849
.init_early = omap1_init_early,
878850
.init_irq = omap1_init_irq,
879851
.init_machine = ams_delta_init,
880-
.init_late = ams_delta_init_late,
852+
.init_late = omap1_init_late,
881853
.init_time = omap1_timer_init,
882854
.restart = omap1_restart,
883855
MACHINE_END

0 commit comments

Comments
 (0)