Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78cfd7ee authored by Xiaoming Zhou's avatar Xiaoming Zhou
Browse files

msm: mdss: expose MDP capabilities through sysfs on 8x10



Currently, MDP capabilities are exposed to the client via
a dedicated ioctl.  As more capabilities are added, it becomes
difficult to have to extend and maintain header file compatibility.
This change is to add a sysfs node which can be used to get the
MDP capabilities.

Change-Id: I9eb2e5546f708eb3f46c61f9abe4f25f23cd64aa
Signed-off-by: default avatarXiaoming Zhou <zhoux@codeaurora.org>
parent 6badacdb
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -1936,6 +1936,53 @@ static void mdp3_dma_underrun_intr_handler(int type, void *arg)
			mdp3_res->underrun_cnt);
}

static ssize_t mdp3_show_capabilities(struct device *dev,
		struct device_attribute *attr, char *buf)
{
	size_t len = PAGE_SIZE;
	int cnt = 0;

#define SPRINT(fmt, ...) \
		(cnt += scnprintf(buf + cnt, len - cnt, fmt, ##__VA_ARGS__))

	SPRINT("mdp_version=3\n");
	SPRINT("hw_rev=%d\n", 304);
	SPRINT("dma_pipes=%d\n", 1);
	SPRINT("\n");

	return cnt;
}

static DEVICE_ATTR(caps, S_IRUGO, mdp3_show_capabilities, NULL);

static struct attribute *mdp3_fs_attrs[] = {
	&dev_attr_caps.attr,
	NULL
};

static struct attribute_group mdp3_fs_attr_group = {
	.attrs = mdp3_fs_attrs
};

static int mdp3_register_sysfs(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	int rc;

	rc = sysfs_create_group(&dev->kobj, &mdp3_fs_attr_group);

	return rc;
}

int mdp3_create_sysfs_link(struct device *dev)
{
	int rc;
	rc = sysfs_create_link_nowarn(&dev->kobj,
			&mdp3_res->pdev->dev.kobj, "mdp");

	return rc;
}

static int mdp3_probe(struct platform_device *pdev)
{
	int rc;
@@ -1994,6 +2041,10 @@ static int mdp3_probe(struct platform_device *pdev)
		goto probe_done;
	}

	rc = mdp3_register_sysfs(pdev);
	if (rc)
		pr_err("unable to register mdp sysfs nodes\n");

	rc = mdss_fb_register_mdp_instance(&mdp3_interface);
	if (rc)
		pr_err("unable to register mdp instance\n");
+1 −0
Original line number Diff line number Diff line
@@ -188,6 +188,7 @@ int mdp3_iommu_is_attached(int client);
void mdp3_free(void);
int mdp3_parse_dt_splash(struct msm_fb_data_type *mfd);
void mdp3_release_splash_memory(void);
int mdp3_create_sysfs_link(struct device *dev);

#define MDP3_REG_WRITE(addr, val) writel_relaxed(val, mdp3_res->mdp_base + addr)
#define MDP3_REG_READ(addr) readl_relaxed(mdp3_res->mdp_base + addr)
+4 −0
Original line number Diff line number Diff line
@@ -1555,6 +1555,10 @@ int mdp3_ctrl_init(struct msm_fb_data_type *mfd)
		goto init_done;
	}

	rc = mdp3_create_sysfs_link(dev);
	if (rc)
		pr_warn("problem creating link to mdp sysfs\n");

	kobject_uevent(&dev->kobj, KOBJ_ADD);
	pr_debug("vsync kobject_uevent(KOBJ_ADD)\n");