#include "dsp/dspmgr.h"
#include "sys/spcprm.h"
#include "dsp_common.h"

/* 解像度に対応するPLL設定値 */
AG903_SPCPrmPllnParam DSP_SAMPLE_PLL[DSP_SAMPLE_RES_NUM] = {
	/* XGA 64MHz */
	{
		.ms		= 3,
		.ns		= 8,
		.div	= 0,
		.frange	= 1,
		.src	= 0,	/* OSC (PLL1-3全てで'0') */
		.en		= 1		/* 有効 */
	},
	/* SXGA 108MHz */
	{
		.ms		= 2,
		.ns		= 9,
		.div	= 0,
		.frange	= 2,
		.src	= 0,	/* OSC (PLL1-3全てで'0') */
		.en		= 1		/* 有効 */
	},
	/* FULLHD 148MHz */
	{
		.ms		= 3,
		.ns		= 37,
		.div	= 1,
		.frange	= 3,
		.src	= 0,	/* OSC (PLL1-3全てで'0') */
		.en		= 1		/* 有効 */
	},
	/* WUXGA 156MHz */
	{
		.ms		= 2,
		.ns		= 13,
		.div	= 0,
		.frange	= 3,
		.src	= 0,	/* OSC (PLL1-3全てで'0') */
		.en		= 1		/* 有効 */
	},
	/* VGA 25.333MHz */
	{
		.ms		= 3,
		.ns		= 19,
		.div	= 5,
		.frange	= 3,
		.src	= 0,	/* OSC (PLL1-3全てで'0') */
		.en		= 1		/* 有効 */
	},
};


/* 解像度に対応する同期パラメータ */
AG903_DSPMgrSyncParam DSP_SAMPLE_SYNCPARAM[DSP_SAMPLE_RES_NUM] = {
	/* XGA (65MHz) */
	{
		.rgbde_sel					= AG903_DSP_RGBDE_SIGNAL_DATA,
		.field_hsync_polarity		= AG903_DSP_POLARITY_NEGA,
		.vsync_polarity				= AG903_DSP_POLARITY_NEGA,
		.hrz_frontporch 			= 24,
		.hrz_pulsewidth 			= 136,
		.hrz_backporch  			= 160,
		.vt_frontporch  			= 3,
		.vt_pulsewidth  			= 6,
		.vt_backporch   			= 29,
		.even_backporch_plus1		= 0,
		.even_frontporch_plus1		= 0,
		.odd_backporch_plus1		= 0,
		.odd_frontporch_plus1		= 0
	},
	/* SXGA (108MHz) */
	{
		.rgbde_sel					= AG903_DSP_RGBDE_SIGNAL_DATA,
		.field_hsync_polarity		= AG903_DSP_POLARITY_POSI,
		.vsync_polarity				= AG903_DSP_POLARITY_POSI,
		.hrz_frontporch 			= 48,
		.hrz_pulsewidth 			= 112,
		.hrz_backporch  			= 248,
		.vt_frontporch  			= 1,
		.vt_pulsewidth  			= 3,
		.vt_backporch   			= 38,
		.even_backporch_plus1		= 0,
		.even_frontporch_plus1		= 0,
		.odd_backporch_plus1		= 0,
		.odd_frontporch_plus1		= 0
	},
	/* FULLHD (148.5MHz) */
	{
		.rgbde_sel					= AG903_DSP_RGBDE_SIGNAL_DATA,
		.field_hsync_polarity		= AG903_DSP_POLARITY_POSI,
		.vsync_polarity				= AG903_DSP_POLARITY_POSI,
		.hrz_frontporch 			= 88,
		.hrz_pulsewidth 			= 44,
		.hrz_backporch  			= 148,
		.vt_frontporch  			= 4,
		.vt_pulsewidth  			= 5,
		.vt_backporch   			= 36,
		.even_backporch_plus1		= 0,
		.even_frontporch_plus1		= 0,
		.odd_backporch_plus1		= 0,
		.odd_frontporch_plus1		= 0
	},
	/* WUXGA (154MHz) */
	{
		.rgbde_sel					= AG903_DSP_RGBDE_SIGNAL_DATA,
		.field_hsync_polarity		= AG903_DSP_POLARITY_POSI,
		.vsync_polarity				= AG903_DSP_POLARITY_NEGA,
		.hrz_frontporch 			= 48,
		.hrz_pulsewidth 			= 32,
		.hrz_backporch  			= 80,
		.vt_frontporch  			= 3,
		.vt_pulsewidth  			= 6,
		.vt_backporch   			= 26,
		.even_backporch_plus1		= 0,
		.even_frontporch_plus1		= 0,
		.odd_backporch_plus1		= 0,
		.odd_frontporch_plus1		= 0
	},
	/* VGA (25.333MHz) */
	{
		.rgbde_sel					= AG903_DSP_RGBDE_SIGNAL_DATA,
		.field_hsync_polarity		= AG903_DSP_POLARITY_NEGA,
		.vsync_polarity				= AG903_DSP_POLARITY_NEGA,
		.hrz_frontporch 			= 16,
		.hrz_pulsewidth 			= 96,
		.hrz_backporch  			= 48,
		.vt_frontporch  			= 10,
		.vt_pulsewidth  			= 2,
		.vt_backporch   			= 33,
		.even_backporch_plus1		= 0,
		.even_frontporch_plus1		= 0,
		.odd_backporch_plus1		= 0,
		.odd_frontporch_plus1		= 0
	},
};
