static int __init ams_delta_module_init(void) { int ret; if (!(machine_is_ams_delta())) return -ENODEV; ams_delta_audio_platform_device = platform_device_alloc("soc-audio", -1); if (!ams_delta_audio_platform_device) return -ENOMEM; platform_set_drvdata(ams_delta_audio_platform_device, &ams_delta_audio_card); ret = platform_device_add(ams_delta_audio_platform_device); if (ret) goto err; /* * Codec platform device could be registered from elsewhere (board?), * but I do it here as it makes sense only if used with the card. */ cx20442_platform_device = platform_device_register_simple("cx20442-codec", -1, NULL, 0); return 0; err: platform_device_put(ams_delta_audio_platform_device); return ret; }
static int __init ams_delta_module_init(void) { int ret; if (!(machine_is_ams_delta())) return -ENODEV; ams_delta_audio_platform_device = platform_device_alloc("soc-audio", -1); if (!ams_delta_audio_platform_device) return -ENOMEM; platform_set_drvdata(ams_delta_audio_platform_device, &ams_delta_snd_soc_device); ams_delta_snd_soc_device.dev = &ams_delta_audio_platform_device->dev; *(unsigned int *)ams_delta_dai_link.cpu_dai->private_data = OMAP_MCBSP1; ret = platform_device_add(ams_delta_audio_platform_device); if (ret) goto err; /* * Codec platform device could be registered from elsewhere (board?), * but I do it here as it makes sense only if used with the card. */ cx20442_platform_device = platform_device_register_simple("cx20442", -1, NULL, 0); return 0; err: platform_device_put(ams_delta_audio_platform_device); return ret; }
static int __init late_init(void) { int err; if (!machine_is_ams_delta()) return -ENODEV; err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); if (err) { pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); return err; } platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); err = platform_device_register(&modem_nreset_device); if (err) { pr_err("Couldn't register the modem regulator device\n"); return err; } omap_cfg_reg(M14_1510_GPIO2); ams_delta_modem_ports[0].irq = gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem"); if (err) { pr_err("Couldn't request gpio pin for modem\n"); return err; } gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); /* Initialize the modem_nreset regulator consumer before use */ modem_priv.regulator = ERR_PTR(-ENODEV); ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, AMS_DELTA_LATCH2_MODEM_CODEC); err = platform_device_register(&ams_delta_modem_device); if (err) goto gpio_free; /* * Once the modem device is registered, the modem_nreset * regulator can be requested on behalf of that device. */ modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev, "RESET#"); if (IS_ERR(modem_priv.regulator)) { err = PTR_ERR(modem_priv.regulator); goto unregister; } return 0; unregister: platform_device_unregister(&ams_delta_modem_device); gpio_free: gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); return err; }
static int __init late_init(void) { int err; if (!machine_is_ams_delta()) return -ENODEV; err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); if (err) { pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); return err; } platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); omap_cfg_reg(M14_1510_GPIO2); ams_delta_modem_ports[0].irq = gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem"); if (err) { pr_err("Couldn't request gpio pin for modem\n"); return err; } gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); ams_delta_latch2_write( AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); err = platform_device_register(&ams_delta_modem_device); if (err) goto gpio_free; return 0; gpio_free: gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); return err; }
static int __init ams_delta_modem_init(void) { int err; if (!machine_is_ams_delta()) return -ENODEV; omap_cfg_reg(M14_1510_GPIO2); ams_delta_modem_ports[0].irq = gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); err = gpio_request(AMS_DELTA_GPIO_PIN_MODEM_IRQ, "modem"); if (err) { pr_err("Couldn't request gpio pin for modem\n"); return err; } gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); ams_delta_latch2_write( AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); return platform_device_register(&ams_delta_modem_device); }