static int __devinit archos_omap4_soc_probe(struct platform_device *pdev) { int ret, no_twl6040; pr_info("%s: Archos Device SoC init\n", __func__); no_twl6040 = 0; if (!no_twl6040) { /* Master clock has to be enable to feed the TWL6040 */ pt_audio_device_io = archos_audio_twl6040_get_io(); } archos_omap4_snd_device = platform_device_alloc("soc-audio", -1); if (!archos_omap4_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&archos_omap4_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; if (no_twl6040) platform_set_drvdata(archos_omap4_snd_device, &snd_soc_archos_omap4_no_twl6040); else platform_set_drvdata(archos_omap4_snd_device, &snd_soc_archos_omap4); ret = platform_device_add(archos_omap4_snd_device); if (ret) goto err_dev; /* regulators */ dmic_1v8 = regulator_get(&archos_omap4_snd_device->dev, "DMIC_1V8"); if (IS_ERR(dmic_1v8)) dev_dbg(&archos_omap4_snd_device->dev, "no DMIC_1V8\n"); if (!no_twl6040) { twl6040_codec = snd_soc_card_get_codec(&snd_soc_archos_omap4, "twl6040-codec"); if(twl6040_codec <= 0) { printk(KERN_ERR "archos_omap4: could not find `twl6040-codec`\n"); ret = -ENODEV; goto err_dev; } } return ret; err_dev: snd_soc_unregister_dais(&archos_omap4_snd_device->dev, ARRAY_SIZE(dai)); err: platform_device_put(archos_omap4_snd_device); if (!IS_ERR(dmic_1v8)) { regulator_disable(dmic_1v8); regulator_put(dmic_1v8); } return ret; }
static int __init sdp4430_soc_init(void) { int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda() && !machine_is_omap_tabletblaze()) { pr_debug("Not SDP4430, BlazeTablet or PandaBoard!\n"); return -ENODEV; } printk(KERN_INFO "SDP4430 SoC init\n"); if (machine_is_omap_4430sdp()) snd_soc_sdp4430.name = "SDP4430"; else if (machine_is_omap4_panda()) snd_soc_sdp4430.name = "Panda"; else if (machine_is_omap_tabletblaze()) snd_soc_sdp4430.name = "Tablet44xx"; sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err_dev; twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); if(twl6040_codec <= 0) { printk(KERN_ERR "sdp4430: could not find `twl6040-codec`\n"); ret = -ENODEV; goto err_dev; } av_switch_reg = regulator_get(&sdp4430_snd_device->dev, "av-switch"); if (IS_ERR(av_switch_reg)) { ret = PTR_ERR(av_switch_reg); printk(KERN_ERR "couldn't get AV Switch regulator %d\n", ret); goto err_dev; } return ret; err_dev: snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai)); err: platform_device_put(sdp4430_snd_device); return ret; }
static int __init sdp4430_soc_init(void) { int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda()) { pr_debug("Not SDP4430 or PandaBoard!\n"); return -ENODEV; } printk(KERN_INFO "SDP4430 SoC init\n"); if (machine_is_omap_4430sdp()) snd_soc_sdp4430.name = "SDP4430"; else if (machine_is_omap4_panda()) snd_soc_sdp4430.name = "Panda"; sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err; twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); return 0; err: printk(KERN_ERR "Unable to add platform device\n"); platform_device_put(sdp4430_snd_device); return ret; }
static int __init sdp4430_soc_init(void) { int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda() && !machine_is_omap_tabletblaze()) { pr_debug("Not SDP4430, BlazeTablet or PandaBoard!\n"); return -ENODEV; } printk(KERN_INFO "SDP4430 SoC init\n"); if (machine_is_omap_4430sdp()) snd_soc_sdp4430.name = "SDP4430"; else if (machine_is_omap4_panda()) snd_soc_sdp4430.name = "Panda"; else if (machine_is_omap_tabletblaze()) snd_soc_sdp4430.name = "Tablet44xx"; sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err_dev; twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); if(twl6040_codec <= 0) { printk(KERN_ERR "sdp4430: could not find `twl6040-codec`\n"); ret = -ENODEV; goto err_dev; } /*av_switch_reg = regulator_get(&sdp4430_snd_device->dev, "av-switch"); if (IS_ERR(av_switch_reg)) { ret = PTR_ERR(av_switch_reg); printk(KERN_ERR "couldn't get AV Switch regulator %d\n", ret); goto err_dev; }*/ /* Default mode is low-power, MCLK not required */ twl6040_power_mode = 0; cdc_tcxo_set_req_int(CDC_TCXO_CLK2, 0); /* * CDC CLK2 supplies TWL6040 MCLK, drive it from REQ2INT to * have full control of MCLK gating */ cdc_tcxo_set_req_prio(CDC_TCXO_CLK2, CDC_TCXO_PRIO_REQINT); return ret; err_dev: snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai)); err: platform_device_put(sdp4430_snd_device); return ret; }
static int __init sdp4430_soc_init(void) { u8 gpoctl; int ret; // Need Fix // if (!machine_is_p2() && !machine_is_lghdk() && !machine_is_iff() && !machine_is_u2) { // printk("Not Supported Sound Device\n"); // return -ENODEV; // } printk(KERN_INFO "LG SoC init\n"); if (machine_is_lghdk()) snd_soc_sdp4430.name = "lghdk"; else if(machine_is_p2()) snd_soc_sdp4430.name = "p2"; else if(machine_is_iff()) snd_soc_sdp4430.name = "iff"; // Need Fix else snd_soc_sdp4430.name = "u2"; sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err_dev; twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); if(twl6040_codec <= 0) { printk(KERN_ERR "sdp4430: could not find `twl6040-codec`\n"); ret = -ENODEV; goto err_dev; } #if 0 //Ti patch av_switch_reg = regulator_get(&sdp4430_snd_device->dev, "av-switch"); if (IS_ERR(av_switch_reg)) { ret = PTR_ERR(av_switch_reg); printk(KERN_ERR "couldn't get AV Switch regulator %d\n", ret); goto err_dev; } /* Default mode is low-power, MCLK not required */ twl6040_power_mode = 0; cdc_tcxo_set_req_int(CDC_TCXO_CLK2, 0); /* * CDC CLK2 supplies TWL6040 MCLK, drive it from REQ2INT to * have full control of MCLK gating */ cdc_tcxo_set_req_prio(CDC_TCXO_CLK2, CDC_TCXO_PRIO_REQINT); return ret; #else // /* Default mode is low-power, MCLK not required */ twl6040_power_mode = 0; // Set Default mode is High-Performace power // //cdc_tcxo_set_req_int(CDC_TCXO_CLK3, 0); cdc_tcxo_set_req_int(CDC_TCXO_CLK3, 1); // /* * CDC CLK2 supplies TWL6040 MCLK, drive it from REQ2INT to * have full control of MCLK gating */ cdc_tcxo_set_req_prio(CDC_TCXO_CLK3, CDC_TCXO_PRIO_REQINT); return 0; #endif err_dev: snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai)); err: platform_device_put(sdp4430_snd_device); return ret; }
static int __init sdp4430_soc_init(void) { int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda() && !machine_is_tuna()) { pr_debug("Not SDP4430, PandaBoard or Tuna!\n"); return -ENODEV; } printk(KERN_INFO "SDP4430 SoC init\n"); if (machine_is_tuna()) { ret = gpio_request(TUNA_MAIN_MIC_GPIO, "MAIN_MICBIAS_EN"); if (ret) goto mainmic_gpio_err; gpio_direction_output(TUNA_MAIN_MIC_GPIO, 0); ret = gpio_request(TUNA_SUB_MIC_GPIO, "SUB_MICBIAS_EN"); if (ret) goto submic_gpio_err; gpio_direction_output(TUNA_SUB_MIC_GPIO, 0); } if (machine_is_omap_4430sdp()) snd_soc_sdp4430.name = "SDP4430"; else if (machine_is_omap4_panda()) snd_soc_sdp4430.name = "Panda"; else if (machine_is_tuna()) snd_soc_sdp4430.name = "Tuna"; twl6040_clk32kreg = regulator_get(NULL, "twl6040_clk32k"); if (IS_ERR(twl6040_clk32kreg)) { ret = PTR_ERR(twl6040_clk32kreg); printk(KERN_ERR "failed to get CLK32K %d\n", ret); goto clk32kreg_err; } /* enable external 32kHz clock during TWL6040/McPDM probe */ ret = regulator_enable(twl6040_clk32kreg); if (ret) { printk(KERN_ERR "failed to enable TWL6040 CLK32K\n"); goto clk32kreg_ena_err; } sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); ret = -ENOMEM; goto device_err; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err; regulator_disable(twl6040_clk32kreg); twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); return 0; err: printk(KERN_ERR "Unable to add platform device\n"); platform_device_put(sdp4430_snd_device); device_err: regulator_disable(twl6040_clk32kreg); clk32kreg_ena_err: regulator_put(twl6040_clk32kreg); clk32kreg_err: if (machine_is_tuna()) gpio_free(TUNA_SUB_MIC_GPIO); submic_gpio_err: if (machine_is_tuna()) gpio_free(TUNA_MAIN_MIC_GPIO); mainmic_gpio_err: return ret; }
static int __init sdp4430_soc_init(void) { struct i2c_adapter *adapter; u8 gpoctl; int ret; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda() && !machine_is_omap_tabletblaze()) { pr_debug("Not SDP4430, BlazeTablet or PandaBoard!\n"); return -ENODEV; } printk(KERN_INFO "SDP4430 SoC init\n"); if (machine_is_omap_4430sdp()) snd_soc_sdp4430.name = "SDP4430"; else if (machine_is_omap4_panda()) snd_soc_sdp4430.name = "Panda"; else if (machine_is_omap_tabletblaze()) snd_soc_sdp4430.name = "Tablet44xx"; sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } ret = snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); if (ret < 0) goto err; platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err_dev; twl6040_codec = snd_soc_card_get_codec(&snd_soc_sdp4430, "twl6040-codec"); if(twl6040_codec <= 0) { printk(KERN_ERR "sdp4430: could not find `twl6040-codec`\n"); ret = -ENODEV; goto err_dev; } av_switch_reg = regulator_get(&sdp4430_snd_device->dev, "av-switch"); if (IS_ERR(av_switch_reg)) { ret = PTR_ERR(av_switch_reg); printk(KERN_ERR "couldn't get AV Switch regulator %d\n", ret); goto err_dev; } /* enable tps6130x */ ret = twl_i2c_read_u8(TWL_MODULE_AUDIO_VOICE, &gpoctl, TWL6040_REG_GPOCTL); if (ret) { printk(KERN_ERR "i2c read error\n"); goto i2c_err; } ret = twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, gpoctl | TWL6040_GPO2, TWL6040_REG_GPOCTL); if (ret) { printk(KERN_ERR "i2c write error\n"); goto i2c_err; } adapter = i2c_get_adapter(TPS6130X_I2C_ADAPTER); if (!adapter) { printk(KERN_ERR "can't get i2c adapter\n"); ret = -ENODEV; goto adp_err; } tps6130x_client = i2c_new_device(adapter, &tps6130x_hwmon_info); if (!tps6130x_client) { printk(KERN_ERR "can't add i2c device\n"); ret = -ENODEV; goto tps_err; } /* Only configure the TPS6130x on SDP4430 */ if (machine_is_omap_4430sdp() || machine_is_omap_tabletblaze()) sdp4430_tps6130x_configure(); i2c_put_adapter(adapter); return ret; tps_err: i2c_put_adapter(adapter); adp_err: twl_i2c_write_u8(TWL_MODULE_AUDIO_VOICE, gpoctl, TWL6040_REG_GPOCTL); i2c_err: regulator_put(av_switch_reg); err_dev: snd_soc_unregister_dais(&sdp4430_snd_device->dev, ARRAY_SIZE(dai)); err: platform_device_put(sdp4430_snd_device); return ret; }