&lcdc {
status = "okay";
};
+
+&tve {
+ status = "okay";
+};
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>;
status = "disabled";
};
- tve {
+ tve: tve{
compatible = "rockchip,rk3036-tve";
reg = <0x10118200 0x100>;
status = "disabled";
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);
}
-#endif
+//#endif
}
EXPORT_SYMBOL(rk_display_device_enable);
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;
struct device *dev = &pdev->dev;
struct resource *res;
int ret;
-
+
lcdc_dev = devm_kzalloc(dev,
sizeof(struct lcdc_device), GFP_KERNEL);
if (!lcdc_dev) {
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);
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;
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;
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.
#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;
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;
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));
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;
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;
}
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))
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);