Commit a5555708 authored by 吴智聪(John Wu)'s avatar 吴智聪(John Wu)

Merge branch 'neuros' of...

Merge branch 'neuros' of ssh://git@git.neuros.com.cn/git/git-pub/osd20/linux-davinci-2.6 into neuros
parents 7312bff3 7e81604f
...@@ -836,7 +836,18 @@ CONFIG_NEUROS_IR_BLASTER=m ...@@ -836,7 +836,18 @@ CONFIG_NEUROS_IR_BLASTER=m
# Multifunction device drivers # Multifunction device drivers
# #
# CONFIG_MFD_SM501 is not set # CONFIG_MFD_SM501 is not set
# CONFIG_NEW_LEDS is not set CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
#
# LED drivers
#
CONFIG_LEDS_GPIO=y
#
# LED Triggers
#
# CONFIG_LEDS_TRIGGERS is not set
# #
# Multimedia devices # Multimedia devices
......
...@@ -37,6 +37,12 @@ ...@@ -37,6 +37,12 @@
#include <video/davincifb.h> #include <video/davincifb.h>
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
#include <asm/arch/mux.h>
#include <asm/arch/gpio.h>
#include <linux/leds.h>
#endif
/* other misc. init functions */ /* other misc. init functions */
void __init davinci_psc_init(void); void __init davinci_psc_init(void);
void __init davinci_irq_init(void); void __init davinci_irq_init(void);
...@@ -246,6 +252,31 @@ static struct platform_device rtc_dev = { ...@@ -246,6 +252,31 @@ static struct platform_device rtc_dev = {
.id = -1, .id = -1,
}; };
/*
* LEDS
*/
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
struct gpio_led leds[] = {
{ .name = "led1_green", .gpio = GPIO(10) },
{ .name = "led1_red", .gpio = GPIO(11) },
{ .name = "led2_green", .gpio = GPIO(12) },
{ .name = "led2_red", .gpio = GPIO(13) },
};
static struct gpio_led_platform_data leds_data = {
.num_leds = ARRAY_SIZE(leds),
.leds = (void *)leds,
};
static struct platform_device leds_dev = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &leds_data,
},
};
#endif
static struct platform_device *ntosd_644xa_devices[] __initdata = { static struct platform_device *ntosd_644xa_devices[] __initdata = {
&ntosd_644xa_norflash_device, &ntosd_644xa_norflash_device,
#if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE) #if defined(CONFIG_MTD_NAND_DAVINCI) || defined(CONFIG_MTD_NAND_DAVINCI_MODULE)
...@@ -259,6 +290,9 @@ defined(CONFIG_FB_DM) || defined(CONFIG_FB_DM_MODULE) ...@@ -259,6 +290,9 @@ defined(CONFIG_FB_DM) || defined(CONFIG_FB_DM_MODULE)
&usb_dev, &usb_dev,
#endif #endif
&rtc_dev, &rtc_dev,
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
&leds_dev,
#endif
}; };
static void __init static void __init
...@@ -280,6 +314,14 @@ static __init void ntosd_644xa_init(void) ...@@ -280,6 +314,14 @@ static __init void ntosd_644xa_init(void)
ARRAY_SIZE(ntosd_644xa_devices)); ARRAY_SIZE(ntosd_644xa_devices));
setup_usb(); setup_usb();
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
davinci_mux_peripheral(DAVINCI_MUX_AEAW0, 0);
davinci_mux_peripheral(DAVINCI_MUX_AEAW1, 0);
davinci_mux_peripheral(DAVINCI_MUX_AEAW2, 0);
davinci_mux_peripheral(DAVINCI_MUX_AEAW3, 0);
davinci_mux_peripheral(DAVINCI_MUX_AEAW4, 0);
davinci_mux_peripheral(DAVINCI_MUX_VLYNQEN, 0);
#endif
} }
static __init void ntosd_644xa_irq_init(void) static __init void ntosd_644xa_irq_init(void)
......
...@@ -501,7 +501,7 @@ static void __devinit nand_davinci_flash_init(void) ...@@ -501,7 +501,7 @@ static void __devinit nand_davinci_flash_init(void)
/* Disable HPI and ATA mux */ /* Disable HPI and ATA mux */
davinci_mux_peripheral(DAVINCI_MUX_HPIEN, 0); davinci_mux_peripheral(DAVINCI_MUX_HPIEN, 0);
davinci_mux_peripheral(DAVINCI_MUX_ATAEN, 0); davinci_mux_peripheral(DAVINCI_MUX_ATAEN, 0);
#ifndef CONFIG_MACH_NTOSD_644XA
/* Enable VLYNQ and AEAW */ /* Enable VLYNQ and AEAW */
davinci_mux_peripheral(DAVINCI_MUX_AEAW0, 1); davinci_mux_peripheral(DAVINCI_MUX_AEAW0, 1);
davinci_mux_peripheral(DAVINCI_MUX_AEAW1, 1); davinci_mux_peripheral(DAVINCI_MUX_AEAW1, 1);
...@@ -510,7 +510,7 @@ static void __devinit nand_davinci_flash_init(void) ...@@ -510,7 +510,7 @@ static void __devinit nand_davinci_flash_init(void)
davinci_mux_peripheral(DAVINCI_MUX_AEAW4, 1); davinci_mux_peripheral(DAVINCI_MUX_AEAW4, 1);
davinci_mux_peripheral(DAVINCI_MUX_VLSCREN, 1); davinci_mux_peripheral(DAVINCI_MUX_VLSCREN, 1);
davinci_mux_peripheral(DAVINCI_MUX_VLYNQEN, 1); davinci_mux_peripheral(DAVINCI_MUX_VLYNQEN, 1);
#endif
regval = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + PINMUX0); regval = davinci_readl(DAVINCI_SYSTEM_MODULE_BASE + PINMUX0);
printk(KERN_WARNING "Warning: MUX config for NAND: Set " \ printk(KERN_WARNING "Warning: MUX config for NAND: Set " \
......
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
static int ths8200_attach_adapter(struct i2c_adapter *adapter); static int ths8200_attach_adapter(struct i2c_adapter *adapter);
static int ths8200_detach_client(struct i2c_client *client); static int ths8200_detach_client(struct i2c_client *client);
static int ths8200_detect_client(struct i2c_adapter *adapter, static int ths8200_detect_client(struct i2c_adapter *adapter, int address, int kind);
int address, int kind);
static inline int ths8200_write_value(u8 reg, u8 value); static inline int ths8200_write_value(u8 reg, u8 value);
static inline int ths8200_read_value(u8 reg); static inline int ths8200_read_value(u8 reg);
...@@ -56,8 +55,7 @@ static struct i2c_driver ths8200_driver = { ...@@ -56,8 +55,7 @@ static struct i2c_driver ths8200_driver = {
}; };
/* I2C Addresses to scan */ /* I2C Addresses to scan */
static unsigned short normal_i2c[] = { 0x20, \ static unsigned short normal_i2c[] = { 0x20, I2C_CLIENT_END };
I2C_CLIENT_END};
/* This makes all addr_data:s */ /* This makes all addr_data:s */
I2C_CLIENT_INSMOD; I2C_CLIENT_INSMOD;
...@@ -74,8 +72,7 @@ static inline int ths8200_write_value(u8 reg, u8 value) ...@@ -74,8 +72,7 @@ static inline int ths8200_write_value(u8 reg, u8 value)
{ {
int ret; int ret;
ret = i2c_smbus_write_byte_data(ths8200_client, ret = i2c_smbus_write_byte_data(ths8200_client, reg, value);
reg, value);
if (ret != 0) if (ret != 0)
DPRINTK("Write Error Address = %x\n", reg); DPRINTK("Write Error Address = %x\n", reg);
...@@ -100,8 +97,7 @@ static int ths8200_detach_client(struct i2c_client *client) ...@@ -100,8 +97,7 @@ static int ths8200_detach_client(struct i2c_client *client)
err = i2c_detach_client(client); err = i2c_detach_client(client);
if (err) { if (err) {
DPRINTK("Client deregistration failed, \ DPRINTK("Client deregistration failed, client not detached.\n");
client not detached.\n");
return err; return err;
} }
kfree(client); kfree(client);
...@@ -117,19 +113,17 @@ static int ths8200_detect_client(struct i2c_adapter *adapter, ...@@ -117,19 +113,17 @@ static int ths8200_detect_client(struct i2c_adapter *adapter,
FN_IN; FN_IN;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA | if (!i2c_check_functionality(adapter,
I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_WRITE_BYTE)) { I2C_FUNC_SMBUS_WRITE_BYTE)) {
DPRINTK("Functinality check failed for %s \n", DPRINTK("Functinality check failed for %s \n", client_name);
client_name);
return err; return err;
} }
ths8200_client = kmalloc(sizeof(struct i2c_client), ths8200_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
GFP_KERNEL);
if (ths8200_client == NULL) { if (ths8200_client == NULL) {
err = -ENOMEM; err = -ENOMEM;
DPRINTK("Couldn't allocate memory for %s\n", DPRINTK("Couldn't allocate memory for %s\n", client_name);
client_name);
return err; return err;
} }
...@@ -156,7 +150,8 @@ int ths8200_set_480p_mode(void) ...@@ -156,7 +150,8 @@ int ths8200_set_480p_mode(void)
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET); ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET);
/* take ths8200 out of reset and in normal operation mode */ /* take ths8200 out of reset and in normal operation mode */
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_OUT_OF_RESET | ths8200_write_value(CHIP_CTL_REG,
CHIP_SOFTWARE_OUT_OF_RESET |
CHIP_LOW_FREQUENCY); CHIP_LOW_FREQUENCY);
/* place color space conversion control in reset state */ /* place color space conversion control in reset state */
...@@ -177,7 +172,8 @@ int ths8200_set_480p_mode(void) ...@@ -177,7 +172,8 @@ int ths8200_set_480p_mode(void)
CSC_PROTECTION_ON); CSC_PROTECTION_ON);
/* set YCx20 External Sync */ /* set YCx20 External Sync */
ths8200_write_value(DTG2_CNTL_REG, HS_IN_POSITIVE_POLARITY | ths8200_write_value(DTG2_CNTL_REG,
HS_IN_POSITIVE_POLARITY |
VS_IN_POSITIVE_POLARITY | VS_IN_POSITIVE_POLARITY |
HS_OUT_POSITIVE_POLARITY | HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY); VS_OUT_POSITIVE_POLARITY);
...@@ -283,7 +279,8 @@ int ths8200_set_480p_mode(void) ...@@ -283,7 +279,8 @@ int ths8200_set_480p_mode(void)
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET); ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET);
/* take ths8200 out of reset and in normal operation mode */ /* take ths8200 out of reset and in normal operation mode */
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_OUT_OF_RESET | ths8200_write_value(CHIP_CTL_REG,
CHIP_SOFTWARE_OUT_OF_RESET |
CHIP_LOW_FREQUENCY); CHIP_LOW_FREQUENCY);
printk(KERN_INFO "THS8200 set video mode as 480p\n"); printk(KERN_INFO "THS8200 set video mode as 480p\n");
...@@ -319,7 +316,8 @@ int ths8200_set_720p_mode(void) ...@@ -319,7 +316,8 @@ int ths8200_set_720p_mode(void)
CSC_PROTECTION_ON); CSC_PROTECTION_ON);
/* set YCx20 External Sync */ /* set YCx20 External Sync */
ths8200_write_value(DTG2_CNTL_REG, HS_IN_POSITIVE_POLARITY | ths8200_write_value(DTG2_CNTL_REG,
HS_IN_POSITIVE_POLARITY |
VS_IN_POSITIVE_POLARITY | VS_IN_POSITIVE_POLARITY |
HS_OUT_POSITIVE_POLARITY | HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY); VS_OUT_POSITIVE_POLARITY);
...@@ -436,11 +434,13 @@ int ths8200_set_1080i_mode(void) ...@@ -436,11 +434,13 @@ int ths8200_set_1080i_mode(void)
FN_IN; FN_IN;
/* place ths8200 in reset state */ /* place ths8200 in reset state */
ths8200_write_value(CHIP_CTL_REG,CHIP_SOFTWARE_RESET | ths8200_write_value(CHIP_CTL_REG,
CHIP_SOFTWARE_RESET |
CHIP_LOW_FREQUENCY); CHIP_LOW_FREQUENCY);
/* take ths8200 out of reset and in normal operation mode */ /* take ths8200 out of reset and in normal operation mode */
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_OUT_OF_RESET | ths8200_write_value(CHIP_CTL_REG,
CHIP_SOFTWARE_OUT_OF_RESET |
CHIP_LOW_FREQUENCY); CHIP_LOW_FREQUENCY);
/* place color space conversion control in reset state */ /* place color space conversion control in reset state */
...@@ -468,7 +468,8 @@ int ths8200_set_1080i_mode(void) ...@@ -468,7 +468,8 @@ int ths8200_set_1080i_mode(void)
ths8200_write_value(CSM_GY_CNTL_MULT_MSB_REG, 0x00); ths8200_write_value(CSM_GY_CNTL_MULT_MSB_REG, 0x00);
/* set YCx20 External Sync */ /* set YCx20 External Sync */
ths8200_write_value(DTG2_CNTL_REG, HS_IN_POSITIVE_POLARITY | ths8200_write_value(DTG2_CNTL_REG,
HS_IN_POSITIVE_POLARITY |
VS_IN_POSITIVE_POLARITY | VS_IN_POSITIVE_POLARITY |
HS_OUT_POSITIVE_POLARITY | HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY | VS_OUT_POSITIVE_POLARITY |
...@@ -635,8 +636,7 @@ static __init int ths8200_init(void) ...@@ -635,8 +636,7 @@ static __init int ths8200_init(void)
FN_IN; FN_IN;
if (i2c_add_driver(&ths8200_driver)) { if (i2c_add_driver(&ths8200_driver)) {
DPRINTK("Driver registration failed, \ DPRINTK("Driver registration failed, module not inserted.\n");
module not inserted.\n");
return -ENODEV; return -ENODEV;
} }
......
...@@ -225,10 +225,8 @@ static const struct fb_videomode dmfb_modedb[] = { ...@@ -225,10 +225,8 @@ static const struct fb_videomode dmfb_modedb[] = {
* vmode, flag * vmode, flag
*/ */
/* Standard Modes */ /* Standard Modes */
{ "576i", 50, 720, 576, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 6, FB_SYNC_BROADCAST, { "576i", 50, 720, 576, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 6, FB_SYNC_BROADCAST, FB_VMODE_INTERLACED, 0},
FB_VMODE_INTERLACED, 0}, { "480i", 50, 720, 480, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 5, FB_SYNC_BROADCAST, FB_VMODE_INTERLACED, 0},
{ "480i", 50, 720, 480, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 5, FB_SYNC_BROADCAST,
FB_VMODE_INTERLACED, 0},
/* Modes provided by THS8200 */ /* Modes provided by THS8200 */
{ "480p", 30, 720, 480, LCD_PANEL_CLOCK, 122, 15, 36, 8, 0x50, 0x5, FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED, 0}, { "480p", 30, 720, 480, LCD_PANEL_CLOCK, 122, 15, 36, 8, 0x50, 0x5, FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED, 0},
{ "720p", 30, 1280, 720, LCD_PANEL_CLOCK, 300, 69, 26, 3, 0x50, 0x5, FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED, 0}, { "720p", 30, 1280, 720, LCD_PANEL_CLOCK, 300, 69, 26, 3, 0x50, 0x5, FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED, 0},
...@@ -283,11 +281,9 @@ static int dm_venc_mode_set(struct dm_info *dm, const struct fb_videomode *mode) ...@@ -283,11 +281,9 @@ static int dm_venc_mode_set(struct dm_info *dm, const struct fb_videomode *mode)
*/ */
int dm_venc_set_state(struct output_device *od) int dm_venc_set_state(struct output_device *od)
{ {
struct dm_info *dm = struct dm_info *dm = (struct dm_info *)class_get_devdata(&od->class_dev);
(struct dm_info *)class_get_devdata(&od->class_dev);
unsigned long state = od->request_state; unsigned long state = od->request_state;
/* TODO check that the output is in standard mode */ /* TODO check that the output is in standard mode */
switch (state) switch (state)
{ {
...@@ -320,8 +316,7 @@ int dm_venc_set_state(struct output_device *od) ...@@ -320,8 +316,7 @@ int dm_venc_set_state(struct output_device *od)
/* Returns the current output mode selcted */ /* Returns the current output mode selcted */
int dm_venc_get_status(struct output_device *od) int dm_venc_get_status(struct output_device *od)
{ {
struct dm_info *dm = struct dm_info *dm = (struct dm_info *)class_get_devdata(&od->class_dev);
(struct dm_info *)class_get_devdata(&od->class_dev);
return dm->output_sel; return dm->output_sel;
} }
...@@ -529,8 +524,7 @@ static inline void slow_down_vclk(void) ...@@ -529,8 +524,7 @@ static inline void slow_down_vclk(void)
/* select MXI mode. Use 27 MHz (from MXI27) /* select MXI mode. Use 27 MHz (from MXI27)
* (DAC clock = 27 MHz).VPBE/Video encoder clock * (DAC clock = 27 MHz).VPBE/Video encoder clock
* is enabled*/ * is enabled*/
outl(VPSS_CLKCTL_ENABLE_VPBE_CLK, outl(VPSS_CLKCTL_ENABLE_VPBE_CLK, VPSS_CLKCTL);
VPSS_CLKCTL);
} }
#if 0 #if 0
static void davincifb_480p_component_config(int on) static void davincifb_480p_component_config(int on)
...@@ -865,8 +859,7 @@ static int davincifb_set_attr_blend(struct dm_win_info *w, ...@@ -865,8 +859,7 @@ static int davincifb_set_attr_blend(struct dm_win_info *w,
* ... Do we want to return an error otherwise? * ... Do we want to return an error otherwise?
*/ */
width_bytes = r->width * var->bits_per_pixel / 8; width_bytes = r->width * var->bits_per_pixel / 8;
start = w->fb_base + r->dy * info->fix.line_length start = w->fb_base + r->dy * info->fix.line_length + r->dx * var->bits_per_pixel / 8;
+ r->dx * var->bits_per_pixel / 8;
blend = (((u8) r->color & 0xf) << 4) | ((u8) r->color); blend = (((u8) r->color & 0xf) << 4) | ((u8) r->color);
while (r->height--) { while (r->height--) {
...@@ -1074,8 +1067,7 @@ static int window_overlap(struct dm_win_info *w, u32 xp, u32 yp, u32 xl, u32 yl) ...@@ -1074,8 +1067,7 @@ static int window_overlap(struct dm_win_info *w, u32 xp, u32 yp, u32 xl, u32 yl)
/* Returns 1 if the window parameters are within DAVINCIFB_WIN_VID0, 0 otherwise */ /* Returns 1 if the window parameters are within DAVINCIFB_WIN_VID0, 0 otherwise */
static int within_vid0_limits(struct dm_win_info *vid0, u32 xp, u32 yp, u32 xl, static int within_vid0_limits(struct dm_win_info *vid0, u32 xp, u32 yp, u32 xl, u32 yl)
u32 yl)
{ {
u32 vid0_xp = 0, vid0_yp = 0, vid0_xl = 0, vid0_yl = 0; u32 vid0_xp = 0, vid0_yp = 0, vid0_xl = 0, vid0_yl = 0;
...@@ -1172,8 +1164,7 @@ static void dm_win_fix_set(struct dm_win_info *w) ...@@ -1172,8 +1164,7 @@ static void dm_win_fix_set(struct dm_win_info *w)
struct fb_info *info = &w->info; struct fb_info *info = &w->info;
info->fix.smem_start = w->fb_base_phys; info->fix.smem_start = w->fb_base_phys;
info->fix.line_length = info->fix.line_length = (info->var.xres_virtual * info->var.bits_per_pixel) / 8;
(info->var.xres_virtual * info->var.bits_per_pixel) / 8;
info->fix.smem_len = w->fb_size; info->fix.smem_len = w->fb_size;
info->fix.type = FB_TYPE_PACKED_PIXELS; info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.visual = (info->var.bits_per_pixel <= 8) ? info->fix.visual = (info->var.bits_per_pixel <= 8) ?
...@@ -1264,8 +1255,9 @@ static int dm_win_probe(struct dm_win_info *w) ...@@ -1264,8 +1255,9 @@ static int dm_win_probe(struct dm_win_info *w)
/* append the list modes */ /* append the list modes */
fb_videomode_to_modelist(dmfb_modedb, ARRAY_SIZE(dmfb_modedb), fb_videomode_to_modelist(dmfb_modedb, ARRAY_SIZE(dmfb_modedb),
&info->modelist); &info->modelist);
if (!fb_find_mode(vinfo, &w->info, NULL, if (!fb_find_mode(vinfo, &w->info, NULL, dmfb_modedb,
dmfb_modedb, ARRAY_SIZE(dmfb_modedb), NULL, is_win(w, DAVINCIFB_WIN_OSD1) ? 4 : 16)) { ARRAY_SIZE(dmfb_modedb), NULL,
is_win(w, DAVINCIFB_WIN_OSD1) ? 4 : 16)) {
return -EINVAL; return -EINVAL;
} }
/* create the fb device */ /* create the fb device */
...@@ -1280,8 +1272,7 @@ static int dm_win_probe(struct dm_win_info *w) ...@@ -1280,8 +1272,7 @@ static int dm_win_probe(struct dm_win_info *w)
switch (info->var.bits_per_pixel) { switch (info->var.bits_per_pixel) {
case 16: case 16:
/* yuv422 */ /* yuv422 */
if (is_win(w, DAVINCIFB_WIN_VID0) || if (is_win(w, DAVINCIFB_WIN_VID0) || is_win(w, DAVINCIFB_WIN_VID1))
is_win(w, DAVINCIFB_WIN_VID1))
bg_color = 0x88; bg_color = 0x88;
break; break;
...@@ -1467,8 +1458,8 @@ static int davincifb_check_var(struct fb_var_screeninfo *var, ...@@ -1467,8 +1458,8 @@ static int davincifb_check_var(struct fb_var_screeninfo *var,
v.xres, v.xres_virtual, v.bits_per_pixel); v.xres, v.xres_virtual, v.bits_per_pixel);
return -EINVAL; return -EINVAL;
} }
if ((w->fb_size) && (v.xres_virtual * v.yres_virtual * v.bits_per_pixel if ((w->fb_size) &&
/ 8 > w->fb_size)) { (v.xres_virtual * v.yres_virtual * v.bits_per_pixel / 8 > w->fb_size)) {
dev_dbg(dev, "Requested resolution too big\n"); dev_dbg(dev, "Requested resolution too big\n");
goto error; goto error;
} }
...@@ -1506,18 +1497,15 @@ static int davincifb_check_var(struct fb_var_screeninfo *var, ...@@ -1506,18 +1497,15 @@ static int davincifb_check_var(struct fb_var_screeninfo *var,
} else if (is_win(w, DAVINCIFB_WIN_VID0)) { } else if (is_win(w, DAVINCIFB_WIN_VID0)) {
if (check_new_vid0_size((struct dm_info *)w, w->x, w->y, if (check_new_vid0_size((struct dm_info *)w, w->x, w->y,
v.xres, v.yres)) { v.xres, v.yres)) {
dev_dbg(dev, "vid0 isn't large enough to handle all " dev_dbg(dev, "vid0 isn't large enough to handle all windows\n");
"windows\n");
goto error; goto error;
} }
v.bits_per_pixel = 16; v.bits_per_pixel = 16;
} else if (is_win(w, DAVINCIFB_WIN_VID1)) { } else if (is_win(w, DAVINCIFB_WIN_VID1)) {
/* Rule 11 */ /* Rule 11 */
if (w->dm->windows[DAVINCIFB_WIN_VID0] && if (w->dm->windows[DAVINCIFB_WIN_VID0] &&
((w->dm->windows[DAVINCIFB_WIN_VID0]->x - w->x) ((w->dm->windows[DAVINCIFB_WIN_VID0]->x - w->x) % 16)) {
% 16)) { dev_dbg(dev, "vid1 x should be multiple of 16 from vid0\n");
dev_dbg(dev, "vid1 x should be multiple of 16 from "
"vid0\n");
return -EINVAL; return -EINVAL;
} }
/* Video1 may be in YUV or RGB888 format */ /* Video1 may be in YUV or RGB888 format */
...@@ -1555,8 +1543,7 @@ static int davincifb_set_par(struct fb_info *info) ...@@ -1555,8 +1543,7 @@ static int davincifb_set_par(struct fb_info *info)
/* Memory offsets */ /* Memory offsets */
info->fix.line_length = v->xres_virtual * v->bits_per_pixel / 8; info->fix.line_length = v->xres_virtual * v->bits_per_pixel / 8;
offset = v->yoffset * info->fix.line_length + offset = v->yoffset * info->fix.line_length + v->xoffset * v->bits_per_pixel / 8;
v->xoffset * v->bits_per_pixel / 8;
start = (u32) w->fb_base_phys + offset; start = (u32) w->fb_base_phys + offset;
set_sdram_params(w, start, info->fix.line_length); set_sdram_params(w, start, info->fix.line_length);
...@@ -1602,23 +1589,23 @@ static int davincifb_set_par(struct fb_info *info) ...@@ -1602,23 +1589,23 @@ static int davincifb_set_par(struct fb_info *info)
ths8200_set_480p_mode(); ths8200_set_480p_mode();
/* Enable all VENC, non-standard timing mode, /* Enable all VENC, non-standard timing mode,
* master timing, HD, progressive */ * master timing, HD, progressive */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC | dispc_reg_out(VENC_VMOD,
VENC_VMOD_VMD | VENC_VMOD_HDMD)); (VENC_VMOD_VENC | VENC_VMOD_VMD | VENC_VMOD_HDMD));
} }
else if (!strcmp(dmfb_modedb[mode].name, "720p")) { else if (!strcmp(dmfb_modedb[mode].name, "720p")) {
ths8200_set_720p_mode(); ths8200_set_720p_mode();
/* Enable all VENC, non-standard timing mode, /* Enable all VENC, non-standard timing mode,
* master timing, HD, progressive */ * master timing, HD, progressive */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC | dispc_reg_out(VENC_VMOD,
VENC_VMOD_VMD | VENC_VMOD_HDMD)); (VENC_VMOD_VENC | VENC_VMOD_VMD | VENC_VMOD_HDMD));
} }
else if (!strcmp(dmfb_modedb[mode].name, "1080i")) { else if (!strcmp(dmfb_modedb[mode].name, "1080i")) {
ths8200_set_1080i_mode(); ths8200_set_1080i_mode();
/* Enable all VENC, non-standard timing mode, /* Enable all VENC, non-standard timing mode,
* master timing, HD, interlaced */ * master timing, HD, interlaced */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC | dispc_reg_out(VENC_VMOD,
VENC_VMOD_VMD | VENC_VMOD_HDMD | (VENC_VMOD_VENC | VENC_VMOD_VMD |
VENC_VMOD_NSIT)); VENC_VMOD_HDMD | VENC_VMOD_NSIT));
} }
#endif #endif
} }
...@@ -1693,9 +1680,9 @@ static int davincifb_ioctl(struct fb_info *info, unsigned int cmd, ...@@ -1693,9 +1680,9 @@ static int davincifb_ioctl(struct fb_info *info, unsigned int cmd,
case FBIO_SETZOOM: case FBIO_SETZOOM:
if (copy_from_user(&zoom, argp, sizeof(zoom))) if (copy_from_user(&zoom, argp, sizeof(zoom)))
return -EFAULT; return -EFAULT;
if ((zoom.zoom_h == 2) || (zoom.zoom_h == 0) if ((zoom.zoom_h == 2) || (zoom.zoom_h == 0) ||
|| (zoom.zoom_h == 1) || (zoom.zoom_v == 2) (zoom.zoom_h == 1) || (zoom.zoom_v == 2) ||
|| (zoom.zoom_v == 0) || (zoom.zoom_v == 1)) { (zoom.zoom_v == 0) || (zoom.zoom_v == 1)) {
if (!is_win(w, zoom.window_id)) if (!is_win(w, zoom.window_id))
return -EINVAL; return -EINVAL;
set_zoom(w, zoom.zoom_h, zoom.zoom_v); set_zoom(w, zoom.zoom_h, zoom.zoom_v);
...@@ -1822,8 +1809,7 @@ static int davincifb_pan_display(struct fb_var_screeninfo *var, ...@@ -1822,8 +1809,7 @@ static int davincifb_pan_display(struct fb_var_screeninfo *var,
if ((var->xres_virtual * var->bits_per_pixel / 8) % 32) if ((var->xres_virtual * var->bits_per_pixel / 8) % 32)
return -EINVAL; return -EINVAL;
offset = var->yoffset * info->fix.line_length + offset = var->yoffset * info->fix.line_length + var->xoffset * var->bits_per_pixel / 8;
var->xoffset * var->bits_per_pixel / 8;
start = (u32) w->fb_base_phys + offset; start = (u32) w->fb_base_phys + offset;
if ((dispc_reg_in(VENC_VSTAT) & 0x00000010)==0x10) if ((dispc_reg_in(VENC_VSTAT) & 0x00000010)==0x10)
...@@ -1974,8 +1960,7 @@ static int davincifb_probe(struct platform_device *pdev) ...@@ -1974,8 +1960,7 @@ static int davincifb_probe(struct platform_device *pdev)
} }
/* map the regions */ /* map the regions */
dm->mmio_base = dm->mmio_base = (unsigned long)ioremap(dm->mmio_base_phys, dm->mmio_size);
(unsigned long)ioremap(dm->mmio_base_phys, dm->mmio_size);
if (!dm->mmio_base) { if (!dm->mmio_base) {
dev_err(dm->dev, ": cannot map MMIO\n"); dev_err(dm->dev, ": cannot map MMIO\n");
goto release_mmio; goto release_mmio;
...@@ -2005,24 +1990,19 @@ static int davincifb_probe(struct platform_device *pdev) ...@@ -2005,24 +1990,19 @@ static int davincifb_probe(struct platform_device *pdev)
/* Field Inversion Workaround */ /* Field Inversion Workaround */
dispc_reg_out(OSD_MODE, 0x200); dispc_reg_out(OSD_MODE, 0x200);
dm->windows_mask = (1 << DAVINCIFB_WIN_OSD0) | dm->windows_mask = (1 << DAVINCIFB_WIN_OSD0) |(1 << DAVINCIFB_WIN_OSD1) |
(1 << DAVINCIFB_WIN_OSD1) | (1 << DAVINCIFB_WIN_VID0) | (1 << DAVINCIFB_WIN_VID1);
(1 << DAVINCIFB_WIN_VID0) |
(1 << DAVINCIFB_WIN_VID1);
if (dm_wins_probe(dm) < 0) if (dm_wins_probe(dm) < 0)
goto probe_error; goto probe_error;
/* install our interrupt service routine */ /* install our interrupt service routine */
if (request_irq(IRQ_VENCINT, davincifb_isr, IRQF_SHARED, MODULE_NAME, if (request_irq(IRQ_VENCINT, davincifb_isr, IRQF_SHARED, MODULE_NAME, dm)) {
dm)) { dev_err(dm->dev, MODULE_NAME ": could not install interrupt service routine\n");
dev_err(dm->dev, MODULE_NAME
": could not install interrupt service routine\n");
goto irq_error; goto irq_error;
} }
/* TODO remove this */ /* TODO remove this */
//dm->output_device_config(1); //dm->output_device_config(1);
dm->output = dm->output = video_output_register("venc", dm->dev, dm, &dm_venc_props);
video_output_register("venc", dm->dev, dm, &dm_venc_props);
if (!dm->output) if (!dm->output)
goto venc_error; goto venc_error;
platform_set_drvdata(pdev, dm); platform_set_drvdata(pdev, dm);
...@@ -2104,10 +2084,8 @@ int __init davincifb_setup(char *options) ...@@ -2104,10 +2084,8 @@ int __init davincifb_setup(char *options)
dmparams.format = COMPONENT; dmparams.format = COMPONENT;
} }
} else if (!strncmp(this_opt, "format=", 7)) { } else if (!strncmp(this_opt, "format=", 7)) {
if (dmparams.output == LCD || if (dmparams.output == LCD || dmparams.output == HD720P ||
dmparams.output == HD720P || dmparams.output == HD1080I || dmparams.output == HD480P)
dmparams.output == HD1080I ||
dmparams.output == HD480P)
continue; continue;
if (!strncmp(this_opt + 7, "composite", 9)) if (!strncmp(this_opt + 7, "composite", 9))
dmparams.format = COMPOSITE; dmparams.format = COMPOSITE;
...@@ -2121,8 +2099,7 @@ int __init davincifb_setup(char *options) ...@@ -2121,8 +2099,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3)) if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID0); dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID0);
else if (!parse_win_params(this_opt + 5, else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos, &xres, &yres, &xpos, &ypos)) {
&ypos)) {
dmparams.vid0_xres = xres; dmparams.vid0_xres = xres;
dmparams.vid0_yres = yres; dmparams.vid0_yres = yres;
dmparams.vid0_xpos = xpos; dmparams.vid0_xpos = xpos;
...@@ -2132,8 +2109,7 @@ int __init davincifb_setup(char *options) ...@@ -2132,8 +2109,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3)) if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID1); dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID1);
else if (!parse_win_params(this_opt + 5, else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos, &xres, &yres, &xpos, &ypos)) {
&ypos)) {
dmparams.vid1_xres = xres; dmparams.vid1_xres = xres;
dmparams.vid1_yres = yres; dmparams.vid1_yres = yres;
dmparams.vid1_xpos = xpos; dmparams.vid1_xpos = xpos;
...@@ -2143,8 +2119,7 @@ int __init davincifb_setup(char *options) ...@@ -2143,8 +2119,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3)) if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD0); dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD0);
else if (!parse_win_params(this_opt + 5, else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos, &xres, &yres, &xpos, &ypos)) {
&ypos)) {
dmparams.osd0_xres = xres; dmparams.osd0_xres = xres;
dmparams.osd0_yres = yres; dmparams.osd0_yres = yres;
dmparams.osd0_xpos = xpos; dmparams.osd0_xpos = xpos;
...@@ -2154,8 +2129,7 @@ int __init davincifb_setup(char *options) ...@@ -2154,8 +2129,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3)) if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD1); dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD1);
else if (!parse_win_params(this_opt + 5, else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos, &xres, &yres, &xpos, &ypos)) {
&ypos)) {
dmparams.osd1_xres = xres; dmparams.osd1_xres = xres;
dmparams.osd1_yres = yres; dmparams.osd1_yres = yres;
dmparams.osd1_xpos = xpos; dmparams.osd1_xpos = xpos;
...@@ -2163,8 +2137,7 @@ int __init davincifb_setup(char *options) ...@@ -2163,8 +2137,7 @@ int __init davincifb_setup(char *options)
} }
} }
} }
printk(KERN_INFO "DaVinci: " printk(KERN_INFO "DaVinci: " "Output on %s%s, Enabled windows: %s %s %s %s\n",
"Output on %s%s, Enabled windows: %s %s %s %s\n",
(dmparams.output == LCD) ? "LCD" : (dmparams.output == LCD) ? "LCD" :
(dmparams.output == HD720P) ? "HD720P": (dmparams.output == HD720P) ? "HD720P":
(dmparams.output == HD1080I) ? "HD1080I": (dmparams.output == HD1080I) ? "HD1080I":
...@@ -2194,8 +2167,7 @@ int __init davincifb_setup(char *options) ...@@ -2194,8 +2167,7 @@ int __init davincifb_setup(char *options)
format_xres = DISP_XRES480P; format_xres = DISP_XRES480P;
format_yres = DISP_YRES480P; format_yres = DISP_YRES480P;
} else { } else {
printk(KERN_INFO printk(KERN_INFO "DaVinci:invalid format..defaulting width to 480\n");
"DaVinci:invalid format..defaulting width to 480\n");
} }
dmparams.osd0_xres = osd0_default_var.xres = format_xres; dmparams.osd0_xres = osd0_default_var.xres = format_xres;
dmparams.osd1_xres = osd1_default_var.xres = format_xres; dmparams.osd1_xres = osd1_default_var.xres = format_xres;
...@@ -2218,12 +2190,9 @@ int __init davincifb_setup(char *options) ...@@ -2218,12 +2190,9 @@ int __init davincifb_setup(char *options)
vid1_default_var.yres_virtual = format_yres * TRIPLE_BUF; vid1_default_var.yres_virtual = format_yres * TRIPLE_BUF;
dmparams.osd0_phys = DAVINCI_FB_RESERVE_MEM_BASE; dmparams.osd0_phys = DAVINCI_FB_RESERVE_MEM_BASE;
dmparams.osd1_phys = dmparams.osd0_phys + dmparams.osd1_phys = dmparams.osd0_phys + fb_window_size(format_xres, format_yres, DOUBLE_BUF);
fb_window_size(format_xres, format_yres, DOUBLE_BUF); dmparams.vid0_phys = dmparams.osd1_phys + fb_window_size(format_xres, format_yres, DOUBLE_BUF);
dmparams.vid0_phys = dmparams.osd1_phys + dmparams.vid1_phys = dmparams.vid0_phys + fb_window_size(format_xres, format_yres, TRIPLE_BUF);
fb_window_size(format_xres, format_yres, DOUBLE_BUF);
dmparams.vid1_phys = dmparams.vid0_phys +
fb_window_size(format_xres, format_yres, TRIPLE_BUF);
if (dmparams.windows & (1 << DAVINCIFB_WIN_VID0)) if (dmparams.windows & (1 << DAVINCIFB_WIN_VID0))
printk(KERN_INFO "Setting Video0 size %dx%d, " printk(KERN_INFO "Setting Video0 size %dx%d, "
...@@ -2267,8 +2236,7 @@ int __init davincifb_init(void) ...@@ -2267,8 +2236,7 @@ int __init davincifb_init(void)
for (i = 0; i < num_names && !done; i++) { for (i = 0; i < num_names && !done; i++) {
if (fb_get_options(names[i], &option)) { if (fb_get_options(names[i], &option)) {
printk(MODULE_NAME printk(MODULE_NAME ": Disabled on command-line.\n");
": Disabled on command-line.\n");
return -ENODEV; return -ENODEV;
} else if (option) { } else if (option) {
davincifb_setup(option); davincifb_setup(option);
......
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
#ifndef __DAVINCI_GPIO_H #ifndef __DAVINCI_GPIO_H
#define __DAVINCI_GPIO_H #define __DAVINCI_GPIO_H
#include <asm/io.h>
#include "hardware.h"
#include "io.h"
/* /*
* basic gpio routines * basic gpio routines
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment