mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
rk31: add i2s/codec/pwm/backlight support
This commit is contained in:
@@ -148,6 +148,18 @@ static struct platform_device device_fb = {
|
||||
//i2c
|
||||
#ifdef CONFIG_I2C0_RK30
|
||||
static struct i2c_board_info __initdata i2c0_info[] = {
|
||||
#if defined (CONFIG_SND_SOC_RK1000)
|
||||
{
|
||||
.type = "rk1000_i2c_codec",
|
||||
.addr = 0x60,
|
||||
.flags = 0,
|
||||
},
|
||||
{
|
||||
.type = "rk1000_control",
|
||||
.addr = 0x40,
|
||||
.flags = 0,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
#ifdef CONFIG_I2C1_RK30
|
||||
@@ -191,10 +203,73 @@ static void __init rk30_i2c_register_board_info(void)
|
||||
static struct spi_board_info board_spi_devices[] = {
|
||||
};
|
||||
|
||||
/***********************************************************
|
||||
* rk30 backlight
|
||||
************************************************************/
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
#define PWM_ID 1
|
||||
#define PWM_MUX_NAME GPIO0A3_PWM0_NAME
|
||||
#define PWM_MUX_MODE GPIO0A_PWM0
|
||||
#define PWM_MUX_MODE_GPIO GPIO0A_GPIO0A3
|
||||
#define PWM_GPIO RK30_PIN0_PA3
|
||||
#define PWM_EFFECT_VALUE 1
|
||||
|
||||
#define LCD_DISP_ON_PIN
|
||||
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
|
||||
#define BL_EN_PIN RK30_PIN6_PB3
|
||||
#define BL_EN_VALUE GPIO_HIGH
|
||||
#endif
|
||||
static int rk29_backlight_io_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_io_deinit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_suspend(void)
|
||||
{
|
||||
int ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_resume(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct rk29_bl_info rk29_bl_info = {
|
||||
.pwm_id = PWM_ID,
|
||||
.bl_ref = PWM_EFFECT_VALUE,
|
||||
.io_init = rk29_backlight_io_init,
|
||||
.io_deinit = rk29_backlight_io_deinit,
|
||||
.pwm_suspend = rk29_backlight_pwm_suspend,
|
||||
.pwm_resume = rk29_backlight_pwm_resume,
|
||||
};
|
||||
|
||||
static struct platform_device rk29_device_backlight = {
|
||||
.name = "rk29_backlight",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk29_bl_info,
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#if defined(CONFIG_FB_ROCKCHIP)
|
||||
&device_fb,
|
||||
#endif
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
&rk29_device_backlight,
|
||||
#endif
|
||||
};
|
||||
/**************************************************************************************************
|
||||
* SDMMC devices, include the module of SD,MMC,and sdio.noted by xbw at 2012-03-05
|
||||
@@ -384,6 +459,11 @@ static struct clk xin24m = {
|
||||
.rate = 24000000,
|
||||
};
|
||||
|
||||
static struct clk xin12m = {
|
||||
.name = "xin12m",
|
||||
.rate = 12000000,
|
||||
};
|
||||
|
||||
#define CLK(dev, con, ck) \
|
||||
{ \
|
||||
.dev_id = dev, \
|
||||
@@ -413,10 +493,26 @@ static struct clk_lookup clks[] = {
|
||||
CLK("rk_serial.2", "uart", &xin24m),
|
||||
CLK("rk_serial.2", "pclk_uart", &xin24m),
|
||||
|
||||
CLK("rk29_i2s.0", "i2s_div", &xin24m),
|
||||
CLK("rk29_i2s.0", "i2s_frac_div", &xin24m),
|
||||
CLK("rk29_i2s.0", "i2s", &xin24m),
|
||||
CLK("rk29_i2s.0", "hclk_i2s", &xin24m),
|
||||
CLK("rk29_i2s.1", "i2s_div", &xin24m),
|
||||
CLK("rk29_i2s.1", "i2s_frac_div", &xin24m),
|
||||
CLK("rk29_i2s.1", "i2s", &xin12m),
|
||||
CLK("rk29_i2s.1", "hclk_i2s", &xin24m),
|
||||
|
||||
CLK("rk29_sdmmc.0","mmc",&xin24m),
|
||||
CLK("rk29_sdmmc.0","hclk_mmc",&xin24m),
|
||||
CLK("rk29_sdmmc.1","mmc",&xin24m),
|
||||
CLK("rk29_sdmmc.1","hclk_mmc",&xin24m),
|
||||
|
||||
CLK(NULL,"pd_lcdc0",&xin24m),
|
||||
CLK(NULL,"hclk_lcdc0",&xin24m),
|
||||
CLK(NULL,"aclk_lcdc0",&xin24m),
|
||||
CLK(NULL,"dclk_lcdc0",&xin24m),
|
||||
CLK(NULL,"pd_lcdc1",&xin24m),
|
||||
CLK(NULL,"hclk_lcdc1",&xin24m),
|
||||
CLK(NULL,"aclk_lcdc1",&xin24m),
|
||||
CLK(NULL,"dclk_lcdc1",&xin24m),
|
||||
|
||||
CLK(NULL,"pwm01",&xin24m),
|
||||
};
|
||||
|
||||
static void __init rk30_clock_init(void)
|
||||
@@ -451,7 +547,10 @@ EXPORT_SYMBOL(clk_disable);
|
||||
|
||||
unsigned long clk_get_rate(struct clk *clk)
|
||||
{
|
||||
return 24000000;
|
||||
if(clk)
|
||||
return clk->rate;
|
||||
else
|
||||
return 24000000;
|
||||
}
|
||||
EXPORT_SYMBOL(clk_get_rate);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#define RK30_IPP_SIZE SZ_16K
|
||||
#define RK30_RGA_PHYS 0x10114000
|
||||
#define RK30_RGA_SIZE SZ_8K
|
||||
#ifdef CONFIG_ARCH_RK30
|
||||
#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK31)
|
||||
#define RK30_HDMI_PHYS 0x10116000
|
||||
#define RK30_HDMI_SIZE SZ_8K
|
||||
#define RK30_I2S0_8CH_PHYS 0x10118000
|
||||
|
||||
@@ -299,7 +299,7 @@ config BACKLIGHT_RK2818_BL
|
||||
|
||||
config BACKLIGHT_RK29_BL
|
||||
bool "rk backlight driver"
|
||||
depends on BACKLIGHT_CLASS_DEVICE && (ARCH_RK29 || ARCH_RK30)
|
||||
depends on BACKLIGHT_CLASS_DEVICE && (ARCH_RK29 || ARCH_RK30 || ARCH_RK31)
|
||||
default y
|
||||
help
|
||||
rk29 backlight support.
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_RK30)
|
||||
#if defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK31)
|
||||
#define write_pwm_reg(id, addr, val) __raw_writel(val, addr+(RK30_PWM01_BASE+(id>>1)*0x20000)+id*0x10)
|
||||
#define read_pwm_reg(id, addr) __raw_readl(addr+(RK30_PWM01_BASE+(id>>1)*0x20000+id*0x10))
|
||||
#elif defined(CONFIG_ARCH_RK29)
|
||||
@@ -170,6 +170,7 @@ static int rk29_backlight_probe(struct platform_device *pdev)
|
||||
unsigned long pwm_clk_rate;
|
||||
struct backlight_properties props;
|
||||
|
||||
|
||||
if (rk29_bl) {
|
||||
printk(KERN_CRIT "%s: backlight device register has existed \n",
|
||||
__func__);
|
||||
@@ -186,6 +187,7 @@ static int rk29_backlight_probe(struct platform_device *pdev)
|
||||
rk29_bl_info->io_init();
|
||||
}
|
||||
|
||||
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.type = BACKLIGHT_RAW;
|
||||
props.max_brightness = BL_STEP;
|
||||
@@ -196,9 +198,10 @@ static int rk29_backlight_probe(struct platform_device *pdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
#if defined(CONFIG_ARCH_RK29)
|
||||
pwm_clk = clk_get(NULL, "pwm");
|
||||
#elif defined(CONFIG_ARCH_RK30)
|
||||
#elif defined(CONFIG_ARCH_RK30) || defined(CONFIG_ARCH_RK31)
|
||||
if (id == 0 || id == 1)
|
||||
pwm_clk = clk_get(NULL, "pwm01");
|
||||
else if (id == 2 || id == 3)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
config SND_RK29_SOC
|
||||
tristate "SoC Audio for the rockchip RK29/RK30 System-on-Chip"
|
||||
tristate "SoC Audio for the rockchip RK29/RK30/RK31 System-on-Chip"
|
||||
depends on PLAT_RK && SND_SOC
|
||||
help
|
||||
Say Y or M if you want to add support for codecs attached to
|
||||
@@ -12,7 +12,7 @@ config SND_RK29_SOC_I2S
|
||||
config SND_RK29_SOC_I2S_8CH
|
||||
bool "Soc RK29 I2S 8 Channel support(I2S0)"
|
||||
default y
|
||||
depends on SND_RK29_SOC_I2S
|
||||
depends on SND_RK29_SOC_I2S && !ARCH_RK31
|
||||
help
|
||||
This supports the use of the 8 Channel I2S interface on rk29 processors.
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ endif
|
||||
ifdef CONFIG_ARCH_RK2928
|
||||
snd-soc-rockchip-i2s-objs := rk30_i2s.o
|
||||
endif
|
||||
ifdef CONFIG_ARCH_RK31
|
||||
snd-soc-rockchip-i2s-objs := rk30_i2s.o
|
||||
endif
|
||||
snd-soc-rockchip-spdif-objs := rk29_spdif.o
|
||||
|
||||
obj-$(CONFIG_SND_RK29_SOC) += snd-soc-rockchip.o
|
||||
|
||||
@@ -85,7 +85,11 @@ static struct snd_soc_dai_link rk29_dai[] = {
|
||||
.platform_name = "rockchip-audio",
|
||||
.codec_name = "RK1000_CODEC.0-0060",
|
||||
.codec_dai_name = "rk1000_codec",
|
||||
.cpu_dai_name = "rk29_i2s.1",
|
||||
#if defined(CONFIG_SND_RK29_SOC_I2S_8CH)
|
||||
.cpu_dai_name = "rk29_i2s.0",
|
||||
#elif defined(CONFIG_SND_RK29_SOC_I2S_2CH)
|
||||
.cpu_dai_name = "rk29_i2s.1",
|
||||
#endif
|
||||
.init = rk29_rk1000_codec_init,
|
||||
.ops = &rk29_ops,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user