disp: msm: dsi: add support for dsi config

Add uio support for dsi config.

Change-Id: I2098a6b3abe95794cf3e08dbb34198543d15385c
Signed-off-by: Deven Solanki <quic_dsolanki@quicinc.com>
This commit is contained in:
Deven Solanki 2022-08-03 13:01:36 +05:30 • committed by Gerrit - the friendly Code Review server
commit 40e19ff3ed

View file

@ -11,6 +11,10 @@
#include <linux/of_irq.h>
#include <video/mipi_display.h>
#ifdef CONFIG_UIO
#include <linux/uio_driver.h>
#endif
#include "msm_drv.h"
#include "msm_kms.h"
#include "msm_mmu.h"
@ -2094,6 +2098,58 @@ static int dsi_ctrl_dts_parse(struct dsi_ctrl *dsi_ctrl,
return 0;
}
#ifdef CONFIG_UIO
static void uio_init(struct platform_device *pdev)
{
struct uio_info *uio_reg_info = NULL;
struct resource *clnt_res = NULL;
int ret = 0;
u32 mem_size = 0;
phys_addr_t mem_pyhsical = 0;
clnt_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "disp_conf");
if (!clnt_res) {
pr_debug("resource not found\n");
return;
}
mem_size = resource_size(clnt_res);
if (mem_size == 0) {
pr_debug("resource memory size is zero\n");
goto exit;
}
uio_reg_info = devm_kzalloc(&pdev->dev, sizeof(struct uio_info),
GFP_KERNEL);
if (!uio_reg_info)
goto exit;
mem_pyhsical = clnt_res->start;
/* Setup device */
uio_reg_info->name = clnt_res->name;
uio_reg_info->version = "1.0";
uio_reg_info->mem[0].addr = mem_pyhsical;
uio_reg_info->mem[0].size = mem_size;
uio_reg_info->mem[0].memtype = UIO_MEM_PHYS;
ret = uio_register_device(&pdev->dev, uio_reg_info);
if (ret) {
pr_debug("uio register failed. ret:%d\n", ret);
goto exit;
}
pr_debug("Device file created for dsi_ctrl config.\n");
return;
exit:
pr_debug("Unable to get dsi_ctrl config.\n");
}
#else /* CONFIG_UIO */
static void uio_init(struct platform_device *pdev)
{
}
#endif /* CONFIG_UIO */
static int dsi_ctrl_dev_probe(struct platform_device *pdev)
{
struct dsi_ctrl *dsi_ctrl;
@ -2173,6 +2229,9 @@ static int dsi_ctrl_dev_probe(struct platform_device *pdev)
dsi_ctrl->pdev = pdev;
platform_set_drvdata(pdev, dsi_ctrl);
uio_init(pdev);
DSI_CTRL_INFO(dsi_ctrl, "Probe successful\n");
return 0;