Skip to content

Commit

Permalink
Merge branch 'viafb-next' of git://github.com/schandinat/linux-2.6
Browse files Browse the repository at this point in the history
* 'viafb-next' of git://github.com/schandinat/linux-2.6: (24 commits)
  viafb: Automatic OLPC XO-1.5 configuration
  viafb: remove unused CEA mode
  viafb: try to map less memory in case of failure
  viafb: use write combining for video ram
  viafb: add X server compatibility mode
  viafb: reduce OLPC refresh a bit
  viafb: fix OLPC XO 1.5 device connection
  viafb: fix OLPC DCON refresh rate
  viafb: delete clock and PLL initialization
  viafb: replace custom return values
  viafb: some small cleanup for global variables
  viafb: gather common good, old VGA initialization in one place
  viafb: add engine clock support
  viafb: add VIA slapping capability
  viafb: split clock and PLL code to an extra file
  viafb: add primary/secondary clock on/off switches
  viafb: add clock source selection and PLL power management support
  viafb: prepare for PLL separation
  viafb: call viafb_get_clk_value only in viafb_set_vclock
  viafb: remove unused max_hres/vres
  ...
  • Loading branch information
Linus Torvalds committed May 22, 2011
2 parents 1723800 + 8aa4d96 commit 71a8638
Show file tree
Hide file tree
Showing 19 changed files with 723 additions and 706 deletions.
11 changes: 11 additions & 0 deletions drivers/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1562,6 +1562,17 @@ config FB_VIA_DIRECT_PROCFS
correct output device configuration.
Its use is strongly discouraged.

config FB_VIA_X_COMPATIBILITY
bool "X server compatibility"
depends on FB_VIA
default n
help
This option reduces the functionality (power saving, ...) of the
framebuffer to avoid negative impact on the OpenChrome X server.
If you use any X server other than fbdev you should enable this
otherwise it should be safe to disable it and allow using all
features.

endif

config FB_NEOMAGIC
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/via/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ obj-$(CONFIG_FB_VIA) += viafb.o

viafb-y :=viafbdev.o hw.o via_i2c.o dvi.o lcd.o ioctl.o accel.o \
via_utility.o vt1636.o global.o tblDPASetting.o viamode.o \
via-core.o via-gpio.o via_modesetting.o
via-core.o via-gpio.o via_modesetting.o via_clock.o
6 changes: 0 additions & 6 deletions drivers/video/via/chip.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,11 @@ struct chip_information {
struct lvds_chip_information lvds_chip_info2;
};

struct crt_setting_information {
int iga_path;
};

struct tmds_setting_information {
int iga_path;
int h_active;
int v_active;
int max_pixel_clock;
int max_hres;
int max_vres;
};

struct lvds_setting_information {
Expand Down
160 changes: 12 additions & 148 deletions drivers/video/via/dvi.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,11 @@ static int tmds_register_read_bytes(int index, u8 *buff, int buff_len);
static void __devinit dvi_get_panel_size_from_DDCv1(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting);
static void __devinit dvi_get_panel_size_from_DDCv2(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting);
static int viafb_dvi_query_EDID(void);

static int check_tmds_chip(int device_id_subaddr, int device_id)
static inline bool check_tmds_chip(int device_id_subaddr, int device_id)
{
if (tmds_register_read(device_id_subaddr) == device_id)
return OK;
else
return FAIL;
return tmds_register_read(device_id_subaddr) == device_id;
}

void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
Expand All @@ -47,22 +41,13 @@ void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
DEBUG_MSG(KERN_INFO "viafb_init_dvi_size()\n");

viafb_dvi_sense();
switch (viafb_dvi_query_EDID()) {
case 1:
if (viafb_dvi_query_EDID() == 1)
dvi_get_panel_size_from_DDCv1(tmds_chip, tmds_setting);
break;
case 2:
dvi_get_panel_size_from_DDCv2(tmds_chip, tmds_setting);
break;
default:
printk(KERN_WARNING "viafb_init_dvi_size: DVI panel size undetected!\n");
break;
}

return;
}

