mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Add rk29 rk1000 codec and i2s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
obj-y += timer.o io.o devices.o iomux.o clock.o rk29-pl330.o dma.o gpio.o
|
||||
obj-$(CONFIG_SND_RK29_SOC_I2S) += rk29-audio.o
|
||||
obj-$(CONFIG_RK29_VPU) += vpu.o
|
||||
obj-$(CONFIG_MACH_RK29SDK) += board-rk29sdk.o board-rk29sdk-key.o
|
||||
|
||||
@@ -410,6 +410,13 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = {
|
||||
.flags = 0,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_SND_SOC_RK1000)
|
||||
{
|
||||
.type = "rk1000_i2c_codec",
|
||||
.addr = 0x60,
|
||||
.flags = 0,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_BATTERY_STC3100)
|
||||
{
|
||||
.type = "stc3100-battery",
|
||||
@@ -663,6 +670,12 @@ static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_I2C3_RK29
|
||||
&rk29_device_i2c3,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SND_RK29_SOC_I2S
|
||||
&rk29_device_iis_2ch,
|
||||
//&rk29_device_iis_8ch,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KEYS_RK29
|
||||
&rk29_device_keys,
|
||||
#endif
|
||||
|
||||
@@ -17,14 +17,20 @@
|
||||
#define __ARCH_ARM_MACH_RK29_DEVICES_H
|
||||
|
||||
extern struct rk29_nand_platform_data rk29_nand_data;
|
||||
|
||||
extern struct rk29_i2c_platform_data default_i2c0_data;
|
||||
extern struct rk29_i2c_platform_data default_i2c1_data;
|
||||
extern struct rk29_i2c_platform_data default_i2c2_data;
|
||||
extern struct rk29_i2c_platform_data default_i2c3_data;
|
||||
|
||||
extern struct platform_device rk29_device_i2c0;
|
||||
extern struct platform_device rk29_device_i2c1;
|
||||
extern struct platform_device rk29_device_i2c2;
|
||||
extern struct platform_device rk29_device_i2c3;
|
||||
|
||||
extern struct platform_device rk29_device_iis_2ch;
|
||||
extern struct platform_device rk29_device_iis_8ch;
|
||||
|
||||
extern struct platform_device rk29_device_uart0;
|
||||
extern struct platform_device rk29_device_uart1;
|
||||
extern struct platform_device rk29_device_uart2;
|
||||
|
||||
@@ -100,6 +100,12 @@ struct rk29_i2c_platform_data {
|
||||
int (*io_deinit)(void);
|
||||
};
|
||||
|
||||
/*i2s*/
|
||||
struct rk29_i2s_platform_data {
|
||||
int (*io_init)(void);
|
||||
int (*io_deinit)(void);
|
||||
};
|
||||
|
||||
void __init rk29_map_common_io(void);
|
||||
void __init rk29_clock_init(void);
|
||||
|
||||
|
||||
68
arch/arm/mach-rk29/rk29-audio.c
Normal file
68
arch/arm/mach-rk29/rk29-audio.c
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
#include <mach/rk29-dma-pl330.h>
|
||||
#include <mach/rk29_iomap.h>
|
||||
#include <mach/irqs.h>
|
||||
|
||||
static struct resource rk29_iis_2ch_resource[] = {
|
||||
[0] = {
|
||||
.start = RK29_I2S_2CH_PHYS,
|
||||
.end = RK29_I2S_2CH_PHYS + RK29_I2S_2CH_SIZE,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = DMACH_I2S_2CH_TX,
|
||||
.end = DMACH_I2S_2CH_TX,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
[2] = {
|
||||
.start = DMACH_I2S_2CH_RX,
|
||||
.end = DMACH_I2S_2CH_RX,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
[3] = {
|
||||
.start = IRQ_I2S_2CH,
|
||||
.end = IRQ_I2S_2CH,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device rk29_device_iis_2ch = {
|
||||
.name = "rk29-i2s",
|
||||
.id = 0,
|
||||
.num_resources = ARRAY_SIZE(rk29_iis_2ch_resource),
|
||||
.resource = rk29_iis_2ch_resource,
|
||||
};
|
||||
|
||||
static struct resource rk29_iis_8ch_resource[] = {
|
||||
[0] = {
|
||||
.start = RK29_I2S_8CH_PHYS,
|
||||
.end = RK29_I2S_8CH_PHYS + RK29_I2S_8CH_SIZE,
|
||||
.flags = IORESOURCE_MEM,
|
||||
},
|
||||
[1] = {
|
||||
.start = DMACH_I2S_8CH_TX,
|
||||
.end = DMACH_I2S_8CH_TX,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
[2] = {
|
||||
.start = DMACH_I2S_8CH_RX,
|
||||
.end = DMACH_I2S_8CH_RX,
|
||||
.flags = IORESOURCE_DMA,
|
||||
},
|
||||
[3] = {
|
||||
.start = IRQ_I2S_8CH,
|
||||
.end = IRQ_I2S_8CH,
|
||||
.flags = IORESOURCE_IRQ,
|
||||
},
|
||||
};
|
||||
|
||||
struct platform_device rk29_device_iis_8ch = {
|
||||
.name = "rk29-i2s",
|
||||
.id = 1,
|
||||
.num_resources = ARRAY_SIZE(rk29_iis_8ch_resource),
|
||||
.resource = rk29_iis_8ch_resource,
|
||||
};
|
||||
@@ -37,6 +37,7 @@ source "sound/soc/s6000/Kconfig"
|
||||
source "sound/soc/sh/Kconfig"
|
||||
source "sound/soc/txx9/Kconfig"
|
||||
source "sound/soc/rk2818/Kconfig"
|
||||
source "sound/soc/rk29/Kconfig"
|
||||
# Supported codecs
|
||||
source "sound/soc/codecs/Kconfig"
|
||||
|
||||
|
||||
@@ -15,3 +15,4 @@ obj-$(CONFIG_SND_SOC) += s6000/
|
||||
obj-$(CONFIG_SND_SOC) += sh/
|
||||
obj-$(CONFIG_SND_SOC) += txx9/
|
||||
obj-$(CONFIG_SND_SOC) += rk2818/
|
||||
obj-$(CONFIG_SND_SOC) += rk29/
|
||||
|
||||
@@ -131,10 +131,13 @@ static int rk1000_codec_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
rk1000_codec_write_reg_cache (codec, reg, value);
|
||||
i2c = (struct i2c_client *)codec->control_data;
|
||||
i2c->addr = (i2c->addr & 0x60)|reg;
|
||||
if (codec->hw_write(codec->control_data, data, 1) == 2)
|
||||
if (codec->hw_write(codec->control_data, data, 1) == 2){
|
||||
DBG("================%s Run OK================\n",__FUNCTION__,__LINE__);
|
||||
return 0;
|
||||
else
|
||||
}else{
|
||||
DBG("================%s Run EIO================\n",__FUNCTION__,__LINE__);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
static const struct snd_kcontrol_new rk1000_codec_snd_controls[] = {
|
||||
@@ -803,7 +806,7 @@ static int rk1000_codec_register(struct rk1000_codec_priv *rk1000_codec,
|
||||
//goto err;
|
||||
//}
|
||||
|
||||
#if 1
|
||||
#if 0 //fzf rk2818 is SPK_CTL
|
||||
gpio_request(RK2818_PIN_PF7, "rk1000_codec");
|
||||
rk2818_mux_api_set(GPIOE_SPI1_FLASH_SEL_NAME, IOMUXA_GPIO1_A3B7);
|
||||
gpio_direction_output(RK2818_PIN_PF7,GPIO_HIGH);
|
||||
|
||||
Reference in New Issue
Block a user