add rk1000 control and rk1000 codec

This commit is contained in:
林辉辉
2010-06-07 13:06:14 +00:00
committed by 黄涛
parent 8529a79300
commit 731ca45a76
11 changed files with 1572 additions and 4 deletions

View File

@@ -127,5 +127,6 @@ source "drivers/staging/iio/Kconfig"
source "drivers/staging/rk2818/rk2818_dsp/Kconfig"
source "drivers/staging/rk2818/rk1000_control/Kconfig"
endif # !STAGING_EXCLUDE_BUILD
endif # STAGING

View File

@@ -45,3 +45,4 @@ obj-$(CONFIG_RAR_REGISTER) += rar/
obj-$(CONFIG_DX_SEP) += sep/
obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_RK2818_DSP) += rk2818/rk2818_dsp/
obj-$(CONFIG_RK1000_CONTROL) += rk2818/rk1000_control/

View File

@@ -0,0 +1,7 @@
menu "RK1000 control"
config RK1000_CONTROL
tristate "ROCKCHIP RK1000 CONTROL"
default n
help
rk1000 control module.
endmenu

View File

@@ -0,0 +1,4 @@
#
# Makefile for the rk1000 control.
#
obj-$(CONFIG_RK1000_CONTROL) += rk1000_control.o

View File

