Commit 2eaa4a30 authored by 吴智聪(John Wu)'s avatar 吴智聪(John Wu)

Merge branch 'neuros' of...

Merge branch 'neuros' of ssh://git@git.neuros.com.cn/git/git-pub/osd20/linux-davinci-2.6 into neuros
parents b37fe3a8 4a94fb83
...@@ -812,6 +812,26 @@ static inline void dm_win_position_get(const struct dm_win_info *w, ...@@ -812,6 +812,26 @@ static inline void dm_win_position_get(const struct dm_win_info *w,
*yl = v->yres; *yl = v->yres;
} }
static void dm_win_clear(struct dm_win_info *w)
{
struct fb_var_screeninfo *v = &(w->info.var);
int bg_color = 0x00;
switch (v->bits_per_pixel) {
case 16:
/* yuv422 */
if (is_win(w, DAVINCIFB_WIN_VID0) || is_win(w, DAVINCIFB_WIN_VID1))
bg_color = 0x88;
break;
/* attribute */
case 4:
if (is_win(w, DAVINCIFB_WIN_OSD1))
bg_color = 0x77;
break;
}
memset((void *)w->fb_base, bg_color, w->fb_size);
}
/** /**
* Checks if the rectangle formed by the first four coordinates is inside the * Checks if the rectangle formed by the first four coordinates is inside the
* rectangle formed by the second four coordinates * rectangle formed by the second four coordinates
...@@ -1153,7 +1173,6 @@ static int dm_wins_remove(struct dm_info *info) ...@@ -1153,7 +1173,6 @@ static int dm_wins_remove(struct dm_info *info)
static int dm_win_probe(struct dm_win_info *w) static int dm_win_probe(struct dm_win_info *w)
{ {
int ret; int ret;
int bg_color = 0x00;
struct fb_info *info = &w->info; struct fb_info *info = &w->info;
struct device *dev = w->dm->dev; struct device *dev = w->dm->dev;
struct fb_var_screeninfo *vinfo = &info->var; struct fb_var_screeninfo *vinfo = &info->var;
...@@ -1177,20 +1196,7 @@ static int dm_win_probe(struct dm_win_info *w) ...@@ -1177,20 +1196,7 @@ static int dm_win_probe(struct dm_win_info *w)
return -EINVAL; return -EINVAL;
} }
/* clear the memory */ /* clear the memory */
switch (info->var.bits_per_pixel) { dm_win_clear(w);
case 16:
/* yuv422 */
if (is_win(w, DAVINCIFB_WIN_VID0) || is_win(w, DAVINCIFB_WIN_VID1))
bg_color = 0x88;
break;
/* attribute */
case 4:
if (is_win(w, DAVINCIFB_WIN_OSD1))
bg_color = 0x77;
break;
}
memset((void *)w->fb_base, bg_color, w->fb_size);
/* create the fb device */ /* create the fb device */
if (register_framebuffer(info) < 0) { if (register_framebuffer(info) < 0) {
dev_err(dev, "Unable to register %s framebuffer\n", dev_err(dev, "Unable to register %s framebuffer\n",
...@@ -1371,7 +1377,8 @@ static int davincifb_check_var(struct fb_var_screeninfo *var, ...@@ -1371,7 +1377,8 @@ static int davincifb_check_var(struct fb_var_screeninfo *var,
} }
else else
v.xres_virtual = v.xres; v.xres_virtual = v.xres;
v.yres_virtual = (w->fb_size / v.bits_per_pixel * 8) / v.xres_virtual; v.yres_virtual = (w->fb_size / v.bits_per_pixel * 8) /
(v.xres_virtual ? v.xres_virtual : 1);
if (v.yres_virtual < v.yres) if (v.yres_virtual < v.yres)
v.yres = v.yres_virtual; v.yres = v.yres_virtual;
...@@ -1510,6 +1517,7 @@ static int davincifb_set_par(struct fb_info *info) ...@@ -1510,6 +1517,7 @@ static int davincifb_set_par(struct fb_info *info)
interlaced = v->vmode == FB_VMODE_INTERLACED ? 1 : 0; interlaced = v->vmode == FB_VMODE_INTERLACED ? 1 : 0;
set_win_position(w, w->x, w->y, v->xres, v->yres / (interlaced + 1)); set_win_position(w, w->x, w->y, v->xres, v->yres / (interlaced + 1));
set_win_mode(w); set_win_mode(w);
dm_win_clear(w);
if (!is_win(w, DAVINCIFB_WIN_VID0)) if (!is_win(w, DAVINCIFB_WIN_VID0))
return 0; return 0;
......
...@@ -67,6 +67,9 @@ ...@@ -67,6 +67,9 @@
#define LEFTLOP_LEVEL_CTRL_REG 86 #define LEFTLOP_LEVEL_CTRL_REG 86
#define RIGHTLOP_LEVEL_CTRL_REG 93 #define RIGHTLOP_LEVEL_CTRL_REG 93
#define CODEC_CLKIN_CTRL_REG 101
#define CLOCK_GENERATION_CTRL_REG 102
/* aic32 control registers value */ /* aic32 control registers value */
#define PAGE0 0x0 #define PAGE0 0x0
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <sound/davincisound.h> #include <sound/davincisound.h>
#include <asm/gpio.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -120,6 +121,8 @@ ...@@ -120,6 +121,8 @@
#define LSB6BIT(x) ((unsigned char)((x) << 2)) #define LSB6BIT(x) ((unsigned char)((x) << 2))
#define CLK_OUT0_FUNCTION_BIT 16 #define CLK_OUT0_FUNCTION_BIT 16
#define CLK_OUT1_FUNCTION_BIT 17
#define TIMIN_FUNCTION_BIT 18
#define ASP_FUNCTION_BIT 10 #define ASP_FUNCTION_BIT 10
#define SET_BIT(addr, bit) outl(inl(addr) | (1U << bit), addr) #define SET_BIT(addr, bit) outl(inl(addr) | (1U << bit), addr)
...@@ -900,18 +903,18 @@ int davinci_set_samplerate(long sample_rate) ...@@ -900,18 +903,18 @@ int davinci_set_samplerate(long sample_rate)
(reg_info[count].Fsref == 48000)) { (reg_info[count].Fsref == 48000)) {
/* For MCLK = 27 MHz and to get Fsref = 48kHz /* For MCLK = 27 MHz and to get Fsref = 48kHz
Fsref = (MCLK * k * R)/(2048 * p); Fsref = (MCLK * k * R)/(2048 * p);
Select P = 1, R= 1, K = 7.2817, Select P = 4, R= 1, K = 14.5635
which results in J = 3, D = 6408 */ which results in J = 14, D = 5635 */
/*Enable the PLL | Q-value | P-value */ /*Enable the PLL | Q-value | P-value */
audio_aic32_write(PLL_A_REG, audio_aic32_write(PLL_A_REG,
PLL_ENABLE | 0x01); PLL_ENABLE | 0x04);
audio_aic32_write(PLL_B_REG, audio_aic32_write(PLL_B_REG,
(3 << 2)); /* J-value */ (14 << 2)); /* J-value */
audio_aic32_write(PLL_C_REG, audio_aic32_write(PLL_C_REG,
MSB8BIT(6408)); /* D-value 8-MSB's */ MSB8BIT(5635)); /* D-value 8-MSB's */
audio_aic32_write(PLL_D_REG, audio_aic32_write(PLL_D_REG,
LSB6BIT(6408)); /* D-value 6-LSB's */ LSB6BIT(5635)); /* D-value 6-LSB's */
} }
...@@ -920,18 +923,18 @@ int davinci_set_samplerate(long sample_rate) ...@@ -920,18 +923,18 @@ int davinci_set_samplerate(long sample_rate)
/* MCLK = 27 MHz and to get Fsref = 44.1kHz /* MCLK = 27 MHz and to get Fsref = 44.1kHz
Fsref = (MCLK * k * R)/(2048 * p); Fsref = (MCLK * k * R)/(2048 * p);
Select P = 1, R =1, K = 3.3450, Select P = 4, R =1, K = 13.3802
which results in J = 3, D = 3450 */ which results in J = 13, D = 3802 */
/*Enable the PLL | Q-value | P-value */ /*Enable the PLL | Q-value | P-value */
audio_aic32_write(PLL_A_REG, audio_aic32_write(PLL_A_REG,
PLL_ENABLE | 0x01); PLL_ENABLE | 0x04);
audio_aic32_write(PLL_B_REG, audio_aic32_write(PLL_B_REG,
(3 << 2)); /* J-value */ (13 << 2)); /* J-value */
audio_aic32_write(PLL_C_REG, audio_aic32_write(PLL_C_REG,
MSB8BIT(3450)); /* D-value 8-MSB's */ MSB8BIT(3802)); /* D-value 8-MSB's */
audio_aic32_write(PLL_D_REG, audio_aic32_write(PLL_D_REG,
LSB6BIT(3450)); /* D-value 6-LSB's */ LSB6BIT(3802)); /* D-value 6-LSB's */
} }
#else #else
...@@ -1105,6 +1108,12 @@ static inline void aic32_configure() ...@@ -1105,6 +1108,12 @@ static inline void aic32_configure()
audio_aic32_write(SERIAL_DATA_CTRL_REG, audio_aic32_write(SERIAL_DATA_CTRL_REG,
BIT_CLK_MASTER | WORD_CLK_MASTER); BIT_CLK_MASTER | WORD_CLK_MASTER);
#endif #endif
//PLLDIV_IN uses MCLK
audio_aic32_write(CLOCK_GENERATION_CTRL_REG, 0x02);
//CODEC_CLKIN = PLLDIV_OUT
audio_aic32_write(CODEC_CLKIN_CTRL_REG, 0x0);
aic32_update(SET_LINE, aic32_local.line); aic32_update(SET_LINE, aic32_local.line);
aic32_update(SET_VOLUME, aic32_local.volume); aic32_update(SET_VOLUME, aic32_local.volume);
...@@ -1263,6 +1272,8 @@ static int davinci_aic32_probe(void) ...@@ -1263,6 +1272,8 @@ static int davinci_aic32_probe(void)
codec_stop, NULL/* client data */); codec_stop, NULL/* client data */);
#endif #endif
aic32_configure();
/* Announcement Time */ /* Announcement Time */
DPRINTK(PLATFORM_NAME " " CODEC_NAME " audio support initialized\n"); DPRINTK(PLATFORM_NAME " " CODEC_NAME " audio support initialized\n");
return 0; return 0;
......
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