diff options
Diffstat (limited to 'src/panel/gx2_9211.c')
-rw-r--r-- | src/panel/gx2_9211.c | 79 |
1 files changed, 41 insertions, 38 deletions
diff --git a/src/panel/gx2_9211.c b/src/panel/gx2_9211.c index 7d46b9c..b34a19d 100644 --- a/src/panel/gx2_9211.c +++ b/src/panel/gx2_9211.c @@ -34,13 +34,13 @@ #include "gx2_9211.h" #include "pnl_defs.h" -#if defined(_WIN32) /* windows */ +#if defined(_WIN32) /* windows */ #include "gfx_defs.h" extern DEV_STATUS gfx_msr_read(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); extern DEV_STATUS gfx_msr_write(unsigned int device, unsigned int msrRegister, - Q_WORD * msrValue); + Q_WORD * msrValue); #endif static unsigned long FPBaseAddr; @@ -80,45 +80,45 @@ SetFPBaseAddr(unsigned long addr) ****************************************************************************/ void protected_mode_access(unsigned long mode, - unsigned long width, unsigned long addr, char *pdata) + unsigned long width, unsigned long addr, char *pdata) { - void *ptr = (void *)(FPBaseAddr + addr); + void *ptr = (void *) (FPBaseAddr + addr); /* type specific buffer pointers */ - char *byte_data = (char *)pdata; - unsigned long *word_data = (unsigned long *)pdata; - unsigned long *dword_data = (unsigned long *)pdata; + char *byte_data = (char *) pdata; + unsigned long *word_data = (unsigned long *) pdata; + unsigned long *dword_data = (unsigned long *) pdata; if (mode == GX2_READ) { switch (width) { case FOUR_BYTES: - *(dword_data) = (unsigned long)(*(unsigned long *)ptr); + *(dword_data) = (unsigned long) (*(unsigned long *) ptr); break; case TWO_BYTES: - *(word_data) = (unsigned long)(*(unsigned long *)ptr); + *(word_data) = (unsigned long) (*(unsigned long *) ptr); break; default: - *(byte_data) = (char)(*(char *)ptr); + *(byte_data) = (char) (*(char *) ptr); break; } - } /* end GX2_READ */ + } /* end GX2_READ */ else if (mode == GX2_WRITE) { switch (width) { case FOUR_BYTES: - *(unsigned long *)ptr = *dword_data; + *(unsigned long *) ptr = *dword_data; break; case TWO_BYTES: - *(unsigned long *)ptr = *word_data; + *(unsigned long *) ptr = *word_data; break; default: - *(char *)ptr = *byte_data; + *(char *) ptr = *byte_data; break; - } /* end switch(mode) */ + } /* end switch(mode) */ } /* end case GX2_WRITE */ return; -} /* End of protected_mode_access. */ +} /* End of protected_mode_access. */ /************************************************************************* * void write_video_reg64_low( unsigned long offset, unsigned long value ) @@ -132,8 +132,8 @@ void write_video_reg64_low(unsigned long offset, unsigned long value) { protected_mode_access(GX2_WRITE, FOUR_BYTES, - FPBaseAddr + offset, (char *)&value); -} /*end write_video_reg64_low() */ + FPBaseAddr + offset, (char *) &value); +} /*end write_video_reg64_low() */ /************************************************************************* * unsigned long read_video_reg64_low( unsigned long offset ) @@ -149,9 +149,9 @@ read_video_reg64_low(unsigned long offset) unsigned long data; protected_mode_access(GX2_READ, FOUR_BYTES, - FPBaseAddr + offset, (char *)&data); + FPBaseAddr + offset, (char *) &data); return (data); -} /*end read_video_reg64_low() */ +} /*end read_video_reg64_low() */ /***************************************************************************** * void Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data) @@ -174,11 +174,12 @@ Redcloud_fp_reg(int mode, unsigned long address, unsigned long *data) { if (mode == GX2_READ) { *data = read_video_reg64_low(address); - } else { + } + else { write_video_reg64_low(address, *data); } -} /* End of Redcloud_fp_reg() */ +} /* End of Redcloud_fp_reg() */ /*------------------------------------------------------------------- * @@ -200,7 +201,8 @@ set_Redcloud_92xx_mode_params(int mode) msrValue.low &= ~GX2_VP_PAD_SELECT_MASK; if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { msrValue.low = GX2_VP_PAD_SELECT_TFT; - } else { + } + else { msrValue.low = GX2_VP_PAD_SELECT_DSTN; } gfx_msr_write(RC_ID_DF, GX2_VP_MSR_PAD_SELECT, &msrValue); @@ -208,17 +210,17 @@ set_Redcloud_92xx_mode_params(int mode) /* Turn the 92xx power off before setting any new parameters. */ temp_data = pMode->power_management & ~GX2_FP_PM_PWR_ON; - Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, (unsigned long *)&temp_data); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, (unsigned long *) &temp_data); /* Set 9211 registers using the desired panel settings */ Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING1, - (unsigned long *)&pMode->panel_timing1); + (unsigned long *) &pMode->panel_timing1); /* On Redcloud, bit 31 is now reserved. */ temp_data = pMode->panel_timing2 & 0x7FFFFFFF; Redcloud_fp_reg(GX2_WRITE, GX2_FP_PAN_TIMING2, - (unsigned long *)&temp_data); + (unsigned long *) &temp_data); /* On Redcloud TFT parts, set this to 0x70 so all 8 bits per color run * thru fp crc but only non-TFT parts. Otherwise, set it to be 0x50. @@ -226,30 +228,31 @@ set_Redcloud_92xx_mode_params(int mode) */ if (pMode->panel_type == PNL_TFT || pMode->panel_type == PNL_TWOP) { temp_data = GX2_FP_CRC_PASS_THRU_MASK; - } else { + } + else { temp_data = pMode->rev_C_dither_frc; } Redcloud_fp_reg(GX2_WRITE, GX2_FP_DITH_FR_CNTRL, - (unsigned long *)&temp_data); + (unsigned long *) &temp_data); Redcloud_fp_reg(GX2_WRITE, GX2_FP_BLFSR, - (unsigned long *)&pMode->blue_lsfr_seed); + (unsigned long *) &pMode->blue_lsfr_seed); Redcloud_fp_reg(GX2_WRITE, GX2_FP_RLFSR, - (unsigned long *)&pMode->red_green_lsfr_seed); + (unsigned long *) &pMode->red_green_lsfr_seed); /* Set the memory information, then the power register last. * This will turn the panel on at the 9211. */ - Redcloud_fp_reg(GX2_READ, GX2_FP_FBB, (unsigned long *)&base_data); + Redcloud_fp_reg(GX2_READ, GX2_FP_FBB, (unsigned long *) &base_data); if (base_data != 0x41780000) { base_data = 0x41780000; - Redcloud_fp_reg(GX2_WRITE, GX2_FP_FBB, (unsigned long *)&base_data); + Redcloud_fp_reg(GX2_WRITE, GX2_FP_FBB, (unsigned long *) &base_data); } Redcloud_fp_reg(GX2_WRITE, GX2_FP_PWR_MAN, - (unsigned long *)&pMode->power_management); + (unsigned long *) &pMode->power_management); -} /*end set_92xx_mode_params() */ +} /*end set_92xx_mode_params() */ /* ----------------------------------------------------------------------- * SET_FLAT_PANEL_MODE @@ -277,11 +280,11 @@ set_Redcloud_92xx_mode(Pnl_PanelStat * pstat) /* SET THE 92xx FOR THE SELECTED MODE */ set_Redcloud_92xx_mode_params(mode); return TRUE; - } /* end if() */ - } /* end for() */ + } /* end if() */ + } /* end for() */ return FALSE; -} /* end set_Centaurus_92xx_mode() */ +} /* end set_Centaurus_92xx_mode() */ void Redcloud_9211init(Pnl_PanelStat * pstat) |