static int __init omap4_hdmi_soc_init(void) { int ret; if (!(machine_is_omap_4430sdp() || machine_is_omap4_panda())) return -ENODEV; printk(KERN_INFO "OMAP4 HDMI audio SoC init\n"); if (machine_is_omap4_panda()) snd_soc_omap4_hdmi.name = "PandaHDMI"; omap4_hdmi_snd_device = platform_device_alloc("soc-audio", OMAP4_HDMI_SND_DEV_ID); if (!omap4_hdmi_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } platform_set_drvdata(omap4_hdmi_snd_device, &snd_soc_omap4_hdmi); ret = platform_device_add(omap4_hdmi_snd_device); if (ret) goto err; return 0; err: printk(KERN_ERR "Unable to add platform device\n"); platform_device_put(omap4_hdmi_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; } 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 omap4panda_soc_init(void) { int ret = 0; if (!machine_is_omap4_panda()) { pr_err("Not Panda board!\n"); return -ENODEV; } pr_info("OMA4 Panda SoC init\n"); omap4panda_snd_device = platform_device_alloc("soc-audio", -1); if (!omap4panda_snd_device) { pr_err("Platform device allocation failed\n"); return -ENOMEM; } snd_soc_register_dais(&omap4panda_snd_device->dev, dai, ARRAY_SIZE(dai)); platform_set_drvdata(omap4panda_snd_device, &snd_soc_omap4panda); ret = platform_device_add(omap4panda_snd_device); if (ret) goto plat_err; twl6040_power_mode = 0; return 0; plat_err: platform_device_put(omap4panda_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 panda_camera_init(void) { if (!machine_is_omap4_panda()) return 0; panda_cam_aux_clk = clk_get(NULL, "auxclk1_ck"); if (IS_ERR(panda_cam_aux_clk)) { printk(KERN_ERR "Unable to get auxclk1_ck\n"); return -ENODEV; } if (clk_set_rate(panda_cam_aux_clk, clk_round_rate(panda_cam_aux_clk, 24000000))) return -EINVAL; /* * CSI2 1(A): * LANEENABLE[4:0] = 00111(0x7) - Lanes 0, 1 & 2 enabled * CTRLCLKEN = 1 - Active high enable for CTRLCLK * CAMMODE = 0 - DPHY mode */ omap4_ctrl_pad_writel((omap4_ctrl_pad_readl( OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX) & ~(OMAP4_CAMERARX_CSI21_LANEENABLE_MASK | OMAP4_CAMERARX_CSI21_CAMMODE_MASK)) | (0x7 << OMAP4_CAMERARX_CSI21_LANEENABLE_SHIFT) | OMAP4_CAMERARX_CSI21_CTRLCLKEN_MASK, OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_CAMERA_RX); /* Select GPIO 45 */ omap_mux_init_gpio(PANDA_GPIO_CAM_PWRDN, OMAP_PIN_OUTPUT); /* Select GPIO 83 */ omap_mux_init_gpio(PANDA_GPIO_CAM_RESET, OMAP_PIN_OUTPUT); /* Init FREF_CLK1_OUT */ omap_mux_init_signal("fref_clk1_out", OMAP_PIN_OUTPUT); if (gpio_request_one(PANDA_GPIO_CAM_PWRDN, GPIOF_OUT_INIT_HIGH, "CAM_PWRDN")) printk(KERN_WARNING "Cannot request GPIO %d\n", PANDA_GPIO_CAM_PWRDN); if (gpio_request_one(PANDA_GPIO_CAM_RESET, GPIOF_OUT_INIT_HIGH, "CAM_RESET")) printk(KERN_WARNING "Cannot request GPIO %d\n", PANDA_GPIO_CAM_RESET); omap4_init_camera(&panda_iss_platform_data, &omap4iss_data); return 0; }
static int __init sdp4430_soc_init(void) { struct i2c_adapter *adapter; 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"); sdp4430_snd_device = platform_device_alloc("soc-audio", -1); if (!sdp4430_snd_device) { printk(KERN_ERR "Platform device allocation failed\n"); return -ENOMEM; } snd_soc_register_dais(&sdp4430_snd_device->dev, dai, ARRAY_SIZE(dai)); platform_set_drvdata(sdp4430_snd_device, &snd_soc_sdp4430); ret = platform_device_add(sdp4430_snd_device); if (ret) goto err; adapter = i2c_get_adapter(1); if (!adapter) { printk(KERN_ERR "can't get i2c adapter\n"); return -ENODEV; } tps6130x_client = i2c_new_device(adapter, &tps6130x_hwmon_info); if (!tps6130x_client) { printk(KERN_ERR "can't add i2c device\n"); return -ENODEV; } /* Only configure the TPS6130x on SDP4430 */ if (machine_is_omap_4430sdp()) sdp4430_tps6130x_configure(); return 0; err: printk(KERN_ERR "Unable to add platform device\n"); platform_device_put(sdp4430_snd_device); return ret; }
static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_codec *codec = rtd->codec; struct twl6040 *twl6040 = codec->control_data; struct snd_soc_dapm_context *dapm = &codec->dapm; int hsotrim, left_offset, right_offset, mode, ret; /* Add SDP4430 specific controls */ ret = snd_soc_add_controls(codec, sdp4430_controls, ARRAY_SIZE(sdp4430_controls)); if (ret) return ret; /* Add SDP4430 specific widgets */ ret = snd_soc_dapm_new_controls(dapm, sdp4430_twl6040_dapm_widgets, ARRAY_SIZE(sdp4430_twl6040_dapm_widgets)); if (ret) return ret; /* Set up SDP4430 specific audio path audio_map */ snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); /* SDP4430 connected pins */ snd_soc_dapm_enable_pin(dapm, "Ext Mic"); snd_soc_dapm_enable_pin(dapm, "Ext Spk"); snd_soc_dapm_enable_pin(dapm, "AFML"); snd_soc_dapm_enable_pin(dapm, "AFMR"); snd_soc_dapm_enable_pin(dapm, "Headset Mic"); snd_soc_dapm_enable_pin(dapm, "Headset Stereophone"); /* allow audio paths from the audio modem to run during suspend */ snd_soc_dapm_ignore_suspend(dapm, "Ext Mic"); snd_soc_dapm_ignore_suspend(dapm, "Ext Spk"); snd_soc_dapm_ignore_suspend(dapm, "AFML"); snd_soc_dapm_ignore_suspend(dapm, "AFMR"); snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); snd_soc_dapm_ignore_suspend(dapm, "Headset Stereophone"); snd_soc_dapm_ignore_suspend(dapm, "Digital Mic 0"); snd_soc_dapm_ignore_suspend(dapm, "Digital Mic 1"); snd_soc_dapm_ignore_suspend(dapm, "Digital Mic 2"); ret = snd_soc_dapm_sync(dapm); if (ret) return ret; /* Headset jack detection */ ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, &hs_jack); if (ret) return ret; ret = snd_soc_jack_add_pins(&hs_jack, ARRAY_SIZE(hs_jack_pins), hs_jack_pins); if (machine_is_omap_4430sdp() || machine_is_omap_tabletblaze() || machine_is_omap4_panda()) twl6040_hs_jack_detect(codec, &hs_jack, SND_JACK_HEADSET); else snd_soc_jack_report(&hs_jack, SND_JACK_HEADSET, SND_JACK_HEADSET); /* DC offset cancellation computation */ hsotrim = snd_soc_read(codec, TWL6040_REG_HSOTRIM); right_offset = (hsotrim & TWL6040_HSRO) >> TWL6040_HSRO_OFFSET; left_offset = hsotrim & TWL6040_HSLO; if (twl6040_get_icrev(twl6040) < TWL6040_REV_1_3) /* For ES under ES_1.3 HS step is 2 mV */ mode = 2; else /* For ES_1.3 HS step is 1 mV */ mode = 1; abe_dsp_set_hs_offset(left_offset, right_offset, mode); /* don't wait before switching of HS power */ rtd->pmdown_time = 0; 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 __devinit int omap_abe_probe(struct platform_device *pdev) { struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev); struct snd_soc_card *card = &omap_abe_card; struct omap_abe_data *card_data; int ret; card->dev = &pdev->dev; if (!machine_is_omap_4430sdp() && !machine_is_omap4_panda() && !machine_is_omap5_sevm()) return -ENODEV; pr_info("OMAP4/5 SoC init\n"); if (!pdata) { dev_err(&pdev->dev, "Missing pdata\n"); return -ENODEV; } if (pdata->card_name) { card->name = pdata->card_name; } else { dev_err(&pdev->dev, "Card name is not provided\n"); return -ENODEV; } if (!pdata->mclk_freq) { dev_err(&pdev->dev, "MCLK frequency missing\n"); return -ENODEV; } if (pdata->has_abe) { if (pdata->has_dmic) { card->dai_link = omap_abe_dai; card->num_links = ARRAY_SIZE(omap_abe_dai); } else { card->dai_link = omap_abe_no_dmic_dai; card->num_links = ARRAY_SIZE(omap_abe_no_dmic_dai); } } else if (pdata->has_dmic) { card->dai_link = twl6040_dmic_dai; card->num_links = ARRAY_SIZE(twl6040_dmic_dai); } else { card->dai_link = twl6040_only_dai; card->num_links = ARRAY_SIZE(twl6040_only_dai); } card_data = devm_kzalloc(&pdev->dev, sizeof(*card_data), GFP_KERNEL); if (card_data == NULL) return -ENOMEM; snd_soc_card_set_drvdata(card, card_data); /* * Dummy symbols to enforce loading of snd-soc-omap and snd-soc-mcpdm */ omap_pcm_dummy(); omap_mcpdm_dummy(); ret = snd_soc_register_card(card); if (ret) dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ret); 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; }