struct rtc_wkalrm alarm;
struct wake_lock wake_lock;
};
-
+static struct i2c_client *gClient = NULL;
static int hym8563_i2c_read_regs(struct i2c_client *client, u8 reg, u8 buf[], unsigned len)
{
int ret;
mutex_unlock(&hym8563->mutex);
return 0;
}
+#ifdef CONFIG_HDMI_SAVE_DATA
+int hdmi_get_data(void)
+{
+ u8 regs=0;
+ if(gClient)
+ hym8563_i2c_read_regs(gClient, RTC_T_COUNT, ®s, 1);
+ else
+ {
+ printk("%s rtc has no init\n",__func__);
+ return -1;
+ }
+ if(regs==0 || regs==0xff){
+ printk("%s rtc has no hdmi data\n",__func__);
+ return -1;
+ }
+ return (regs-1);
+}
+
+int hdmi_set_data(int data)
+{
+ u8 regs = (data+1)&0xff;
+ if(gClient)
+ hym8563_i2c_set_regs(gClient, RTC_T_COUNT, ®s, 1);
+ else
+ {
+ printk("%s rtc has no init\n",__func__);
+ return -1;
+ }
+ return 0;
+}
+EXPORT_SYMBOL(hdmi_get_data);
+EXPORT_SYMBOL(hdmi_set_data);
+#endif
#if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE)
static int hym8563_i2c_open_alarm(struct i2c_client *client)
{
if (!hym8563) {
return -ENOMEM;
}
-
+ gClient = client;
hym8563->client = client;
mutex_init(&hym8563->mutex);
wake_lock_init(&hym8563->wake_lock, WAKE_LOCK_SUSPEND, "rtc_hym8563");
if HDMI
source "drivers/video/hdmi/chips/Kconfig"
+
+config HDMI_SAVE_DATA
+ bool "enable hdmi save data"
+ help
+ Enable hdmi save data in rtc register
+
#config HDMI_DUAL_DISP
# bool "hdmi support dual display"
# help
anx7150_param_chg(anx);\r
return 0;\r
}\r
+\r
static int anx7150_init(struct hdmi *hdmi)\r
{\r
struct anx7150_pdata *anx = hdmi_priv(hdmi);\r
-\r
+#ifdef CONFIG_HDMI_SAVE_DATA\r
+ int hdmi_data = hdmi_get_data();\r
+ if(hdmi_data<0){\r
+ hdmi_set_data((hdmi->resolution&0x7)|((hdmi->scale&0x1f)<<3));\r
+ }\r
+ else{\r
+ hdmi->resolution = hdmi_data&0x7;\r
+ hdmi->scale_set= ((hdmi_data>>3)&0x1f) + MIN_SCALE;\r
+ hdmi->scale = hdmi->scale_set;\r
+ }\r
+#endif\r
anx->init = 0;\r
- hdmi_changed(hdmi, 1);\r
+ hdmi_changed(hdmi,1);\r
\r
return 0;\r
}\r
+static void anx7150_init_work_func(struct work_struct *work)\r
+{\r
+ struct anx7150_pdata *anx = container_of(work, struct anx7150_pdata, work.work);\r
+\r
+ if(anx!=NULL)\r
+ anx7150_init(anx->hdmi);\r
+ else\r
+ printk("anx7150_init_work_func err\n");\r
+}\r
static struct hdmi_ops anx7150_ops = {\r
.set_param = anx7150_set_param,\r
.hdmi_precent = anx7150_precent,\r
return -ENOMEM;\r
}\r
hdmi->ops = &anx7150_ops;\r
- hdmi->display_on = HDMI_DISABLE;\r
+ hdmi->display_on = HDMI_DEFAULT_MODE;\r
hdmi->hdcp_on = HDMI_DISABLE;\r
hdmi->audio_fs = HDMI_I2S_DEFAULT_Fs;\r
hdmi->resolution = HDMI_DEFAULT_RESOLUTION;\r
register_early_suspend(&anx->early_suspend);\r
#endif\r
anx7150_unplug(anx->client);\r
+ INIT_DELAYED_WORK(&anx->work,anx7150_init_work_func);\r
+ schedule_delayed_work(&anx->work, msecs_to_jiffies(2000));\r
dev_info(&client->dev, "anx7150 i2c probe ok\n");\r
return 0;\r
err_gpio_free:\r
struct hdmi* hdmi = get_hdmi_struct(0);\r
if(!hdmi)\r
return 100;\r
- else\r
+ else if(hdmi->mode == DISP_ON_HDMI)\r
return hdmi->scale;\r
+ else\r
+ return 100;\r
}\r
\r
int hdmi_set_scale(int event, char *data, int len)\r
#include <linux/string.h>\r
\r
int debug_en = 0;\r
+\r
+#ifndef CONFIG_HDMI_SAVE_DATA\r
+int hdmi_get_data(void)\r
+{\r
+return 0;\r
+}\r
+int hdmi_set_data(int data)\r
+{\r
+return 0;\r
+}\r
+#endif\r
+\r
static ssize_t hdmi_show_state_attrs(struct device *dev,\r
struct device_attribute *attr,\r
char *buf) \r
char *p;\r
const char *q;\r
int set_param = 0, tmp = 0;\r
-\r
+ #ifdef CONFIG_HDMI_SAVE_DATA\r
+ int hdmi_data=0;\r
+ #endif\r
if(hdmi->mode == DISP_ON_LCD)\r
{\r
dev_err(dev, "display on lcd, do not set parameter!\n");\r
hdmi->scale_set = tmp;\r
hdmi_dbg(dev, "set scale = %d\n", tmp);\r
hdmi->scale = tmp;\r
+ #ifdef CONFIG_HDMI_SAVE_DATA\r
+ hdmi_data = hdmi_get_data();\r
+ if(hdmi_data<0)\r
+ hdmi->ops->init(hdmi);\r
+ hdmi_data = (((hdmi->scale-MIN_SCALE)&0x1f)<<3) | (hdmi_data & 0x7);\r
+ hdmi_set_data(hdmi_data);\r
+ #endif\r
}\r
else\r
{\r
set_param |= 1;\r
hdmi_dbg(dev, "set resolution = %d\n", tmp);\r
hdmi->resolution = tmp;\r
+ #ifdef CONFIG_HDMI_SAVE_DATA\r
+ hdmi_data = hdmi_get_data();\r
+ if(hdmi_data<0)\r
+ hdmi->ops->init(hdmi);\r
+ hdmi_data = (hdmi->resolution&0x7) | (hdmi_data & 0xf8);\r
+ hdmi_set_data(hdmi_data);\r
+ #endif\r
}\r
}\r
else\r
debug_en = tmp;\r
return size;\r
}\r
+#if 0\r
static ssize_t hdmi_restore_init_attrs(struct device *dev, \r
struct device_attribute *attr,\r
const char *buf, size_t size)\r
hdmi->ops->init(hdmi);\r
return size;\r
}\r
+#endif\r
static struct device_attribute hdmi_attrs[] = {\r
__ATTR(state, 0777, hdmi_show_state_attrs, hdmi_restore_state_attrs),\r
__ATTR(enable, 0777, hdmi_show_switch_attrs, hdmi_restore_switch_attrs),\r
__ATTR(debug, 0777, hdmi_show_debug_attrs, hdmi_restore_debug_attrs),\r
- __ATTR(init, 0777, NULL, hdmi_restore_init_attrs),\r
+ //__ATTR(init, 0777, NULL, hdmi_restore_init_attrs),\r
};\r
-\r
int hdmi_create_attrs(struct hdmi *hdmi)\r
{\r
int rc = 0;\r
extern int hdmi_set_scale(int event, char *data, int len);\r
extern int fb_get_video_mode(void);\r
extern int display_on_hdmi(void);\r
+extern int hdmi_get_data(void);\r
+extern int hdmi_set_data(int data);\r
#endif\r