};
+ gpio1_spdif {
+ spdif_tx: spdif-tx {
+ rockchip,pins = <SPDIF_TX>;
+ rockchip,pull = <VALUE_PULL_DISABLE>;
+ //rockchip,voltage = <VALUE_VOL_DEFAULT>;
+ rockchip,drive = <VALUE_DRV_DEFAULT>;
+ //rockchip,tristate = <VALUE_TRI_DEFAULT>;
+
+ };
+ };
+
gpio3_pwm {
pwm0_pin:pwm0 {
rockchip,pins = <PWM0>;
brightness-levels = <0 4 8 16 32 64 128 255>;
default-brightness-level = <6>;
gpios = <&gpio0 GPIO_A2 GPIO_ACTIVE_HIGH>;
-};
+ };
+
+ codec-hdmi-i2s {
+ compatible = "hdmi-i2s";
+ };
+ codec-hdmi-spdif {
+ compatible = "hdmi-spdif";
+ };
+ rockchip-rt5631 {
+ compatible = "rockchip-rt5631";
+ };
+
+ rockchip-hdmi-i2s {
+ compatible = "rockchip-hdmi-i2s";
+ };
+
+ rockchip-hdmi-spdif {
+ compatible = "rockchip-hdmi-spdif";
+ };
};
&uart0 {
&i2c0 {
status = "okay";
+ codec@1a {
+ compatible = "rt5631";
+ reg = <0x1a>;
+ };
};
&i2c1 {
snd-soc-ak4641-objs := ak4641.o
snd-soc-ak4642-objs := ak4642.o
snd-soc-ak4671-objs := ak4671.o
+snd-soc-ak4396-objs := ak4396.o
snd-soc-ak5386-objs := ak5386.o
snd-soc-arizona-objs := arizona.o
snd-soc-cq93vc-objs := cq93vc.o
snd-soc-da732x-objs := da732x.o
snd-soc-da9055-objs := da9055.o
snd-soc-dfbmcs320-objs := dfbmcs320.o
+snd-soc-jz4740-codec-objs := jz4740.o
snd-soc-dmic-objs := dmic.o
snd-soc-es8323-objs := es8323.o
snd-soc-es8323-pcm-objs := es8323_pcm.o
snd-soc-wm8782-objs := wm8782.o
snd-soc-wm8804-objs := wm8804.o
snd-soc-wm8900-objs := wm8900.o
-snd-soc-rt5621-objs := rt5621.o
-snd-soc-rt5623-objs := rt5623.o
-snd-soc-rt5631-objs := rt5631.o
-snd-soc-rt5616-objs := rt5616.o
-snd-soc-rt5631-phone-objs := rt5631_phone.o
-snd-soc-rt5625-objs := rt5625.o
-snd-soc-cs42l52-objs := cs42l52.o
snd-soc-wm8903-objs := wm8903.o
snd-soc-wm8904-objs := wm8904.o
snd-soc-wm8996-objs := wm8996.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
-snd-soc-jz4740-codec-objs := jz4740.o
-snd-soc-rk610-objs := rk610_codec.o
-snd-soc-rk616-objs := rk616_codec.o
+snd-soc-rt5621-objs := rt5621.o
+snd-soc-rt5623-objs := rt5623.o
+snd-soc-rt5631-objs := rt5631.o
+snd-soc-rt5616-objs := rt5616.o
+snd-soc-rt5631-phone-objs := rt5631_phone.o
+snd-soc-rt5625-objs := rt5625.o
+snd-soc-rt5639-objs := rt5639.o rt5639_ioctl.o rt56xx_ioctl.o
snd-soc-rt5640-objs := rt5640.o rt5640-dsp.o rt5640_ioctl.o rt56xx_ioctl.o
snd-soc-rt3261-objs := rt3261.o rt3261-dsp.o rt3261_ioctl.o rt_codec_ioctl.o
snd-soc-rt3224-objs := rt3261.o rt3261_ioctl.o rt_codec_ioctl.o
+snd-soc-cs42l52-objs := cs42l52.o
+snd-soc-rk1000-objs := rk1000_codec.o
+snd-soc-rk610-objs := rk610_codec.o
+snd-soc-rk616-objs := rk616_codec.o
snd-soc-rk2928-objs := rk2928_codec.o
snd-soc-rk3026-objs := rk3026_codec.o
snd-soc-rk3190-objs := rk3190_codec.o
-snd-soc-rt5639-objs := rt5639.o rt5639_ioctl.o rt56xx_ioctl.o
+
# Amp
snd-soc-max9877-objs := max9877.o
snd-soc-tpa6130a2-objs := tpa6130a2.o
-obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
-obj-$(CONFIG_SND_SOC_RT3261) += snd-soc-rt3261.o
-obj-$(CONFIG_SND_SOC_RT3224) += snd-soc-rt3224.o
-obj-$(CONFIG_SND_SOC_RT5639) += snd-soc-rt5639.o
obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o
obj-$(CONFIG_SND_SOC_AB8500_CODEC) += snd-soc-ab8500-codec.o
obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
obj-$(CONFIG_SND_SOC_AK4641) += snd-soc-ak4641.o
obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o
obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o
+obj-$(CONFIG_SND_SOC_AK4396) += snd-soc-ak4396.o
obj-$(CONFIG_SND_SOC_AK5386) += snd-soc-ak5386.o
obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o
obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o
obj-$(CONFIG_SND_SOC_ML26124) += snd-soc-ml26124.o
obj-$(CONFIG_SND_SOC_OMAP_HDMI_CODEC) += snd-soc-omap-hdmi-codec.o
obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
-obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
obj-$(CONFIG_SND_SOC_WM8782) += snd-soc-wm8782.o
obj-$(CONFIG_SND_SOC_WM8804) += snd-soc-wm8804.o
obj-$(CONFIG_SND_SOC_WM8900) += snd-soc-wm8900.o
-obj-$(CONFIG_SND_SOC_RT5621) += snd-soc-rt5621.o
-obj-$(CONFIG_SND_SOC_RT5623) += snd-soc-rt5623.o
-obj-$(CONFIG_SND_SOC_AK4396) += snd-soc-ak4396.o
-obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
-obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o
-obj-$(CONFIG_SND_SOC_RT5631_PHONE) += snd-soc-rt5631-phone.o
-obj-$(CONFIG_SND_SOC_RT5625) += snd-soc-rt5625.o
-obj-$(CONFIG_SND_SOC_CS42L52) += snd-soc-cs42l52.o
obj-$(CONFIG_SND_SOC_WM8903) += snd-soc-wm8903.o
obj-$(CONFIG_SND_SOC_WM8904) += snd-soc-wm8904.o
obj-$(CONFIG_SND_SOC_WM8996) += snd-soc-wm8996.o
obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o
obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
+obj-$(CONFIG_SND_SOC_RT5512) += snd-soc-rt5512.o
+obj-$(CONFIG_SND_SOC_RT5621) += snd-soc-rt5621.o
+obj-$(CONFIG_SND_SOC_RT5623) += snd-soc-rt5623.o
+obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
+obj-$(CONFIG_SND_SOC_RT5616) += snd-soc-rt5616.o
+obj-$(CONFIG_SND_SOC_RT5631_PHONE) += snd-soc-rt5631-phone.o
+obj-$(CONFIG_SND_SOC_RT5625) += snd-soc-rt5625.o
+obj-$(CONFIG_SND_SOC_RT3261) += snd-soc-rt3261.o
+obj-$(CONFIG_SND_SOC_RT3224) += snd-soc-rt3224.o
+obj-$(CONFIG_SND_SOC_RT5639) += snd-soc-rt5639.o
+obj-$(CONFIG_SND_SOC_RT5640) += snd-soc-rt5640.o
+obj-$(CONFIG_SND_SOC_CS42L52) += snd-soc-cs42l52.o
obj-$(CONFIG_SND_SOC_RK1000) += snd-soc-rk1000.o
obj-$(CONFIG_SND_SOC_RK610) += snd-soc-rk610.o
obj-$(CONFIG_SND_SOC_RK616) += snd-soc-rk616.o
obj-$(CONFIG_SND_SOC_RK2928) += snd-soc-rk2928.o
obj-$(CONFIG_SND_SOC_RK3026) += snd-soc-rk3026.o
obj-$(CONFIG_SND_SOC_RK3190) += snd-soc-rk3190.o
-obj-$(CONFIG_SND_SOC_RT5512) += snd-soc-rt5512.o
# Amp
obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
#include <linux/spi/spi.h>
#include <sound/asoundef.h>
#include <linux/delay.h>
-#include <mach/iomux.h>
/* AK4396 registers addresses */
#define AK4396_REG_CONTROL1 0x00
#endif
}
-void codec_set_spk(bool on)
+void ak4396_codec_set_spk(bool on)
{
on_off_ext_amp(on);
}
return ret;
}
-static int ak4396_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int ak4396_suspend(struct snd_soc_codec *codec)
{
return 0;
}
return ret;
}
-static int __devexit ak4396_spi_remove(struct spi_device *spi)
+static int ak4396_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
kfree(spi_get_drvdata(spi));
.owner = THIS_MODULE,
},
.probe = ak4396_spi_probe,
- .remove = __devexit_p(ak4396_spi_remove),
+ .remove = ak4396_spi_remove,
};
static int __init ak4396_init(void)
return 0;
}
-static int cx2070x_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int cx2070x_suspend(struct snd_soc_codec *codec)
{
INFO("%lu: %s() called\n",jiffies,__func__);
cx2070x_set_bias_level(codec, SND_SOC_BIAS_OFF);
#include <linux/spi/spi.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
+#include <linux/of_gpio.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
-#include <mach/iomux.h>
-#include <mach/board.h>
-#include <mach/gpio.h>
-
//#include <linux/tchip_sysinf.h>
#include "es8323.h"
#ifdef CONFIG_MACH_RK_FAC
int es8323_hdmi_ctrl=0;
#endif
-#define SPK_CON RK30_PIN2_PD7 //RK30_PIN4_PC5
-#define HP_DET RK30_PIN0_PB5
+//#define SPK_CON RK30_PIN2_PD7 //RK30_PIN4_PC5
+//#define HP_DET RK30_PIN0_PB5
+#define INVALID_GPIO -1
+int es8323_spk_con_gpio = INVALID_GPIO;
+int es8323_hp_det_gpio = INVALID_GPIO;
static int HP_IRQ=0;
static int hp_irq_flag = 0;
//#define SPK_CTL RK29_PIN6_PB6
static void hp_detect_do_switch(struct work_struct *work)
{
int ret;
- int irq = gpio_to_irq(HP_DET);
+ int irq = gpio_to_irq(es8323_hp_det_gpio);
unsigned int type;
//rk28_send_wakeup_key();
printk("hjc:%s,irq=%d\n",__func__,irq);
- type = gpio_get_value(HP_DET) ? IRQ_TYPE_EDGE_FALLING : IRQ_TYPE_EDGE_RISING;
+ type = gpio_get_value(es8323_hp_det_gpio) ? IRQ_TYPE_EDGE_FALLING : IRQ_TYPE_EDGE_RISING;
ret = irq_set_irq_type(irq, type);
if (ret < 0) {
pr_err("%s: irq_set_irq_type(%d, %d) failed\n", __func__, irq, type);
hp_irq_flag = 1;
- if(0 == gpio_get_value(HP_DET)){
+ if(0 == gpio_get_value(es8323_hp_det_gpio)){
printk("hp_det = 0,insert hp\n");
- gpio_set_value(SPK_CON,0);
- }else if(1 == gpio_get_value(HP_DET)){
+ gpio_set_value(es8323_spk_con_gpio,0);
+ }else if(1 == gpio_get_value(es8323_hp_det_gpio)){
printk("hp_det = 1,deinsert hp\n");
- gpio_set_value(SPK_CON,1);
+ gpio_set_value(es8323_spk_con_gpio,1);
}
enable_irq(irq);
}
// printk("fun:%s, event:%d\r\n", __FUNCTION__, event);
if (event==1)
{
- widget->dapm->dev_power = 1;
+ //widget->dapm->dev_power = 1;
es8323_set_bias_level(widget->codec, SND_SOC_BIAS_PREPARE);
}
return 0;
// printk("fun:%s, event:%d\r\n", __FUNCTION__, event);
if (event==8)
{
- widget->dapm->dev_power = 0;
+ //widget->dapm->dev_power = 0;
es8323_set_bias_level(widget->codec, SND_SOC_BIAS_STANDBY);
}
return 0;
return;
}
if(hp_irq_flag == 0)
- gpio_set_value(SPK_CON, i); //delete by hjc
+ gpio_set_value(es8323_spk_con_gpio, i); //delete by hjc
DBG("*** %s() SPEAKER set SPK_CON %d\n", __FUNCTION__, i);
mdelay(50);
.symmetric_rates = 1,
};
-static int es8323_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int es8323_suspend(struct snd_soc_codec *codec)
{
// u16 i;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
snd_soc_write(codec, 0x01, 0x58);
snd_soc_write(codec, 0x2b, 0x9c);
msleep(50);
- gpio_set_value(SPK_CON, 0);
+ gpio_set_value(es8323_spk_con_gpio, 0);
return 0;
}
snd_soc_write(codec, 0x31, es8323_DEF_VOL);
snd_soc_write(codec, 0x30, es8323_DEF_VOL);
snd_soc_write(codec, 0x19, 0x02);
- gpio_set_value(SPK_CON, 1);
+ gpio_set_value(es8323_spk_con_gpio, 1);
return 0;
}
}
gpio_direction_input(RK30_PIN0_PC7);
#endif
- ret = gpio_request(SPK_CON, NULL);
+ ret = gpio_request(es8323_spk_con_gpio, NULL);
if (ret != 0) {
printk("%s request SPK_CON error", __func__);
return ret;
}
//gpio_set_value(SPK_CON, 1);
- gpio_direction_output(SPK_CON,0);
+ gpio_direction_output(es8323_spk_con_gpio,0);
- ret = gpio_request(HP_DET, NULL);
+ ret = gpio_request(es8323_hp_det_gpio, NULL);
if (ret != 0) {
printk("%s request HP_DET error", __func__);
return ret;
}
- gpio_direction_input(HP_DET);
+ gpio_direction_input(es8323_hp_det_gpio);
- flags = gpio_get_value(HP_DET) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
+ flags = gpio_get_value(es8323_hp_det_gpio) ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
- HP_IRQ = gpio_to_irq(HP_DET);
+ HP_IRQ = gpio_to_irq(es8323_hp_det_gpio);
if (HP_IRQ){
ret = request_irq(HP_IRQ, hp_det_irq_handler, flags, "ES8323", NULL);
if(ret == 0){
snd_soc_dapm_new_controls(dapm, es8323_dapm_widgets,
ARRAY_SIZE(es8323_dapm_widgets));
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
- create_proc_read_entry("es8323_suspend", 0644, NULL, entry_read, NULL);
+
+ //create_proc_read_entry("es8323_suspend", 0644, NULL, entry_read, NULL);
return 0;
}
return 0;
}
-#ifdef CONFIG_MACH_RK_FAC
void es8323_codec_set_spk(bool on)
-{
- if(es8323_hdmi_ctrl)
- {
- set_spk = on;
- gpio_set_value(SPK_CON, on);
- }
-}
-#else
-void codec_set_spk(bool on)
{
DBG("Enter::%s----%d--, on = %d\n",__FUNCTION__,__LINE__, on);
set_spk = on;
- gpio_set_value(SPK_CON, on);
+ gpio_set_value(es8323_spk_con_gpio, on);
//return;
}
-#endif
static struct snd_soc_codec_driver soc_codec_dev_es8323 = {
.probe = es8323_probe,
static struct device *es8323_dev = NULL;
static struct class *es8323_class = NULL;
static DEVICE_ATTR(es8323, 0664, es8323_show, es8323_store);
+
+/*
+dts:
+ codec@10 {
+ compatible = "es8323";
+ reg = <0x10>;
+ spk-con-gpio = <&gpio2 GPIO_D7 GPIO_ACTIVE_HIGH>;
+ hp-det-gpio = <&gpio0 GPIO_B5 GPIO_ACTIVE_HIGH>;
+ };
+*/
+
static int es8323_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
int ret = -1;
struct i2c_adapter *adapter = to_i2c_adapter(i2c->dev.parent);
char reg;
- char tmp;
if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
dev_warn(&adapter->dev,
i2c_set_clientdata(i2c, es8323);
es8323->control_type = SND_SOC_I2C;
-
+
+ es8323_spk_con_gpio = of_get_named_gpio(i2c->dev.of_node, "spk-con-gpio", 0);
+ if (es8323_spk_con_gpio < 0) {
+ DBG("%s() Can not read property codec-en-gpio\n", __FUNCTION__);
+ es8323_spk_con_gpio = INVALID_GPIO;
+ }
+
+ es8323_hp_det_gpio = of_get_named_gpio(i2c->dev.of_node, "hp-det-gpio", 0);
+ if (es8323_hp_det_gpio < 0) {
+ DBG("%s() Can not read property codec-en-gpio\n", __FUNCTION__);
+ es8323_hp_det_gpio = INVALID_GPIO;
+ }
+
reg = ES8323_DACCONTROL18;
- ret = i2c_master_reg8_recv(i2c, reg, &tmp, 1 ,200 * 1000);
+ ret = i2c_master_recv(i2c, ®, 1);
//ret =i2c_master_reg8_recv(client, 0x00, buf, 2, 200*1000);//i2c_write_bytes(client, &test_data, 1); //Test I2C connection.
if (ret < 0){
printk("es8323 probe error\n");
void es8323_i2c_shutdown(struct i2c_client *client)
{
printk("Chenzy-------hkw-------%s\n", __func__);
- gpio_direction_output(SPK_CON,0);
+ gpio_direction_output(es8323_spk_con_gpio,0);
snd_soc_write(es8323_codec, ES8323_CONTROL2, 0x58);
snd_soc_write(es8323_codec, ES8323_CONTROL1, 0x32);
mdelay(100);
}
+/*
#define I2C_CLK_NAME GPIO0B0_I2S8CHCLK_NAME
#define I2C_CLK_GPIO_MODE GPIO0B_GPIO0B0
#define I2C_GPIO_OUTPUT GPIO_LOW
#define I2C_MGPIO_OUTPUT GPIO_LOW
#define I2C_MCLK_CLK_MODE GPIO0B_I2S_8CH_SCLK
#define I2C_MCLK_GPIO RK30_PIN0_PB1
-static int es8323_i2c_suspend (struct i2c_client *client, pm_message_t mesg)
+*/
+static int es8323_i2c_suspend (struct i2c_client *client)
{
#if 0
rk30_mux_api_set(I2C_CLK_NAME,I2C_CLK_GPIO_MODE);
gpio_direction_output(I2C_MCLK_GPIO,I2C_MGPIO_OUTPUT);
#endif
- iomux_set(GPIO1_C1);
+ /* iomux_set(GPIO1_C1);
if (gpio_request(RK30_PIN1_PC1, NULL)) {
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
return -1;
}
gpio_direction_input(RK30_PIN1_PC1);
- gpio_pull_updown(RK30_PIN1_PC1, PullDisable);
+ gpio_pull_updown(RK30_PIN1_PC1, PullDisable);*/
#if 0
iomux_set(GPIO1_C2);
rk30_mux_api_set(I2C_CLK_NAME,I2C_CLK_CLK_MODE);
#endif
- gpio_free(RK30_PIN1_PC1);
- iomux_set(I2S0_SCLK);
+ /* gpio_free(RK30_PIN1_PC1);
+ iomux_set(I2S0_SCLK);*/
return 0;
}
* Author: chenjq <chenjq@rock-chips.com>
*/
-#include <linux/init.h>
#include <linux/module.h>
-#include <linux/interrupt.h>
-#include <linux/device.h>
-#include <linux/delay.h>
-#include <linux/clk.h>
-#include <linux/version.h>
-
-#include <asm/dma.h>
-#include <sound/core.h>
+#include <linux/moduleparam.h>
+#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <sound/soc.h>
#include <sound/pcm.h>
-#include <sound/pcm_params.h>
#include <sound/initval.h>
-#include <sound/soc.h>
-#include <asm/io.h>
-
-#include <mach/board.h>
-#include <mach/hardware.h>
-#include <mach/io.h>
-#include <mach/gpio.h>
-#include <mach/iomux.h>
#if 0
#define DBG(x...) printk(KERN_INFO "hdmi i2s:"x)
static struct snd_soc_codec_driver soc_codec_dev_hdmi_i2s;
-static int hdmi_i2s_platform_probe(struct platform_device *pdev)
+static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
{
- DBG("Entered %s\n", __func__);
+ int ret;
+
+ //set dev name to driver->name for sound card register
+ dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
- return snd_soc_register_codec(&pdev->dev,
+ ret = snd_soc_register_codec(&pdev->dev,
&soc_codec_dev_hdmi_i2s,
&hdmi_i2s_dai, 1);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
+ return ret;
}
-static int hdmi_i2s_platform_remove(struct platform_device *pdev)
+static int rockchip_hdmi_i2s_audio_remove(struct platform_device *pdev)
{
- DBG("Entered %s\n", __func__);
-
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
-
-static struct platform_driver hdmi_i2s_driver = {
- .probe = hdmi_i2s_platform_probe,
- .remove = hdmi_i2s_platform_remove,
- .driver = {
- .name = "hdmi-i2s",
- .owner = THIS_MODULE,
- },
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_hdmi_i2s_of_match[] = {
+ { .compatible = "hdmi-i2s", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
+ .driver = {
+ .name = "hdmi-i2s",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
+ },
+ .probe = rockchip_hdmi_i2s_audio_probe,
+ .remove = rockchip_hdmi_i2s_audio_remove,
};
-
-static int __init hdmi_i2s_init(void)
-{
- DBG("Entered %s\n", __func__);
-
- return platform_driver_register(&hdmi_i2s_driver);
-}
-
-static void __exit hdmi_i2s_exit(void)
-{
- DBG("Entered %s\n", __func__);
-
- platform_driver_unregister(&hdmi_i2s_driver);
-}
-module_init(hdmi_i2s_init);
-module_exit(hdmi_i2s_exit);
+module_platform_driver(rockchip_hdmi_i2s_audio_driver);
MODULE_DESCRIPTION("HDMI I2S Controller Driver");
MODULE_LICENSE("GPL");
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <sound/soc.h>
#include <sound/pcm.h>
#include <sound/initval.h>
static struct snd_soc_codec_driver soc_codec_spdif_dit;
static struct snd_soc_dai_driver dit_stub_dai = {
- .name = "dit-hifi",
+ .name = "rk-hdmi-spdif-hifi",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
},
};
-static int spdif_dit_probe(struct platform_device *pdev)
+static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
{
- return snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
+ int ret;
+
+ //set dev name to driver->name for sound card register
+ dev_set_name(&pdev->dev, "%s", pdev->dev.driver->name);
+
+ ret = snd_soc_register_codec(&pdev->dev, &soc_codec_spdif_dit,
&dit_stub_dai, 1);
+
+ if (ret)
+ printk("%s() register codec failed:%d\n", __FUNCTION__, ret);
+
+ return ret;
}
-static int spdif_dit_remove(struct platform_device *pdev)
+static int rockchip_hdmi_spdif_audio_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
+
return 0;
}
-static struct platform_driver spdif_dit_driver = {
- .probe = spdif_dit_probe,
- .remove = spdif_dit_remove,
- .driver = {
- .name = DRV_NAME,
- .owner = THIS_MODULE,
- },
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_hdmi_spdif_of_match[] = {
+ { .compatible = "hdmi-spdif", },
+ {},
};
+MODULE_DEVICE_TABLE(of, rockchip_hdmi_spdif_of_match);
+#endif /* CONFIG_OF */
-static int __init dit_modinit(void)
-{
- return platform_driver_register(&spdif_dit_driver);
-}
-
-static void __exit dit_exit(void)
-{
- platform_driver_unregister(&spdif_dit_driver);
-}
+static struct platform_driver rockchip_hdmi_spdif_audio_driver = {
+ .driver = {
+ .name = "hdmi-spdif",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_hdmi_spdif_of_match),
+ },
+ .probe = rockchip_hdmi_spdif_audio_probe,
+ .remove = rockchip_hdmi_spdif_audio_remove,
+};
-module_init(dit_modinit);
-module_exit(dit_exit);
+module_platform_driver(rockchip_hdmi_spdif_audio_driver);
MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
MODULE_DESCRIPTION("SPDIF dummy codec driver");
#include <sound/initval.h>
#include <sound/tlv.h>
#include <trace/events/asoc.h>
-#include <mach/gpio.h>
-#include <mach/iomux.h>
#include "rk1000_codec.h"
-#define RK1000_CODEC_PROC
+//#define RK1000_CODEC_PROC
#ifdef RK1000_CODEC_PROC
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
}
};
-static int rk1000_codec_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk1000_codec_suspend(struct snd_soc_codec *codec)
{
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
rk1000_codec_set_bias_level(codec, SND_SOC_BIAS_OFF);
#if 1
printk("i2c write ret = 0x%x\n",ret);
memset(data,0,sizeof(data));
- ret = i2c_master_reg8_recv(client, 0, data, (int)4, 20*1000);
+ ret = i2c_master_recv(client, data, 4);
+ //ret = i2c_master_reg8_recv(client, 0, data, (int)4, 20*1000);
printk("i2c read reg %x, %x, %x, %x ret=x%x\n",data[0],data[1],data[2],data[3],ret);
#endif
return 0;
}
-static int rk2928_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk2928_suspend(struct snd_soc_codec *codec)
{
DBG("%s", __FUNCTION__);
rk2928_set_bias_level(codec, SND_SOC_BIAS_OFF);
};
-static int rk3026_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk3026_suspend(struct snd_soc_codec *codec)
{
if (rk3026_for_mid)
{
#include <sound/initval.h>
#include <sound/tlv.h>
#include <asm/io.h>
-#include <mach/board.h>
-#include <mach/io.h>
-#include <mach/iomux.h>
-#include <mach/cru.h>
+
#include "rk3190_codec.h"
#ifdef CONFIG_RK_HEADSET_DET
};
-static int rk3190_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk3190_suspend(struct snd_soc_codec *codec)
{
if (rk3190_for_mid)
{
&soc_codec_dev_rk3190, rk3190_dai, ARRAY_SIZE(rk3190_dai));
}
-static __devexit int rk3190_platform_remove(struct platform_device *pdev)
+static int rk3190_platform_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
.symmetric_rates = 1,
};
-static int rk610_codec_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk610_codec_suspend(struct snd_soc_codec *codec)
{
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
rk610_codec_set_bias_level(codec, SND_SOC_BIAS_OFF);
snd_soc_write(codec, RK616_SINGNAL_ZC_CTL1, 0x3f);
snd_soc_write(codec, RK616_SINGNAL_ZC_CTL2, 0xff);
+ //set ADC Power for MICBIAS
+ snd_soc_update_bits(codec, RK616_PWR_ADD1,
+ RK616_ADC_PWRD, 0);
+
return 0;
}
break;
case SND_SOC_BIAS_OFF:
- snd_soc_write(codec, RK616_PWR_ADD1, rk616_reg_defaults[RK616_PWR_ADD1]);
+ snd_soc_write(codec, RK616_PWR_ADD1, rk616_reg_defaults[RK616_PWR_ADD1] & ~RK616_ADC_PWRD);
snd_soc_write(codec, RK616_PWR_ADD2, rk616_reg_defaults[RK616_PWR_ADD2]);
snd_soc_write(codec, RK616_PWR_ADD3, rk616_reg_defaults[RK616_PWR_ADD3]);
if (!rk616_for_mid)
};
-static int rk616_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rk616_suspend(struct snd_soc_codec *codec)
{
if (rk616_for_mid)
rk616_codec_power_down(RK616_CODEC_ALL);
#endif
#ifdef CONFIG_PM
-int rt3261_dsp_suspend(struct snd_soc_codec *codec, pm_message_t state)
+int rt3261_dsp_suspend(struct snd_soc_codec *codec)
{
return 0;
}
int rt3261_dsp_probe(struct snd_soc_codec *codec);
int rt_codec_dsp_ioctl_common(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_PM
-int rt3261_dsp_suspend(struct snd_soc_codec *codec, pm_message_t state);
+int rt3261_dsp_suspend(struct snd_soc_codec *codec);
int rt3261_dsp_resume(struct snd_soc_codec *codec);
#endif
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
+#include <linux/clk.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
-#include <mach/board.h>
-#include <linux/clk.h>
-#include <mach/iomux.h>
-
-//#define RT3261_PROC
-#ifdef RT3261_PROC
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/vmalloc.h>
-#endif
//#define USE_INT_CLK
#define DIFFERENTIAL 1
#define TWO_SPK 2
#define ONE_SPK 1
+enum {
+ SPK_AMPLIFY_ZERO_POINT_FIVE_WATT=1,
+ SPK_AMPLIFY_ZERO_POINT_SIX_WATT,
+ SPK_AMPLIFY_ZERO_POINT_EIGHT_WATT,
+ SPK_AMPLIFY_ONE_WATT,
+};
+
+enum {
+ LR_NORMAL,
+ LR_SWAP,
+ LEFT_COPY_TO_RIGHT,
+ RIGHT_COPY_LEFT,
+};
+
static struct snd_soc_codec *rt3261_codec;
-#if 0
+#if 1
#define DBG(x...) printk(KERN_DEBUG x)
#else
#define DBG(x...)
static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value, const void *data, int len)
{
+ struct rt3261_priv *rt3261 = snd_soc_codec_get_drvdata(codec);
int ret;
if (!snd_soc_codec_volatile_register(codec, reg) &&
return 0;
}
- ret = i2c_master_normal_send(codec->control_data, data, len,400*1000);
- if (ret == len)
+ if (i2c_master_send(rt3261->i2c, data, len) == len)
return 0;
- if (ret < 0)
- return ret;
else
return -EIO;
}
}
}
-void codec_set_spk(bool on)
+static void rt3261_codec_set_spk(bool on)
{
-
struct snd_soc_codec *codec = rt3261_codec;
DBG("%s: %d\n", __func__, on);
}
//bard 8-9 e
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt3261_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
- printk("hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
+ printk("rt3261_hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
// dump_reg(codec);
if(on) {
if(hp_amp_power_count <= 0) {
static int rt3261_adc_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event)
{
- struct snd_soc_codec *codec = w->codec;
- unsigned int val, mask;
+ //struct snd_soc_codec *codec = w->codec;
+ //unsigned int val, mask;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
- unsigned int val, mask;
+ //unsigned int val, mask;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
struct snd_kcontrol *kcontrol, int event)
{
struct snd_soc_codec *codec = w->codec;
- unsigned int val, mask;
+ //unsigned int val, mask;
switch (event) {
case SND_SOC_DAPM_POST_PMU:
RT3261_HP_CO_EN | RT3261_HP_SG_EN);
rt3261_index_update_bits(codec, RT3261_CHPUMP_INT_REG1,0x0700, 0x0400); //bard 12-6
#else
- hp_amp_power(codec, 1);
+ rt3261_hp_amp_power(codec, 1);
#endif
/* headphone unmute sequence */
snd_soc_update_bits(codec, RT3261_DEPOP_M3,
RT3261_PWR_HP_L | RT3261_PWR_HP_R | RT3261_PWR_HA,
0);
#else
- hp_amp_power(codec, 0);
+ rt3261_hp_amp_power(codec, 0);
#endif
}
#else //one bit
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- hp_amp_power(codec,1);
+ rt3261_hp_amp_power(codec,1);
snd_soc_update_bits(codec, RT3261_PWR_ANLG1,
RT3261_PWR_LM, RT3261_PWR_LM); //bard 10-18
snd_soc_update_bits(codec, RT3261_OUTPUT,
RT3261_L_MUTE | RT3261_R_MUTE);
snd_soc_update_bits(codec, RT3261_PWR_ANLG1,
RT3261_PWR_LM, 0); //bard 10-18
- hp_amp_power(codec,0);
+ rt3261_hp_amp_power(codec,0);
break;
default:
return 0;
}
-
-static int rt3261_proc_init(void);
-
static int rt3261_probe(struct snd_soc_codec *codec)
{
return ret;
}
codec->write = rt3261_write;
-
- #ifdef RT3261_PROC
- rt3261_proc_init();
- #endif
#if defined (CONFIG_SND_SOC_RT5623)
struct clk *iis_clk;
}
#ifdef CONFIG_PM
-static int rt3261_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt3261_suspend(struct snd_soc_codec *codec)
{
#if defined (CONFIG_SND_SOC_RT3261)
/* After opening LDO of DSP, then close LDO of codec.
* (3) DSP IIS interface power off
* (4) Toggle pin of codec LDO1 to power off
*/
- rt3261_dsp_suspend(codec, state);
+ rt3261_dsp_suspend(codec);
#endif
rt3261_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
};
MODULE_DEVICE_TABLE(i2c, rt3261_i2c_id);
+#ifdef CONFIG_OF
+/*
+dts:
+ codec@1c {
+ compatible = "rt3261";
+ reg = <0x1c>;
+ codec-en-gpio = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
+ spk-num= <2>;
+ modem-input-mode = <1>;
+ lout-to-modem_mode = <1>;
+ spk-amplify = <2>;
+ playback-if1-data_control = <0>;
+ playback-if2-data_control = <0>;
+ };
+*/
+
+static int rt3261_parse_dt_property(struct device *dev,
+ struct rt3261_priv *rt3261)
+{
+ struct device_node *node = dev->of_node;
+ int ret;
+ enum of_gpio_flags flags;
+
+ printk("%s()\n", __FUNCTION__);
+
+ if (!node)
+ return -ENODEV;
+
+ rt3261->codec_en_gpio = of_get_named_gpio_flags(node, "codec-en-gpio", 0, &flags);
+ if (rt3261->codec_en_gpio < 0) {
+ DBG("%s() Can not read property codec-en-gpio\n", __FUNCTION__);
+ } else {
+ ret = devm_gpio_request(dev, rt3261->codec_en_gpio, "codec_en_gpio");
+ if(ret){
+ printk("%s() codec_en_gpio request ERROR", __FUNCTION__);
+ return ret;
+ }
+ ret = gpio_direction_output(rt3261->codec_en_gpio , !flags);
+ if(ret){
+ printk("%s() codec_en_gpio set ERROR", __FUNCTION__);
+ return ret;
+ }
+ }
+
+ ret = of_property_read_u32(node, "spk-num", &rt3261->spk_num);
+ if (ret < 0) {
+ DBG("%s() Can not read property spk-num\n", __FUNCTION__);
+ rt3261->spk_num = TWO_SPK;
+ }
+
+ ret = of_property_read_u32(node, "modem-input-mode", &rt3261->modem_input_mode);
+ if (ret < 0) {
+ DBG("%s() Can not read property modem-input-mode\n", __FUNCTION__);
+ rt3261->modem_input_mode = DIFFERENTIAL;
+ }
+
+ ret = of_property_read_u32(node, "lout-to-modem-mode", &rt3261->lout_to_modem_mode);
+ if (ret < 0) {
+ DBG("%s() Can not read property lout-to-modem-mode\n", __FUNCTION__);
+ rt3261->lout_to_modem_mode = DIFFERENTIAL;
+ }
+
+ ret = of_property_read_u32(node, "spk-amplify", &rt3261->spk_amplify);
+ if (ret < 0) {
+ DBG("%s() Can not read property spk-amplify\n", __FUNCTION__);
+ rt3261->spk_amplify = SPK_AMPLIFY_ZERO_POINT_SIX_WATT;
+ }
+
+ ret = of_property_read_u32(node, "playback-if1-data-control", &rt3261->playback_if1_data_control);
+ if (ret < 0) {
+ DBG("%s() Can not read property playback-if1-data-control\n", __FUNCTION__);
+ rt3261->playback_if1_data_control = LR_NORMAL;
+ }
+
+ ret = of_property_read_u32(node, "playback-if2-data-control", &rt3261->playback_if2_data_control);
+ if (ret < 0) {
+ DBG("%s() Can not read property playback-if2-data-control\n", __FUNCTION__);
+ rt3261->playback_if1_data_control = LR_NORMAL;
+ }
+ return 0;
+}
+#else
+static int rt3261_parse_dt_property(struct device *dev,
+ struct rt3261_priv *rt3261)
+{
+ return -ENOSYS;
+}
+#endif //#ifdef CONFIG_OF
+
static int rt3261_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct rt3261_priv *rt3261;
int ret;
- struct rt3261_platform_data *pdata = pdata = i2c->dev.platform_data;
rt3261 = kzalloc(sizeof(struct rt3261_priv), GFP_KERNEL);
if (NULL == rt3261)
return -ENOMEM;
- rt3261->codec_en_gpio = pdata->codec_en_gpio;
- rt3261->io_init = pdata->io_init;
- rt3261->spk_num = pdata->spk_num;
- rt3261->modem_input_mode = pdata->modem_input_mode;
- rt3261->lout_to_modem_mode = pdata->lout_to_modem_mode;
- rt3261->spk_amplify = pdata->spk_amplify;
- rt3261->playback_if1_data_control = pdata->playback_if1_data_control;
- rt3261->playback_if2_data_control = pdata->playback_if2_data_control;
+ rt3261->i2c = i2c;
- if(rt3261->io_init)
- rt3261->io_init(pdata->codec_en_gpio, pdata->codec_en_gpio_info.iomux_name, pdata->codec_en_gpio_info.iomux_mode);
+ ret = rt3261_parse_dt_property(&i2c->dev, rt3261);
+ if (ret < 0) {
+ printk("%s() parse device tree property error %d\n", __FUNCTION__, ret);
+ return ret;
+ }
#if defined (CONFIG_SND_SOC_RT5623)
rt3261->modem_is_open = 0;
MODULE_DESCRIPTION("ASoC RT3261 driver");
MODULE_AUTHOR("Johnny Hsu <johnnyhsu@realtek.com>");
MODULE_LICENSE("GPL");
-
-
-#ifdef RT3261_PROC
-
-static ssize_t rt3261_proc_write(struct file *file, const char __user *buffer,
- unsigned long len, void *data)
-{
- char *cookie_pot;
- char *p;
- int reg;
- int i;
- int value;
- #if defined (CONFIG_SND_SOC_RT3261)
- struct rt3261_dsp_param param;
- #endif
-
- cookie_pot = (char *)vmalloc( len );
- if (!cookie_pot)
- {
- return -ENOMEM;
- }
- else
- {
- if (copy_from_user( cookie_pot, buffer, len ))
- return -EFAULT;
- }
-
- switch(cookie_pot[0])
- {
- case 'r':
- case 'R':
- printk("Read reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,",")))
- {
- reg = simple_strtol(p,NULL,16);
- value = rt3261_read(rt3261_codec,reg);
- printk("rt3261_read:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- else
- {
- printk("Error Read reg debug.\n");
- printk("For example: echo r:22,23,24,25>rt3261_ts\n");
- }
- break;
- case 'w':
- case 'W':
- printk("Write reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,"=")))
- {
- reg = simple_strtol(p,NULL,16);
- p=strsep(&cookie_pot,",");
- value = simple_strtol(p,NULL,16);
- rt3261_write(rt3261_codec,reg,value);
- printk("rt3261_write:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- else
- {
- printk("Error Write reg debug.\n");
- printk("For example: w:22=0,23=0,24=0,25=0>rt3261_ts\n");
- }
- break;
- case 'a':
- printk("Dump rt3261 index reg \n");
-
- for (i = 0; i < 0xb4; i++)
- {
- value = rt3261_index_read(rt3261_codec, i);
- printk("rt3261_index_read:0x%04x = 0x%04x\n",i,value);
- }
- break;
- #if defined (CONFIG_SND_SOC_RT3261)
- case 'b':
- param.cmd_fmt = 0x00e0;
- param.cmd = RT3261_DSP_CMD_MW;
- printk("Write dsp reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,"=")))
- {
- param.addr = simple_strtol(p,NULL,16);
- p=strsep(&cookie_pot,",");
- param.data = simple_strtol(p,NULL,16);
- rt3261_dsp_write(rt3261_codec,¶m);
- printk("rt3261_dsp_write:0x%04x = 0x%04x\n",param.addr,param.data);
- }
- printk("\n");
- }
- break;
- case 'c':
- printk("Read dsp reg debug\n");
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,",")))
- {
- reg = simple_strtol(p,NULL,16);
- value = rt3261_dsp_read(rt3261_codec,reg);
- printk("rt3261_dsp_read:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- break;
- #endif
- case 'd':
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,"=")))
- {
- reg = simple_strtol(p,NULL,16);
- p=strsep(&cookie_pot,",");
- value = simple_strtol(p,NULL,16);
- rt3261_index_write(rt3261_codec,reg,value);
- printk("rt3261_index_write:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- break;
- case 'e':
- if(cookie_pot[1] ==':')
- {
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,",")))
- {
- reg = simple_strtol(p,NULL,16);
- value = rt3261_index_read(rt3261_codec,reg);
- printk("rt3261_index_read:0x%04x = 0x%04x\n",reg,value);
- }
- printk("\n");
- }
- break;
- default:
- printk("Help for rt3261_ts .\n-->The Cmd list: \n");
- printk("-->'d&&D' Open or Off the debug\n");
- printk("-->'r&&R' Read reg debug,Example: echo 'r:22,23,24,25'>rt3261_ts\n");
- printk("-->'w&&W' Write reg debug,Example: echo 'w:22=0,23=0,24=0,25=0'>rt3261_ts\n");
- break;
- }
-
- return len;
-}
-
-static const struct file_operations rt3261_proc_fops = {
- .owner = THIS_MODULE,
-};
-
-static int rt3261_proc_init(void)
-{
- struct proc_dir_entry *rt3261_proc_entry;
- rt3261_proc_entry = create_proc_entry("driver/rt3261_ts", 0777, NULL);
- if(rt3261_proc_entry != NULL)
- {
- rt3261_proc_entry->write_proc = rt3261_proc_write;
- return 0;
- }
- else
- {
- printk("create proc error !\n");
- return -1;
- }
-}
-#endif
#define RT3261_HEADSET_DET BIT(1)
#define RT3261_HEADPHO_DET BIT(2)
-void codec_set_spk(bool on);
-
-int rt3261_headset_mic_detect(int jack_insert);
-
/* System Clock Source */
enum {
RT3261_SCLK_S_MCLK,
};
struct rt3261_priv {
+ struct i2c_client *i2c;
struct snd_soc_codec *codec;
struct delayed_work patch_work;
bool dsp_rec_pass;
unsigned int codec_en_gpio;
- int (*io_init)(int gpio, char *iomux_name, int iomux_mode);
unsigned int modem_is_open;
unsigned int spk_num;
int rt3261_conn_mux_path(struct snd_soc_codec *codec,
char *widget_name, char *path_name);
+int rt3261_headset_mic_detect(int jack_insert);
+static void rt3261_codec_set_spk(bool on);
+
#endif /* __RT3261_H__ */
}
#ifdef CONFIG_PM
-static int rt5512_codec_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5512_codec_suspend(struct snd_soc_codec *codec)
{
RT_DBG("\n");
rt5512_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt5616_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
static void rt5616_pmu_depop(struct snd_soc_codec *codec)
{
- hp_amp_power(codec, 1);
+ rt5616_hp_amp_power(codec, 1);
/* headphone unmute sequence */
snd_soc_update_bits(codec, RT5616_DEPOP_M3,
RT5616_L_MUTE | RT5616_R_MUTE, RT5616_L_MUTE | RT5616_R_MUTE);
msleep(30);
- hp_amp_power(codec, 0);
+ rt5616_hp_amp_power(codec, 0);
}
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- hp_amp_power(codec,1);
+ rt5616_hp_amp_power(codec,1);
snd_soc_update_bits(codec, RT5616_LOUT_CTRL1,
RT5616_L_MUTE | RT5616_R_MUTE, 0);
break;
snd_soc_update_bits(codec, RT5616_LOUT_CTRL1,
RT5616_L_MUTE | RT5616_R_MUTE,
RT5616_L_MUTE | RT5616_R_MUTE);
- hp_amp_power(codec,0);
+ rt5616_hp_amp_power(codec,0);
break;
default:
return 0;
}
-void codec_set_spk(bool on)
+void rt5616_codec_set_spk(bool on)
{
struct snd_soc_codec *codec = rt5616_codec;
}
#ifdef CONFIG_PM
-static int rt5616_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5616_suspend(struct snd_soc_codec *codec)
{
rt5616_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/tlv.h>
-#include <mach/gpio.h>
+//#include <mach/gpio.h>
#include "rt5621.h"
#define DBG(x...)
#endif
+#define GPIO_HIGH 1
+#define GPIO_LOW 0
+#define INVALID_GPIO -1
+
#define RT5621_VERSION "0.01 alsa 1.0.24"
+int rt5621_spk_ctl_gpio = INVALID_GPIO;
static int caps_charge = 500;
module_param(caps_charge, int, 0);
MODULE_PARM_DESC(caps_charge, "RT5621 cap charge time (msecs)");
return 0;
}
-void codec_set_spk(bool on)
+void rt5621_codec_set_spk(bool on)
{
struct snd_soc_codec *codec = rt5621_codec;
}
#ifdef CONFIG_PM
-static int rt5621_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5621_suspend(struct snd_soc_codec *codec)
{
rt5621_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
};
MODULE_DEVICE_TABLE(i2c, rt5621_i2c_id);
+/*
+dts:
+ codec@1a {
+ compatible = "rt5621";
+ reg = <0x1a>;
+ spk-ctl-gpio = <&gpio6 GPIO_B6 GPIO_ACTIVE_HIGH>;
+ };
+*/
static int rt5621_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
printk("##################### %s ######################\n", __FUNCTION__);
- ret = gpio_request(RK29_PIN6_PB6, "spk_con");
+#ifdef CONFIG_OF
+ rt5621_spk_ctl_gpio= of_get_named_gpio_flags(i2c->dev.of_node, "spk-ctl-gpio", 0, NULL);
+ if (rt5621_spk_ctl_gpio < 0) {
+ DBG("%s() Can not read property spk-ctl-gpio\n", __FUNCTION__);
+ rt5621_spk_ctl_gpio = INVALID_GPIO;
+ }
+#endif //#ifdef CONFIG_OF
+
+ ret = gpio_request(rt5621_spk_ctl_gpio, "spk_con");
if(ret < 0){
printk("gpio request spk_con error!\n");
}
else{
printk("########################### set spk_con HIGH ##################################\n");
- gpio_direction_output(RK29_PIN6_PB6, GPIO_HIGH);
- gpio_set_value(RK29_PIN6_PB6, GPIO_HIGH);
+ gpio_direction_output(rt5621_spk_ctl_gpio, GPIO_HIGH);
+ gpio_set_value(rt5621_spk_ctl_gpio, GPIO_HIGH);
}
rt5621 = kzalloc(sizeof(struct rt5621_priv), GFP_KERNEL);
return ret;
}
-static __devexit int rt5621_i2c_remove(struct i2c_client *i2c)
+static int rt5621_i2c_remove(struct i2c_client *i2c)
{
snd_soc_unregister_codec(&i2c->dev);
kfree(i2c_get_clientdata(i2c));
.owner = THIS_MODULE,
},
.probe = rt5621_i2c_probe,
- .remove = __devexit_p(rt5621_i2c_remove),
+ .remove = rt5621_i2c_remove,
.id_table = rt5621_i2c_id,
};
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
+#include <linux/of_gpio.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <linux/gpio.h>
#include "rt5625.h"
-#include <mach/board.h>
-#define RT5625_PROC
+#define INVALID_GPIO -1
+
+//#define RT5625_PROC
#ifdef RT5625_PROC
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
}
#ifdef CONFIG_PM
-static int rt5625_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5625_suspend(struct snd_soc_codec *codec)
{
rt5625_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
};
MODULE_DEVICE_TABLE(i2c, rt5625_i2c_id);
+#ifdef CONFIG_OF
+/*
+dts:
+ codec@1e {
+ compatible = "rt5625";
+ reg = <0x1e>;
+ spk-ctr-pin = <&gpio3 GPIO_D7 GPIO_ACTIVE_HIGH>;
+ spk-ctr-on = <1>;
+ spk-ctr-off = <0>;
+ };
+*/
+
+static int rt5625_parse_dt_property(struct device *dev,
+ struct rt5625_priv *rt5625)
+{
+ struct device_node *node = dev->of_node;
+ int ret;
+
+ printk("%s()\n", __FUNCTION__);
+
+ if (!node)
+ return -ENODEV;
+
+ rt5625->spk_ctr_pin= of_get_named_gpio_flags(node, "spk-ctr-pin", 0, NULL);
+ if (rt5625->spk_ctr_pin < 0) {
+ DBG("%s() Can not read property spk-ctr-pin\n", __FUNCTION__);
+ rt5625->spk_ctr_pin = INVALID_GPIO;
+ }
+
+ ret = of_property_read_u32(node, "spk-ctr-on", &rt5625->spk_ctr_on);
+ if (ret < 0) {
+ DBG("%s() Can not read property spk-ctr-on\n", __FUNCTION__);
+ rt5625->spk_ctr_on = 1;
+ }
+
+ ret = of_property_read_u32(node, "spk-ctr-off", &rt5625->spk_ctr_off);
+ if (ret < 0) {
+ DBG("%s() Can not read property spk-ctr-off\n", __FUNCTION__);
+ rt5625->spk_ctr_off = 0;
+ }
+
+ return 0;
+}
+#else
+static int rt5625_parse_dt_property(struct device *dev,
+ struct rt3261_priv *rt3261)
+{
+ return -ENOSYS;
+}
+#endif //#ifdef CONFIG_OF
+
static int rt5625_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
struct rt5625_priv *rt5625;
int ret;
- struct rt5625_platform_data *pdata = pdata = i2c->dev.platform_data;
+ //struct rt5625_platform_data *pdata = pdata = i2c->dev.platform_data;
rt5625 = kzalloc(sizeof(struct rt5625_priv), GFP_KERNEL);
if (NULL == rt5625)
return -ENOMEM;
- rt5625->spk_ctr_pin = pdata->spk_ctr_pin;
- rt5625->spk_ctr_on = pdata->spk_ctr_on;
- rt5625->spk_ctr_off = pdata->spk_ctr_off;
+ ret = rt5625_parse_dt_property(&i2c->dev, rt5625);
+ if (ret < 0) {
+ printk("%s() parse device tree property error %d\n", __FUNCTION__, ret);
+ return ret;
+ }
if(rt5625->spk_ctr_pin != INVALID_GPIO)
{
return ret;
}
-static __devexit int rt5625_i2c_remove(struct i2c_client *i2c)
+static int rt5625_i2c_remove(struct i2c_client *i2c)
{
snd_soc_unregister_codec(&i2c->dev);
kfree(i2c_get_clientdata(i2c));
.owner = THIS_MODULE,
},
.probe = rt5625_i2c_probe,
- .remove = __devexit_p(rt5625_i2c_remove),
+ .remove = rt5625_i2c_remove,
.id_table = rt5625_i2c_id,
};
[RT5631_PSEUDO_SPATL_CTRL] = 0x0553,
};
-void codec_set_spk(bool on)
+void rt5631_codec_set_spk(bool on)
{
struct snd_soc_codec *codec = rt5631_codec;
}
#ifdef CONFIG_PM
-static int rt5631_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5631_suspend(struct snd_soc_codec *codec)
{
rt5631_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
#include <sound/initval.h>
#include <sound/tlv.h>
-#define RT3261_PROC
-#ifdef RT3261_PROC
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/vmalloc.h>
-char debug_write_read = 0;
-#endif
-static struct snd_soc_codec *rt3261_codec;
-
#define RTK_IOCTL
#ifdef RTK_IOCTL
#if defined(CONFIG_SND_HWDEP) || defined(CONFIG_SND_HWDEP_MODULE)
#endif
#endif
-static unsigned int rt3261_read(struct snd_soc_codec *codec,
- unsigned int reg)
-{
- unsigned int val;
-
- val = codec->hw_read(codec, reg);
- return val;
-}
-
-static int do_hw_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value, const void *data, int len)
-{
- int ret;
-
- if (!snd_soc_codec_volatile_register(codec, reg) &&
- reg < codec->driver->reg_cache_size &&
- !codec->cache_bypass) {
- ret = snd_soc_cache_write(codec, reg, value);
- if (ret < 0)
- return -1;
- }
-
- if (codec->cache_only) {
- codec->cache_sync = 1;
- return 0;
- }
-
- ret = codec->hw_write(codec->control_data, data, len);
- if (ret == len)
- return 0;
- if (ret < 0)
- return ret;
- else
- return -EIO;
-}
-
-static int rt3261_write(struct snd_soc_codec *codec, unsigned int reg,
- unsigned int value)
-{
- u8 data[3];
-
- data[0] = reg;
- data[1] = (value >> 8) & 0xff;
- data[2] = value & 0xff;
-
- return do_hw_write(codec, reg, value, data, 3);
-}
-
#include "rt5639.h"
#define RT5639_REG_RW 0 /* for debug */
}
#if USE_ONEBIT_DEPOP
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt5639_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
-// printk("one bit hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
+// printk("one bit rt5639_hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
if(on) {
if(hp_amp_power_count <= 0) {
static void rt5639_pmu_depop(struct snd_soc_codec *codec)
{
- hp_amp_power(codec, 1);
+ rt5639_hp_amp_power(codec, 1);
/* headphone unmute sequence */
msleep(5);
snd_soc_update_bits(codec, RT5639_HP_VOL,
RT5639_L_MUTE | RT5639_R_MUTE,
RT5639_L_MUTE | RT5639_R_MUTE);
msleep(50);
- hp_amp_power(codec, 0);
+ rt5639_hp_amp_power(codec, 0);
}
#else //seq
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt5639_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
-// printk("hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
+// printk("rt5639_hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
if(on) {
if(hp_amp_power_count <= 0) {
static void rt5639_pmu_depop(struct snd_soc_codec *codec)
{
- hp_amp_power(codec, 1);
+ rt5639_hp_amp_power(codec, 1);
/* headphone unmute sequence */
snd_soc_update_bits(codec, RT5639_DEPOP_M3,
RT5639_CP_FQ1_MASK | RT5639_CP_FQ2_MASK | RT5639_CP_FQ3_MASK,
RT5639_L_MUTE | RT5639_R_MUTE, RT5639_L_MUTE | RT5639_R_MUTE);
msleep(30);
- hp_amp_power(codec, 0);
+ rt5639_hp_amp_power(codec, 0);
}
#endif
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- hp_amp_power(codec,1);
+ rt5639_hp_amp_power(codec,1);
snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
RT5639_PWR_LM, RT5639_PWR_LM);
snd_soc_update_bits(codec, RT5639_OUTPUT,
RT5639_L_MUTE | RT5639_R_MUTE);
snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
RT5639_PWR_LM, 0);
- hp_amp_power(codec,0);
+ rt5639_hp_amp_power(codec,0);
break;
default:
return 0;
}
-static int rt3261_proc_init(void);
-
static int rt5639_probe(struct snd_soc_codec *codec)
{
struct rt5639_priv *rt5639 = snd_soc_codec_get_drvdata(codec);
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
return ret;
}
-
-#ifdef RT3261_PROC
- rt3261_proc_init();
-#endif
rt5639_reset(codec);
snd_soc_update_bits(codec, RT5639_PWR_ANLG1,
ioctl_ops->index_read = rt5639_index_read;
ioctl_ops->index_update_bits = rt5639_index_update_bits;
ioctl_ops->ioctl_common = rt5639_ioctl_common;
- realtek_ce_init_hwdep(codec);
+ rt56xx_ce_init_hwdep(codec);
#endif
#endif
"Failed to create codex_reg sysfs files: %d\n", ret);
return ret;
}
- rt3261_codec = codec;
return 0;
}
}
#ifdef CONFIG_PM
-static int rt5639_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5639_suspend(struct snd_soc_codec *codec)
{
rt5639_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
MODULE_DESCRIPTION("ASoC RT5639 driver");
MODULE_AUTHOR("Johnny Hsu <johnnyhsu@realtek.com>");
MODULE_LICENSE("GPL");
-
-#ifdef RT3261_PROC
-
-static ssize_t rt3261_proc_write(struct file *file, const char __user *buffer,
- unsigned long len, void *data)
-{
- char *cookie_pot;
- char *p;
- int reg;
- int i;
- int value;
-
- cookie_pot = (char *)vmalloc( len );
- if (!cookie_pot)
- {
- return -ENOMEM;
- }
- else
- {
- if (copy_from_user( cookie_pot, buffer, len ))
- return -EFAULT;
- }
-
- switch(cookie_pot[0])
- {
- case 'd':
- case 'D':
- debug_write_read ++;
- debug_write_read %= 2;
- if(debug_write_read != 0)
- printk("Debug read and write reg on\n");
- else
- printk("Debug read and write reg off\n");
- break;
- case 'r':
- case 'R':
- printk("Read reg debug\n");
- if(cookie_pot[1] ==':')
- {
- debug_write_read = 1;
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,",")))
- {
- reg = simple_strtol(p,NULL,16);
- value = rt3261_read(rt3261_codec,reg);
- printk("rt3261_read:0x%04x = 0x%04x\n",reg,value);
- }
- debug_write_read = 0;
- printk("\n");
- }
- else
- {
- printk("Error Read reg debug.\n");
- printk("For example: echo r:22,23,24,25>rt3261_ts\n");
- }
- break;
- case 'w':
- case 'W':
- printk("Write reg debug\n");
- if(cookie_pot[1] ==':')
- {
- debug_write_read = 1;
- strsep(&cookie_pot,":");
- while((p=strsep(&cookie_pot,"=")))
- {
- reg = simple_strtol(p,NULL,16);
- p=strsep(&cookie_pot,",");
- value = simple_strtol(p,NULL,16);
- rt3261_write(rt3261_codec,reg,value);
- printk("rt3261_write:0x%04x = 0x%04x\n",reg,value);
- }
- debug_write_read = 0;
- printk("\n");
- }
- else
- {
- printk("Error Write reg debug.\n");
- printk("For example: w:22=0,23=0,24=0,25=0>rt3261_ts\n");
- }
- break;
- /*case 'a':
- printk("Dump rt3261 dsp reg \n");
-
- for (i = 0; i < 0xb4; i++)
- {
- value = rt3261_index_read(rt3261_codec, i);
- printk("rt3261_index_read:0x%04x = 0x%04x\n",i,value);
- }
-
- break; */
- default:
- printk("Help for rt3261_ts .\n-->The Cmd list: \n");
- printk("-->'d&&D' Open or Off the debug\n");
- printk("-->'r&&R' Read reg debug,Example: echo 'r:22,23,24,25'>rt3261_ts\n");
- printk("-->'w&&W' Write reg debug,Example: echo 'w:22=0,23=0,24=0,25=0'>rt3261_ts\n");
- break;
- }
-
- return len;
-}
-
-static const struct file_operations rt3261_proc_fops = {
- .owner = THIS_MODULE,
-};
-
-static int rt3261_proc_init(void)
-{
- struct proc_dir_entry *rt3261_proc_entry;
- rt3261_proc_entry = create_proc_entry("driver/rt3261_ts", 0777, NULL);
- if(rt3261_proc_entry != NULL)
- {
- rt3261_proc_entry->write_proc = rt3261_proc_write;
- return 0;
- }
- else
- {
- printk("create proc error !\n");
- return -1;
- }
-}
-#endif
-
#endif
#ifdef CONFIG_PM
-int rt5640_dsp_suspend(struct snd_soc_codec *codec, pm_message_t state)
+int rt5640_dsp_suspend(struct snd_soc_codec *codec)
{
struct rt5640_dsp_param param;
int ret;
int rt5640_dsp_probe(struct snd_soc_codec *codec);
int rt56xx_dsp_ioctl_common(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg);
#ifdef CONFIG_PM
-int rt5640_dsp_suspend(struct snd_soc_codec *codec, pm_message_t state);
+int rt5640_dsp_suspend(struct snd_soc_codec *codec);
int rt5640_dsp_resume(struct snd_soc_codec *codec);
#endif
}
#if USE_ONEBIT_DEPOP
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt5640_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
-// printk("one bit hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
+// printk("one bit rt5640_hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
if(on) {
if(hp_amp_power_count <= 0) {
static void rt5640_pmu_depop(struct snd_soc_codec *codec)
{
- hp_amp_power(codec, 1);
+ rt5640_hp_amp_power(codec, 1);
/* headphone unmute sequence */
msleep(5);
snd_soc_update_bits(codec, RT5640_HP_VOL,
RT5640_L_MUTE | RT5640_R_MUTE,
RT5640_L_MUTE | RT5640_R_MUTE);
msleep(50);
- hp_amp_power(codec, 0);
+ rt5640_hp_amp_power(codec, 0);
}
#else //seq
-void hp_amp_power(struct snd_soc_codec *codec, int on)
+void rt5640_hp_amp_power(struct snd_soc_codec *codec, int on)
{
static int hp_amp_power_count;
-// printk("hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
+// printk("rt5640_hp_amp_power on=%d hp_amp_power_count=%d\n",on,hp_amp_power_count);
if(on) {
if(hp_amp_power_count <= 0) {
static void rt5640_pmu_depop(struct snd_soc_codec *codec)
{
- hp_amp_power(codec, 1);
+ rt5640_hp_amp_power(codec, 1);
/* headphone unmute sequence */
snd_soc_update_bits(codec, RT5640_DEPOP_M3,
RT5640_CP_FQ1_MASK | RT5640_CP_FQ2_MASK | RT5640_CP_FQ3_MASK,
RT5640_L_MUTE | RT5640_R_MUTE, RT5640_L_MUTE | RT5640_R_MUTE);
msleep(30);
- hp_amp_power(codec, 0);
+ rt5640_hp_amp_power(codec, 0);
}
#endif
switch (event) {
case SND_SOC_DAPM_POST_PMU:
- hp_amp_power(codec,1);
+ rt5640_hp_amp_power(codec,1);
snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
RT5640_PWR_LM, RT5640_PWR_LM);
snd_soc_update_bits(codec, RT5640_OUTPUT,
RT5640_L_MUTE | RT5640_R_MUTE);
snd_soc_update_bits(codec, RT5640_PWR_ANLG1,
RT5640_PWR_LM, 0);
- hp_amp_power(codec,0);
+ rt5640_hp_amp_power(codec,0);
break;
default:
}
/* add by magf for CONFIG_.._CTL_CODEC option */
-void codec_set_spk(bool on)
+void rt5640_codec_set_spk(bool on)
{
struct snd_soc_codec *codec = rt5640_codec;
ioctl_ops->index_read = rt5640_index_read;
ioctl_ops->index_update_bits = rt5640_index_update_bits;
ioctl_ops->ioctl_common = rt5640_ioctl_common;
- realtek_ce_init_hwdep(codec);
+ rt56xx_ce_init_hwdep(codec);
#endif
#endif
}
#ifdef CONFIG_PM
-static int rt5640_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int rt5640_suspend(struct snd_soc_codec *codec)
{
#if defined(CONFIG_SND_SOC_RT5642_MODULE) || defined(CONFIG_SND_SOC_RT5642)
/* After opening LDO of DSP, then close LDO of codec.
* (3) DSP IIS interface power off
* (4) Toggle pin of codec LDO1 to power off
*/
- rt5640_dsp_suspend(codec, state);
+ rt5640_dsp_suspend(codec);
#endif
rt5640_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
return 0;
}
-int realtek_ce_init_hwdep(struct snd_soc_codec *codec)
+int rt56xx_ce_init_hwdep(struct snd_soc_codec *codec)
{
struct snd_hwdep *hw;
struct snd_card *card = codec->card->snd_card;
return 0;
}
-EXPORT_SYMBOL_GPL(realtek_ce_init_hwdep);
+EXPORT_SYMBOL_GPL(rt56xx_ce_init_hwdep);
#endif
struct rt56xx_ops *rt56xx_get_ioctl_ops(void)
RT_GET_CODEC_ID = _IOR('R', 0x30, struct rt56xx_cmd),
};
-int realtek_ce_init_hwdep(struct snd_soc_codec *codec);
+int rt56xx_ce_init_hwdep(struct snd_soc_codec *codec);
struct rt56xx_ops *rt56xx_get_ioctl_ops(void);
#endif /* __RT56XX_IOCTL_H__ */
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/cdev.h>
-
-#include <linux/proc_fs.h>
+#include <linux/of_gpio.h>
#include <linux/seq_file.h>
+#include <linux/spi/spi.h>
+#include <linux/clk.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
+#include <sound/tlv.h>
-#include <mach/gpio.h>
+//#include <mach/gpio.h>
#include "tlv320aic3111.h"
#if 0
-#define AIC3111_DEBUG
#define AIC_DBG(x...) printk(KERN_INFO x)
#else
#define AIC_DBG(x...) do { } while (0)
#endif
-#define HP_DET_PIN RK29_PIN6_PA0
-//#define AIC3111_DEBUG
+#define GPIO_HIGH 1
+#define GPIO_LOW 0
+#define INVALID_GPIO -1
+
/* codec status */
#define AIC3110_IS_SHUTDOWN 0
#define AIC3110_IS_CAPTURE_ON 1
#define AIC3110_POWERDOWN_PLAYBACK_CAPTURE 3
#define JACK_DET_ADLOOP msecs_to_jiffies(200)
-//#define AIC3111_DEBUG
#define SPK 1
#define HP 0
+
+int aic3111_spk_ctl_gpio = INVALID_GPIO;
+int aic3111_hp_det_gpio = INVALID_GPIO;
+
static int aic3111_power_speaker (bool on);
struct speaker_data {
struct timer_list timer;
u8 data[2];
u8 page;
//printk("enter %s!!!!!!\n",__FUNCTION__);
- //printk("RK29_PIN6_PB6 =%d!!!!!!\n",gpio_get_value(RK29_PIN6_PB6));
+ //printk("aic3111_hp_det_gpio =%d!!!!!!\n",gpio_get_value(aic3111_hp_det_gpio));
page = reg / 128;
data[AIC3111_REG_OFFSET_INDEX] = reg % 128;
//aic3111_write (codec, 1, 0x01);
aic3111_write (codec, 63, 0x00);
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
msleep(10);
aic3111_write (aic3111_codec, (68), 0x01); //disable DRC
aic3111_write (aic3111_codec, (128 + 31), 0xc4);
struct snd_soc_codec *codec = aic3111_codec;
AIC_DBG ("CODEC::%s>>>>>>%d\n", __FUNCTION__, on);
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
aic3111_power_init();
if ((on == POWER_STATE_ON) &&
!(aic3111_current_status & AIC3110_IS_PLAYBACK_ON)) {
// if(1){
- //gpio_set_value(RK29_PIN6_PB5, GPIO_HIGH);
+ //gpio_set_value(aic3111_spk_ctl_gpio, GPIO_HIGH);
/****open HPL and HPR*******/
//aic3111_write(codec, (63), 0xfc);
aic3111_current_status &= ~AIC3110_IS_PLAYBACK_ON;
}
//mdelay(800);
- gpio_set_value(RK29_PIN6_PB5, GPIO_HIGH);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_HIGH);
return 0;
}
if(status == 0)
{
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
mdelay(10);
}
},
};
-#ifdef AIC3111_DEBUG
-static struct class *aic3111_debug_class = NULL;
-static int reg_128_39 = 12, reg_128_43 = 0;
-static int i=52;j=1,k=0;
-static int CheckCommand(const char __user *buffer)
-{
- switch(*buffer) {
- case '1':
- if (*(buffer + 1) == '+') {
- if (reg_128_39 < 12) {
- if (reg_128_39 % 2 == 0)
- printk("write reg 128 + 39 vol + : %ddB -> -%d.5dB\n", (reg_128_39 - 12) / 2, (11 - reg_128_39) / 2);
- else
- printk("write reg 128 + 39 vol + : -%d.5dB -> %ddB\n", (12 - reg_128_39) / 2, (reg_128_39 - 11) / 2);
- reg_128_39++;
- aic3111_write(aic3111_codec, (128 + 39), 0x04 + (12 - reg_128_39));
- } else {
- printk("128 + 39 max vol 0dB\n");
- }
- } else if (*(buffer + 1) == '-') {
- if (reg_128_39 > 0) {
- if (reg_128_39 % 2 == 0)
- printk("write reg 128 + 39 vol - : %ddB -> -%d.5dB\n", (reg_128_39 - 12) / 2, (13 - reg_128_39) / 2);
- else
- printk("write reg 128 + 39 vol - : -%d.5dB -> %ddB\n", (12 - reg_128_39) / 2, (reg_128_39 - 13) / 2);
- reg_128_39--;
- aic3111_write(aic3111_codec, (128 + 39), 0x08 + (12 - reg_128_39));
- } else {
- printk("128 + 39 min vol -6dB\n");
- }
- }
- break;
- case '2':
- if (*(buffer + 1) == '+') {
- if (reg_128_43 < 2) {
- printk("write reg 128 + 43 vol + : %ddB -> %ddB\n", (reg_128_43) * 6, (reg_128_43 + 1) * 6);
- reg_128_43++;
- aic3111_write(aic3111_codec, (128 + 43), 0x04 + ((reg_128_43 + 1) << 3));
- } else {
- printk("128 + 43 max vol 12dB\n");
- }
- } else if (*(buffer + 1) == '-') {
- if (reg_128_43 > 0) {
- printk("write reg 128 + 43 vol - : %ddB -> %ddB\n", (reg_128_43) * 6, (reg_128_43 - 1) * 6);
- reg_128_43--;
- aic3111_write(aic3111_codec, (128 + 43), 0x04 + ((reg_128_43 + 1) << 3));
- } else {
- printk("128 + 43 min vol 0dB\n");
- }
- }
- break;
- case 'o':
- aic3111_write(aic3111_codec, (128 + 39), 0x08 + (12 - reg_128_39));
- aic3111_write(aic3111_codec, (128 + 43), 0x04 + ((reg_128_43 + 1) << 3));
- case 'l':
- if (reg_128_39 % 2 == 0)
- printk("reg 128 + 43 vol : %ddB reg 128 + 39 vol : %ddB\n", (reg_128_43) * 6, (reg_128_39 - 12) / 2);
- else
- printk("reg 128 + 43 vol : %ddB reg 128 + 39 vol : -%d.5dB\n", (reg_128_43) * 6, (12 - reg_128_39) / 2);
- break;
- case 's':
- aic3111_power_speaker (POWER_STATE_ON);
- break;
-
- case 'h':
- aic3111_power_headphone (POWER_STATE_ON);
- break;
-
- case 'q':
- aic3111_power_speaker (POWER_STATE_OFF);
- break;
-
- case 'w':
- aic3111_power_headphone (POWER_STATE_OFF);
- break;
-
- case 'a':
- i--;
- gpio_set_value(RK29_PIN6_PB5, GPIO_HIGH);
- //printk("reg[128+39]=0x%x\n",aic3111_read(aic3111_codec,(128 + 39)));
- printk("-db add\n");
- break;
- case 'r':
- i++;
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
- //printk("reg[128+39]=0x%x\n",aic3111_read(aic3111_codec,(128 + 39)));
- printk("-db down\n");
- break;
- case 't':
-
- printk("PB5 = %d\n",gpio_get_value(RK29_PIN6_PB5));
- break;
-
- case 'z':
- j++;
- aic3111_write(aic3111_codec, (66), j);
- printk("DAC db add\n");
- printk("reg[66]=0x%x\n",aic3111_read(aic3111_codec,66));
- break;
- case 'x':
- j--;
- aic3111_write(aic3111_codec, (66), j);
- printk("DAC db down\n");
- printk("reg[66]=0x%x\n",aic3111_read(aic3111_codec,66));
- break;
-
- case 'c':
- j--;
- aic3111_write(aic3111_codec, (63), 0xfc);
- printk("reg[63]=0x%x\n",aic3111_read(aic3111_codec,66));
- break;
-
- case 'n':
- k++;
- if(k==1)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x0e);
- aic3111_write(aic3111_codec, (128 + 41), 0x0e);
- printk("HPR and HPL 1 DB\n",k);
- }
- if(k==2)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x1e);
- aic3111_write(aic3111_codec, (128 + 40), 0x1e);
- printk("HPR and HPL 3 DB\n",k);
- }
- if(k==3)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x2e);
- aic3111_write(aic3111_codec, (128 + 40), 0x2e);
- printk("HPR and HPL 5 DB\n",k);
- }
- break;
-
- case 'm':
- k--;
- if(k==1)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x0e);
- aic3111_write(aic3111_codec, (128 + 41), 0x0e);
- printk("HPR and HPL 1 DB\n",k);
- }
- if(k==2)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x1e);
- aic3111_write(aic3111_codec, (128 + 40), 0x1e);
- printk("HPR and HPL 3 DB\n",k);
- }
- if(k==3)
- {
- aic3111_write(aic3111_codec, (128 + 40), 0x2e);
- aic3111_write(aic3111_codec, (128 + 40), 0x2e);
- printk("HPR and HPL 5 DB\n",k);
- }
- break;
-
-
- default:
- printk("Please press '1' '2' 'o' 'l' !\n");
- break;
- }
- return 0;
-}
-
-static int aic3111_proc_write(struct file *file, const char __user *buffer,
- unsigned long count, void *data)
-{
- if (CheckCommand(buffer) != 0) {
- printk("Write proc error !\n");
- return -1;
- }
-
- return sizeof(buffer);
-}
-static const struct file_operations aic3111_proc_fops = {
- .owner = THIS_MODULE,
- .write = aic3111_proc_write,
-};
-
-static int aic3111_proc_init(void) {
-
- struct proc_dir_entry *aic3111_proc_entry;
- //printk("!!!!!!!!!!!!!!!!!!!!\n");
- aic3111_proc_entry = create_proc_entry("driver/aic3111_ts", 0777, NULL);
-
- if (aic3111_proc_entry != NULL) {
-
- aic3111_proc_entry->write_proc = aic3111_proc_write;
-
- return -1;
- }else {
- printk("create proc error !\n");
- }
-
- return 0;
-}
-#endif
-
struct delayed_work aic3111_speaker_delayed_work;
int speakeronoff;
//aic3111_write(codec, (128 + 32), 0xc6);
//printk("reg 128+32 = %x\n"aic3111_read(codec, (128 + 32)));
isHSin = 0;
- //gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ //gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
aic3111_power_speaker(POWER_STATE_OFF);
- gpio_set_value(RK29_PIN6_PB5, GPIO_HIGH);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_HIGH);
//aic3111_power_headphone(POWER_STATE_ON);
//aic3111_write(codec, (128 + 35), 0x88);
printk("now hp sound\n");
isHSin = 1;
//aic3111_power_headphone(POWER_STATE_OFF);
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
aic3111_power_speaker(POWER_STATE_ON);
aic3111_write(codec, (128 + 35), 0x44);
aic3111_write(codec, (63), 0xfc);
struct speaker_data *spk = (struct speaker_data *)_data;
int new_status;
- if (gpio_get_value(RK29_PIN6_PB6) == 0) {
+ if (gpio_get_value(aic3111_hp_det_gpio) == 0) {
new_status = HP;
isHSin = 0;
//printk("hp now\n");
}
}
- if (gpio_get_value(RK29_PIN6_PB6) == 1) {
+ if (gpio_get_value(aic3111_hp_det_gpio) == 1) {
new_status = SPK;
isHSin = 1;
//printk("speak now\n");
aic3111_codec = codec;
#if 1
- gpio_set_value(RK29_PIN6_PB6,1);
+ gpio_set_value(aic3111_hp_det_gpio,1);
struct speaker_data *spk;
spk = kzalloc(sizeof(struct speaker_data), GFP_KERNEL);
INIT_DELAYED_WORK(&aic3111_speaker_delayed_work, aic3111_speaker_delayed_work_func);
/*********************/
- //pio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ //pio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
//aic3111_power_speaker(POWER_STATE_OFF);
//aic3111_power_headphone(POWER_STATE_ON);
#endif
*/
/* Just Reset codec */
aic3111_soft_reset();
- gpio_set_value(RK29_PIN6_PB5, GPIO_LOW);
+ gpio_set_value(aic3111_spk_ctl_gpio, GPIO_LOW);
msleep(10);
aic3111_write (aic3111_codec, (68), 0x01); //disable DRC
aic3111_write (aic3111_codec, (128 + 31), 0xc4);
aic3111_write (aic3111_codec, (128 + 40), 0x4f); //HPL driver PGA
aic3111_write (aic3111_codec, (128 + 41), 0x4f); //HPR driver PGA
-#ifdef AIC3111_DEBUG
- aic3111_proc_init();
-#endif
-
aic3111_set_bias_level (codec, SND_SOC_BIAS_STANDBY);
return 0;
*
*----------------------------------------------------------------------------
*/
-static int aic3111_suspend (struct snd_soc_codec *codec, pm_message_t state)
+static int aic3111_suspend (struct snd_soc_codec *codec)
{
AIC_DBG ("CODEC::%s\n", __FUNCTION__);
};
MODULE_DEVICE_TABLE(i2c, tlv320aic3111_i2c_id);
+/*
+dts:
+ codec@1a {
+ compatible = "aic3111";
+ reg = <0x1a>;
+ spk-ctl-gpio = <&gpio6 GPIO_B5 GPIO_ACTIVE_HIGH>;
+ hp-det-pio = <&gpio6 GPIO_B6 GPIO_ACTIVE_HIGH>;
+ };
+*/
static int tlv320aic3111_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
aic3111_i2c = i2c;
+#ifdef CONFIG_OF
+ aic3111_spk_ctl_gpio= of_get_named_gpio_flags(i2c->dev.of_node, "spk-ctl-gpio", 0, NULL);
+ if (aic3111_spk_ctl_gpio < 0) {
+ printk("%s() Can not read property spk-ctl-gpio\n", __FUNCTION__);
+ aic3111_spk_ctl_gpio = INVALID_GPIO;
+ }
+
+ aic3111_hp_det_gpio = of_get_named_gpio_flags(i2c->dev.of_node, "hp-det-pio", 0, NULL);
+ if (aic3111_hp_det_gpio < 0) {
+ printk("%s() Can not read property hp-det-pio\n", __FUNCTION__);
+ aic3111_hp_det_gpio = INVALID_GPIO;
+ }
+#endif //#ifdef CONFIG_OF
+
i2c_set_clientdata(i2c, aic3111);
aic3111_privdata = aic3111;
return ret;
}
-static __devexit int tlv320aic3111_i2c_remove(struct i2c_client *client)
+static int tlv320aic3111_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
kfree(i2c_get_clientdata(client));
.owner = THIS_MODULE,
},
.probe = tlv320aic3111_i2c_probe,
- .remove = __devexit_p(tlv320aic3111_i2c_remove),
+ .remove = tlv320aic3111_i2c_remove,
.id_table = tlv320aic3111_i2c_id,
};
module_init (tlv320aic3111_init);
module_exit (tlv320aic3111_exit);
-#ifdef CONFIG_PROC_FS
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-static int proc_3110_reg_show (struct seq_file *s, void *v)
-{
- struct snd_soc_codec *codec = aic3111_codec;
- int reg;
- u8 *cache = codec->reg_cache;
-
- seq_printf (s, "========3110register========\n");
- for (reg = 0; reg < 256; reg++) {
- if (reg == 0) seq_printf (s, "Page 0\n");
- if (reg == 128) seq_printf (s, "\nPage 1\n");
- if (reg%8 == 0 && reg != 0 && reg != 128) seq_printf (s, "\n");
- seq_printf (s, "[%d]0x%02x, ",reg,aic3111_read (codec, reg));
- }
- seq_printf (s, "\n========3110cache========\n");
- for (reg = 0; reg < codec->reg_size; reg++) {
- if (reg == 0) seq_printf (s, "Page 0\n");
- if (reg == 128) seq_printf (s, "\nPage 1\n");
- if (reg%16 == 0 && reg != 0 && reg != 128) seq_printf (s, "\n");
- seq_printf (s, "0x%02x, ",cache[reg]);
- }
- printk ("\n==========================\n");
- return 0;
-}
-
-static int proc_3110_reg_open (struct inode *inode, struct file *file)
-{
- return single_open (file, proc_3110_reg_show, NULL);
-}
-
-static const struct file_operations proc_3110_reg_fops = {
- .open = proc_3110_reg_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int __init codec_proc_init (void)
-{
- proc_create ("aic3110_register", 0, NULL, &proc_3110_reg_fops);
-
- return 0;
-}
-late_initcall (codec_proc_init);
-#endif /* CONFIG_PROC_FS */
-
MODULE_DESCRIPTION (" ASoC TLV320AIC3111 codec driver ");
MODULE_AUTHOR (" Jaz B John <jazbjohn@mistralsolutions.com> ");
MODULE_LICENSE ("GPL");
*
*----------------------------------------------------------------------------
*/
-static int aic3262_suspend(struct snd_soc_codec *codec, pm_message_t state)
+static int aic3262_suspend(struct snd_soc_codec *codec)
{
aic3262_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
*
*/
#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <sound/pcm.h>
#include <sound/soc.h>
{
.name = "RK2928",
.stream_name = "RK2928",
- .cpu_dai_name = "rk_i2s.0",
- .platform_name = "rockchip-audio",
+ .cpu_dai_name = "rockchip-i2s.0",
+ .platform_name = "rockchip-pcm",
.codec_name = "rk2928-codec",
.codec_dai_name = "rk2928-codec",
.ops = &rk2928_dai_ops,
};
/* Audio machine driver */
-static struct snd_soc_card snd_soc_rk2928 = {
+static struct snd_soc_card rockchip_rk2928_snd_card = {
.name = "RK2928",
.dai_link = rk2928_dai,
.num_links = ARRAY_SIZE(rk2928_dai),
};
-static struct platform_device *rk2928_snd_device;
-
-static int __init rk2928_soc_init(void)
+static int rockchip_rk2928_audio_probe(struct platform_device *pdev)
{
int ret;
+ struct snd_soc_card *card = &rockchip_rk2928_snd_card;
- printk(KERN_INFO "RK2928 SoC init\n");
-
- rk2928_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk2928_snd_device) {
- printk(KERN_ERR "Platform device allocation failed\n");
- return -ENOMEM;
- }
+ card->dev = &pdev->dev;
- platform_set_drvdata(rk2928_snd_device, &snd_soc_rk2928);
+ ret = snd_soc_register_card(card);
- ret = platform_device_add(rk2928_snd_device);
if (ret)
- goto err1;
-
- return 0;
-
-err1:
- printk(KERN_ERR "Unable to add platform device\n");
- platform_device_put(rk2928_snd_device);
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
return ret;
}
-module_init(rk2928_soc_init);
-static void __exit rk2928_soc_exit(void)
+static int rockchip_rk2928_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk2928_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_exit(rk2928_soc_exit);
+
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk2928_of_match[] = {
+ { .compatible = "rockchip-rk2928", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk2928_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk2928_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk2928",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk2928_of_match),
+ },
+ .probe = rockchip_rk2928_audio_probe,
+ .remove = rockchip_rk2928_audio_remove,
+};
+
+module_platform_driver(rockchip_rk2928_audio_driver);
MODULE_DESCRIPTION("ALSA SoC RK2928");
MODULE_LICENSE("GPL");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
-#include <mach/gpio.h>
+
#include "../codecs/tlv320aic3111.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "AIC3111",
.stream_name = "AIC3111 PCM",
.codec_name = "AIC3111.0-0018",
- .platform_name = "rockchip-audio",
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ .cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "AIC3111 HiFi",
.init = rk29_aic3111_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_aic3111_snd_card = {
.name = "RK_AIC3111",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_aic3111_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- AIC_DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- AIC_DBG("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- AIC_DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
+ int ret;
+ struct snd_soc_card *card = &rockchip_aic3111_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_aic3111_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_aic3111_of_match[] = {
+ { .compatible = "rockchip-aic3111", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_aic3111_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_aic3111_audio_driver = {
+ .driver = {
+ .name = "rockchip-aic3111",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_aic3111_of_match),
+ },
+ .probe = rockchip_aic3111_audio_probe,
+ .remove = rockchip_aic3111_audio_remove,
+};
+
+module_platform_driver(rockchip_aic3111_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/gpio.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <asm/mach-types.h>
#include <linux/module.h>
#include <linux/device.h>
-#include <asm/io.h>
-#include <mach/hardware.h>
#include "../codecs/wm8994.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "AIC3262 I2S1",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi1",
.ops = &rk29_aif1_ops,
.name = "AIC3262 I2S2",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi2",
.ops = &rk29_aif2_ops,
.name = "AIC3262 I2S3",
.stream_name = "AIC3262 PCM",
.codec_name = "tlv320aic3262-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "aic326x-asi3",
.ops = &rk29_aif3_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_aic3262_snd_card = {
.name = "RK_AIC3262",
.dai_link = rk29_dai,
.num_links = ARRAY_SIZE(rk29_dai),
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_aic3262_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_aic3262_snd_card;
- DBG_AIC3262("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ card->dev = &pdev->dev;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
-
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- // snd_soc_unregister_dai(&rk29_snd_device->dev);
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
- return ret;
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_aic3262_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_aic3262_of_match[] = {
+ { .compatible = "rockchip-aic3262", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_aic3262_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_aic3262_audio_driver = {
+ .driver = {
+ .name = "rockchip-aic3262",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_aic3262_of_match),
+ },
+ .probe = rockchip_aic3262_audio_probe,
+ .remove = rockchip_aic3262_audio_remove,
+};
+
+module_platform_driver(rockchip_aic3262_audio_driver);
/* Module information */
MODULE_AUTHOR("rockchip");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "rk_pcm.h"
#include "rk29_i2s.h"
-#include <mach/gpio.h>
-
#if 1
#define DBG(x...) printk(KERN_INFO x)
#else
.name = "AK4396",
.stream_name = "AK4396 PCM",
.codec_name = "spi1.0",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "AK4396 HiFi",
.init = rk29_ak4396_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_ak4396_snd_card = {
.name = "RK_AK4396",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_ak4396_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
-
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
-
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
+ int ret;
+ struct snd_soc_card *card = &rockchip_ak4396_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_ak4396_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);;
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_ak4396_of_match[] = {
+ { .compatible = "rockchip-ak4396", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_ak4396_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_ak4396_audio_driver = {
+ .driver = {
+ .name = "rockchip-ak4396",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_ak4396_of_match),
+ },
+ .probe = rockchip_ak4396_audio_probe,
+ .remove = rockchip_ak4396_audio_remove,
+};
+
+module_platform_driver(rockchip_ak4396_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
#include <linux/clk.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
+
#include "../codecs/cs42l52.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
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;
+ struct snd_soc_dai *codec_dai = rtd->codec_dai;
+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
unsigned int pll_out = 0;
unsigned int lrclk = 0;
int div_bclk,div_mclk;
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
+ ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); //by Vincent
}
else
{
static int rk29_cs42l52_dai_init(struct snd_soc_codec *codec)
{
- struct snd_soc_dai *codec_dai = &codec->dai[0];
- int ret;
+ struct snd_soc_dapm_context *dapm = &codec->dapm;
- snd_soc_dapm_nc_pin(codec, "INPUT1A");
- snd_soc_dapm_nc_pin(codec, "INPUT2A");
- snd_soc_dapm_nc_pin(codec, "INPUT3A");
- snd_soc_dapm_nc_pin(codec, "INPUT4A");
- snd_soc_dapm_nc_pin(codec, "INPUT1B");
- snd_soc_dapm_nc_pin(codec, "INPUT2B");
- snd_soc_dapm_nc_pin(codec, "INPUT3B");
- snd_soc_dapm_nc_pin(codec, "INPUT4B");
- snd_soc_dapm_nc_pin(codec, "MICB");
- snd_soc_dapm_sync(codec);
+ snd_soc_dapm_nc_pin(dapm, "INPUT1A");
+ snd_soc_dapm_nc_pin(dapm, "INPUT2A");
+ snd_soc_dapm_nc_pin(dapm, "INPUT3A");
+ snd_soc_dapm_nc_pin(dapm, "INPUT4A");
+ snd_soc_dapm_nc_pin(dapm, "INPUT1B");
+ snd_soc_dapm_nc_pin(dapm, "INPUT2B");
+ snd_soc_dapm_nc_pin(dapm, "INPUT3B");
+ snd_soc_dapm_nc_pin(dapm, "INPUT4B");
+ snd_soc_dapm_nc_pin(dapm, "MICB");
+ snd_soc_dapm_sync(dapm);
return 0;
}
};
static struct snd_soc_dai_link rk29_cs42l52_dai_link = {
- .name = "CS42L52",
- .stream_name = "CS42L52 PCM",
- .cpu_dai = &rk29_i2s_dai[0],
- .codec_dai = &soc_cs42l52_dai,
- .init = rk29_cs42l52_dai_init,
- .ops = &rk29_cs42l52_ops,
+ .name = "CS42L52",
+ .stream_name = "CS42L52 PCM",
+ .codec_name = "cs42l52.0-004a",
+ .platform_name = "rockchip-pcm",
+#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
+ .cpu_dai_name = "rockchip-i2s.0",
+#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
+ .cpu_dai_name = "rockchip-i2s.1",
+#else
+ .cpu_dai_name = "rockchip-i2s.2",
+#endif
+ .codec_dai_name = "cs42l52-hifi",
+ .init = rk29_cs42l52_dai_init,
+ .ops = &rk29_cs42l52_ops,
};
-static struct snd_soc_card snd_soc_card_rk29_cs42l52 = {
+static struct snd_soc_card rockchip_cs42l52_snd_card = {
.name = "RK_CS42L52",
- .platform = &rk29_soc_platform,
.dai_link = &rk29_cs42l52_dai_link,
.num_links = 1,
};
+static int rockchip_cs42l52_audio_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct snd_soc_card *card = &rockchip_cs42l52_snd_card;
+
+ card->dev = &pdev->dev;
-static struct snd_soc_device rk29_cs42l52_snd_devdata = {
- .card = &snd_soc_card_rk29_cs42l52,
- .codec_dev = &soc_codec_dev_cs42l52,
-};
+ ret = snd_soc_register_card(card);
-static struct platform_device *rk29_cs42l52_snd_device;
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
-static int rk29_cs42l52_probe(struct platform_device *pdev)
-{
- int ret =0;
- printk("RK CS42L52 SoC Audio driver\n");
- rk29_cs42l52_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_cs42l52_snd_device) {
- ret = -ENOMEM;
- printk("%s:platform device alloc fail\n",__FUNCTION__);
- return ret;
- }
- platform_set_drvdata(rk29_cs42l52_snd_device, &rk29_cs42l52_snd_devdata);
- rk29_cs42l52_snd_devdata.dev = &rk29_cs42l52_snd_device->dev;
- ret = platform_device_add(rk29_cs42l52_snd_device);
- if (ret) {
- platform_device_put(rk29_cs42l52_snd_device);
- printk("%s:platform device add fail,ret = %d\n",__FUNCTION__,ret);
- }
return ret;
}
-static int rk29_cs42l52_remove(struct platform_device *pdev)
+static int rockchip_cs42l52_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_cs42l52_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
return 0;
}
-static struct platform_driver rk29_cs42l52_driver = {
- .probe = rk29_cs42l52_probe,
- .remove = rk29_cs42l52_remove,
- .driver = {
- .name = "rk29_cs42l52",
- .owner = THIS_MODULE,
- },
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_cs42l52_of_match[] = {
+ { .compatible = "rockchip-cs42l52", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_cs42l52_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_cs42l52_audio_driver = {
+ .driver = {
+ .name = "rockchip-cs42l52",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_cs42l52_of_match),
+ },
+ .probe = rockchip_cs42l52_audio_probe,
+ .remove = rockchip_cs42l52_audio_remove,
};
-static int __init rk29_cs42l52_init(void)
-{
- return platform_driver_register(&rk29_cs42l52_driver);
-}
-
-static void __exit rk29_cs42l52_exit(void)
-{
- platform_driver_unregister(&rk29_cs42l52_driver);
-}
+module_platform_driver(rockchip_cs42l52_audio_driver);
-module_init(rk29_cs42l52_init);
-module_exit(rk29_cs42l52_exit);
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
MODULE_LICENSE("GPL");
*/
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 <sound/jack.h>
#include <linux/delay.h>
#include "rk_pcm.h"
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
- DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
+ DBG("rk29_hw_params_cx2070x:failed to set the sysclk for codec side\n");
return ret;
}
#endif
{ /* Primary DAI i/f */
.name = "CX2070X AIF1",
.stream_name = "CX2070X PCM",
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
.codec_dai_name = "cx2070x-hifi",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
.codec_name = "cx2070x.0-0014",
.init = cx2070x_init,
.ops = &rk29_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_cx2070x_snd_card = {
.name = "RK_CX2070X",
.dai_link = rk29_dai,
.num_links = ARRAY_SIZE(rk29_dai),
};
-static int __init audio_card_init(void)
+static int rockchip_cx2070x_audio_probe(struct platform_device *pdev)
{
int ret;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device)
- return -ENOMEM;
+ struct snd_soc_card *card = &rockchip_cx2070x_snd_card;
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
- ret = platform_device_add(rk29_snd_device);
- printk(">>>>>>>>>>%s ret = %d",__FUNCTION__, ret);
if (ret)
- platform_device_put(rk29_snd_device);
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
return ret;
}
-module_init(audio_card_init);
-static void __exit audio_card_exit(void)
+static int rockchip_cx2070x_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_exit(audio_card_exit);
+
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_cx2070x_of_match[] = {
+ { .compatible = "rockchip-cx2070x", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_cx2070x_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_cx2070x_audio_driver = {
+ .driver = {
+ .name = "rockchip-cx2070x",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_cx2070x_of_match),
+ },
+ .probe = rockchip_cx2070x_audio_probe,
+ .remove = rockchip_cx2070x_audio_remove,
+};
+
+module_platform_driver(rockchip_cx2070x_audio_driver);
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
MODULE_AUTHOR("showy.zhang <showy.zhang@rock-chips.com>");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
-//#include <linux/tchip_sysinf.h>
+
#include "../codecs/es8323.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
-#include <mach/gpio.h>
#ifdef CONFIG_MACH_RK_FAC
#include <plat/config.h>
extern int codec_type;
static struct snd_soc_dai_link rk29_dai = {
.name = "ES8323",
.stream_name = "ES8323 PCM",
- .codec_name = "ES8323.4-0010", // ES8323.0-0010
- .platform_name = "rockchip-audio",
+ .codec_name = "ES8323.0-0010", // ES8323.0-0010
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1", //Ó²¼þÉÏÊǽӵ½IIS0ÉÏ£¬µ«ÊÇÓÉÓÚxxÔÒò£¬Õâ±ß¶¨ÒåΪIIS1ÉÏ
+ .cpu_dai_name = "rockchip-i2s.1", //Ó²¼þÉÏÊǽӵ½IIS0ÉÏ£¬µ«ÊÇÓÉÓÚxxÔÒò£¬Õâ±ß¶¨ÒåΪIIS1ÉÏ
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "ES8323 HiFi",
.init = rk29_es8323_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_es8323_snd_card = {
.name = "RK_ES8323",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_es8323_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-#ifdef CONFIG_MACH_RK_FAC
- if(codec_type!=CODEC_TYPE_ES8323)
- return -1;
-#endif
- DBG("ES8323 audio_card_init\n");
-#if 0
- extern int get_sound_card_exist() ;
- extern void set_sound_card_exist(int i) ;
- extern int i2c0_prober_verify(u32 dev_addr, u16 reg, u32 reg_addr_len, u32 reg_val_len, u32 id);
- if(i2c0_prober_verify(0x10, 0x35, 1, 1, 0x0000) != 0) {
- printk("%s(): Ping error with 0x1a\n", __FUNCTION__);
- return -ENODEV;
- }
- else
- printk("%s(): Ping OK with 0x1a\n", __FUNCTION__);
-#endif
-//leaf if(0 == tcsi_get_value(TCSI_CODEC_ES8323))
-//leaf2012-7-26 return;
- DBG("XXXXEnter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- DBG("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
+ int ret;
+ struct snd_soc_card *card = &rockchip_es8323_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit audio_card_exit(void)
+
+static int rockchip_es8323_audio_remove(struct platform_device *pdev)
{
-//leaf 2012-7-26 if(0 == tcsi_get_value(TCSI_CODEC_ES8323))
-//leaf 2012-7-26 return;
- platform_device_unregister(rk29_snd_device);
- //rk29_speaker_deinit(rk29_speaker);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_es8323_of_match[] = {
+ { .compatible = "rockchip-es8323", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_es8323_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_es8323_audio_driver = {
+ .driver = {
+ .name = "rockchip-es8323",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_es8323_of_match),
+ },
+ .probe = rockchip_es8323_audio_probe,
+ .remove = rockchip_es8323_audio_remove,
+};
+
+module_platform_driver(rockchip_es8323_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
* Author: chenjq <chenjq@rock-chips.com>
*/
-#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
#include <sound/soc.h>
-#include <mach/iomux.h>
+#include <sound/soc-dapm.h>
#include "rk_pcm.h"
#include "rk29_i2s.h"
#define DBG(x...) do { } while (0)
#endif
-
static int hdmi_i2s_hifi_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
.name = "HDMI I2S",
.stream_name = "HDMI PCM",
.codec_name = "hdmi-i2s",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk-hdmi-i2s-hifi",
.ops = &hdmi_i2s_hifi_ops,
};
-static struct snd_soc_card snd_soc_card_hdmi_i2s = {
+static struct snd_soc_card rockchip_hdmi_i2s_snd_card = {
.name = "RK-HDMI-I2S",
.dai_link = &hdmi_i2s_dai,
.num_links = 1,
};
-static struct platform_device *hdmi_i2s_snd_device;
-static struct platform_device *hdmi_i2s_device;
-
-static int __init audio_card_init(void)
+static int rockchip_hdmi_i2s_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- hdmi_i2s_device = platform_device_alloc("hdmi-i2s", -1);
-
- if (!hdmi_i2s_device){
- printk("spdif:platform_device_alloc hdmi-i2s\n");
- return -ENOMEM;
- }
+ int ret;
+ struct snd_soc_card *card = &rockchip_hdmi_i2s_snd_card;
- ret = platform_device_add(hdmi_i2s_device);
- if (ret) {
- printk("platform device add hdmi-i2s failed\n");
+ card->dev = &pdev->dev;
- platform_device_put(hdmi_i2s_device);
- return ret;
- }
+ ret = snd_soc_register_card(card);
- hdmi_i2s_snd_device = platform_device_alloc("soc-audio", -3);
- if (!hdmi_i2s_snd_device) {
- printk("platform device allocation failed\n");
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- platform_device_put(hdmi_i2s_device);
- return -ENOMEM;
- }
+ return ret;
+}
- platform_set_drvdata(hdmi_i2s_snd_device, &snd_soc_card_hdmi_i2s);
- ret = platform_device_add(hdmi_i2s_snd_device);
- if (ret) {
- printk("platform device add soc-audio failed\n");
+static int rockchip_hdmi_i2s_audio_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
- platform_device_put(hdmi_i2s_device);
- platform_device_put(hdmi_i2s_snd_device);
- return ret;
- }
+ snd_soc_unregister_card(card);
- return ret;
+ return 0;
}
-static void __exit audio_card_exit(void)
-{
- platform_device_unregister(hdmi_i2s_snd_device);
-}
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_hdmi_i2s_of_match[] = {
+ { .compatible = "rockchip-hdmi-i2s", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_hdmi_i2s_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_hdmi_i2s_audio_driver = {
+ .driver = {
+ .name = "rockchip-hdmi-i2s",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_hdmi_i2s_of_match),
+ },
+ .probe = rockchip_hdmi_i2s_audio_probe,
+ .remove = rockchip_hdmi_i2s_audio_remove,
+};
+
+module_platform_driver(rockchip_hdmi_i2s_audio_driver);
-late_initcall(audio_card_init);
-module_exit(audio_card_exit);
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP hdmi i2s ASoC Interface");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL");
\ No newline at end of file
*
*/
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include <linux/clk.h>
-
+#include <sound/core.h>
+#include <sound/pcm.h>
#include <sound/soc.h>
-
-#include <mach/iomux.h>
+#include <sound/soc-dapm.h>
#if 0
#define RK_SPDIF_DBG(x...) printk(KERN_INFO "rk_hdmi_spdif:"x)
static struct snd_soc_dai_link rk_dai = {
.name = "SPDIF",
.stream_name = "SPDIF PCM Playback",
- .platform_name = "rockchip-audio",
- .cpu_dai_name = "rk-spdif",
- .codec_dai_name = "dit-hifi",
- .codec_name = "spdif-dit",
+ .platform_name = "rockchip-pcm",
+ .cpu_dai_name = "rockchip-spdif",
+ .codec_dai_name = "rk-hdmi-spdif-hifi",
+ .codec_name = "hdmi-spdif",
.ops = &rk_spdif_ops,
};
-static struct snd_soc_card rk_spdif = {
+static struct snd_soc_card rockchip_hdmi_spdif_snd_card = {
.name = "ROCKCHIP-SPDIF",
.dai_link = &rk_dai,
.num_links = 1,
};
-static struct platform_device *rk_snd_spdif_dit_device;
-static struct platform_device *rk_snd_spdif_device;
-
-static int __init rk_spdif_init(void)
+static int rockchip_hdmi_spdif_audio_probe(struct platform_device *pdev)
{
int ret;
-
- RK_SPDIF_DBG("Entered %s\n", __func__);
-
- rk_snd_spdif_dit_device = platform_device_alloc("spdif-dit", -1);
- if (!rk_snd_spdif_dit_device){
- printk("spdif:platform_device_alloc spdif-dit\n");
- return -ENOMEM;
- }
+ struct snd_soc_card *card = &rockchip_hdmi_spdif_snd_card;
- ret = platform_device_add(rk_snd_spdif_dit_device);
- if (ret)
- goto err1;
-
- rk_snd_spdif_device = platform_device_alloc("soc-audio", -3);
- if (!rk_snd_spdif_device) {
- printk("spdif:platform_device_alloc rk_soc-audio\n");
- ret = -ENOMEM;
- goto err2;
- }
-
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
- platform_set_drvdata(rk_snd_spdif_device, &rk_spdif);
-#else
- platform_set_drvdata(rk_snd_spdif_device, &rk_spdif);
- rk_spdif.dev = &rk_snd_spdif_device->dev;
-#endif
+ card->dev = &pdev->dev;
- //platform_set_drvdata(rk_snd_spdif_device, &rk_spdif);
+ ret = snd_soc_register_card(card);
- ret = platform_device_add(rk_snd_spdif_device);
if (ret)
- goto err3;
-
- RK_SPDIF_DBG("rk_spdif_init ok\n");
- return ret;
-err3:
- platform_device_put(rk_snd_spdif_device);
-err2:
- platform_device_del(rk_snd_spdif_dit_device);
-err1:
- platform_device_put(rk_snd_spdif_dit_device);
-
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit rk_spdif_exit(void)
+static int rockchip_hdmi_spdif_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk_snd_spdif_device);
- platform_device_unregister(rk_snd_spdif_dit_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-//using late_initcall to make sure spdif is after board codec. added by zxg.
-//module_init(rk_spdif_init);
-late_initcall(rk_spdif_init);
-module_exit(rk_spdif_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_hdmi_spdif_of_match[] = {
+ { .compatible = "rockchip-hdmi-spdif"},
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_hdmi_spdif_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_hdmi_spdif_audio_driver = {
+ .driver = {
+ .name = "rockchip-hdmi-spdif",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_hdmi_spdif_of_match),
+ },
+ .probe = rockchip_hdmi_spdif_audio_probe,
+ .remove = rockchip_hdmi_spdif_audio_remove,
+};
+
+module_platform_driver(rockchip_hdmi_spdif_audio_driver);
MODULE_AUTHOR("hzb, <hzb@rock-chips.com>");
MODULE_DESCRIPTION("ALSA SoC RK+S/PDIF");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rk610_codec.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
#else
.codec_name = "RK610_CODEC.0-0060",
#endif
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rk610_codec",
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rk610_snd_card = {
.name = "RK_RK610",
.dai_link = &rk29_dai,
.num_links = 1,
};
+static int rockchip_rk610_audio_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct snd_soc_card *card = &rockchip_rk610_snd_card;
-static struct platform_device *rk29_snd_device;
+ card->dev = &pdev->dev;
-static int __init audio_card_init(void)
-{
- int ret =0;
-#ifdef CONFIG_MACH_RK_FAC
- if(codec_type!=CODEC_TYPE_RK616)
- return -1;
-#endif
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("[%s] platform device allocation failed\n", __FUNCTION__);
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
return ret;
}
-static void __exit audio_card_exit(void)
+
+static int rockchip_rk610_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk610_of_match[] = {
+ { .compatible = "rockchip-rk610", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk610_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk610_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk610",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk610_of_match),
+ },
+ .probe = rockchip_rk610_audio_probe,
+ .remove = rockchip_rk610_audio_remove,
+};
+
+module_platform_driver(rockchip_rk610_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rk1000_codec.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
{
.name = "RK1000",
.stream_name = "RK1000 CODEC PCM",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
.codec_name = "RK1000_CODEC.0-0060",
.codec_dai_name = "rk1000_codec",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.init = rk29_rk1000_codec_init,
.ops = &rk29_ops,
}
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rk1000_snd_card = {
.name = "RK_RK1000",
.dai_link = rk29_dai,
.num_links = 1,
};
+static int rockchip_rk1000_audio_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct snd_soc_card *card = &rockchip_rk1000_snd_card;
-static struct platform_device *rk29_snd_device;
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
-static int __init audio_card_init(void)
-{
- int ret =0;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
-
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
- printk("audio_card_init end....\n");
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rk1000_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk1000_of_match[] = {
+ { .compatible = "rockchip-rk1000", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk1000_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk1000_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk1000",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk1000_of_match),
+ },
+ .probe = rockchip_rk1000_audio_probe,
+ .remove = rockchip_rk1000_audio_remove,
+};
+
+module_platform_driver(rockchip_rk1000_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rk3026_codec.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "RK3026 I2S1",
.stream_name = "RK3026 PCM",
.codec_name = "rk3026-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3026-hifi",
.init = rk3026_init,
.name = "RK3026 I2S2",
.stream_name = "RK3026 PCM",
.codec_name = "rk3026-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk3026-voice",
.ops = &rk3026_voice_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk = {
+static struct snd_soc_card rockchip_rk3026_snd_card = {
.name = "RK_RK3026",
.dai_link = rk_dai,
.num_links = 2,
};
-static struct platform_device *rk_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rk3026_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ int ret;
+ struct snd_soc_card *card = &rockchip_rk3026_snd_card;
- rk_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
+ card->dev = &pdev->dev;
- platform_set_drvdata(rk_snd_device, &snd_soc_card_rk);
- ret = platform_device_add(rk_snd_device);
- if (ret) {
- printk("platform device add failed\n");
+ ret = snd_soc_register_card(card);
- platform_device_put(rk_snd_device);
- return ret;
- }
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- return ret;
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rk3026_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk3026_of_match[] = {
+ { .compatible = "rockchip-rk3026", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk3026_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk3026_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk3026",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk3026_of_match),
+ },
+ .probe = rockchip_rk3026_audio_probe,
+ .remove = rockchip_rk3026_audio_remove,
+};
+
+module_platform_driver(rockchip_rk3026_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rk3190_codec.h"
#include "rk29_pcm.h"
#include "rk29_i2s.h"
.name = "RK3190 I2S1",
.stream_name = "RK3190 PCM",
.codec_name = "rk3190-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK29_SOC_I2S_8CH)
.cpu_dai_name = "rk29_i2s.0",
#elif defined(CONFIG_SND_RK29_SOC_I2S_2CH)
.name = "RK3190 I2S2",
.stream_name = "RK3190 PCM",
.codec_name = "rk3190-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK29_SOC_I2S_8CH)
.cpu_dai_name = "rk29_i2s.0",
#elif defined(CONFIG_SND_RK29_SOC_I2S_2CH)
},
};
-static struct snd_soc_card snd_soc_card_rk = {
+static struct snd_soc_card rockchip_rk3190_snd_card = {
.name = "RK_RK3190",
.dai_link = rk_dai,
.num_links = 2,
};
-static struct platform_device *rk_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rk3190_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_rk3190_snd_card;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ card->dev = &pdev->dev;
- rk_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
+ ret = snd_soc_register_card(card);
- platform_set_drvdata(rk_snd_device, &snd_soc_card_rk);
- ret = platform_device_add(rk_snd_device);
- if (ret) {
- printk("platform device add failed\n");
-
- platform_device_put(rk_snd_device);
- return ret;
- }
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- return ret;
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rk3190_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk3190_of_match[] = {
+ { .compatible = "rockchip-rk3190", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk3190_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk3190_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk3190",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk3190_of_match),
+ },
+ .probe = rockchip_rk3190_audio_probe,
+ .remove = rockchip_rk3190_audio_remove,
+};
+
+module_platform_driver(rockchip_rk3190_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rk616_codec.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "RK616 I2S1",
.stream_name = "RK616 PCM",
.codec_name = "rk616-codec.4-0050",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk616-hifi",
.init = rk616_init,
.name = "RK616 I2S2",
.stream_name = "RK616 PCM",
.codec_name = "rk616-codec.4-0050",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rk616-voice",
.ops = &rk616_voice_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk = {
+static struct snd_soc_card rockchip_rk616_snd_card = {
.name = "RK_RK616",
.dai_link = rk_dai,
.num_links = 2,
};
-static struct platform_device *rk_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rk616_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ int ret;
+ struct snd_soc_card *card = &rockchip_rk616_snd_card;
- rk_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
+ card->dev = &pdev->dev;
- platform_set_drvdata(rk_snd_device, &snd_soc_card_rk);
- ret = platform_device_add(rk_snd_device);
- if (ret) {
- printk("platform device add failed\n");
+ ret = snd_soc_register_card(card);
- platform_device_put(rk_snd_device);
- return ret;
- }
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- return ret;
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rk616_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rk616_of_match[] = {
+ { .compatible = "rockchip-rk616", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rk616_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rk616_audio_driver = {
+ .driver = {
+ .name = "rockchip-rk616",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rk616_of_match),
+ },
+ .probe = rockchip_rk616_audio_probe,
+ .remove = rockchip_rk616_audio_remove,
+};
+
+module_platform_driver(rockchip_rk616_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <asm/io.h>
-#include <mach/hardware.h>
+#include <linux/of.h>
+#include <linux/of_gpio.h>
#include "../codecs/rt3261.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
-
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
#define DBG(x...)
#endif
-static int rk29_hw_params(struct snd_pcm_substream *substream,
+static int rockchip_rt3261_hifi_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
return 0;
}
-static int rt3261_voice_hw_params(struct snd_pcm_substream *substream,
+static int rockchip_rt3261_voice_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
return 0;
}
-static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = {
+static const struct snd_soc_dapm_widget rockchip_rt3261_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_MIC("Headset Jack", NULL),
SND_SOC_DAPM_SPK("Ext Spk", NULL),
{"Headphone Jack", NULL, "HPOR"},
} ;
-static const struct snd_kcontrol_new rk_controls[] = {
+static const struct snd_kcontrol_new rockchip_rt3261_controls[] = {
SOC_DAPM_PIN_SWITCH("Mic Jack"),
SOC_DAPM_PIN_SWITCH("Headset Jack"),
SOC_DAPM_PIN_SWITCH("Ext Spk"),
/*
* Logic for a rt3261 as connected on a rockchip board.
*/
-static int rk29_rt3261_init(struct snd_soc_pcm_runtime *rtd)
+static int rockchip_rt3261_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- snd_soc_add_codec_controls(codec, rk_controls,
- ARRAY_SIZE(rk_controls));
+ snd_soc_add_codec_controls(codec, rockchip_rt3261_controls,
+ ARRAY_SIZE(rockchip_rt3261_controls));
/* Add specific widgets */
- snd_soc_dapm_new_controls(dapm, rt3261_dapm_widgets,
- ARRAY_SIZE(rt3261_dapm_widgets));
+ snd_soc_dapm_new_controls(dapm, rockchip_rt3261_dapm_widgets,
+ ARRAY_SIZE(rockchip_rt3261_dapm_widgets));
/* Set up specific audio path audio_mapnects */
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
extern int hdmi_is_insert(void);
extern void codec_set_spk(bool on);
if(hdmi_is_insert())
- codec_set_spk(false);
+ rt3261_codec_set_spk(false);
#endif
#ifdef CONFIG_HDMI_RK30
extern int hdmi_get_hotplug(void);
if(hdmi_get_hotplug() == 2/*HDMI_HPD_ACTIVED*/)
- codec_set_spk(false);
+ rt3261_codec_set_spk(false);
#endif
snd_soc_dapm_sync(dapm);
return 0;
}
-static struct snd_soc_ops rk29_ops = {
- .hw_params = rk29_hw_params,
+static struct snd_soc_ops rockchip_rt3261_hifi_ops = {
+ .hw_params = rockchip_rt3261_hifi_hw_params,
};
-static struct snd_soc_ops rt3261_voice_ops = {
- .hw_params = rt3261_voice_hw_params,
+static struct snd_soc_ops rockchip_rt3261_voice_ops = {
+ .hw_params = rockchip_rt3261_voice_hw_params,
};
-static struct snd_soc_dai_link rk29_dai[] = {
+static struct snd_soc_dai_link rockchip_rt3261_dai[] = {
{
.name = "RT3261 I2S1",
.stream_name = "RT3261 PCM",
.codec_name = "rt3261.0-001c",
- .platform_name = "rockchip-audio",
- #if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ #if defined(CONFIG_SND_RK_SOC_I2S_8CH)
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt3261-aif1",
- .init = rk29_rt3261_init,
- .ops = &rk29_ops,
+ .init = rockchip_rt3261_init,
+ .ops = &rockchip_rt3261_hifi_ops,
},
{
.name = "RT3261 I2S2",
.stream_name = "RT3261 PCM",
.codec_name = "rt3261.0-001c",
- .platform_name = "rockchip-audio",
- #if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ #if defined(CONFIG_SND_RK_SOC_I2S_8CH)
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt3261-aif2",
- .ops = &rt3261_voice_ops,
+ .ops = &rockchip_rt3261_voice_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
- .name = "RK_RT3261",
- .dai_link = rk29_dai,
- .num_links = 2,
+static struct snd_soc_card rockchip_rt3261_snd_card = {
+ #if defined (CONFIG_SND_SOC_RT3224)
+ .name = "ROCKCHIP-RT3224",
+ #else
+ .name = "ROCKCHIP-RT3261",
+ #endif
+ .owner = THIS_MODULE,
+ .dai_link = rockchip_rt3261_dai,
+ .num_links = ARRAY_SIZE(rockchip_rt3261_dai),
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt3261_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt3261_snd_card;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ card->dev = &pdev->dev;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
+ ret = snd_soc_register_card(card);
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
- return ret;
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt3261_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt3261_of_match[] = {
+ { .compatible = "rockchip-rt3261", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt3261_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt3261_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt3261",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt3261_of_match),
+ },
+ .probe = rockchip_rt3261_audio_probe,
+ .remove = rockchip_rt3261_audio_remove,
+};
+
+module_platform_driver(rockchip_rt3261_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
*/
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 <sound/jack.h>
#include <linux/delay.h>
#include "rk_pcm.h"
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
- DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
+ DBG("rk29_hw_params_rt5512:failed to set the sysclk for codec side\n");
return ret;
}
{ /* Primary DAI i/f */
.name = "RT5512 AIF1",
.stream_name = "RT5512 PCM",
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
.codec_dai_name = "RT5512-aif1",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
.codec_name = "rt5512.1-0018",
.init = rt5512_init,
.ops = &rk29_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rt5512_snd_card = {
.name = "RK_RT5512",
.dai_link = rk29_dai,
.num_links = ARRAY_SIZE(rk29_dai),
};
-static int __init audio_card_init(void)
+static int rockchip_rt5512_audio_probe(struct platform_device *pdev)
{
int ret;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device)
- return -ENOMEM;
+ struct snd_soc_card *card = &rockchip_rt5512_snd_card;
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
- ret = platform_device_add(rk29_snd_device);
if (ret)
- platform_device_put(rk29_snd_device);
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
return ret;
}
-module_init(audio_card_init);
-static void __exit audio_card_exit(void)
+static int rockchip_rt5512_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_exit(audio_card_exit);
+
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5512_of_match[] = {
+ { .compatible = "rockchip-rt5512", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5512_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5512_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5512",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5512_of_match),
+ },
+ .probe = rockchip_rt5512_audio_probe,
+ .remove = rockchip_rt5512_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5512_audio_driver);
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
MODULE_AUTHOR("cy_huang <cy_huang@richtek.com>");
/*
- * rk29_rt5631.c -- SoC audio for rockchip
+ * rk29_rt5616.c -- SoC audio for rockchip
*
- * Driver for rockchip rt5631 audio
+ * Driver for rockchip rt5616 audio
*
* 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
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rt5631.h"
+
+#include "../codecs/rt5616.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
#if defined (CONFIG_SND_RK_CODEC_SOC_SLAVE)
#if 0 //use pll from blck
- /*Set the pll of rt5631,the Pll source from BITCLK on CPU is master mode*/
+ /*Set the pll of rt5616,the Pll source from BITCLK on CPU is master mode*/
//bitclk is 64fs
ret=snd_soc_dai_set_pll(codec_dai,0,params_rate(params)*64,pll_out);
if (ret < 0)
{
- DBG("rk29_hw_params_rt5631:failed to set the pll for codec side\n");
+ DBG("rk29_hw_params_rt5616:failed to set the pll for codec side\n");
return ret;
}
#endif
ret=snd_soc_dai_set_sysclk(codec_dai, 0,pll_out,SND_SOC_CLOCK_IN);
if (ret < 0)
{
- DBG("rk29_hw_params_rt5631:failed to set the sysclk for codec side\n");
+ DBG("rk29_hw_params_rt5616:failed to set the sysclk for codec side\n");
return ret;
}
#endif
return 0;
}
-static const struct snd_soc_dapm_widget rt5631_dapm_widgets[] = {
+static const struct snd_soc_dapm_widget rt5616_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_SPK("Ext Spk", NULL),
} ;
/*
- * Logic for a rt5631 as connected on a rockchip board.
+ * Logic for a rt5616 as connected on a rockchip board.
*/
-static int rk29_rt5631_init(struct snd_soc_pcm_runtime *rtd)
+static int rk29_rt5616_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/* Add specific widgets */
- snd_soc_dapm_new_controls(dapm, rt5631_dapm_widgets,
- ARRAY_SIZE(rt5631_dapm_widgets));
+ snd_soc_dapm_new_controls(dapm, rt5616_dapm_widgets,
+ ARRAY_SIZE(rt5616_dapm_widgets));
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
/* Set up specific audio path audio_mapnects */
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
static struct snd_soc_dai_link rk29_dai = {
.name = "rt5616",
.stream_name = "rt5616 PCM",
- .codec_name = "rt5616.4-001b",
- .platform_name = "rockchip-audio",
+ .codec_name = "rt5616.0-001b",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rt5616-aif1",
- .init = rk29_rt5631_init,
+ .init = rk29_rt5616_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rt5616_snd_card = {
.name = "RK_RT5616",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt5616_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt5616_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt5616_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5616_of_match[] = {
+ { .compatible = "rockchip-rt5616", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5616_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5616_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5616",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5616_of_match),
+ },
+ .probe = rockchip_rt5616_audio_probe,
+ .remove = rockchip_rt5616_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5616_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
+
#include "../codecs/rt5621.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "RT5621",
.stream_name = "RT5621 PCM",
.codec_name = "RT5621.0-001a",
- .platform_name = "rockchip-audio",
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ .cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "RT5621 HiFi",
.init = rk29_rt5621_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rt5621_snd_card = {
.name = "RK_RT5621",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt5621_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- //rk29_speaker = rk29_speaker_init(RK29_PIN6_PB6, GPIO_HIGH, 2, (200*1000*1000));
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- DBG("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- return ret;
- }
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt5621_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt5621_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5621_of_match[] = {
+ { .compatible = "rockchip-rt5621", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5621_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5621_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5621",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5621_of_match),
+ },
+ .probe = rockchip_rt5621_audio_probe,
+ .remove = rockchip_rt5621_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5621_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
\r
#include <linux/module.h>\r
#include <linux/device.h>\r
+#include <linux/of.h>\r
+#include <linux/of_gpio.h>\r
#include <sound/core.h>\r
#include <sound/pcm.h>\r
#include <sound/soc.h>\r
#include <sound/soc-dapm.h>\r
-#include <asm/io.h>\r
-#include <mach/hardware.h>\r
-#include <mach/rk29_iomap.h>\r
+\r
#include "../codecs/rt5625.h"\r
#include "rk_pcm.h"\r
#include "rk29_i2s.h"\r
.name = "RT5625 I2S1",\r
.stream_name = "RT5625 PCM",\r
.codec_name = "rt5625.0-001f",\r
- .platform_name = "rockchip-audio",\r
- .cpu_dai_name = "rk_i2s.0",\r
+ .platform_name = "rockchip-pcm",\r
+ .cpu_dai_name = "rockchip-i2s.0",\r
.codec_dai_name = "rt5625-aif1",\r
.ops = &rk29_ops,\r
},\r
.name = "RT5625 I2S2",\r
.stream_name = "RT5625 PCM",\r
.codec_name = "rt5625.0-001f",\r
- .platform_name = "rockchip-audio",\r
- .cpu_dai_name = "rk_i2s.0",\r
+ .platform_name = "rockchip-pcm",\r
+ .cpu_dai_name = "rockchip-i2s.0",\r
.codec_dai_name = "rt5625-aif2",\r
.ops = &rt5625_voice_ops,\r
},\r
};\r
\r
-static struct snd_soc_card snd_soc_card_rk29 = {\r
+static struct snd_soc_card rockchip_rt5625_snd_card = {\r
.name = "RK_RT5625",\r
.dai_link = rk29_dai,\r
.num_links = 2,\r
};\r
\r
-static struct platform_device *rk29_snd_device;\r
-\r
-static int __init audio_card_init(void)\r
+static int rockchip_rt5625_audio_probe(struct platform_device *pdev)\r
{\r
- int ret =0;\r
+ int ret;\r
+ struct snd_soc_card *card = &rockchip_rt5625_snd_card;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);\r
+ card->dev = &pdev->dev;\r
\r
- rk29_snd_device = platform_device_alloc("soc-audio", -1);\r
- if (!rk29_snd_device) {\r
- printk("platform device allocation failed\n");\r
- return -ENOMEM;\r
- }\r
+ ret = snd_soc_register_card(card);\r
\r
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);\r
- ret = platform_device_add(rk29_snd_device);\r
- if (ret) {\r
- printk("platform device add failed\n");\r
+ if (ret)\r
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);\r
\r
- platform_device_put(rk29_snd_device);\r
- return ret;\r
- }\r
- \r
- return ret;\r
+ return ret;\r
}\r
\r
-static void __exit audio_card_exit(void)\r
+static int rockchip_rt5625_audio_remove(struct platform_device *pdev)\r
{\r
- platform_device_unregister(rk29_snd_device);\r
+ struct snd_soc_card *card = platform_get_drvdata(pdev);\r
+\r
+ snd_soc_unregister_card(card);\r
+\r
+ return 0;\r
}\r
\r
-module_init(audio_card_init);\r
-module_exit(audio_card_exit);\r
+#ifdef CONFIG_OF\r
+static const struct of_device_id rockchip_rt5625_of_match[] = {\r
+ { .compatible = "rockchip-rt5625", },\r
+ {},\r
+};\r
+MODULE_DEVICE_TABLE(of, rockchip_rt5625_of_match);\r
+#endif /* CONFIG_OF */\r
+\r
+static struct platform_driver rockchip_rt5625_audio_driver = {\r
+ .driver = {\r
+ .name = "rockchip-rt5625",\r
+ .owner = THIS_MODULE,\r
+ .of_match_table = of_match_ptr(rockchip_rt5625_of_match),\r
+ },\r
+ .probe = rockchip_rt5625_audio_probe,\r
+ .remove = rockchip_rt5625_audio_remove,\r
+};\r
+\r
+module_platform_driver(rockchip_rt5625_audio_driver);\r
+\r
/* Module information */\r
MODULE_AUTHOR("rockchip");\r
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");\r
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rt5631.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
};
static struct snd_soc_dai_link rk29_dai = {
- .name = "RT5631",
- .stream_name = "RT5631 PCM",
- .codec_name = "RT5631.0-001a",
- .platform_name = "rockchip-audio",
+ .name = "rt5631",
+ .stream_name = "rt5631 PCM",
+ .codec_name = "rt5631.0-001a",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
- .codec_dai_name = "RT5631 HiFi",
+ .codec_dai_name = "rt5631-hifi",
.init = rk29_rt5631_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
- .name = "RK_RT5631",
+static struct snd_soc_card rockchip_rt5631_snd_card = {
+ .name = "RK_rt5631",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt5631_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt5631_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
-#ifdef CONFIG_MACH_RK_FAC
- if(codec_type!=CODEC_TYPE_RT5631)
- return -1;
-#endif
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt5631_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5631_of_match[] = {
+ { .compatible = "rockchip-rt5631", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5631_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5631_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5631",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5631_of_match),
+ },
+ .probe = rockchip_rt5631_audio_probe,
+ .remove = rockchip_rt5631_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5631_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rt5631_phone.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "RT5631 hifi",
.stream_name = "RT5631 hifi stream",
.codec_name = "RT5631.0-001a",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "RT5631 HiFi",
.init = rk29_rt5631_init,
.name = "RT5631 voice",
.stream_name = "RT5631 voice stream",
.codec_name = "RT5631.0-001a",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#else
- .cpu_dai_name = "rk_i2s.2",
+ .cpu_dai_name = "rockchip-i2s.2",
#endif
.codec_dai_name = "rt5631-voice",
.ops = &rk29_ops_voice,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rt5631_snd_card = {
.name = "RK_RT5631",
.dai_link = rk29_dai,
.num_links = 2,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt5631_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt5631_snd_card;
+
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt5631_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5631_of_match[] = {
+ { .compatible = "rockchip-rt5631-phone", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5631_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5631_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5631-phone",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5631_of_match),
+ },
+ .probe = rockchip_rt5631_audio_probe,
+ .remove = rockchip_rt5631_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5631_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
\r
#include <linux/module.h>\r
#include <linux/device.h>\r
+#include <linux/of.h>\r
+#include <linux/of_gpio.h>\r
#include <sound/core.h>\r
#include <sound/pcm.h>\r
#include <sound/soc.h>\r
#include <sound/soc-dapm.h>\r
-#include <asm/io.h>\r
-#include <mach/hardware.h>\r
\r
-#include "../codecs/rt3261.h"\r
+#include "../codecs/rt5639.h"\r
#include "rk_pcm.h"\r
#include "rk29_i2s.h"\r
\r
return 0;\r
}\r
\r
-static int rt3261_voice_hw_params(struct snd_pcm_substream *substream,\r
+static int rt5639_voice_hw_params(struct snd_pcm_substream *substream,\r
struct snd_pcm_hw_params *params)\r
{\r
struct snd_soc_pcm_runtime *rtd = substream->private_data;\r
};\r
\r
static struct snd_soc_ops rt5639_voice_ops = {\r
- .hw_params = rt3261_voice_hw_params,\r
+ .hw_params = rt5639_voice_hw_params,\r
};\r
\r
static struct snd_soc_dai_link rk29_dai[] = {\r
.name = "RT5639 I2S1",\r
.stream_name = "RT5639 PCM",\r
.codec_name = "rt5639.0-001c",\r
- .platform_name = "rockchip-audio",\r
- .cpu_dai_name = "rk_i2s.0",\r
+ .platform_name = "rockchip-pcm",\r
+ .cpu_dai_name = "rockchip-i2s.0",\r
.codec_dai_name = "rt5639-aif1",\r
.ops = &rk29_ops,\r
},\r
.name = "RT5639 I2S2",\r
.stream_name = "RT5639 PCM",\r
.codec_name = "rt5639.0-001c",\r
- .platform_name = "rockchip-audio",\r
- .cpu_dai_name = "rk_i2s.0",\r
+ .platform_name = "rockchip-pcm",\r
+ .cpu_dai_name = "rockchip-i2s.0",\r
.codec_dai_name = "rt5639-aif2",\r
.ops = &rt5639_voice_ops,\r
},\r
};\r
\r
-static struct snd_soc_card snd_soc_card_rk29 = {\r
+static struct snd_soc_card rockchip_rt5639_snd_card = {\r
.name = "RK_RT5639",\r
.dai_link = rk29_dai,\r
.num_links = 2,\r
};\r
\r
-static struct platform_device *rk29_snd_device;\r
-\r
-static int __init audio_card_init(void)\r
+static int rockchip_rt5639_audio_probe(struct platform_device *pdev)\r
{\r
- int ret =0;\r
+ int ret;\r
+ struct snd_soc_card *card = &rockchip_rt5639_snd_card;\r
\r
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);\r
+ card->dev = &pdev->dev;\r
\r
- rk29_snd_device = platform_device_alloc("soc-audio", -1);\r
- if (!rk29_snd_device) {\r
- printk("platform device allocation failed\n");\r
- return -ENOMEM;\r
- }\r
+ ret = snd_soc_register_card(card);\r
\r
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);\r
- ret = platform_device_add(rk29_snd_device);\r
- if (ret) {\r
- printk("platform device add failed\n");\r
+ if (ret)\r
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);\r
\r
- platform_device_put(rk29_snd_device);\r
- return ret;\r
- }\r
- \r
- return ret;\r
+ return ret;\r
}\r
\r
-static void __exit audio_card_exit(void)\r
+static int rockchip_rt5639_audio_remove(struct platform_device *pdev)\r
{\r
- platform_device_unregister(rk29_snd_device);\r
+ struct snd_soc_card *card = platform_get_drvdata(pdev);\r
+\r
+ snd_soc_unregister_card(card);\r
+\r
+ return 0;\r
}\r
\r
-module_init(audio_card_init); \r
-module_exit(audio_card_exit);\r
+#ifdef CONFIG_OF\r
+static const struct of_device_id rockchip_rt5639_of_match[] = {\r
+ { .compatible = "rockchip-rt5639", },\r
+ {},\r
+};\r
+MODULE_DEVICE_TABLE(of, rockchip_rt5639_of_match);\r
+#endif /* CONFIG_OF */\r
+\r
+static struct platform_driver rockchip_rt5639_audio_driver = {\r
+ .driver = {\r
+ .name = "rockchip-rt5639",\r
+ .owner = THIS_MODULE,\r
+ .of_match_table = of_match_ptr(rockchip_rt5639_of_match),\r
+ },\r
+ .probe = rockchip_rt5639_audio_probe,\r
+ .remove = rockchip_rt5639_audio_remove,\r
+};\r
+\r
+module_platform_driver(rockchip_rt5639_audio_driver);\r
+\r
/* Module information */\r
MODULE_AUTHOR("rockchip");\r
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");\r
/*
- * rk29_rt3261.c -- SoC audio for rockchip
+ * rk29_rt5640.c -- SoC audio for rockchip
*
- * Driver for rockchip rt3261 audio
+ * Driver for rockchip rt5640 audio
*
* 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
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/rt3261.h"
+#include "../codecs/rt5640.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
ret = snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, SND_SOC_CLOCK_IN);
if (ret < 0)
{
- DBG("rk29_hw_params_rt3261:failed to set the sysclk for codec side\n");
+ DBG("rk29_hw_params_rt5640:failed to set the sysclk for codec side\n");
return ret;
}
return 0;
}
-static int rt3261_voice_hw_params(struct snd_pcm_substream *substream,
+static int rt5640_voice_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
DBG("Enter:%s, %d, rate=%d\n", __FUNCTION__, __LINE__, params_rate(params));
/*Set the system clk for codec*/
- snd_soc_dai_set_pll(codec_dai, 0, RT3261_PLL1_S_MCLK, pll_out, 24576000);
+ snd_soc_dai_set_pll(codec_dai, 0, RT5640_PLL1_S_MCLK, pll_out, 24576000);
- ret = snd_soc_dai_set_sysclk(codec_dai, RT3261_SCLK_S_PLL1, 24576000, SND_SOC_CLOCK_IN);
+ ret = snd_soc_dai_set_sysclk(codec_dai, RT5640_SCLK_S_PLL1, 24576000, SND_SOC_CLOCK_IN);
if (ret < 0) {
- printk("rk29_hw_params_rt3261:failed to set the sysclk for codec side\n");
+ printk("rk29_hw_params_rt5640:failed to set the sysclk for codec side\n");
return ret;
}
return 0;
}
-static const struct snd_soc_dapm_widget rt3261_dapm_widgets[] = {
+static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = {
SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_MIC("Headset Jack", NULL),
SND_SOC_DAPM_SPK("Ext Spk", NULL),
};
/*
- * Logic for a rt3261 as connected on a rockchip board.
+ * Logic for a rt5640 as connected on a rockchip board.
*/
-static int rk29_rt3261_init(struct snd_soc_pcm_runtime *rtd)
+static int rk29_rt5640_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_dapm_context *dapm = &codec->dapm;
ARRAY_SIZE(rk_controls));
/* Add specific widgets */
- snd_soc_dapm_new_controls(dapm, rt3261_dapm_widgets,
- ARRAY_SIZE(rt3261_dapm_widgets));
+ snd_soc_dapm_new_controls(dapm, rt5640_dapm_widgets,
+ ARRAY_SIZE(rt5640_dapm_widgets));
/* Set up specific audio path audio_mapnects */
snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
.hw_params = rk29_hw_params,
};
-static struct snd_soc_ops rt3261_voice_ops = {
- .hw_params = rt3261_voice_hw_params,
+static struct snd_soc_ops rt5640_voice_ops = {
+ .hw_params = rt5640_voice_hw_params,
};
static struct snd_soc_dai_link rk29_dai[] = {
.name = "RT5640 I2S1",
.stream_name = "RT5640 PCM",
.codec_name = "rt5640.0-001c",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt5640-aif1",
- .init = rk29_rt3261_init,
+ .init = rk29_rt5640_init,
.ops = &rk29_ops,
},
{
.name = "RT5640 I2S2",
.stream_name = "RT5640 PCM",
.codec_name = "rt5640.0-001c",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "rt5640-aif2",
- .ops = &rt3261_voice_ops,
+ .ops = &rt5640_voice_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_rt5640_snd_card = {
.name = "RK_RT5640",
.dai_link = rk29_dai,
.num_links = 2,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_rt5640_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_rt5640_snd_card;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ card->dev = &pdev->dev;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
+ ret = snd_soc_register_card(card);
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
- return ret;
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_rt5640_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_rt5640_of_match[] = {
+ { .compatible = "rockchip-rt5640", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_rt5640_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_rt5640_audio_driver = {
+ .driver = {
+ .name = "rockchip-rt5640",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_rt5640_of_match),
+ },
+ .probe = rockchip_rt5640_audio_probe,
+ .remove = rockchip_rt5640_audio_remove,
+};
+
+module_platform_driver(rockchip_rt5640_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
+
#include "../codecs/wm8900.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
-#else
- struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
- struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
-#endif
unsigned int pll_out = 0;
int div_bclk,div_mclk;
int ret;
#define HW_PARAMS_FLAG_EQVOL_OFF 0x22
if ((params->flags == HW_PARAMS_FLAG_EQVOL_ON)||(params->flags == HW_PARAMS_FLAG_EQVOL_OFF))
{
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); //by Vincent
-#else
- ret = codec_dai->ops->hw_params(substream, params, codec_dai); //by Vincent
-#endif
+
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
}
else
/*
* Logic for a wm8900 as connected on a rockchip board.
*/
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
static int rk29_wm8900_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_codec *codec = rtd->codec;
return 0;
}
-#else
-static int rk29_wm8900_init(struct snd_soc_codec *codec)
-{
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-
- /* Add specific widgets */
- snd_soc_dapm_new_controls(codec, wm8900_dapm_widgets,
- ARRAY_SIZE(wm8900_dapm_widgets));
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- /* Set up specific audio path audio_mapnects */
- snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- snd_soc_dapm_nc_pin(codec, "HP_L");
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- snd_soc_dapm_nc_pin(codec, "HP_R");
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- snd_soc_dapm_sync(codec);
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- return 0;
-}
-#endif
static struct snd_soc_ops rk29_ops = {
.hw_params = rk29_hw_params,
};
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
static struct snd_soc_dai_link rk29_dai = {
.name = "WM8900",
.stream_name = "WM8900 PCM",
.codec_name = "WM8900.0-001a",
- .platform_name = "rockchip-audio",
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ .cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "WM8900 HiFi",
.init = rk29_wm8900_init,
.ops = &rk29_ops,
};
-#else
-static struct snd_soc_dai_link rk29_dai = {
- .name = "WM8900",
- .stream_name = "WM8900 PCM",
- .cpu_dai = &rk29_i2s_dai[0],
- .codec_dai = &wm8900_dai,
- .init = rk29_wm8900_init,
- .ops = &rk29_ops,
-};
-#endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_wm8900_snd_card = {
.name = "RK_WM8900",
.dai_link = &rk29_dai,
.num_links = 1,
};
-#else
-static struct snd_soc_card snd_soc_card_rk29 = {
- .name = "RK_WM8900",
- .platform = &rk29_soc_platform,
- .dai_link = &rk29_dai,
- .num_links = 1,
-};
+static int rockchip_wm8900_audio_probe(struct platform_device *pdev)
+{
+ int ret;
+ struct snd_soc_card *card = &rockchip_wm8900_snd_card;
-static struct snd_soc_card rk29_snd_devdata = {
- .card = &snd_soc_card_rk29,
- .codec_dev = &soc_codec_dev_wm8900,
-};
-#endif
+ card->dev = &pdev->dev;
-static struct platform_device *rk29_snd_device;
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
-static int __init audio_card_init(void)
-{
- int ret =0;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- DBG("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
-#else
- platform_set_drvdata(rk29_snd_device, &rk29_snd_devdata);
- rk29_snd_devdata.dev = &rk29_snd_device->dev;
-#endif
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- }
return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_wm8900_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_wm8900_of_match[] = {
+ { .compatible = "rockchip-wm8900", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_wm8900_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_wm8900_audio_driver = {
+ .driver = {
+ .name = "rockchip-wm8900",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_wm8900_of_match),
+ },
+ .probe = rockchip_wm8900_audio_probe,
+ .remove = rockchip_wm8900_audio_remove,
+};
+
+module_platform_driver(rockchip_wm8900_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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/rk29_iomap.h>
+
#include "../codecs/wm8988.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
-#include <mach/gpio.h>
-
#if 0
#define DBG(x...) printk(KERN_INFO x)
#else
.name = "WM8988",
.stream_name = "WM8988 PCM",
.codec_name = "WM8988.0-001a",
- .platform_name = "rockchip-audio",
- .cpu_dai_name = "rk_i2s.0",
+ .platform_name = "rockchip-pcm",
+ .cpu_dai_name = "rockchip-i2s.0",
.codec_dai_name = "WM8988 HiFi",
.init = rk29_wm8988_init,
.ops = &rk29_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_wm8988_snd_card = {
.name = "RK_WM8988",
.dai_link = &rk29_dai,
.num_links = 1,
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_wm8988_audio_probe(struct platform_device *pdev)
{
- int ret =0;
-
- //rk29_speaker = rk29_speaker_init(RK29_PIN6_PB6, GPIO_HIGH, 2, (200*1000*1000));
+ int ret;
+ struct snd_soc_card *card = &rockchip_wm8988_snd_card;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- DBG("platform device allocation failed\n");
- ret = -ENOMEM;
- return ret;
- }
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
- return ret;
+ card->dev = &pdev->dev;
+
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
+ return ret;
}
-static void __exit audio_card_exit(void)
+
+static int rockchip_wm8988_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
- //rk29_speaker_deinit(rk29_speaker);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_wm8988_of_match[] = {
+ { .compatible = "rockchip-wm8988", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_wm8988_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_wm8988_audio_driver = {
+ .driver = {
+ .name = "rockchip-wm8988",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_wm8988_of_match),
+ },
+ .probe = rockchip_wm8988_audio_probe,
+ .remove = rockchip_wm8988_audio_remove,
+};
+
+module_platform_driver(rockchip_wm8988_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
#include <linux/module.h>
#include <linux/device.h>
+#include <linux/of.h>
+#include <linux/of_gpio.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 "../codecs/wm8994.h"
#include "rk_pcm.h"
#include "rk29_i2s.h"
.name = "WM8994 I2S1",
.stream_name = "WM8994 PCM",
.codec_name = "wm8994-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "wm8994-aif1",
.ops = &rk29_aif1_ops,
.name = "WM8994 I2S2",
.stream_name = "WM8994 PCM",
.codec_name = "wm8994-codec",
- .platform_name = "rockchip-audio",
+ .platform_name = "rockchip-pcm",
#if defined(CONFIG_SND_RK_SOC_I2S_8CH)
- .cpu_dai_name = "rk_i2s.0",
+ .cpu_dai_name = "rockchip-i2s.0",
#elif defined(CONFIG_SND_RK_SOC_I2S_2CH)
- .cpu_dai_name = "rk_i2s.1",
+ .cpu_dai_name = "rockchip-i2s.1",
#endif
.codec_dai_name = "wm8994-aif2",
.ops = &rk29_aif2_ops,
},
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card rockchip_wm8994_snd_card = {
.name = "RK_WM8994",
.dai_link = rk29_dai,
.num_links = ARRAY_SIZE(rk29_dai),
};
-static struct platform_device *rk29_snd_device;
-
-static int __init audio_card_init(void)
+static int rockchip_wm8994_audio_probe(struct platform_device *pdev)
{
- int ret =0;
+ int ret;
+ struct snd_soc_card *card = &rockchip_wm8994_snd_card;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
+ card->dev = &pdev->dev;
- rk29_snd_device = platform_device_alloc("soc-audio", -1);
- if (!rk29_snd_device) {
- printk("platform device allocation failed\n");
- return -ENOMEM;
- }
-
- platform_set_drvdata(rk29_snd_device, &snd_soc_card_rk29);
- ret = platform_device_add(rk29_snd_device);
- if (ret) {
- printk("platform device add failed\n");
- // snd_soc_unregister_dai(&rk29_snd_device->dev);
- platform_device_put(rk29_snd_device);
- return ret;
- }
-
- return ret;
+ ret = snd_soc_register_card(card);
+
+ if (ret)
+ printk("%s() register card failed:%d\n", __FUNCTION__, ret);
+
+ return ret;
}
-static void __exit audio_card_exit(void)
+static int rockchip_wm8994_audio_remove(struct platform_device *pdev)
{
- platform_device_unregister(rk29_snd_device);
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+ snd_soc_unregister_card(card);
+
+ return 0;
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
+#ifdef CONFIG_OF
+static const struct of_device_id rockchip_wm8994_of_match[] = {
+ { .compatible = "rockchip-wm8994", },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rockchip_wm8994_of_match);
+#endif /* CONFIG_OF */
+
+static struct platform_driver rockchip_wm8994_audio_driver = {
+ .driver = {
+ .name = "rockchip-wm8994",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rockchip_wm8994_of_match),
+ },
+ .probe = rockchip_wm8994_audio_probe,
+ .remove = rockchip_wm8994_audio_remove,
+};
+
+module_platform_driver(rockchip_wm8994_audio_driver);
+
/* Module information */
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");