mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
rk30:add backlight config
This commit is contained in:
@@ -73,6 +73,10 @@ CONFIG_SPI_FPGA_GPIO_NUM=0
|
||||
CONFIG_SPI_FPGA_GPIO_IRQ_NUM=0
|
||||
# CONFIG_HWMON is not set
|
||||
# CONFIG_MFD_SUPPORT is not set
|
||||
CONFIG_BACKLIGHT_LCD_SUPPORT=y
|
||||
# CONFIG_LCD_CLASS_DEVICE is not set
|
||||
CONFIG_BACKLIGHT_CLASS_DEVICE=y
|
||||
# CONFIG_BACKLIGHT_GENERIC is not set
|
||||
# CONFIG_HID_SUPPORT is not set
|
||||
# CONFIG_USB_SUPPORT is not set
|
||||
# CONFIG_CMMB is not set
|
||||
|
||||
@@ -166,8 +166,111 @@ static struct spi_board_info board_spi_devices[] = {
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* rk30 backlight
|
||||
************************************************************/
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
#define PWM_ID 0
|
||||
#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_MUX_NAME GPIOF34_UART3_SEL_NAME
|
||||
//#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
|
||||
|
||||
#define BL_EN_PIN INVALID_GPIO //?
|
||||
#define BL_EN_VALUE GPIO_HIGH
|
||||
#endif
|
||||
static int rk29_backlight_io_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
// rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
|
||||
|
||||
ret = gpio_request(BL_EN_PIN, NULL);
|
||||
if(ret != 0)
|
||||
{
|
||||
gpio_free(BL_EN_PIN);
|
||||
}
|
||||
|
||||
gpio_direction_output(BL_EN_PIN, 0);
|
||||
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_io_deinit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
gpio_free(BL_EN_PIN);
|
||||
#endif
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_suspend(void)
|
||||
{
|
||||
int ret = 0;
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
if (gpio_request(PWM_GPIO, NULL)) {
|
||||
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
gpio_direction_output(PWM_GPIO, GPIO_LOW);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
gpio_direction_output(BL_EN_PIN, 0);
|
||||
gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_resume(void)
|
||||
{
|
||||
gpio_free(PWM_GPIO);
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
msleep(30);
|
||||
gpio_direction_output(BL_EN_PIN, 1);
|
||||
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
struct platform_device rk29_device_backlight = {
|
||||
.name = "rk29_backlight",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk29_bl_info,
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
&rk29_device_backlight,
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
// i2c
|
||||
|
||||
@@ -670,103 +670,6 @@ static void __init rk30_init_spim(void)
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* rk30 backlight
|
||||
************************************************************/
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
#define PWM_ID 0
|
||||
#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_MUX_NAME GPIOF34_UART3_SEL_NAME
|
||||
//#define BL_EN_MUX_MODE IOMUXB_GPIO1_B34
|
||||
|
||||
#define BL_EN_PIN INVALID_GPIO //?
|
||||
#define BL_EN_VALUE GPIO_HIGH
|
||||
#endif
|
||||
static int rk29_backlight_io_init(void)
|
||||
{
|
||||
int ret = 0;
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
// rk30_mux_api_set(BL_EN_MUX_NAME, BL_EN_MUX_MODE);
|
||||
|
||||
ret = gpio_request(BL_EN_PIN, NULL);
|
||||
if(ret != 0)
|
||||
{
|
||||
gpio_free(BL_EN_PIN);
|
||||
}
|
||||
|
||||
gpio_direction_output(BL_EN_PIN, 0);
|
||||
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_io_deinit(void)
|
||||
{
|
||||
int ret = 0;
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
gpio_free(BL_EN_PIN);
|
||||
#endif
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_suspend(void)
|
||||
{
|
||||
int ret = 0;
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
if (gpio_request(PWM_GPIO, NULL)) {
|
||||
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
gpio_direction_output(PWM_GPIO, GPIO_LOW);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
gpio_direction_output(BL_EN_PIN, 0);
|
||||
gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int rk29_backlight_pwm_resume(void)
|
||||
{
|
||||
gpio_free(PWM_GPIO);
|
||||
rk30_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
|
||||
#ifdef LCD_DISP_ON_PIN
|
||||
msleep(30);
|
||||
gpio_direction_output(BL_EN_PIN, 1);
|
||||
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
struct platform_device rk29_device_backlight = {
|
||||
.name = "rk29_backlight",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk29_bl_info,
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MTD_NAND_RK29XX
|
||||
static struct resource resources_nand[] = {
|
||||
{
|
||||
@@ -800,11 +703,7 @@ static int __init rk30_init_devices(void)
|
||||
rk30_init_dma();
|
||||
rk30_init_uart();
|
||||
rk30_init_i2c();
|
||||
rk30_init_spim();
|
||||
|
||||
#ifdef CONFIG_BACKLIGHT_RK29_BL
|
||||
platform_device_register(&rk29_device_backlight);
|
||||
#endif
|
||||
rk30_init_spim();
|
||||
#ifdef CONFIG_MTD_NAND_RK29XX
|
||||
platform_device_register(&device_nand);
|
||||
#endif
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
|
||||
#if defined(CONFIG_ARCH_RK30)
|
||||
#include <mach/io.h>
|
||||
#define write_pwm_reg(id, addr, val) __raw_writel(val, addr+(RK30_PWM01_BASE+(id>>1)*0x20000)+id*10)
|
||||
#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))
|
||||
#else defined(CONFIG_ARCH_RK29)
|
||||
#elif defined(CONFIG_ARCH_RK29)
|
||||
#include <mach/rk29_iomap.h>
|
||||
#define write_pwm_reg(id, addr, val) __raw_writel(val, addr+(RK29_PWM_BASE+id*0x10))
|
||||
#define read_pwm_reg(id, addr) __raw_readl(addr+(RK29_PWM_BASE+id*0x10))
|
||||
|
||||
Reference in New Issue
Block a user