Commit c57eddf7 authored by charles.park's avatar charles.park Committed by Gerrit Code Review

Merge "ODROIDXU3 : add HDMI signal strength control parameter." into odroidxu3-3.10.y

parents 70795b38 c6753e99
......@@ -218,6 +218,243 @@ struct hdmiphy_config {
u8 conf[32];
};
//-----------------------------------------------------------------------------
#if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE)
//-----------------------------------------------------------------------------
//
// TMDS data amplitude control.
// 1LSB corresponds to 20 mVdiff amplitude level.
// tx_amp_lvl : 0 = 760 mVdiff(Min), 31 = 1380 mVdiff(Max)
//
// Hardkernel default hdmi_tx_amp_lvl = 31(1380 mVdiff);
// Samsung default hdmi_tx_amp_lvl = 13(1020 mVdiff);
//
//-----------------------------------------------------------------------------
unsigned long gTxAmpLevel = 31; // Default setup
static int __init hdmi_tx_amp_lvl(char *line)
{
if(kstrtoul(line, 10, &gTxAmpLevel) != 0) gTxAmpLevel = 31;
if(gTxAmpLevel > 31) gTxAmpLevel = 31;
return 0;
}
__setup("hdmi_tx_amp_lvl=", hdmi_tx_amp_lvl);
//-----------------------------------------------------------------------------
//
// TMDS data amplitude fine control for each channel.
// 1LSB corresponds to 20 mVdiff amplitude level.
// tx_lvl : 0 = 0 mVdiff(Min), 3 = 60 mVdiff(Max)
//
// Hardkernel default
// hdmi_tx_lvl_ch0 = 3, hdmi_tx_lvl_ch1 = 3, hdmi_tx_lvl_ch2 = 3,
// Samsung default
// hdmi_tx_lvl_ch0 = 1, hdmi_tx_lvl_ch1 = 0, hdmi_tx_lvl_ch2 = 2,
//
//-----------------------------------------------------------------------------
unsigned long gTxLevelCh0 = 3; // Default setup
unsigned long gTxLevelCh1 = 3; // Default setup
unsigned long gTxLevelCh2 = 3; // Default setup
static int __init hdmi_tx_lvl_ch0(char *line)
{
if(kstrtoul(line, 10, &gTxLevelCh0) != 0) gTxLevelCh0 = 3;
if(gTxLevelCh0 > 3) gTxLevelCh0 = 3;
return 0;
}
static int __init hdmi_tx_lvl_ch1(char *line)
{
if(kstrtoul(line, 10, &gTxLevelCh1) != 0) gTxLevelCh1 = 3;
if(gTxLevelCh1 > 3) gTxLevelCh1 = 3;
return 0;
}
static int __init hdmi_tx_lvl_ch2(char *line)
{
if(kstrtoul(line, 10, &gTxLevelCh2) != 0) gTxLevelCh2 = 3;
if(gTxLevelCh2 > 3) gTxLevelCh2 = 3;
return 0;
}
__setup("hdmi_tx_lvl_ch0=", hdmi_tx_lvl_ch0);
__setup("hdmi_tx_lvl_ch1=", hdmi_tx_lvl_ch1);
__setup("hdmi_tx_lvl_ch2=", hdmi_tx_lvl_ch2);
//-----------------------------------------------------------------------------
//
// TMDS data pre-emphasis level control.
// 1LSB corresponds to -0.45dB emphasis level except for 1
// tx_emp_lvl : 0 = 0 db(Min), 1 = -0.25 db, 2 = 0.7 db, 15 = -7.45 db(Max)
//
// Hardkernel default hdmi_tx_emp_lvl = 6 (-2.50 db);
// Samsung default hdmi_tx_emp_lvl = 6 (-2.50 db);
//
//-----------------------------------------------------------------------------
unsigned long gTxEmpLevel = 6; // Default setup
static int __init hdmi_tx_emp_lvl(char *line)
{
if(kstrtoul(line, 10, &gTxEmpLevel) != 0) gTxEmpLevel = 6;
if(gTxEmpLevel > 15) gTxEmpLevel = 6;
return 0;
}
__setup("hdmi_tx_emp_lvl=", hdmi_tx_emp_lvl);
//-----------------------------------------------------------------------------
//
// TMDS clock amplitude control.
// 1LSB corresponds to 20 mVdiff amplitude level.
// clk_amp_lvl : 0 = 790 mVdiff(Min), 31 = 1410 mVdiff(Max)
//
// Hardkernel default hdmi_clk_amp_lvl = 31 (1410 mVdiff)
// Samsung default hdmi_clk_amp_lvl = 16 (1110 mVdiff)
//
//-----------------------------------------------------------------------------
unsigned long gClkAmpLevel = 31; // Default setup
static int __init hdmi_clk_amp_lvl(char *line)
{
if(kstrtoul(line, 10, &gClkAmpLevel) != 0) gClkAmpLevel = 31;
if(gClkAmpLevel > 31) gClkAmpLevel = 31;
return 0;
}
__setup("hdmi_clk_amp_lvl=", hdmi_clk_amp_lvl);
//-----------------------------------------------------------------------------
//
// TMDS data source termination resistor control.
// tx_res :
// 0 = Source Termination OFF(Min), 1 = 200 ohm, 2 = 300 ohm, 3 = 120 ohm(Max)
//
// Hardkernrel default hdmi_tx_res = 0 (Source Termination OFF)
// Samsung default hdmi_tx_res = 0 (Source Termination OFF)
//
//-----------------------------------------------------------------------------
unsigned long gTxRes = 0; // Default setup
static int __init hdmi_tx_res(char *line)
{
if(kstrtoul(line, 10, &gTxRes) != 0) gTxRes = 0;
if(gTxRes > 3) gTxRes = 0;
return 0;
}
__setup("hdmi_tx_res=", hdmi_tx_res);
//-----------------------------------------------------------------------------
#if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE_DEBUG)
void hdmi_phy_tune_info(unsigned char *buffer)
{
unsigned char value;
printk("========================================\n");
printk(" HDMI PHY TUNE INFO\n");
printk("========================================\n");
value = buffer[16] & 0x0F; value <<= 1;
value |= (buffer[15] & 0x80) ? 0x01 : 0x00;
printk("TX_AMP_LVL[%d] (760 mVdiff ~ 1380 mVdiff) = %d mVdiff\n",
value, 760 + (unsigned short)value * 20);
value = (buffer[4] & 0xC0) >> 6;
printk("TX_LVL_CH0[%d] (0 mVdiff ~ 60 mVdiff) = %d mVdiff\n",
value, value * 20);
value = buffer[19] & 0x03;
printk("TX_LVL_CH1[%d] (0 mVdiff ~ 60 mVdiff) = %d mVdiff\n",
value, value * 20);
value = buffer[23] & 0x03;
printk("TX_LVL_CH2[%d] (0 mVdiff ~ 60 mVdiff) = %d mVdiff\n",
value, value * 20);
value = (buffer[16] & 0xF0) >> 4;
printk("TX_EMP_LVL[%d] (0 db ~ -7.45 db) = ", value);
if(value == 1) printk("-0.25 db\n");
else {
if(value) printk("-%d.%02d db\n",
(25 + 45 * (unsigned short)(value -1)) / 100,
(25 + 45 * (unsigned short)(value -1)) % 100);
else printk("0 db\n");
}
value = (buffer[23] & 0xF8) >> 3;
printk("TX_CLK_LVL[%d] (790 mVdiff ~ 1410 mVdiff) = %d mVdiff\n",
value, 790 + (unsigned short)value * 20);
value = (buffer[15] & 0x30) >> 4;
printk("TX_RES[%d] = ", value);
switch(value) {
case 0:
default : printk("Source Termination OFF\n");
break;
case 1: printk("200 ohm\n");
break;
case 2: printk("300 ohm\n");
break;
case 3: printk("120 ohm\n");
break;
}
printk("========================================\n");
}
#endif // #if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE_DEBUG)
//-----------------------------------------------------------------------------
void hdmi_phy_tune(unsigned char *buffer)
{
// TxAmpLevel Control
buffer[16] &= (~0x0F); buffer[15] &= (~0x80);
buffer[16] |= (gTxAmpLevel >> 1) & 0x0F;
buffer[15] |= (gTxAmpLevel & 0x01) ? 0x80 : 0x00;
// TxLevel Control 0
buffer[4] &= (~0xC0);
buffer[4] |= (gTxLevelCh0 << 6) & 0xC0;
// TxLevel Control 1
buffer[19] &= (~0x03);
buffer[19] |= (gTxLevelCh1 & 0x03);
// TxLevel Control 2
buffer[23] &= (~0x03);
buffer[23] |= (gTxLevelCh2 & 0x03);
// TxEmpLevel Control
buffer[16] &= (~0xF0);
buffer[16] |= (gTxEmpLevel << 4) & 0xF0;
//ClkAmpLevel Control
buffer[23] &= (~0xF8);
buffer[23] |= (gClkAmpLevel << 3) & 0xF8;
// TxRes Control
buffer[15] &= (~0x30);
buffer[15] |= (gTxRes << 4) & 0x30;
}
//-----------------------------------------------------------------------------
#endif // #if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE)
//-----------------------------------------------------------------------------
/* list of phy config settings */
static const struct hdmiphy_config hdmiphy_v13_configs[] = {
{
......@@ -642,20 +879,36 @@ static int hdmiphy_reg_writeb(struct hdmi_context *hdata,
static int hdmiphy_reg_write_buf(struct hdmi_context *hdata,
u32 reg_offset, const u8 *buf, u32 len)
{
u8 buffer[32];
if ((reg_offset + len) > 32)
return -EINVAL;
memset(buffer, 0x00, sizeof(buffer));
memcpy(buffer, buf, len);
#if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE)
hdmi_phy_tune(buffer);
#if defined(CONFIG_ODROID_EXYNOS5_HDMI_PHY_TUNE_DEBUG)
// Current HDMI-PHY Info Display
hdmi_phy_tune_info(buffer);
#endif
#endif
if (hdata->hdmiphy_port) {
int ret;
ret = i2c_master_send(hdata->hdmiphy_port, buf, len);
ret = i2c_master_send(hdata->hdmiphy_port, buffer, len);
if (ret == len)
return 0;
return ret;
} else {
int i;
for (i = 0; i < len; i++)
writeb(buf[i], hdata->regs_hdmiphy +
writeb(buffer[i], hdata->regs_hdmiphy +
((reg_offset + i)<<2));
return 0;
}
......
......@@ -28,5 +28,20 @@ config ODROID_EXYNOS5_IOBOARD_DEBUG
---help---
Enables the IOBOARD Debug Message
config ODROID_EXYNOS5_HDMI_PHY_TUNE
bool "Enable HDMI-PHY tune functions"
depends on MACH_ODROIDXU3
default y
help
Enables HDMI-PHY tune functions.
config ODROID_EXYNOS5_HDMI_PHY_TUNE_DEBUG
depends on MACH_ODROIDXU3 && ODROID_EXYNOS5_HDMI_PHY_TUNE
bool "Enable HDMI-PHY tune info display"
depends on MACH_ODROIDXU3
default n
help
Enables HDMI-PHY tune info display.
endmenu
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