msm: mdss: add sysfs node for panel status

Some tools like MMI need know whether panel is working
correctly or not, so add a panel_status node in sysfs.

Signed-off-by: Ray Zhang <rayz@codeaurora.org>
Change-Id: I2f5da3c850f83230476f0cd66f2bf11b9234ed32
This commit is contained in:
Ray Zhang 2015-01-08 14:53:11 +08:00
parent 42a293909b
commit c762b3dbe6
3 changed files with 30 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -1387,6 +1387,10 @@ static int mdss_dsi_event_handler(struct mdss_panel_data *pdata,
rc = mdss_dsi_register_recovery_handler(ctrl_pdata,
(struct mdss_intf_recovery *)arg);
break;
case MDSS_EVENT_DSI_PANEL_STATUS:
if (ctrl_pdata->check_status)
rc = ctrl_pdata->check_status(ctrl_pdata);
break;
default:
pr_debug("%s: unhandled event=%d\n", __func__, event);
break;

View file

@ -2,7 +2,7 @@
* Core MDSS framebuffer driver.
*
* Copyright (C) 2007 Google Incorporated
* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -528,6 +528,22 @@ static ssize_t mdss_fb_get_panel_info(struct device *dev,
return ret;
}
static ssize_t mdss_fb_get_panel_status(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct fb_info *fbi = dev_get_drvdata(dev);
struct msm_fb_data_type *mfd = fbi->par;
int ret;
int panel_status;
panel_status = mdss_fb_send_panel_event(mfd,
MDSS_EVENT_DSI_PANEL_STATUS, NULL);
ret = scnprintf(buf, PAGE_SIZE, "panel_status=%s\n",
panel_status > 0 ? "alive" : "dead");
return ret;
}
/*
* mdss_fb_lpm_enable() - Function to Control LowPowerMode
* @mfd: Framebuffer data structure for display
@ -626,7 +642,8 @@ static DEVICE_ATTR(msm_fb_src_split_info, S_IRUGO, mdss_fb_get_src_split_info,
NULL);
static DEVICE_ATTR(msm_fb_thermal_level, S_IRUGO | S_IWUSR,
mdss_fb_get_thermal_level, mdss_fb_set_thermal_level);
static DEVICE_ATTR(msm_fb_panel_status, S_IRUGO,
mdss_fb_get_panel_status, NULL);
static struct attribute *mdss_fb_attrs[] = {
&dev_attr_msm_fb_type.attr,
&dev_attr_msm_fb_split.attr,
@ -636,6 +653,7 @@ static struct attribute *mdss_fb_attrs[] = {
&dev_attr_msm_fb_panel_info.attr,
&dev_attr_msm_fb_src_split_info.attr,
&dev_attr_msm_fb_thermal_level.attr,
&dev_attr_msm_fb_panel_status.attr,
NULL,
};

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -181,6 +181,9 @@ struct mdss_intf_recovery {
* - 1: update to command mode
* @MDSS_EVENT_REGISTER_RECOVERY_HANDLER: Event to recover the interface in
* case there was any errors detected.
* @ MDSS_EVENT_DSI_PANEL_STATUS:Event to check the panel status
* <= 0: panel check fail
* > 0: panel check success
*/
enum mdss_intf_events {
MDSS_EVENT_RESET = 1,
@ -203,6 +206,7 @@ enum mdss_intf_events {
MDSS_EVENT_DSI_STREAM_SIZE,
MDSS_EVENT_DSI_DYNAMIC_SWITCH,
MDSS_EVENT_REGISTER_RECOVERY_HANDLER,
MDSS_EVENT_DSI_PANEL_STATUS,
};
struct lcd_panel_info {