printk(">>>>>> FB_DISPLAY_ON_PIN gpio_request err \n ");
}
}
- else
- {
- ret = gpio_request(TOUCH_SCREEN_DISPLAY_PIN, NULL);
- if(ret != 0)
- {
- gpio_free(TOUCH_SCREEN_DISPLAY_PIN);
- printk(">>>>>> TOUCH_SCREEN_DISPLAY_PIN gpio_request err \n ");
- }
- gpio_direction_output(TOUCH_SCREEN_DISPLAY_PIN, 0);
- gpio_set_value(TOUCH_SCREEN_DISPLAY_PIN, TOUCH_SCREEN_DISPLAY_VALUE);
- }
}
if(fb_setting->disp_on_en)
printk(">>>>>> FB_LCD_STANDBY_PIN gpio_request err \n ");
}
}
- else
- {
- ret = gpio_request(TOUCH_SCREEN_STANDBY_PIN, NULL);
- if(ret != 0)
- {
- gpio_free(TOUCH_SCREEN_STANDBY_PIN);
- printk(">>>>>> TOUCH_SCREEN_STANDBY_PIN gpio_request err \n ");
- }
- gpio_direction_output(TOUCH_SCREEN_STANDBY_PIN, 0);
- gpio_set_value(TOUCH_SCREEN_STANDBY_PIN, TOUCH_SCREEN_STANDBY_VALUE);
- }
}
if(FB_LCD_CABC_EN_PIN != INVALID_GPIO)
};
#endif
-
+#if defined (CONFIG_MPU_SENSORS_MPU3050)
+/*mpu3050*/
+static struct mpu3050_platform_data mpu3050_data = {
+ .int_config = 0x10,
+ //.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
+ //.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
+ .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
+ .level_shifter = 0,
+#if defined (CONFIG_MPU_SENSORS_KXTF9)
+ .accel = {
+#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
+ .get_slave_descr = NULL ,
+#else
+ .get_slave_descr = get_accel_slave_descr ,
+#endif
+ .adapt_num = 0, // The i2c bus to which the mpu device is
+ // connected
+ //.irq = RK29_PIN0_PA3,
+ .bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU
+ .address = 0x0f,
+ //.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
+ //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
+ .orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
+ },
+#endif
+#if defined (CONFIG_MPU_SENSORS_AK8975)
+ .compass = {
+#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
+ .get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
+#else
+ .get_slave_descr = get_compass_slave_descr,
+#endif
+ .adapt_num = 0, // The i2c bus to which the compass device is.
+ // It can be difference with mpu
+ // connected
+ //.irq = RK29_PIN0_PA4,
+ .bus = EXT_SLAVE_BUS_PRIMARY,
+ .address = 0x0d,
+ //.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
+ //.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
+ //.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
+ .orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
+ },
+};
+#endif
+#endif
#if defined (CONFIG_BATTERY_BQ27510)
#define DC_CHECK_PIN RK29_PIN4_PA1
#define LI_LION_BAT_NUM 2
.irq = RK29_PIN0_PA4,
},
#endif
+/*mpu3050*/
+#if defined (CONFIG_MPU_SENSORS_MPU3050)
+ {
+ .type = "mpu3050",
+ .addr = 0x68,
+ .flags = 0,
+ .irq = RK29_PIN5_PA3,
+ .platform_data = &mpu3050_data,
+ },
+#endif
+
#if defined (CONFIG_SND_SOC_CS42L52)
{
.type = "cs42l52",
},
};
#endif
+static struct platform_device rk29_cs42l52_device = {
+ .name = "rk29_cs42l52",
+ .id = -1,
+};
static void __init rk29_board_iomux_init(void)
{
#ifdef CONFIG_LEDS_NEWTON_PWM
&rk29_device_pwm_leds,
#endif
+#ifdef CONFIG_SND_RK29_SOC_CS42L52
+ &rk29_cs42l52_device,
+#endif
};
/*****************************************************************************************
#include "rk29_pcm.h"
#include "rk29_i2s.h"
-#if 0
-#define DBG(x...) printk(KERN_INFO x)
-#else
-#define DBG(x...)
-#endif
+#define HW_PARAMS_FLAG_EQVOL_ON 0x21
+#define HW_PARAMS_FLAG_EQVOL_OFF 0x22
+static const struct snd_soc_dapm_widget cs42l52_dapm_widgets[] = {
+ SND_SOC_DAPM_LINE("Audio Out", NULL),
+ SND_SOC_DAPM_LINE("Line in", NULL),
+ SND_SOC_DAPM_MIC("Micn", NULL),
+ SND_SOC_DAPM_MIC("Micp", NULL),
+};
+
+static const struct snd_soc_dapm_route audio_map[]= {
+
+ {"Audio Out", NULL, "HPA"},
+ {"Audio Out", NULL, "HPB"},
+ {"Line in", NULL, "INPUT1A"},
+ {"Line in", NULL, "INPUT1B"},
+ {"Micn", NULL, "INPUT2A"},
+ {"Micp", NULL, "INPUT2B"},
+};
-static int rk29_hw_params(struct snd_pcm_substream *substream,
+static int rk29_cs42l52_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct clk *general_pll;
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
- /*by Vincent Hsiung for EQ Vol Change*/
- #define HW_PARAMS_FLAG_EQVOL_ON 0x21
- #define HW_PARAMS_FLAG_EQVOL_OFF 0x22
if ((params->flags == HW_PARAMS_FLAG_EQVOL_ON)||(params->flags == HW_PARAMS_FLAG_EQVOL_OFF))
{
ret = codec_dai->ops->hw_params(substream, params, codec_dai); //by Vincent
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
}
else
{
/* set codec DAI configuration */
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
+ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
#endif
#if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER)
- ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
+ ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
#endif
if (ret < 0)
return ret;
/* set cpu DAI configuration */
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
- ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
+ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
#endif
#if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER)
- ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
- SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
-
+ ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
#endif
if (ret < 0)
return ret;
}
- DBG("Enter:%s, rate=%d\n",__FUNCTION__,params_rate(params));
switch(params_rate(params)) {
case 8000:
pll_out = 11289600;
break;
default:
- DBG("Enter:%s, Error rate=%d\n",__FUNCTION__,params_rate(params));
return -EINVAL;
break;
}
- //pll_out = 12000000;
-
- #if defined (CONFIG_SND_RK29_CODEC_SOC_MASTER)
- pll_out = 11289600;
- snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, 0);
- snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
- #endif
-
#if defined (CONFIG_SND_RK29_CODEC_SOC_SLAVE)
general_pll=clk_get(NULL, "general_pll");
if(clk_get_rate(general_pll)>260000000)
div_bclk=(pll_out)/params_rate(params)-1;
div_mclk=0;
}
- DBG("func is%s,gpll=%ld,pll_out=%ld,div_mclk=%ld,div_bclk=%ld\n",
- __FUNCTION__,clk_get_rate(general_pll),pll_out,div_mclk,div_bclk);
//snd_soc_dai_set_sysclk(codec_dai, 0, pll_out, 0);
snd_soc_dai_set_sysclk(cpu_dai, 0, pll_out, 0);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_BCLK,div_bclk);
snd_soc_dai_set_clkdiv(cpu_dai, ROCKCHIP_DIV_MCLK, div_mclk);
- DBG("Enter:%s, LRCK=%d\n",__FUNCTION__,(pll_out/4)/params_rate(params));
#endif
return 0;
}
-static const struct snd_soc_dapm_widget cs42l52_dapm_widgets[] = {
- SND_SOC_DAPM_LINE("Audio Out", NULL),
- SND_SOC_DAPM_LINE("Line in", NULL),
- SND_SOC_DAPM_MIC("Micn", NULL),
- SND_SOC_DAPM_MIC("Micp", NULL),
-};
-
-static const struct snd_soc_dapm_route audio_map[]= {
-
- {"Audio Out", NULL, "HPA"},
- {"Audio Out", NULL, "HPB"},
- {"Line in", NULL, "INPUT1A"},
- {"Line in", NULL, "INPUT1B"},
- {"Micn", NULL, "INPUT2A"},
- {"Micp", NULL, "INPUT2B"},
-};
-
-/*
- * Logic for a cs42l52 as connected on a rockchip board.
- */
-static int rk29_cs42l52_init(struct snd_soc_codec *codec)
+static int rk29_cs42l52_dai_init(struct snd_soc_codec *codec)
{
struct snd_soc_dai *codec_dai = &codec->dai[0];
int ret;
- DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
-#if 0
- /* Add specific widgets */
- snd_soc_dapm_new_controls(codec, cs42l52_dapm_widgets,
- ARRAY_SIZE(cs42l52_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));
-#endif
-
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);
-
- return 0;
+ snd_soc_dapm_sync(codec);
+ return 0;
}
-static struct snd_soc_ops rk29_ops = {
- .hw_params = rk29_hw_params,
+static struct snd_soc_ops rk29_cs42l52_ops = {
+ .hw_params = rk29_cs42l52_hw_params,
};
-static struct snd_soc_dai_link rk29_dai = {
+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_init,
- .ops = &rk29_ops,
+ .init = rk29_cs42l52_dai_init,
+ .ops = &rk29_cs42l52_ops,
};
-static struct snd_soc_card snd_soc_card_rk29 = {
+static struct snd_soc_card snd_soc_card_rk29_cs42l52 = {
.name = "RK29_CS42L52",
.platform = &rk29_soc_platform,
- .dai_link = &rk29_dai,
+ .dai_link = &rk29_cs42l52_dai_link,
.num_links = 1,
};
-static struct snd_soc_device rk29_snd_devdata = {
- .card = &snd_soc_card_rk29,
+static struct snd_soc_device rk29_cs42l52_snd_devdata = {
+ .card = &snd_soc_card_rk29_cs42l52,
.codec_dev = &soc_codec_dev_cs42l52,
};
-static struct platform_device *rk29_snd_device;
+static struct platform_device *rk29_cs42l52_snd_device;
-static int __init audio_card_init(void)
+static int rk29_cs42l52_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) {
- DBG("platform device allocation failed\n");
+ printk("RK29 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_snd_device, &rk29_snd_devdata);
- rk29_snd_devdata.dev = &rk29_snd_device->dev;
- ret = platform_device_add(rk29_snd_device);
+ 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) {
- DBG("platform device add failed\n");
- platform_device_put(rk29_snd_device);
+ platform_device_put(rk29_cs42l52_snd_device);
+ printk("%s:platform device add fail,ret = %d\n",__FUNCTION__,ret);
}
return ret;
}
-static void __exit audio_card_exit(void)
+static int rk29_cs42l52_remove(struct platform_device *pdev)
+{
+ platform_device_unregister(rk29_cs42l52_snd_device);
+ return 0;
+}
+
+static struct platform_driver rk29_cs42l52_driver = {
+ .probe = rk29_cs42l52_probe,
+ .remove = rk29_cs42l52_remove,
+ .driver = {
+ .name = "rk29_cs42l52",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init rk29_cs42l52_init(void)
{
- platform_device_unregister(rk29_snd_device);
+ return platform_driver_register(&rk29_cs42l52_driver);
}
-module_init(audio_card_init);
-module_exit(audio_card_exit);
-/* Module information */
+static void __exit rk29_cs42l52_exit(void)
+{
+ platform_driver_unregister(&rk29_cs42l52_driver);
+}
+
+module_init(rk29_cs42l52_init);
+module_exit(rk29_cs42l52_exit);
MODULE_AUTHOR("rockchip");
MODULE_DESCRIPTION("ROCKCHIP i2s ASoC Interface");
MODULE_LICENSE("GPL");
+