aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-02-12 15:08:41 -0500
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2012-02-12 17:12:45 -0500
commit4e5527c9d1f373cb7dda6eec3af1d7b9659cdf85 (patch)
tree2ee867025ca4fc64150feb9e78629e3b9e2888dc /drivers
parent532f9169db21fbffd07cc44075c7ea1859c07806 (diff)
viafb: make SAMM to also work on LCD
This patch enables LCD to handle SAMM without dual fb. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/via/chip.h2
-rw-r--r--drivers/video/via/hw.c27
-rw-r--r--drivers/video/via/lcd.c18
-rw-r--r--drivers/video/via/lcd.h3
4 files changed, 22 insertions, 28 deletions
diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h
index 3ebf20c06eef..c2ecdb5a94da 100644
--- a/drivers/video/via/chip.h
+++ b/drivers/video/via/chip.h
@@ -146,8 +146,6 @@ struct tmds_setting_information {
146 146
147struct lvds_setting_information { 147struct lvds_setting_information {
148 int iga_path; 148 int iga_path;
149 int h_active;
150 int v_active;
151 int bpp; 149 int bpp;
152 int lcd_panel_hres; 150 int lcd_panel_hres;
153 int lcd_panel_vres; 151 int lcd_panel_vres;
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index e8725c5235c8..d35ced701396 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1530,11 +1530,7 @@ void viafb_update_device_setting(int hres, int vres, int bpp, int flag)
1530 viaparinfo->tmds_setting_info->h_active = hres; 1530 viaparinfo->tmds_setting_info->h_active = hres;
1531 viaparinfo->tmds_setting_info->v_active = vres; 1531 viaparinfo->tmds_setting_info->v_active = vres;
1532 1532
1533 viaparinfo->lvds_setting_info->h_active = hres;
1534 viaparinfo->lvds_setting_info->v_active = vres;
1535 viaparinfo->lvds_setting_info->bpp = bpp; 1533 viaparinfo->lvds_setting_info->bpp = bpp;
1536 viaparinfo->lvds_setting_info2->h_active = hres;
1537 viaparinfo->lvds_setting_info2->v_active = vres;
1538 viaparinfo->lvds_setting_info2->bpp = bpp; 1534 viaparinfo->lvds_setting_info2->bpp = bpp;
1539 } else { 1535 } else {
1540 1536
@@ -1543,16 +1539,11 @@ void viafb_update_device_setting(int hres, int vres, int bpp, int flag)
1543 viaparinfo->tmds_setting_info->v_active = vres; 1539 viaparinfo->tmds_setting_info->v_active = vres;
1544 } 1540 }
1545 1541
1546 if (viaparinfo->lvds_setting_info->iga_path == IGA2) { 1542 if (viaparinfo->lvds_setting_info->iga_path == IGA2)
1547 viaparinfo->lvds_setting_info->h_active = hres;
1548 viaparinfo->lvds_setting_info->v_active = vres;
1549 viaparinfo->lvds_setting_info->bpp = bpp; 1543 viaparinfo->lvds_setting_info->bpp = bpp;
1550 } 1544
1551 if (IGA2 == viaparinfo->lvds_setting_info2->iga_path) { 1545 if (IGA2 == viaparinfo->lvds_setting_info2->iga_path)
1552 viaparinfo->lvds_setting_info2->h_active = hres;
1553 viaparinfo->lvds_setting_info2->v_active = vres;
1554 viaparinfo->lvds_setting_info2->bpp = bpp; 1546 viaparinfo->lvds_setting_info2->bpp = bpp;
1555 }
1556 } 1547 }
1557} 1548}
1558 1549
@@ -1933,7 +1924,8 @@ int viafb_setmode(int video_bpp, int video_bpp1)
1933 if (viafb_SAMM_ON && 1924 if (viafb_SAMM_ON &&
1934 (viaparinfo->lvds_setting_info->iga_path == IGA2)) { 1925 (viaparinfo->lvds_setting_info->iga_path == IGA2)) {
1935 viaparinfo->lvds_setting_info->bpp = video_bpp1; 1926 viaparinfo->lvds_setting_info->bpp = video_bpp1;
1936 viafb_lcd_set_mode(viaparinfo->lvds_setting_info, 1927 viafb_lcd_set_mode(&var2, cxres, cyres,
1928 viaparinfo->lvds_setting_info,
1937 &viaparinfo->chip_info->lvds_chip_info); 1929 &viaparinfo->chip_info->lvds_chip_info);
1938 } else { 1930 } else {
1939 /* IGA1 doesn't have LCD scaling, so set it center. */ 1931 /* IGA1 doesn't have LCD scaling, so set it center. */
@@ -1942,7 +1934,8 @@ int viafb_setmode(int video_bpp, int video_bpp1)
1942 LCD_CENTERING; 1934 LCD_CENTERING;
1943 } 1935 }
1944 viaparinfo->lvds_setting_info->bpp = video_bpp; 1936 viaparinfo->lvds_setting_info->bpp = video_bpp;
1945 viafb_lcd_set_mode(viaparinfo->lvds_setting_info, 1937 viafb_lcd_set_mode(&viafbinfo->var, 0, 0,
1938 viaparinfo->lvds_setting_info,
1946 &viaparinfo->chip_info->lvds_chip_info); 1939 &viaparinfo->chip_info->lvds_chip_info);
1947 } 1940 }
1948 } 1941 }
@@ -1950,7 +1943,8 @@ int viafb_setmode(int video_bpp, int video_bpp1)
1950 if (viafb_SAMM_ON && 1943 if (viafb_SAMM_ON &&
1951 (viaparinfo->lvds_setting_info2->iga_path == IGA2)) { 1944 (viaparinfo->lvds_setting_info2->iga_path == IGA2)) {
1952 viaparinfo->lvds_setting_info2->bpp = video_bpp1; 1945 viaparinfo->lvds_setting_info2->bpp = video_bpp1;
1953 viafb_lcd_set_mode(viaparinfo->lvds_setting_info2, 1946 viafb_lcd_set_mode(&var2, cxres, cyres,
1947 viaparinfo->lvds_setting_info2,
1954 &viaparinfo->chip_info->lvds_chip_info2); 1948 &viaparinfo->chip_info->lvds_chip_info2);
1955 } else { 1949 } else {
1956 /* IGA1 doesn't have LCD scaling, so set it center. */ 1950 /* IGA1 doesn't have LCD scaling, so set it center. */
@@ -1959,7 +1953,8 @@ int viafb_setmode(int video_bpp, int video_bpp1)
1959 LCD_CENTERING; 1953 LCD_CENTERING;
1960 } 1954 }
1961 viaparinfo->lvds_setting_info2->bpp = video_bpp; 1955 viaparinfo->lvds_setting_info2->bpp = video_bpp;
1962 viafb_lcd_set_mode(viaparinfo->lvds_setting_info2, 1956 viafb_lcd_set_mode(&viafbinfo->var, 0, 0,
1957 viaparinfo->lvds_setting_info2,
1963 &viaparinfo->chip_info->lvds_chip_info2); 1958 &viaparinfo->chip_info->lvds_chip_info2);
1964 } 1959 }
1965 } 1960 }
diff --git a/drivers/video/via/lcd.c b/drivers/video/via/lcd.c
index 5f3b4e394e82..02cfdc8d7edd 100644
--- a/drivers/video/via/lcd.c
+++ b/drivers/video/via/lcd.c
@@ -55,8 +55,7 @@ static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres,
55 int panel_vres); 55 int panel_vres);
56static void via_pitch_alignment_patch_lcd( 56static void via_pitch_alignment_patch_lcd(
57 struct lvds_setting_information *plvds_setting_info, 57 struct lvds_setting_information *plvds_setting_info,
58 struct lvds_chip_information 58 struct lvds_chip_information *plvds_chip_info, int hres);
59 *plvds_chip_info);
60static void lcd_patch_skew_dvp0(struct lvds_setting_information 59static void lcd_patch_skew_dvp0(struct lvds_setting_information
61 *plvds_setting_info, 60 *plvds_setting_info,
62 struct lvds_chip_information *plvds_chip_info); 61 struct lvds_chip_information *plvds_chip_info);
@@ -456,14 +455,13 @@ static void load_lcd_scaling(int set_hres, int set_vres, int panel_hres,
456 455
457static void via_pitch_alignment_patch_lcd( 456static void via_pitch_alignment_patch_lcd(
458 struct lvds_setting_information *plvds_setting_info, 457 struct lvds_setting_information *plvds_setting_info,
459 struct lvds_chip_information 458 struct lvds_chip_information *plvds_chip_info, int hres)
460 *plvds_chip_info)
461{ 459{
462 unsigned char cr13, cr35, cr65, cr66, cr67; 460 unsigned char cr13, cr35, cr65, cr66, cr67;
463 unsigned long dwScreenPitch = 0; 461 unsigned long dwScreenPitch = 0;
464 unsigned long dwPitch; 462 unsigned long dwPitch;
465 463
466 dwPitch = plvds_setting_info->h_active * (plvds_setting_info->bpp >> 3); 464 dwPitch = hres * (plvds_setting_info->bpp >> 3);
467 if (dwPitch & 0x1F) { 465 if (dwPitch & 0x1F) {
468 dwScreenPitch = ((dwPitch + 31) & ~31) >> 3; 466 dwScreenPitch = ((dwPitch + 31) & ~31) >> 3;
469 if (plvds_setting_info->iga_path == IGA2) { 467 if (plvds_setting_info->iga_path == IGA2) {
@@ -548,13 +546,14 @@ static void lcd_patch_skew(struct lvds_setting_information
548} 546}
549 547
550/* LCD Set Mode */ 548/* LCD Set Mode */
551void viafb_lcd_set_mode(struct lvds_setting_information *plvds_setting_info, 549void viafb_lcd_set_mode(const struct fb_var_screeninfo *var, u16 cxres,
550 u16 cyres, struct lvds_setting_information *plvds_setting_info,
552 struct lvds_chip_information *plvds_chip_info) 551 struct lvds_chip_information *plvds_chip_info)
553{ 552{
554 int set_iga = plvds_setting_info->iga_path; 553 int set_iga = plvds_setting_info->iga_path;
555 int mode_bpp = plvds_setting_info->bpp; 554 int mode_bpp = plvds_setting_info->bpp;
556 int set_hres = plvds_setting_info->h_active; 555 int set_hres = cxres ? cxres : var->xres;
557 int set_vres = plvds_setting_info->v_active; 556 int set_vres = cyres ? cyres : var->yres;
558 int panel_hres = plvds_setting_info->lcd_panel_hres; 557 int panel_hres = plvds_setting_info->lcd_panel_hres;
559 int panel_vres = plvds_setting_info->lcd_panel_vres; 558 int panel_vres = plvds_setting_info->lcd_panel_vres;
560 u32 clock; 559 u32 clock;
@@ -613,7 +612,8 @@ void viafb_lcd_set_mode(struct lvds_setting_information *plvds_setting_info,
613 viafb_write_reg_mask(CR6A, VIACR, 0x01, BIT0); 612 viafb_write_reg_mask(CR6A, VIACR, 0x01, BIT0);
614 613
615 /* Patch for non 32bit alignment mode */ 614 /* Patch for non 32bit alignment mode */
616 via_pitch_alignment_patch_lcd(plvds_setting_info, plvds_chip_info); 615 via_pitch_alignment_patch_lcd(plvds_setting_info, plvds_chip_info,
616 set_hres);
617} 617}
618 618
619static void integrated_lvds_disable(struct lvds_setting_information 619static void integrated_lvds_disable(struct lvds_setting_information
diff --git a/drivers/video/via/lcd.h b/drivers/video/via/lcd.h
index 77ca7b862e68..8f3e4e06156c 100644
--- a/drivers/video/via/lcd.h
+++ b/drivers/video/via/lcd.h
@@ -76,7 +76,8 @@ void __devinit viafb_init_lvds_output_interface(struct lvds_chip_information
76 *plvds_chip_info, 76 *plvds_chip_info,
77 struct lvds_setting_information 77 struct lvds_setting_information
78 *plvds_setting_info); 78 *plvds_setting_info);
79void viafb_lcd_set_mode(struct lvds_setting_information *plvds_setting_info, 79void viafb_lcd_set_mode(const struct fb_var_screeninfo *var, u16 cxres,
80 u16 cyres, struct lvds_setting_information *plvds_setting_info,
80 struct lvds_chip_information *plvds_chip_info); 81 struct lvds_chip_information *plvds_chip_info);
81bool __devinit viafb_lvds_trasmitter_identify(void); 82bool __devinit viafb_lvds_trasmitter_identify(void);
82void viafb_init_lvds_output_interface(struct lvds_chip_information 83void viafb_init_lvds_output_interface(struct lvds_chip_information