aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/via/hw.c
diff options
context:
space:
mode:
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-18 23:47:28 +0000
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>2010-09-24 02:15:16 +0000
commit7f0e153e2c0b15aa7427ad4ac550640e1e2e9c33 (patch)
tree98f82deced910e6dcc9cc9bde3fb139d699261f8 /drivers/video/via/hw.c
parente029ab0d02b94d633d8e82a46dfdb7fd94a62216 (diff)
downloadkernel_samsung_smdk4412-7f0e153e2c0b15aa7427ad4ac550640e1e2e9c33.zip
kernel_samsung_smdk4412-7f0e153e2c0b15aa7427ad4ac550640e1e2e9c33.tar.gz
kernel_samsung_smdk4412-7f0e153e2c0b15aa7427ad4ac550640e1e2e9c33.tar.bz2
viafb: add function to change sync polarity per device
At the moment only the sync polarity for CRT is handled but there are also bits for controlling the sync polarity for other output devices. Add a function to change those similar to the other output device functions. There is no runtime change yet as the code still handles only CRT. Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Joseph Chan <JosephChan@via.com.tw>
Diffstat (limited to 'drivers/video/via/hw.c')
-rw-r--r--drivers/video/via/hw.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c
index 132d811..d6bbb0a 100644
--- a/drivers/video/via/hw.c
+++ b/drivers/video/via/hw.c
@@ -1151,6 +1151,24 @@ void via_set_state(u32 devices, u8 state)
set_lvds2_state(state);
}
+void via_set_sync_polarity(u32 devices, u8 polarity)
+{
+ if (polarity & ~(VIA_HSYNC_NEGATIVE | VIA_VSYNC_NEGATIVE)) {
+ printk(KERN_WARNING "viafb: Unsupported polarity: %d\n",
+ polarity);
+ return;
+ }
+
+ if (devices & VIA_CRT)
+ via_write_misc_reg_mask(polarity << 6, 0xC0);
+ if (devices & VIA_DVP1)
+ via_write_reg_mask(VIACR, 0x9B, polarity << 5, 0x60);
+ if (devices & VIA_LVDS1)
+ via_write_reg_mask(VIACR, 0x99, polarity << 5, 0x60);
+ if (devices & VIA_LVDS2)
+ via_write_reg_mask(VIACR, 0x97, polarity << 5, 0x60);
+}
+
u32 via_parse_odev(char *input, char **end)
{
char *ptr = input;
@@ -2026,10 +2044,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table,
/* update polarity for CRT timing */
if (crt_table[index].h_sync_polarity == NEGATIVE)
- polarity |= BIT6;
+ polarity |= VIA_HSYNC_NEGATIVE;
if (crt_table[index].v_sync_polarity == NEGATIVE)
- polarity |= BIT7;
- via_write_misc_reg_mask(polarity, BIT6 | BIT7);
+ polarity |= VIA_VSYNC_NEGATIVE;
+ via_set_sync_polarity(VIA_CRT, polarity);
if (set_iga == IGA1) {
viafb_unlock_crt();