int __devinit viafb_tmds_trasmitter_identify(void)
bool __devinit viafb_tmds_trasmitter_identify(void)
{
unsigned char sr2a = 0, sr1e = 0, sr3e = 0;

Expand Down Expand Up @@ -101,7 +86,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
viaparinfo->chip_info->
tmds_chip_info.tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR;
viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_31;
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID) != FAIL) {
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) {
/*
* Currently only support 12bits,dual edge,add 24bits mode later
*/
Expand All @@ -112,11 +97,10 @@ int __devinit viafb_tmds_trasmitter_identify(void)
viaparinfo->chip_info->tmds_chip_info.tmds_chip_name);
DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info->tmds_chip_info.i2c_port);
return OK;
return true;
} else {
viaparinfo->chip_info->tmds_chip_info.i2c_port = VIA_PORT_2C;
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)
!= FAIL) {
if (check_tmds_chip(VT1632_DEVICE_ID_REG, VT1632_DEVICE_ID)) {
tmds_register_write(0x08, 0x3b);
DEBUG_MSG(KERN_INFO "\n VT1632 TMDS ! \n");
DEBUG_MSG(KERN_INFO "\n %2d",
Expand All @@ -125,7 +109,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
DEBUG_MSG(KERN_INFO "\n %2d",
viaparinfo->chip_info->
tmds_chip_info.i2c_port);
return OK;
return true;
}
}

Expand All @@ -135,7 +119,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
((viafb_display_hardware_layout == HW_LAYOUT_DVI_ONLY) ||
(viafb_display_hardware_layout == HW_LAYOUT_LCD_DVI))) {
DEBUG_MSG(KERN_INFO "\n Integrated TMDS ! \n");
return OK;
return true;
}

switch (viaparinfo->chip_info->gfx_chip_name) {
Expand All @@ -159,7 +143,7 @@ int __devinit viafb_tmds_trasmitter_identify(void)
tmds_chip_info.tmds_chip_name = NON_TMDS_TRANSMITTER;
viaparinfo->chip_info->tmds_chip_info.
tmds_chip_slave_addr = VT1632_TMDS_I2C_ADDR;
return FAIL;
return false;
}

static void tmds_register_write(int index, u8 data)
Expand Down Expand Up @@ -306,63 +290,23 @@ static int viafb_dvi_query_EDID(void)
return EDID_VERSION_1; /* Found EDID1 Table */
}

data0 = (u8) tmds_register_read(0x00);
viaparinfo->chip_info->tmds_chip_info.tmds_chip_slave_addr = restore;
if (data0 == 0x20)
return EDID_VERSION_2; /* Found EDID2 Table */
else
return false;
return false;
}

/* Get Panel Size Using EDID1 Table */
static void __devinit dvi_get_panel_size_from_DDCv1(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting)
{
int i, max_h = 0, tmp, restore;
unsigned char rData;
int i, restore;
unsigned char EDID_DATA[18];

DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv1 \n");

restore = tmds_chip->tmds_chip_slave_addr;
tmds_chip->tmds_chip_slave_addr = 0xA0;

rData = tmds_register_read(0x23);
if (rData & 0x3C)
max_h = 640;
if (rData & 0xC0)
max_h = 720;
if (rData & 0x03)
max_h = 800;

rData = tmds_register_read(0x24);
if (rData & 0xC0)
max_h = 800;
if (rData & 0x1E)
max_h = 1024;
if (rData & 0x01)
max_h = 1280;

for (i = 0x25; i < 0x6D; i++) {
switch (i) {
case 0x26:
case 0x28:
case 0x2A:
case 0x2C:
case 0x2E:
case 0x30:
case 0x32:
case 0x34:
rData = tmds_register_read(i);
if (rData == 1)
break;
/* data = (data + 31) * 8 */
tmp = (rData + 31) << 3;
if (tmp > max_h)
max_h = tmp;
break;

case 0x36:
case 0x48:
case 0x5A:
Expand All @@ -383,91 +327,11 @@ static void __devinit dvi_get_panel_size_from_DDCv1(
}
}

tmds_setting->max_hres = max_h;
switch (max_h) {
case 640:
tmds_setting->max_vres = 480;
break;
case 800:
tmds_setting->max_vres = 600;
break;
case 1024:
tmds_setting->max_vres = 768;
break;
case 1280:
tmds_setting->max_vres = 1024;
break;
case 1400:
tmds_setting->max_vres = 1050;
break;
case 1440:
tmds_setting->max_vres = 1050;
break;
case 1600:
tmds_setting->max_vres = 1200;
break;
case 1920:
tmds_setting->max_vres = 1080;
break;
default:
DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d ! "
"set default panel size.\n", max_h);
break;
}

DEBUG_MSG(KERN_INFO "DVI max pixelclock = %d\n",
tmds_setting->max_pixel_clock);
tmds_chip->tmds_chip_slave_addr = restore;
}

