mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
rk3036 lcdc&tve: fix driver load error.
This commit is contained in:
@@ -155,3 +155,7 @@
|
||||
&lcdc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&tve {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -513,7 +513,7 @@
|
||||
|
||||
lcdc: lcdc@10118000 {
|
||||
compatible = "rockchip,rk3036-lcdc";
|
||||
reg = <0x10118000 0x4000>;
|
||||
reg = <0x10118000 0x200>;
|
||||
interrupts = <GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>;
|
||||
status = "disabled";
|
||||
clocks = <&clk_gates9 6>, <&dclk_lcdc1>, <&clk_gates9 5>;
|
||||
@@ -534,7 +534,7 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
tve {
|
||||
tve: tve{
|
||||
compatible = "rockchip,rk3036-tve";
|
||||
reg = <0x10118200 0x100>;
|
||||
status = "disabled";
|
||||
|
||||
@@ -224,12 +224,12 @@ static int display_resume(struct device *dev)
|
||||
|
||||
void rk_display_device_enable(struct rk_display_device *ddev)
|
||||
{
|
||||
#ifndef CONFIG_DISPLAY_AUTO_SWITCH
|
||||
return;
|
||||
#else
|
||||
//#ifndef CONFIG_DISPLAY_AUTO_SWITCH
|
||||
// return;
|
||||
//#else
|
||||
struct list_head *pos, *head = &display_device_list;
|
||||
struct rk_display_device *dev = NULL, *dev_enabled = NULL, *dev_enable = NULL;
|
||||
int enable = 0,connect, has_connect = 0;
|
||||
int enable = 0,connect;
|
||||
|
||||
list_for_each(pos, head) {
|
||||
dev = list_entry(pos, struct rk_display_device, list);
|
||||
@@ -257,7 +257,7 @@ void rk_display_device_enable(struct rk_display_device *ddev)
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
EXPORT_SYMBOL(rk_display_device_enable);
|
||||
|
||||
|
||||
@@ -1209,9 +1209,8 @@ static struct rk_lcdc_drv_ops lcdc_drv_ops = {
|
||||
|
||||
static int rk3036_lcdc_parse_dt(struct lcdc_device *lcdc_dev)
|
||||
{
|
||||
struct device_node *np = lcdc_dev->dev->of_node;
|
||||
|
||||
#if defined(CONFIG_ROCKCHIP_IOMMU)
|
||||
struct device_node *np = lcdc_dev->dev->of_node;
|
||||
int val;
|
||||
if (of_property_read_u32(np, "rockchip,iommu-enabled", &val))
|
||||
lcdc_dev->driver.iommu_enabled = 0;
|
||||
@@ -1230,7 +1229,7 @@ static int rk3036_lcdc_probe(struct platform_device *pdev)
|
||||
struct device *dev = &pdev->dev;
|
||||
struct resource *res;
|
||||
int ret;
|
||||
|
||||
|
||||
lcdc_dev = devm_kzalloc(dev,
|
||||
sizeof(struct lcdc_device), GFP_KERNEL);
|
||||
if (!lcdc_dev) {
|
||||
@@ -1255,7 +1254,7 @@ static int rk3036_lcdc_probe(struct platform_device *pdev)
|
||||
dev_set_name(lcdc_dev->dev, "lcdc%d", lcdc_dev->id);
|
||||
dev_drv = &lcdc_dev->driver;
|
||||
dev_drv->dev = dev;
|
||||
dev_drv->prop = 0;
|
||||
dev_drv->prop = PRMRY;
|
||||
dev_drv->id = lcdc_dev->id;
|
||||
dev_drv->ops = &lcdc_drv_ops;
|
||||
dev_drv->lcdc_win_num = ARRAY_SIZE(lcdc_win);
|
||||
|
||||
@@ -686,6 +686,7 @@ static int rk_fb_open(struct fb_info *info, int user)
|
||||
int win_id;
|
||||
|
||||
win_id = dev_drv->ops->fb_get_win_id(dev_drv, info->fix.id);
|
||||
dev_drv->win[win_id]->logicalstate++;
|
||||
/* if this win aready opened ,no need to reopen */
|
||||
if (dev_drv->win[win_id]->state)
|
||||
return 0;
|
||||
@@ -714,32 +715,35 @@ static int rk_fb_close(struct fb_info *info, int user)
|
||||
struct rk_lcdc_win *win = NULL;
|
||||
int win_id = dev_drv->ops->fb_get_win_id(dev_drv, info->fix.id);
|
||||
if (win_id >= 0) {
|
||||
win = dev_drv->win[win_id];
|
||||
info->fix.smem_start = win->reserved;
|
||||
|
||||
info->var.xres = dev_drv->screen0->mode.xres;
|
||||
info->var.yres = dev_drv->screen0->mode.yres;
|
||||
info->var.grayscale |=
|
||||
(info->var.xres << 8) + (info->var.yres << 20);
|
||||
info->var.xres_virtual = info->var.xres;
|
||||
info->var.yres_virtual = info->var.yres;
|
||||
dev_drv->win[win_id]->logicalstate--;
|
||||
if(!dev_drv->win[win_id]->logicalstate) {
|
||||
win = dev_drv->win[win_id];
|
||||
info->fix.smem_start = win->reserved;
|
||||
|
||||
info->var.xres = dev_drv->screen0->mode.xres;
|
||||
info->var.yres = dev_drv->screen0->mode.yres;
|
||||
info->var.grayscale |=
|
||||
(info->var.xres << 8) + (info->var.yres << 20);
|
||||
info->var.xres_virtual = info->var.xres;
|
||||
info->var.yres_virtual = info->var.yres;
|
||||
#if defined(CONFIG_LOGO_LINUX_BMP)
|
||||
info->var.bits_per_pixel = 32;
|
||||
info->var.bits_per_pixel = 32;
|
||||
#else
|
||||
info->var.bits_per_pixel = 16;
|
||||
info->var.bits_per_pixel = 16;
|
||||
#endif
|
||||
|
||||
info->fix.line_length =
|
||||
(info->var.xres_virtual) * (info->var.bits_per_pixel >> 3);
|
||||
info->var.width = dev_drv->screen0->width;
|
||||
info->var.height = dev_drv->screen0->height;
|
||||
info->var.pixclock = dev_drv->pixclock;
|
||||
info->var.left_margin = dev_drv->screen0->mode.left_margin;
|
||||
info->var.right_margin = dev_drv->screen0->mode.right_margin;
|
||||
info->var.upper_margin = dev_drv->screen0->mode.upper_margin;
|
||||
info->var.lower_margin = dev_drv->screen0->mode.lower_margin;
|
||||
info->var.vsync_len = dev_drv->screen0->mode.vsync_len;
|
||||
info->var.hsync_len = dev_drv->screen0->mode.hsync_len;
|
||||
|
||||
info->fix.line_length =
|
||||
(info->var.xres_virtual) * (info->var.bits_per_pixel >> 3);
|
||||
info->var.width = dev_drv->screen0->width;
|
||||
info->var.height = dev_drv->screen0->height;
|
||||
info->var.pixclock = dev_drv->pixclock;
|
||||
info->var.left_margin = dev_drv->screen0->mode.left_margin;
|
||||
info->var.right_margin = dev_drv->screen0->mode.right_margin;
|
||||
info->var.upper_margin = dev_drv->screen0->mode.upper_margin;
|
||||
info->var.lower_margin = dev_drv->screen0->mode.lower_margin;
|
||||
info->var.vsync_len = dev_drv->screen0->mode.vsync_len;
|
||||
info->var.hsync_len = dev_drv->screen0->mode.hsync_len;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
config RK3036_TV_ENCODER
|
||||
bool "rk3036 tv encoder support"
|
||||
depends on LCDC_RK3036
|
||||
depends on LCDC_RK3036 && RK_TVENCODER
|
||||
default n
|
||||
help
|
||||
Support RK3036 output CVBS.
|
||||
|
||||
@@ -21,11 +21,18 @@
|
||||
#include <linux/rockchip/iomap.h>
|
||||
#include "rk3036_tve.h"
|
||||
|
||||
#define DEBUG
|
||||
#ifdef DEBUG
|
||||
#define TVEDBG(format, ...) \
|
||||
printk(KERN_INFO "RK3036 TVE: " format "\n", ## __VA_ARGS__)
|
||||
#else
|
||||
#define TVEDBG(format, ...)
|
||||
#endif
|
||||
|
||||
static const struct fb_videomode rk3036_cvbs_mode [] = {
|
||||
/* name refresh xres yres pixclock h_bp h_fp v_bp v_fp h_pw v_pw polariry PorI flag*/
|
||||
{ "NTSC", 60, 720, 480, 27000000, 69, 12, 19, 2, 63, 3, 0, FB_VMODE_INTERLACED, 0},
|
||||
{ "PAL", 50, 720, 576, 27000000, 57, 19, 19, 0, 62, 3, 0, FB_VMODE_INTERLACED, 0},
|
||||
{ "NTSC", 60, 720, 576, 27000000, 57, 19, 19, 0, 62, 3, 0, FB_VMODE_INTERLACED, 0},
|
||||
{ "PAL", 50, 720, 480, 27000000, 69, 12, 19, 2, 63, 3, 0, FB_VMODE_INTERLACED, 0},
|
||||
};
|
||||
|
||||
static struct rk3036_tve *rk3036_tve = NULL;
|
||||
@@ -36,6 +43,9 @@ static struct rk3036_tve *rk3036_tve = NULL;
|
||||
static void dac_enable(bool enable)
|
||||
{
|
||||
u32 mask, val;
|
||||
|
||||
TVEDBG("%s enable %d\n", __FUNCTION__, enable);
|
||||
|
||||
if(enable) {
|
||||
mask = m_VBG_EN | m_DAC_EN;
|
||||
val = mask;
|
||||
@@ -48,6 +58,8 @@ static void dac_enable(bool enable)
|
||||
|
||||
static void tve_set_mode (int mode)
|
||||
{
|
||||
TVEDBG("%s mode %d\n", __FUNCTION__, mode);
|
||||
|
||||
tve_writel(TV_RESET, v_RESET(1));
|
||||
udelay(100);
|
||||
tve_writel(TV_RESET, v_RESET(0));
|
||||
@@ -145,6 +157,7 @@ static int tve_switch_fb(const struct fb_videomode *modedb, int enable)
|
||||
|
||||
static int cvbs_set_enable(struct rk_display_device *device, int enable)
|
||||
{
|
||||
TVEDBG("%s enable %d\n", __FUNCTION__, enable);
|
||||
if(rk3036_tve->enable != enable)
|
||||
{
|
||||
rk3036_tve->enable = enable;
|
||||
@@ -165,16 +178,19 @@ static int cvbs_set_enable(struct rk_display_device *device, int enable)
|
||||
|
||||
static int cvbs_get_enable(struct rk_display_device *device)
|
||||
{
|
||||
TVEDBG("%s enable %d\n", __FUNCTION__, rk3036_tve->enable);
|
||||
return rk3036_tve->enable;
|
||||
}
|
||||
|
||||
static int cvbs_get_status(struct rk_display_device *device)
|
||||
{
|
||||
TVEDBG("%s \n", __FUNCTION__);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int cvbs_get_modelist(struct rk_display_device *device, struct list_head **modelist)
|
||||
{
|
||||
TVEDBG("%s \n", __FUNCTION__);
|
||||
*modelist = &(rk3036_tve->modelist);
|
||||
return 0;
|
||||
}
|
||||
@@ -182,7 +198,7 @@ static int cvbs_get_modelist(struct rk_display_device *device, struct list_head
|
||||
static int cvbs_set_mode(struct rk_display_device *device, struct fb_videomode *mode)
|
||||
{
|
||||
int i;
|
||||
|
||||
TVEDBG("%s \n", __FUNCTION__);
|
||||
for(i = 0; i < ARRAY_SIZE(rk3036_cvbs_mode); i++)
|
||||
{
|
||||
if(fb_mode_is_equal(&rk3036_cvbs_mode[i], mode))
|
||||
@@ -256,7 +272,7 @@ static int rk3036_tve_probe(struct platform_device *pdev)
|
||||
INIT_LIST_HEAD(&(rk3036_tve->modelist));
|
||||
for(i = 0; i < ARRAY_SIZE(rk3036_cvbs_mode); i++)
|
||||
fb_add_videomode(&rk3036_cvbs_mode[i], &(rk3036_tve->modelist));
|
||||
|
||||
rk3036_tve->mode = (struct fb_videomode*)&rk3036_cvbs_mode[1];
|
||||
rk3036_tve->ddev = rk_display_device_register(&display_cvbs, &pdev->dev, NULL);
|
||||
rk_display_device_enable(rk3036_tve->ddev);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user