};
#endif // CONFIG_SDMMC0_RK29
+#ifdef CONFIG_SND_SOC_RK2928
+static struct resource resources_acodec[] = {
+ {
+ .start = RK2928_ACODEC_PHYS,
+ .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = RK2928_PIN1_PA0,
+ .end = RK2928_PIN1_PA0,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device device_acodec = {
+ .name = "rk2928-codec",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resources_acodec),
+ .resource = resources_acodec,
+};
+#endif
+
static struct platform_device *devices[] __initdata = {
#ifdef CONFIG_BACKLIGHT_RK29_BL
&rk29_device_backlight,
#ifdef CONFIG_ION
&device_ion,
#endif
+#ifdef CONFIG_SND_SOC_RK2928
+ &device_acodec,
+#endif
};
//i2c
#ifdef CONFIG_I2C0_RK30
};
#endif
+#ifdef CONFIG_SND_SOC_RK2928
+static struct resource resources_acodec[] = {
+ {
+ .start = RK2928_ACODEC_PHYS,
+ .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = RK2928_PIN3_PD4,
+ .end = RK2928_PIN3_PD4,
+ .flags = IORESOURCE_IO,
+ },
+};
+
+static struct platform_device device_acodec = {
+ .name = "rk2928-codec",
+ .id = -1,
+ .num_resources = ARRAY_SIZE(resources_acodec),
+ .resource = resources_acodec,
+};
+#endif
+
static struct platform_device *devices[] __initdata = {
#ifdef CONFIG_BACKLIGHT_RK29_BL
&rk29_device_backlight,
#ifdef CONFIG_RFKILL_RK
&device_rfkill_rk,
#endif
+#ifdef CONFIG_SND_SOC_RK2928
+ &device_acodec,
+#endif
};
//i2c
#ifdef CONFIG_I2C0_RK30
#endif
}
-#ifdef CONFIG_SND_SOC_RK2928
-static struct resource resources_acodec[] = {
- {
- .start = RK2928_ACODEC_PHYS,
- .end = RK2928_ACODEC_PHYS + RK2928_ACODEC_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct platform_device device_acodec = {
- .name = "rk2928-codec",
- .id = -1,
- .num_resources = ARRAY_SIZE(resources_acodec),
- .resource = resources_acodec,
-};
-#endif
-
static struct resource resource_arm_pmu = {
.start = IRQ_ARM_PMU,
.end = IRQ_ARM_PMU,
rk_serial_debug_init(DEBUG_UART_BASE, IRQ_DEBUG_UART, IRQ_UART_SIGNAL, -1);
#endif
rk2928_init_i2s();
-#ifdef CONFIG_SND_SOC_RK2928
- platform_device_register(&device_acodec);
-#endif
#ifdef CONFIG_HDMI_RK2928
platform_device_register(&device_hdmi);
#endif
#include "rk2928_codec.h"
-#define SPK_CTL RK2928_PIN1_PA0
-
static struct rk2928_codec_data {
struct device *dev;
int regbase;
int regsize_phy;
int mute;
int hdmi_enable;
+ int spkctl;
} rk2928_data;
static const struct snd_soc_dapm_widget rk2928_dapm_widgets[] = {
if(!rk2928_data.hdmi_enable)
rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(0));
rk2928_data.mute = 0;
- if(SPK_CTL != INVALID_GPIO) {
- gpio_direction_output(SPK_CTL, GPIO_HIGH);
+ if(rk2928_data.spkctl != INVALID_GPIO) {
+ gpio_direction_output(rk2928_data.spkctl, GPIO_HIGH);
}
}
else {
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
- if(SPK_CTL != INVALID_GPIO) {
- gpio_direction_output(SPK_CTL, GPIO_LOW);
+ if(rk2928_data.spkctl != INVALID_GPIO) {
+ gpio_direction_output(rk2928_data.spkctl, GPIO_LOW);
}
rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(1));
rk2928_data.mute = 1;
ret = -ENXIO;
goto err1;
}
- // Select SDI input from internal audio codec
- writel(0x04000400, RK2928_GRF_BASE + GRF_SOC_CON0);
- if(SPK_CTL != INVALID_GPIO) {
- ret = gpio_request(SPK_CTL, NULL);
+ res = platform_get_resource(pdev, IORESOURCE_IO, 0);
+ if(!res) {
+ rk2928_data.spkctl = INVALID_GPIO;
+ }
+ else {
+ rk2928_data.spkctl = res->start;
+ }
+
+ if(rk2928_data.spkctl != INVALID_GPIO) {
+ ret = gpio_request(rk2928_data.spkctl, NULL);
if (ret != 0) {
- gpio_free(SPK_CTL);
+ gpio_free(rk2928_data.spkctl);
}
else
- gpio_direction_output(SPK_CTL, GPIO_LOW);
+ gpio_direction_output(rk2928_data.spkctl, GPIO_LOW);
}
+
+ // Select SDI input from internal audio codec
+ writel(0x04000400, RK2928_GRF_BASE + GRF_SOC_CON0);
+
// Mute and Power off codec
rk2928_write(codec, CODEC_REG_DAC_MUTE, v_MUTE_DAC(1));
rk2928_set_bias_level(codec, SND_SOC_BIAS_OFF);