struct imx_priv *priv = &card_priv;
struct platform_device *pdev = priv->pdev;
struct mxc_audio_platform_data *plat = pdev->dev.platform_data;
+ int ret = 0;
gcodec = rtd->codec;
snd_soc_dapm_sync(&codec->dapm);
+ if (plat->hp_gpio != -1) {
+ priv->hp_irq = gpio_to_irq(plat->hp_gpio);
+
+ ret = request_irq(priv->hp_irq,
+ imx_headphone_detect_handler,
+ IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
+
+ if (ret < 0) {
+ ret = -EINVAL;
+ return ret;
+ }
+
+ ret = driver_create_file(pdev->dev.driver,
+ &driver_attr_headphone);
+ if (ret < 0) {
+ ret = -EINVAL;
+ return ret;
+ }
+ }
+
if (plat->mic_gpio != -1) {
+ priv->amic_irq = gpio_to_irq(plat->mic_gpio);
+
+ ret = request_irq(priv->amic_irq,
+ imx_amic_detect_handler,
+ IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
+
+ if (ret < 0) {
+ ret = -EINVAL;
+ return ret;
+ }
+
+ ret = driver_create_file(pdev->dev.driver, &driver_attr_amic);
+ if (ret < 0) {
+ ret = -EINVAL;
+ return ret;
+ }
priv->amic_status = gpio_get_value(plat->mic_gpio);
}
priv->sysclk = plat->sysclk;
- priv->hp_irq = gpio_to_irq(plat->hp_gpio);
- priv->amic_irq = gpio_to_irq(plat->mic_gpio);
-
- if (plat->hp_gpio != -1) {
- ret = request_irq(priv->hp_irq,
- imx_headphone_detect_handler,
- IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
-
- if (ret < 0) {
- ret = -EINVAL;
- return ret;
- }
-
- ret = driver_create_file(pdev->dev.driver,
- &driver_attr_headphone);
- if (ret < 0) {
- ret = -EINVAL;
- return ret;
- }
- }
-
- if (plat->mic_gpio != -1) {
- ret = request_irq(priv->amic_irq,
- imx_amic_detect_handler,
- IRQ_TYPE_EDGE_BOTH, pdev->name, priv);
-
- if (ret < 0) {
- ret = -EINVAL;
- return ret;
- }
-
- ret = driver_create_file(pdev->dev.driver, &driver_attr_amic);
- if (ret < 0) {
- ret = -EINVAL;
- return ret;
- }
- }
return ret;
}