@@ -0,0 +1,93 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/i2c.h>
#include <linux/device.h>
#include <linux/delay.h>
int reg_send_data(struct i2c_client *client, const char start_reg,
const char *buf, int count, unsigned int scl_rate)
{
int ret;
struct i2c_adapter *adap = client->adapter;
struct i2c_msg msg;
char tx_buf[count + 1];
tx_buf[0] = start_reg;
memcpy(tx_buf+1, buf, count);
msg.addr = client->addr;
msg.buf = tx_buf;
msg.len = count +1;
msg.flags = client->flags;
msg.scl_rate = scl_rate;
ret = i2c_transfer(adap, &msg, 1);
return ret;
}
static int rk1000_control_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
int ret;
/* reg[0x00] = 0x88, --> ADC_CON
reg[0x01] = 0x0d, --> CODEC_CON
reg[0x02] = 0x22, --> I2C_CON
reg[0x03] = 0x00, --> TVE_CON
*/
char data[4] = {0x88, 0x0d, 0x22, 0x00};
char start_reg = 0x00;
unsigned int scl_rate = 100 * 10000; /* 100kHz */
#if (CONFIG_SND_SOC_RK1000)
data[1] = 0x00;
#endif
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
{
dev_err(&client->dev, "i2c bus does not support the rk1000_control\n");
return -EIO;
}
mdelay(10);
ret = reg_send_data(client, start_reg, data, 4, scl_rate);
if (ret > 0)
ret = 0;
return ret;
}
static int rk1000_control_remove(struct i2c_client *client)
{
return 0;
}
static const struct i2c_device_id rk1000_control_id[] = {
{ "rk1000_control", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, rk1000_control_id);
static struct i2c_driver rk1000_control_driver = {
.driver = {
.name = "rk1000_control",
},
.probe = rk1000_control_probe,
.remove = rk1000_control_remove,
.id_table = rk1000_control_id,
};
static int __init rk1000_control_init(void)
{
return i2c_add_driver(&rk1000_control_driver);
}
static void __exit rk1000_control_exit(void)
{
i2c_del_driver(&rk1000_control_driver);
}
module_init(rk1000_control_init);
module_exit(rk1000_control_exit);
MODULE_DESCRIPTION("RK1000 control driver");
MODULE_AUTHOR("Rock-chips, <www.rock-chips.com>");
MODULE_LICENSE("GPL");

View File

@@ -216,7 +216,9 @@ config SND_SOC_WM9712
config SND_SOC_WM9713
tristate
config SND_SOC_RK1000
tristate
depends on RK1000_CONTROL
# Amp
config SND_SOC_MAX9877
tristate

View File

@@ -44,7 +44,7 @@ snd-soc-wm9705-objs := wm9705.o
snd-soc-wm9712-objs := wm9712.o
snd-soc-wm9713-objs := wm9713.o
snd-soc-wm-hubs-objs := wm_hubs.o
snd-soc-rk1000-objs := rk1000_codec.o
# Amp
snd-soc-max9877-objs := max9877.o
@@ -94,6 +94,6 @@ obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o
obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
obj-$(CONFIG_SND_SOC_RK1000) += snd-soc-rk1000.o
# Amp
obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,265 @@
/*
*
* Copyright (C) 2009 rockchip lhh
*
* Based on WM8750.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef _RK1000_CODEC_H
#define _RK1000_CODEC_H
/* RK1000 register space */
#define ACCELCODEC_R00 0x00 //ADC High Pass Filter / DSM
#define ACCELCODEC_R01 0x01 //DITHER power
#define ACCELCODEC_R02 0x02 //DITHER power
#define ACCELCODEC_R03 0x03 //DITHER power
#define ACCELCODEC_R04 0x04 //Soft mute / sidetone gain control
#define ACCELCODEC_R05 0x05 //Right interpolate filter volume control (MSB)
#define ACCELCODEC_R06 0x06 //Right interpolate filter volume control (LSB)
#define ACCELCODEC_R07 0x07 //Left interpolate filter volume control (MSB)
#define ACCELCODEC_R08 0x08 //Left interpolate filter volume control (LSB)
#define ACCELCODEC_R09 0x09 //Audio interface control
#define ACCELCODEC_R0A 0x0A //Sample Rate / CLK control
#define ACCELCODEC_R0B 0x0B //Decimation filter / Interpolate filter enable
#define ACCELCODEC_R0C 0x0C //LIN volume
#define ACCELCODEC_R0D 0x0D //LIP volume
#define ACCELCODEC_R0E 0x0E //AL volume
//#define ACCELCODEC_R0F 0x0F //RIN volume
//#define ACCELCODEC_R10 0x10 //RIP volume
//#define ACCELCODEC_R11 0x11 //AR volume
#define ACCELCODEC_R12 0x12 //Input volume
#define ACCELCODEC_R13 0x13 //Left out mix
#define ACCELCODEC_R14 0x14 //Right out mix
#define ACCELCODEC_R15 0x15 //LPF out mix / SCF
#define ACCELCODEC_R16 0x16 //SCF control
#define ACCELCODEC_R17 0x17 //LOUT (AOL) volume
#define ACCELCODEC_R18 0x18 //ROUT (AOR) volume
#define ACCELCODEC_R19 0x19 //MONOOUT (AOM) volume
#define ACCELCODEC_R1A 0x1A //MONOOUT / Reference control
#define ACCELCODEC_R1B 0x1B //Bias Current control
#define ACCELCODEC_R1C 0x1C //ADC control
#define ACCELCODEC_R1D 0x1D //Power Mrg 1
#define ACCELCODEC_R1E 0x1E //Power Mrg 2
#define ACCELCODEC_R1F 0x1F //Power Mrg 3
#define RK1000_CACHE_REGNUM 0x1F
//ACCELCODEC_R00
#define ASC_HPF_ENABLE (0x1) //high_pass filter
#define ASC_HPF_DISABLE (0x0)
#define ASC_DSM_MODE_ENABLE (0x1 << 1)
#define ASC_DSM_MODE_DISABLE (0x0 << 1)
#define ASC_SCRAMBLE_ENABLE (0x1 << 2)
#define ASC_SCRAMBLE_DISABLE (0x0 << 2)
#define ASC_DITHER_ENABLE (0x1 << 3)
#define ASC_DITHER_DISABLE (0x0 << 3)
#define ASC_BCLKDIV_4 (0x1 << 4)
#define ASC_BCLKDIV_8 (0x2 << 4)
#define ASC_BCLKDIV_16 (0x3 << 4)
//ACCECODEC_R04
#define ASC_INT_MUTE_L (0x1)
#define ASC_INT_ACTIVE_L (0x0)
#define ASC_INT_MUTE_R (0x1 << 1)
#define ASC_INT_ACTIVE_R (0x0 << 1)
#define ASC_SIDETONE_L_OFF (0x0 << 2)
#define ASC_SIDETONE_L_GAIN_MAX (0x1 << 2)
#define ASC_SIDETONE_R_OFF (0x0 << 5)
#define ASC_SIDETONE_R_GAIN_MAX (0x1 << 5)
//ACCELCODEC_R05
#define ASC_INT_VOL_0DB (0x0)
//ACCELCODEC_R09
#define ASC_DSP_MODE (0x3)
#define ASC_I2S_MODE (0x2)
#define ASC_LEFT_MODE (0x1)
//#define ASC_RIGHT_MODE (0x0)
#define ASC_32BIT_MODE (0x3 << 2)
#define ASC_24BIT_MODE (0x2 << 2)
#define ASC_20BIT_MODE (0x1 << 2)
#define ASC_16BIT_MODE (0x0 << 2)
#define ASC_INVERT_LRCLK (0x1 << 4)
#define ASC_NORMAL_LRCLK (0x0 << 4)
#define ASC_LRSWAP_ENABLE (0x1 << 5)
#define ASC_LRSWAP_DISABLE (0x0 << 5)
#define ASC_MASTER_MODE (0x1 << 6)
#define ASC_SLAVE_MODE (0x0 << 6)
#define ASC_INVERT_BCLK (0x1 << 7)
#define ASC_NORMAL_BCLK (0x0 << 7)
//ACCELCODEC_R0A
#define ASC_USB_MODE (0x1)
#define ASC_NORMAL_MODE (0x0)
#define FREQ96kHz (0x0e << 1)
#define FREQ48kHz (0x00 << 1)
#define FREQ441kHz (0x11 << 1)
#define FREQ32kHz (0x0c << 1)
#define FREQ24kHz (0x1c << 1)
#define FREQ2205kHz (0x1B << 1)
#define FREQ16kHz (0x0a << 1)
#define FREQ12kHz (0x08 << 1)
#define FREQ11025kHz (0x19 << 1)
//#define FREQ9k6Hz 0x09
#define FREQ8kHz (0x06<<1)
#define ASC_CLKDIV2 (0x1 << 6)
#define ASC_CLKNODIV (0x0 << 6)
#define ASC_CLK_ENABLE (0x1 << 7)
#define ASC_CLK_DISABLE (0x0 << 7)
//ACCELCODEC_R0B
#define ASC_DEC_ENABLE (0x1) //decimation filter enable
#define ASC_DEC_DISABLE (0x0)
#define ASC_INT_ENABLE (0x1 << 1) //interpolate filter enable
#define ASC_INT_DISABLE (0x0 << 1)
//Input
#define ASC_INPUT_MUTE (0x1 << 7)
#define ASC_INPUT_ACTIVE (0x0 << 7)
#define ASC_INPUT_VOL_0DB (0x0)
//ACCELCODEC_R12
#define ASC_LINE_INPUT (0)
#define ASC_MIC_INPUT (1 << 7)
#define ASC_MIC_BOOST_0DB (0)
#define ASC_MIC_BOOST_20DB (1 << 5)
//ACCELCODEC_R13
#define ASC_LPGAMXVOL_0DB (0x5)
#define ASC_LPGAMX_ENABLE (0x1 << 3) //the left channel PGA output is directly fed into the left mixer
#define ASC_LPGAMX_DISABLE (0x0 << 3)
#define ASC_ALMXVOL_0DB (0x5 << 4)
#define ASC_ALMX_ENABLE (0x1 << 7) //the left second line input is directly fed into the left mixer
#define ASC_ALMX_DISABLE (0x0 << 7)
//ACCELCODEC_R14
#define ASC_RPGAMXVOL_0DB (0x5)
#define ASC_RPGAMX_ENABLE (0x1 << 3) //the right channel PGA output is directly fed into the right mixer
#define ASC_RPGAMX_DISABLE (0x0 << 3)
#define ASC_ARMXVOL_0DB (0x5 << 4)
#define ASC_ARMX_ENABLE (0x1 << 7) //)the right second line input is directly fed into the right mixer
#define ASC_ARMX_DISABLE (0x0 << 7)
//ACCELCODEC_R15
#define ASC_LDAMX_ENABLE (0x1 << 2) //the left differential signal from DAC is directly fed into the left mixer
#define ASC_LDAMX_DISABLE (0x0 << 2)
#define ASC_RDAMX_ENABLE (0x1 << 3) //the right differential signal from DAC is directly fed into the right mixer
#define ASC_RDAMX_DISABLE (0x0 << 3)
#define ASC_LSCF_MUTE (0x1 << 4) //the left channel LPF is mute
#define ASC_LSCF_ACTIVE (0x0 << 4)
#define ASC_RSCF_MUTE (0x1 << 5) //the right channel LPF is mute
#define ASC_RSCF_ACTIVE (0x0 << 5)
#define ASC_LLPFMX_ENABLE (0x1 << 6) //the left channel LPF output is fed into the left into the mixer
#define ASC_LLPFMX_DISABLE (0x0 << 6)
#define ASC_RLPFMX_ENABLE (0x1 << 7) //the right channel LPF output is fed into the right into the mixer.
#define ASC_RLPFMX_DISABLE (0x0 << 7)
//ACCELCODEC_R17/R18
#define ASC_OUTPUT_MUTE (0x1 << 6)
#define ASC_OUTPUT_ACTIVE (0x0 << 6)
#define ASC_CROSSZERO_EN (0x1 << 7)
#define ASC_OUTPUT_VOL_0DB (0x0F)
//ACCELCODEC_R19
#define ASC_MONO_OUTPUT_MUTE (0x1 << 7)
#define ASC_MONO_OUTPUT_ACTIVE (0x0 << 7)
#define ASC_MONO_CROSSZERO_EN (0x1 << 6)
//ACCELCODEC_R1A
#define ASC_VMDSCL_SLOWEST (0x0 << 2)
#define ASC_VMDSCL_SLOW (0x1 << 2)
#define ASC_VMDSCL_FAST (0x2 << 2)
#define ASC_VMDSCL_FASTEST (0x3 << 2)
#define ASC_MICBIAS_09 (0x1 << 4)
#define ASC_MICBIAS_06 (0x0 << 4)
#define ASC_L2M_ENABLE (0x1 << 5) //the right channel LPF output is fed to mono PA
#define ASC_L2M_DISABLE (0x0 << 5)
#define ASC_R2M_ENABLE (0x1 << 6) //the left channel LPF output is fed to mono PA
#define ASC_R2M_DISABLE (0x0 << 6)
#define ASC_CAPLESS_ENABLE (0x1 << 7) //the capless connection is enable
#define ASC_CAPLESS_DISABLE (0x0 << 7)
//ACCELCODEC_R1C
#define ASC_DITH_0_DIV (0x0 << 3) //the amplitude setting of the ASDM dither(div=vdd/48)
#define ASC_DITH_2_DIV (0x1 << 3)
#define ASC_DITH_4_DIV (0x2 << 3)
#define ASC_DITH_8_DIV (0x3 << 3)
#define ASC_DITH_ENABLE (0x1 << 5) //the ASDM dither is enabled
#define ASC_DITH_DISABLE (0x0 << 5)
#define ASC_DEM_ENABLE (0x1 << 7) //the ASDM DEM is enabled
#define ASC_DEM_DISABLE (0x0 << 7)
//ACCELCODEC_R1D
#define ASC_PDVMID_ENABLE (0x1) //the VMID reference is powered down. VMID is connected to GND
#define ASC_PDVMID_DISABLE (0x0)
#define ASC_PDSDL_ENABLE (0x1 << 2) //the PGA S2D buffer is power down
#define ASC_PDSDL_DISABLE (0x0 << 2)
#define ASC_PDBSTL_ENABLE (0x1 << 4) //the micphone input Op-Amp is power down
#define ASC_PDBSTL_DISABLE (0x0 << 4)
#define ASC_PDPGAL_ENABLE (0x1 << 6) //the PGA is power down
#define ASC_PDPGAL_DISABLE (0x0 << 6)
#define ASC_PDREF_ENABLE (0x1 << 7) //reference generator is power down
#define ASC_PDREF_DISABLE (0x0 << 7)
//ACCELCODEC_R1E
#define ASC_PDPAR_ENABLE (0x1) //the right channel PA is power down
#define ASC_PDPAR_DISABLE (0x0)
#define ASC_PDPAL_ENABLE (0x1 << 1) //the left channel power amplifier is power down
#define ASC_PDPAL_DISABLE (0x0 << 1)
#define ASC_PDMIXR_ENABLE (0x1 << 2) //the right mixer is power down
#define ASC_PDMIXR_DISABLE (0x0 << 2)
#define ASC_PDMIXL_ENABLE (0x1 << 3) //the left mixer is power down
#define ASC_PDMIXL_DISABLE (0x0 << 3)
#define ASC_PDLPFR_ENABLE (0x1 << 4) //the right RC LPF is power down
#define ASC_PDLPFR_DISABLE (0x0 << 4)
#define ASC_PDLPFL_ENABLE (0x1 << 5) //the left channel RC LPF is power down
#define ASC_PDLPFL_DISABLE (0x0 << 5)
#define ASC_PDASDML_ENABLE (0x1 << 7) //the ASDM is power down
#define ASC_PDASDML_DISABLE (0x0 << 7)
//ACCELCODEC_R1F
#define ASC_PDSCFR_ENABLE (0x1 << 1) //the right channel DAC is power down
#define ASC_PDSCFR_DISABLE (0x0 << 1)
#define ASC_PDSCFL_ENABLE (0x1 << 2) //the left channel DAC is power down
#define ASC_PDSCFL_DISABLE (0x0 << 2)
#define ASC_PDMICB_ENABLE (0x1 << 4) //the micbias is power down
#define ASC_PDMICB_DISABLE (0x0 << 4)
#define ASC_PDIB_ENABLE (0x1 << 5) //the left channel LPF is power down
#define ASC_PDIB_DISABLE (0x0 << 5)
#define ASC_PDMIXM_ENABLE (0x1 << 6) //the mon mixer is power down
#define ASC_PDMIXM_DISABLE (0x0 << 6)
#define ASC_PDPAM_ENABLE (0x1 << 7) //the mono PA is power down.
#define ASC_PDPAM_DISABLE (0x0 << 7)
#define LINE_2_MIXER_GAIN (0x5) //left and right PA gain
#define RK1000_CODEC_NUM_REG 0x20
extern struct snd_soc_dai rk1000_codec_dai;
extern struct snd_soc_codec_device soc_codec_dev_rk1000_codec;
#endif

View File

@@ -29,7 +29,7 @@ config SND_ROCKCHIP_SOC_WM8994
config SND_ROCKCHIP_SOC_RK1000
tristate "SoC I2S Audio support for rockchip - RK1000"
depends on SND_ROCKCHIP_SOC
depends on SND_ROCKCHIP_SOC && RK1000_CONTROL
select SND_ROCKCHIP_SOC_I2S
select SND_SOC_RK1000
help

View File

@@ -0,0 +1,183 @@
/*
* rk2818_wm8988.c -- SoC audio for rockchip
*
* Driver for rockchip wm8988 audio
* Copyright (C) 2009 lhh
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*
*/
#include <linux/module.h>
#include <linux/device.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <asm/io.h>
#include <mach/hardware.h>
#include <mach/rk2818_iomap.h>
#include "../codecs/rk1000_codec.h"
#include "rk2818_pcm.h"
#include "rk2818_i2s.h"
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
#define DBG(x...)
#endif
static int rk2818_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/*by Vincent Hsiung for EQ Vol Change*/
#define HW_PARAMS_FLAG_EQVOL_ON 0x21
#define HW_PARAMS_FLAG_EQVOL_OFF 0x22
if ((params->flags == HW_PARAMS_FLAG_EQVOL_ON)||(params->flags == HW_PARAMS_FLAG_EQVOL_OFF))
{
ret = codec_dai->ops->hw_params(substream, params, codec_dai); //by Vincent
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
}
else
{
/* set codec DAI configuration */
#if defined (CONFIG_SND_ROCKCHIP_SOC_MASTER)
ret = codec_dai->ops->set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
#endif
#if defined (CONFIG_SND_ROCKCHIP_SOC_SLAVE)
ret = codec_dai->ops->set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM );
#endif
if (ret < 0)
return ret;
/* set cpu DAI configuration */
#if defined (CONFIG_SND_ROCKCHIP_SOC_MASTER)
ret = cpu_dai->ops->set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
#endif
#if defined (CONFIG_SND_ROCKCHIP_SOC_SLAVE)
ret = cpu_dai->ops->set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
#endif
if (ret < 0)
return ret;
}
return 0;
}
static const struct snd_soc_dapm_widget rk2818_dapm_widgets[] = {
SND_SOC_DAPM_LINE("Audio Out", NULL),
SND_SOC_DAPM_LINE("Line in", NULL),
SND_SOC_DAPM_MIC("Micn", NULL),
SND_SOC_DAPM_MIC("Micp", NULL),
};
static const struct snd_soc_dapm_route audio_map[]= {
{"Audio Out", NULL, "LOUT1"},
{"Audio Out", NULL, "ROUT1"},
{"Line in", NULL, "RINPUT1"},
{"Line in", NULL, "LINPUT1"},
{"Micn", NULL, "RINPUT2"},
{"Micp", NULL, "LINPUT2"},
};
/*
* Logic for a rk1000 codec as connected on a rockchip board.
*/
static int rk2818_rk1000_codec_init(struct snd_soc_codec *codec)
{
struct snd_soc_dai *codec_dai = &codec->dai[0];
int ret;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
ret = snd_soc_dai_set_sysclk(codec_dai, 0,
12000000, SND_SOC_CLOCK_IN);
if (ret < 0) {
printk(KERN_ERR "Failed to set WM8988 SYSCLK: %d\n", ret);
return ret;
}
/* Add specific widgets */
snd_soc_dapm_new_controls(codec, rk2818_dapm_widgets,
ARRAY_SIZE(rk2818_dapm_widgets));
/* Set up specific audio path audio_mapnects */
snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
snd_soc_dapm_sync(codec);
return 0;
}
static struct snd_soc_ops rk2818_ops = {
.hw_params = rk2818_hw_params,
};
static struct snd_soc_dai_link rk2818_dai = {
.name = "RK1000_CODEC",
.stream_name = "RK1000 CODEC PCM",
.cpu_dai = &rk2818_i2s_dai,
.codec_dai = &rk1000_codec_dai,
.init = rk2818_rk1000_codec_init,
.ops = &rk2818_ops,
};
static struct snd_soc_card snd_soc_card_rk2818 = {
.name = "RK1000_CODEC",
.platform = &rk2818_soc_platform,
.dai_link = &rk2818_dai,
.num_links = 1,
};
static struct snd_soc_device rk2818_snd_devdata = {
.card = &snd_soc_card_rk2818,
.codec_dev = &soc_codec_dev_rk1000_codec,
};
static struct platform_device *rk2818_snd_device;
static int __init audio_card_init(void)
{
int ret =0;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
rk2818_snd_device = platform_device_alloc("soc-audio", -1);
if (!rk2818_snd_device) {
DBG("platform device allocation failed\n");
ret = -ENOMEM;
return ret;
}
platform_set_drvdata(rk2818_snd_device, &rk2818_snd_devdata);
rk2818_snd_devdata.dev = &rk2818_snd_device->dev;
ret = platform_device_add(rk2818_snd_device);
if (ret) {
DBG("platform device add failed\n");
platform_device_put(rk2818_snd_device);
}
return ret;
}
static void __exit audio_card_exit(void)
{
platform_device_unregister(rk2818_snd_device);
}
module_init(audio_card_init);
module_exit(audio_card_exit);
/* Module information */
MODULE_AUTHOR("lhh lhh@rock-chips.com");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
MODULE_LICENSE("GPL");