Commit d2867be8 authored by 邱宗炽's avatar 邱宗炽

ths8200 and FB driver code format adjust

Signed-off-by: default avatar邱宗炽 <tqiu@neuros.com.cn>
parent 00d2c3e5
......@@ -38,8 +38,7 @@
static int ths8200_attach_adapter(struct i2c_adapter *adapter);
static int ths8200_detach_client(struct i2c_client *client);
static int ths8200_detect_client(struct i2c_adapter *adapter,
int address, int kind);
static int ths8200_detect_client(struct i2c_adapter *adapter, int address, int kind);
static inline int ths8200_write_value(u8 reg, u8 value);
static inline int ths8200_read_value(u8 reg);
......@@ -56,8 +55,7 @@ static struct i2c_driver ths8200_driver = {
};
/* I2C Addresses to scan */
static unsigned short normal_i2c[] = { 0x20, \
I2C_CLIENT_END};
static unsigned short normal_i2c[] = { 0x20, I2C_CLIENT_END };
/* This makes all addr_data:s */
I2C_CLIENT_INSMOD;
......@@ -74,8 +72,7 @@ static inline int ths8200_write_value(u8 reg, u8 value)
{
int ret;
ret = i2c_smbus_write_byte_data(ths8200_client,
reg, value);
ret = i2c_smbus_write_byte_data(ths8200_client, reg, value);
if (ret != 0)
DPRINTK("Write Error Address = %x\n", reg);
......@@ -100,8 +97,7 @@ static int ths8200_detach_client(struct i2c_client *client)
err = i2c_detach_client(client);
if (err) {
DPRINTK("Client deregistration failed, \
client not detached.\n");
DPRINTK("Client deregistration failed, client not detached.\n");
return err;
}
kfree(client);
......@@ -117,19 +113,17 @@ static int ths8200_detect_client(struct i2c_adapter *adapter,
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)) {
DPRINTK("Functinality check failed for %s \n",
client_name);
DPRINTK("Functinality check failed for %s \n", client_name);
return err;
}
ths8200_client = kmalloc(sizeof(struct i2c_client),
GFP_KERNEL);
ths8200_client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
if (ths8200_client == NULL) {
err = -ENOMEM;
DPRINTK("Couldn't allocate memory for %s\n",
client_name);
DPRINTK("Couldn't allocate memory for %s\n", client_name);
return err;
}
......@@ -156,7 +150,8 @@ int ths8200_set_480p_mode(void)
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET);
/* 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);
/* place color space conversion control in reset state */
......@@ -177,7 +172,8 @@ int ths8200_set_480p_mode(void)
CSC_PROTECTION_ON);
/* 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 |
HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY);
......@@ -283,7 +279,8 @@ int ths8200_set_480p_mode(void)
ths8200_write_value(CHIP_CTL_REG, CHIP_SOFTWARE_RESET);
/* 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);
printk(KERN_INFO "THS8200 set video mode as 480p\n");
......@@ -319,7 +316,8 @@ int ths8200_set_720p_mode(void)
CSC_PROTECTION_ON);
/* 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 |
HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY);
......@@ -436,11 +434,13 @@ int ths8200_set_1080i_mode(void)
FN_IN;
/* 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);
/* 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);
/* place color space conversion control in reset state */
......@@ -468,7 +468,8 @@ int ths8200_set_1080i_mode(void)
ths8200_write_value(CSM_GY_CNTL_MULT_MSB_REG, 0x00);
/* 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 |
HS_OUT_POSITIVE_POLARITY |
VS_OUT_POSITIVE_POLARITY |
......@@ -635,8 +636,7 @@ static __init int ths8200_init(void)
FN_IN;
if (i2c_add_driver(&ths8200_driver)) {
DPRINTK("Driver registration failed, \
module not inserted.\n");
DPRINTK("Driver registration failed, module not inserted.\n");
return -ENODEV;
}
......
......@@ -225,10 +225,8 @@ static const struct fb_videomode dmfb_modedb[] = {
* vmode, flag
*/
/* Standard Modes */
{ "576i", 50, 720, 576, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 6, 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},
{ "576i", 50, 720, 576, LCD_PANEL_CLOCK, 0, 0, 0, 0, 127, 6, 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 */
{ "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},
......@@ -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)
{
struct dm_info *dm =
(struct dm_info *)class_get_devdata(&od->class_dev);
struct dm_info *dm = (struct dm_info *)class_get_devdata(&od->class_dev);
unsigned long state = od->request_state;
/* TODO check that the output is in standard mode */
switch (state)
{
......@@ -320,8 +316,7 @@ int dm_venc_set_state(struct output_device *od)
/* Returns the current output mode selcted */
int dm_venc_get_status(struct output_device *od)
{
struct dm_info *dm =
(struct dm_info *)class_get_devdata(&od->class_dev);
struct dm_info *dm = (struct dm_info *)class_get_devdata(&od->class_dev);
return dm->output_sel;
}
......@@ -529,8 +524,7 @@ static inline void slow_down_vclk(void)
/* select MXI mode. Use 27 MHz (from MXI27)
* (DAC clock = 27 MHz).VPBE/Video encoder clock
* is enabled*/
outl(VPSS_CLKCTL_ENABLE_VPBE_CLK,
VPSS_CLKCTL);
outl(VPSS_CLKCTL_ENABLE_VPBE_CLK, VPSS_CLKCTL);
}
#if 0
static void davincifb_480p_component_config(int on)
......@@ -865,8 +859,7 @@ static int davincifb_set_attr_blend(struct dm_win_info *w,
* ... Do we want to return an error otherwise?
*/
width_bytes = r->width * var->bits_per_pixel / 8;
start = w->fb_base + r->dy * info->fix.line_length
+ r->dx * var->bits_per_pixel / 8;
start = w->fb_base + r->dy * info->fix.line_length + r->dx * var->bits_per_pixel / 8;
blend = (((u8) r->color & 0xf) << 4) | ((u8) r->color);
while (r->height--) {
......@@ -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 */
static int within_vid0_limits(struct dm_win_info *vid0, u32 xp, u32 yp, u32 xl,
u32 yl)
static int within_vid0_limits(struct dm_win_info *vid0, u32 xp, u32 yp, u32 xl, u32 yl)
{
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)
struct fb_info *info = &w->info;
info->fix.smem_start = w->fb_base_phys;
info->fix.line_length =
(info->var.xres_virtual * info->var.bits_per_pixel) / 8;
info->fix.line_length = (info->var.xres_virtual * info->var.bits_per_pixel) / 8;
info->fix.smem_len = w->fb_size;
info->fix.type = FB_TYPE_PACKED_PIXELS;
info->fix.visual = (info->var.bits_per_pixel <= 8) ?
......@@ -1264,8 +1255,9 @@ static int dm_win_probe(struct dm_win_info *w)
/* append the list modes */
fb_videomode_to_modelist(dmfb_modedb, ARRAY_SIZE(dmfb_modedb),
&info->modelist);
if (!fb_find_mode(vinfo, &w->info, NULL,
dmfb_modedb, ARRAY_SIZE(dmfb_modedb), NULL, is_win(w, DAVINCIFB_WIN_OSD1) ? 4 : 16)) {
if (!fb_find_mode(vinfo, &w->info, NULL, dmfb_modedb,
ARRAY_SIZE(dmfb_modedb), NULL,
is_win(w, DAVINCIFB_WIN_OSD1) ? 4 : 16)) {
return -EINVAL;
}
/* create the fb device */
......@@ -1280,8 +1272,7 @@ static int dm_win_probe(struct dm_win_info *w)
switch (info->var.bits_per_pixel) {
case 16:
/* yuv422 */
if (is_win(w, DAVINCIFB_WIN_VID0) ||
is_win(w, DAVINCIFB_WIN_VID1))
if (is_win(w, DAVINCIFB_WIN_VID0) || is_win(w, DAVINCIFB_WIN_VID1))
bg_color = 0x88;
break;
......@@ -1467,8 +1458,8 @@ static int davincifb_check_var(struct fb_var_screeninfo *var,
v.xres, v.xres_virtual, v.bits_per_pixel);
return -EINVAL;
}
if ((w->fb_size) && (v.xres_virtual * v.yres_virtual * v.bits_per_pixel
/ 8 > w->fb_size)) {
if ((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");
goto error;
}
......@@ -1506,18 +1497,15 @@ static int davincifb_check_var(struct fb_var_screeninfo *var,
} else if (is_win(w, DAVINCIFB_WIN_VID0)) {
if (check_new_vid0_size((struct dm_info *)w, w->x, w->y,
v.xres, v.yres)) {
dev_dbg(dev, "vid0 isn't large enough to handle all "
"windows\n");
dev_dbg(dev, "vid0 isn't large enough to handle all windows\n");
goto error;
}
v.bits_per_pixel = 16;
} else if (is_win(w, DAVINCIFB_WIN_VID1)) {
/* Rule 11 */
if (w->dm->windows[DAVINCIFB_WIN_VID0] &&
((w->dm->windows[DAVINCIFB_WIN_VID0]->x - w->x)
% 16)) {
dev_dbg(dev, "vid1 x should be multiple of 16 from "
"vid0\n");
((w->dm->windows[DAVINCIFB_WIN_VID0]->x - w->x) % 16)) {
dev_dbg(dev, "vid1 x should be multiple of 16 from vid0\n");
return -EINVAL;
}
/* Video1 may be in YUV or RGB888 format */
......@@ -1555,8 +1543,7 @@ static int davincifb_set_par(struct fb_info *info)
/* Memory offsets */
info->fix.line_length = v->xres_virtual * v->bits_per_pixel / 8;
offset = v->yoffset * info->fix.line_length +
v->xoffset * v->bits_per_pixel / 8;
offset = v->yoffset * info->fix.line_length + v->xoffset * v->bits_per_pixel / 8;
start = (u32) w->fb_base_phys + offset;
set_sdram_params(w, start, info->fix.line_length);
......@@ -1602,23 +1589,23 @@ static int davincifb_set_par(struct fb_info *info)
ths8200_set_480p_mode();
/* Enable all VENC, non-standard timing mode,
* master timing, HD, progressive */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC |
VENC_VMOD_VMD | VENC_VMOD_HDMD));
dispc_reg_out(VENC_VMOD,
(VENC_VMOD_VENC | VENC_VMOD_VMD | VENC_VMOD_HDMD));
}
else if (!strcmp(dmfb_modedb[mode].name, "720p")) {
ths8200_set_720p_mode();
/* Enable all VENC, non-standard timing mode,
* master timing, HD, progressive */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC |
VENC_VMOD_VMD | VENC_VMOD_HDMD));
dispc_reg_out(VENC_VMOD,
(VENC_VMOD_VENC | VENC_VMOD_VMD | VENC_VMOD_HDMD));
}
else if (!strcmp(dmfb_modedb[mode].name, "1080i")) {
ths8200_set_1080i_mode();
/* Enable all VENC, non-standard timing mode,
* master timing, HD, interlaced */
dispc_reg_out(VENC_VMOD, (VENC_VMOD_VENC |
VENC_VMOD_VMD | VENC_VMOD_HDMD |
VENC_VMOD_NSIT));
dispc_reg_out(VENC_VMOD,
(VENC_VMOD_VENC | VENC_VMOD_VMD |
VENC_VMOD_HDMD | VENC_VMOD_NSIT));
}
#endif
}
......@@ -1693,9 +1680,9 @@ static int davincifb_ioctl(struct fb_info *info, unsigned int cmd,
case FBIO_SETZOOM:
if (copy_from_user(&zoom, argp, sizeof(zoom)))
return -EFAULT;
if ((zoom.zoom_h == 2) || (zoom.zoom_h == 0)
|| (zoom.zoom_h == 1) || (zoom.zoom_v == 2)
|| (zoom.zoom_v == 0) || (zoom.zoom_v == 1)) {
if ((zoom.zoom_h == 2) || (zoom.zoom_h == 0) ||
(zoom.zoom_h == 1) || (zoom.zoom_v == 2) ||
(zoom.zoom_v == 0) || (zoom.zoom_v == 1)) {
if (!is_win(w, zoom.window_id))
return -EINVAL;
set_zoom(w, zoom.zoom_h, zoom.zoom_v);
......@@ -1822,8 +1809,7 @@ static int davincifb_pan_display(struct fb_var_screeninfo *var,
if ((var->xres_virtual * var->bits_per_pixel / 8) % 32)
return -EINVAL;
offset = var->yoffset * info->fix.line_length +
var->xoffset * var->bits_per_pixel / 8;
offset = var->yoffset * info->fix.line_length + var->xoffset * var->bits_per_pixel / 8;
start = (u32) w->fb_base_phys + offset;
if ((dispc_reg_in(VENC_VSTAT) & 0x00000010)==0x10)
......@@ -1974,8 +1960,7 @@ static int davincifb_probe(struct platform_device *pdev)
}
/* map the regions */
dm->mmio_base =
(unsigned long)ioremap(dm->mmio_base_phys, dm->mmio_size);
dm->mmio_base = (unsigned long)ioremap(dm->mmio_base_phys, dm->mmio_size);
if (!dm->mmio_base) {
dev_err(dm->dev, ": cannot map MMIO\n");
goto release_mmio;
......@@ -2005,24 +1990,19 @@ static int davincifb_probe(struct platform_device *pdev)
/* Field Inversion Workaround */
dispc_reg_out(OSD_MODE, 0x200);
dm->windows_mask = (1 << DAVINCIFB_WIN_OSD0) |
(1 << DAVINCIFB_WIN_OSD1) |
(1 << DAVINCIFB_WIN_VID0) |
(1 << DAVINCIFB_WIN_VID1);
dm->windows_mask = (1 << DAVINCIFB_WIN_OSD0) |(1 << DAVINCIFB_WIN_OSD1) |
(1 << DAVINCIFB_WIN_VID0) | (1 << DAVINCIFB_WIN_VID1);
if (dm_wins_probe(dm) < 0)
goto probe_error;
/* install our interrupt service routine */
if (request_irq(IRQ_VENCINT, davincifb_isr, IRQF_SHARED, MODULE_NAME,
dm)) {
dev_err(dm->dev, MODULE_NAME
": could not install interrupt service routine\n");
if (request_irq(IRQ_VENCINT, davincifb_isr, IRQF_SHARED, MODULE_NAME, dm)) {
dev_err(dm->dev, MODULE_NAME ": could not install interrupt service routine\n");
goto irq_error;
}
/* TODO remove this */
//dm->output_device_config(1);
dm->output =
video_output_register("venc", dm->dev, dm, &dm_venc_props);
dm->output = video_output_register("venc", dm->dev, dm, &dm_venc_props);
if (!dm->output)
goto venc_error;
platform_set_drvdata(pdev, dm);
......@@ -2104,10 +2084,8 @@ int __init davincifb_setup(char *options)
dmparams.format = COMPONENT;
}
} else if (!strncmp(this_opt, "format=", 7)) {
if (dmparams.output == LCD ||
dmparams.output == HD720P ||
dmparams.output == HD1080I ||
dmparams.output == HD480P)
if (dmparams.output == LCD || dmparams.output == HD720P ||
dmparams.output == HD1080I || dmparams.output == HD480P)
continue;
if (!strncmp(this_opt + 7, "composite", 9))
dmparams.format = COMPOSITE;
......@@ -2121,8 +2099,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID0);
else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos,
&ypos)) {
&xres, &yres, &xpos, &ypos)) {
dmparams.vid0_xres = xres;
dmparams.vid0_yres = yres;
dmparams.vid0_xpos = xpos;
......@@ -2132,8 +2109,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_VID1);
else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos,
&ypos)) {
&xres, &yres, &xpos, &ypos)) {
dmparams.vid1_xres = xres;
dmparams.vid1_yres = yres;
dmparams.vid1_xpos = xpos;
......@@ -2143,8 +2119,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD0);
else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos,
&ypos)) {
&xres, &yres, &xpos, &ypos)) {
dmparams.osd0_xres = xres;
dmparams.osd0_yres = yres;
dmparams.osd0_xpos = xpos;
......@@ -2154,8 +2129,7 @@ int __init davincifb_setup(char *options)
if (!strncmp(this_opt + 5, "off", 3))
dmparams.windows &= ~(1 << DAVINCIFB_WIN_OSD1);
else if (!parse_win_params(this_opt + 5,
&xres, &yres, &xpos,
&ypos)) {
&xres, &yres, &xpos, &ypos)) {
dmparams.osd1_xres = xres;
dmparams.osd1_yres = yres;
dmparams.osd1_xpos = xpos;
......@@ -2163,8 +2137,7 @@ int __init davincifb_setup(char *options)
}
}
}
printk(KERN_INFO "DaVinci: "
"Output on %s%s, Enabled windows: %s %s %s %s\n",
printk(KERN_INFO "DaVinci: " "Output on %s%s, Enabled windows: %s %s %s %s\n",
(dmparams.output == LCD) ? "LCD" :
(dmparams.output == HD720P) ? "HD720P":
(dmparams.output == HD1080I) ? "HD1080I":
......@@ -2194,8 +2167,7 @@ int __init davincifb_setup(char *options)
format_xres = DISP_XRES480P;
format_yres = DISP_YRES480P;
} else {
printk(KERN_INFO
"DaVinci:invalid format..defaulting width to 480\n");
printk(KERN_INFO "DaVinci:invalid format..defaulting width to 480\n");
}
dmparams.osd0_xres = osd0_default_var.xres = format_xres;
dmparams.osd1_xres = osd1_default_var.xres = format_xres;
......@@ -2218,12 +2190,9 @@ int __init davincifb_setup(char *options)
vid1_default_var.yres_virtual = format_yres * TRIPLE_BUF;
dmparams.osd0_phys = DAVINCI_FB_RESERVE_MEM_BASE;
dmparams.osd1_phys = dmparams.osd0_phys +
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.vid1_phys = dmparams.vid0_phys +
fb_window_size(format_xres, format_yres, TRIPLE_BUF);
dmparams.osd1_phys = dmparams.osd0_phys + 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.vid1_phys = dmparams.vid0_phys + fb_window_size(format_xres, format_yres, TRIPLE_BUF);
if (dmparams.windows & (1 << DAVINCIFB_WIN_VID0))
printk(KERN_INFO "Setting Video0 size %dx%d, "
......@@ -2267,8 +2236,7 @@ int __init davincifb_init(void)
for (i = 0; i < num_names && !done; i++) {
if (fb_get_options(names[i], &option)) {
printk(MODULE_NAME
": Disabled on command-line.\n");
printk(MODULE_NAME ": Disabled on command-line.\n");
return -ENODEV;
} else if (option) {
davincifb_setup(option);
......
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