/* Get Panel Size Using EDID2 Table */
static void __devinit dvi_get_panel_size_from_DDCv2(
struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting)
{
int restore;
unsigned char R_Buffer[2];

DEBUG_MSG(KERN_INFO "\n dvi_get_panel_size_from_DDCv2 \n");

restore = tmds_chip->tmds_chip_slave_addr;
tmds_chip->tmds_chip_slave_addr = 0xA2;

/* Horizontal: 0x76, 0x77 */
tmds_register_read_bytes(0x76, R_Buffer, 2);
tmds_setting->max_hres = R_Buffer[0] + (R_Buffer[1] << 8);

switch (tmds_setting->max_hres) {
case 640:
tmds_setting->max_vres = 480;
break;
case 800:
tmds_setting->max_vres = 600;
break;
case 1024:
tmds_setting->max_vres = 768;
break;
case 1280:
tmds_setting->max_vres = 1024;
break;
case 1400:
tmds_setting->max_vres = 1050;
break;
case 1440:
tmds_setting->max_vres = 1050;
break;
case 1600:
tmds_setting->max_vres = 1200;
break;
default:
DEBUG_MSG(KERN_INFO "Unknown panel size max resolution = %d! "
"set default panel size.\n", tmds_setting->max_hres);
break;
}

tmds_chip->tmds_chip_slave_addr = restore;
}

/* If Disable DVI, turn off pad */
void viafb_dvi_disable(void)
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/video/via/dvi.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
int viafb_dvi_sense(void);
void viafb_dvi_disable(void);
void viafb_dvi_enable(void);
int __devinit viafb_tmds_trasmitter_identify(void);
bool __devinit viafb_tmds_trasmitter_identify(void);
void __devinit viafb_init_dvi_size(struct tmds_chip_information *tmds_chip,
struct tmds_setting_information *tmds_setting);
void viafb_dvi_set_mode(struct VideoModeTable *videoMode, int mode_bpp,
Expand Down
4 changes: 0 additions & 4 deletions drivers/video/via/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ int viafb_hotplug_Yres = 480;
int viafb_hotplug_bpp = 32;
int viafb_hotplug_refresh = 60;
int viafb_primary_dev = None_Device;
unsigned int viafb_second_xres = 640;
unsigned int viafb_second_yres = 480;
unsigned int viafb_second_virtual_xres;
unsigned int viafb_second_virtual_yres;
int viafb_lcd_panel_id = LCD_PANEL_ID_MAXIMUM + 1;
struct fb_info *viafbinfo;
struct fb_info *viafbinfo1;
Expand Down
2 changes: 0 additions & 2 deletions drivers/video/via/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ extern int viafb_hotplug_bpp;
extern int viafb_hotplug_refresh;
extern int viafb_primary_dev;

extern unsigned int viafb_second_xres;
extern unsigned int viafb_second_yres;
extern int viafb_lcd_panel_id;

#endif /* __GLOBAL_H__ */
Loading

0 comments on commit 71a8638

Please sign in to comment.