mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 14:13:01 -04:00
msm/display: add more panel info sys node
msm/display: Add more panel info sys node for moto care. Use drm_conn->kdev to get /sys/class/drm/card0-DSI-1 handle: panelId panelName panelVer panelRegDA panelSupplier Change-Id: Iefb5dc5816a885fda0c69700d2dd9ffe2eeb43a0 Signed-off-by: wangyq13 <wangyq13@lenovo.com> Reviewed-on: https://gerrit.mot.com/1845582 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Dezhen Hou <houdz1@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
81eecf4203
commit
f5b4d7047b
1 changed files with 114 additions and 0 deletions
|
|
@ -6477,6 +6477,118 @@ static void dsi_display_firmware_display(const struct firmware *fw,
|
|||
DSI_DEBUG("success\n");
|
||||
}
|
||||
|
||||
/*
|
||||
Add /sys/class/drm path, other module can get panel info from this path.
|
||||
*/
|
||||
struct dsi_display *display_panel = NULL;
|
||||
static ssize_t panelId_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
mutex_lock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
written = snprintf(buf, PAGE_SIZE, "0x%016llx\n",
|
||||
display_panel->panel->panel_id);
|
||||
mutex_unlock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t panelVer_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
mutex_lock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
written = snprintf(buf, PAGE_SIZE, "0x%016llx\n",
|
||||
display_panel->panel->panel_ver);
|
||||
mutex_unlock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t panelName_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
mutex_lock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
written = snprintf(buf, PAGE_SIZE, "%s\n", display_panel->panel->panel_name);
|
||||
mutex_unlock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t panelRegDA_show(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
mutex_lock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
written = snprintf(buf, PAGE_SIZE, "0x%02x\n", display_panel->panel->panel_regDA);
|
||||
mutex_unlock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static ssize_t panelSupplier_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
int written = 0;
|
||||
|
||||
mutex_lock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
written = scnprintf(buf, PAGE_SIZE, display_panel->panel->panel_supplier);
|
||||
mutex_unlock(&display_panel->drm_conn->dev->mode_config.mutex);
|
||||
|
||||
return written;
|
||||
}
|
||||
|
||||
static struct device_attribute panel_attributes[] = {
|
||||
__ATTR_RO(panelId),
|
||||
__ATTR_RO(panelVer),
|
||||
__ATTR_RO(panelName),
|
||||
__ATTR_RO(panelRegDA),
|
||||
__ATTR_RO(panelSupplier),
|
||||
__ATTR_NULL
|
||||
};
|
||||
|
||||
#define DRM_RETRY_TIMES 3
|
||||
static int panel_class_create(struct platform_device *pdev)
|
||||
{
|
||||
struct device_attribute *attrs = panel_attributes;
|
||||
int i, j, error = 0;
|
||||
|
||||
display_panel = platform_get_drvdata(pdev);
|
||||
|
||||
for (j = 0; j < DRM_RETRY_TIMES; j++) {
|
||||
if (display_panel->drm_conn->kdev) {
|
||||
for (i = 0; attrs[i].attr.name != NULL; ++i) {
|
||||
error = device_create_file(display_panel->drm_conn->kdev, &attrs[i]);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
DSI_ERR("drm_conn->kdev is NULL, retry %d times\n", j);
|
||||
}
|
||||
}
|
||||
|
||||
if (error)
|
||||
goto device_destroy;
|
||||
|
||||
return 0;
|
||||
|
||||
device_destroy:
|
||||
for (--i; i >= 0; --i)
|
||||
device_remove_file(display_panel->drm_conn->kdev, &attrs[i]);
|
||||
DSI_ERR("creating panel class failed\n");
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
int dsi_display_dev_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct dsi_display *display = NULL;
|
||||
|
|
@ -6577,6 +6689,8 @@ int dsi_display_dev_probe(struct platform_device *pdev)
|
|||
goto end;
|
||||
}
|
||||
|
||||
panel_class_create(pdev);
|
||||
|
||||
return 0;
|
||||
end:
|
||||
if (display)
|
||||
|
|
|
|||
Loading…
Reference in a new issue