static struct device_attribute display_attrs[] = {
__ATTR(name, S_IRUGO, display_show_name, NULL),
__ATTR(type, S_IRUGO, display_show_type, NULL),
- __ATTR(enable, S_IRUGO | /*S_IWUGO*/S_IWUSR, display_show_enable, display_store_enable),
+ __ATTR(enable, 0664, display_show_enable, display_store_enable),
__ATTR(connect, S_IRUGO, display_show_connect, NULL),
__ATTR(modes, S_IRUGO, display_show_modes, NULL),
- __ATTR(mode, S_IRUGO | /*S_IWUGO*/S_IWUSR, display_show_mode, display_store_mode)
+ __ATTR(mode, 0664, display_show_mode, display_store_mode)
};
static int display_suspend(struct device *dev, pm_message_t state)
{
case HDMI_1920x1080p_60Hz:
case HDMI_1920x1080p_50Hz:
+ #if 0
rk30_hdmi_config_phy_reg(0x158, 0x0E);
rk30_hdmi_config_phy_reg(0x15c, 0x00);
rk30_hdmi_config_phy_reg(0x160, 0x60);
rk30_hdmi_config_phy_reg(0x168, 0xDA);
rk30_hdmi_config_phy_reg(0x16c, 0xA2);
rk30_hdmi_config_phy_reg(0x170, 0x0e);
- rk30_hdmi_config_phy_reg(0x174, 0x20);
+ rk30_hdmi_config_phy_reg(0x174, 0x22);
+ rk30_hdmi_config_phy_reg(0x178, 0x00);
+ #else
+ rk30_hdmi_config_phy_reg(0x158, 0x0E);
+ rk30_hdmi_config_phy_reg(0x15c, 0x00);
+ rk30_hdmi_config_phy_reg(0x160, 0x77);
+ rk30_hdmi_config_phy_reg(0x164, 0x00);
+ rk30_hdmi_config_phy_reg(0x168, 0xDA);
+ rk30_hdmi_config_phy_reg(0x16c, 0xA1);
+ rk30_hdmi_config_phy_reg(0x170, 0x06);
+ rk30_hdmi_config_phy_reg(0x174, 0x22);
rk30_hdmi_config_phy_reg(0x178, 0x00);
+ #endif
break;
case HDMI_1920x1080i_60Hz:
//set_audio_if I2S
HDMIWrReg(AUDIO_CTRL1, 0x00); //internal CTS, disable down sample, i2s input, disable MCLK
HDMIWrReg(AUDIO_CTRL2, 0x40);
- HDMIWrReg(I2S_AUDIO_CTRL, v_I2S_MODE(I2S_MODE_STANDARD) | v_I2S_CHANNEL( (audio->channel + audio->channel%2)/2));
+ HDMIWrReg(I2S_AUDIO_CTRL, v_I2S_MODE(I2S_MODE_STANDARD) | v_I2S_CHANNEL( audio->channel - ((audio->channel%2)? 0 : 1) ) );
HDMIWrReg(I2S_INPUT_SWAP, 0x00); //no swap
HDMIMskReg(value, AV_CTRL1, m_AUDIO_SAMPLE_RATE, v_AUDIO_SAMPLE_RATE(rate))
HDMIWrReg(SRC_NUM_AUDIO_LEN, word_length);
I2S_CHANNEL_5_6 = 7,
I2S_CHANNEL_7_8 = 0xf
};
-#define v_I2S_CHANNEL(n) ( n << 2 )
+#define v_I2S_CHANNEL(n) ( (n) << 2 )
#define I2S_INPUT_SWAP 0x40
#define EXT_VIDEO_PARA_VDELAY 0xF8
#define EXT_VIDEO_PARA_VSYNCWIDTH 0xFC
+#define PHY_PLL_SPEED 0x158
+ #define v_TEST_EN(n) (n << 6)
+ #define v_PLLA_BYPASS(n) (n << 4)
+ #define v_PLLB_SPEED(n) (n << 2)
+ #define v_PLLA_SPEED(n) (n)
+ enum {
+ PLL_SPEED_LOWEST = 0,
+ PLL_SPEED_MIDLOW,
+ PLL_SPEED_MIDHIGH,
+ PLL_SPEED_HIGHEST
+ };
+
+#define PHY_PLL_17 0x15c // PLL A & B config bit 17
+ #define v_PLLA_BIT17(n) (n << 2)
+ #define v_PLLB_BIT17(n) (n << 1)
+
+#define PHY_BGR 0x160
+ #define v_BGR_DISCONNECT(n) (n << 7)
+ #define v_BGR_V_OFFSET(n) (n << 4)
+ #define v_BGR_I_OFFSET(n) (n)
+
+#define PHY_PLLA_1 0x164
+#define PHY_PLLA_2 0x168
+#define PHY_PLLB_1 0x16c
+#define PHY_PLLB_2 0x170
+
+#define PHY_DRIVER_PREEMPHASIS 0x174
+ #define v_TMDS_SWING(n) (n << 4)
+ #define v_PRE_EMPHASIS(n) (n)
+
+#define PHY_PLL_16_AML 0x178 // PLL A & B config bit 16 and AML control
+ #define v_PLLA_BIT16(n) (n << 5)
+ #define v_PLLB_BIT16(n) (n << 4)
+ #define v_AML(n) (n)
+
#define INTR_MASK1 0x248
#define INTR_MASK2 0x24c
#define INTR_MASK3 0x258
if(rc == 0 && hdmi->lcdc->load_screen) {
hdmi->lcdc->load_screen(hdmi->lcdc, 0);
- par = &dev_drv->layer_par[1];
+ par = dev_drv->layer_par[1];
par->xsize = screen->x_res;
par->ysize = screen->y_res;
hdmi->lcdc->set_par(hdmi->lcdc, 1);
#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/display-sys.h>
+#include <linux/interrupt.h>
#include "rk30_hdmi.h"
static int hdmi_get_enable(struct rk_display_device *device)
{
struct hdmi *hdmi = device->priv_data;
-// if(hdmi->enable == enable)
-// return 0;
-// hdmi->enable = enable;
-// hdmi->command = HDMI_CONFIG_DISPLAY;
-// queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
+ if(hdmi->enable == enable)
+ return 0;
+ hdmi->enable = enable;
+ if(enable == 0) {
+ disable_irq(hdmi->irq);
+ hdmi->command = HDMI_CONFIG_ENABLE;
+ queue_delayed_work(hdmi->workqueue, &hdmi->delay_work, 0);
+ }
+ else
+ enable_irq(hdmi->irq);
return 0;
}
hdmi->audio.rate = HDMI_AUDIO_DEFAULT_RATE;
hdmi->audio.word_length = HDMI_AUDIO_DEFAULT_WORD_LENGTH;
+ memset(&hdmi->edid, 0, sizeof(struct hdmi_edid));
+ INIT_LIST_HEAD(&hdmi->edid.modelist);
return 0;
}
hotplug = rk30_hdmi_detect_hotplug();
hdmi_dbg(hdmi->dev, "[%s] hotplug %02x curvalue %d\n", __FUNCTION__, hotplug, hdmi->hotplug);
- if(hotplug != hdmi->hotplug)
- {
- hdmi->hotplug = hotplug;
- if(hdmi->hotplug == HDMI_HPD_INSERT)
- hdmi->state = READ_PARSE_EDID;
- else {
+
+ if(hotplug == HDMI_HPD_REMOVED) {
hdmi_sys_remove();
+ if(hotplug != hdmi->hotplug) {
+ hdmi->hotplug = hotplug;
kobject_uevent_env(&hdmi->dev->kobj, KOBJ_REMOVE, envp);
+ }
+ if(hdmi->wait == 1) {
+ complete(&hdmi->complete);
+ hdmi->wait = 0;
+ }
return;
}
+ else if(hotplug != hdmi->hotplug) {
+ hdmi->hotplug = hotplug;
+ hdmi->state = READ_PARSE_EDID;
}
- else if(hotplug == HDMI_HPD_REMOVED)
- rk30_hdmi_removed();
do {
state_last = hdmi->state;