mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02:00
drm/msm: get rid of msm_iomap_size
Instead of looping throught the resources each time to get the DSI CTRL area size, get it at the ioremap time. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org> Link: https://lore.kernel.org/r/20210427001828.2375555-4-dmitry.baryshkov@linaro.org Signed-off-by: Rob Clark <robdclark@chromium.org>
This commit is contained in:
parent
2503003cb2
commit
bac2c6a62e
|
|
@ -102,6 +102,7 @@ struct msm_dsi_host {
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
void __iomem *ctrl_base;
|
void __iomem *ctrl_base;
|
||||||
|
phys_addr_t ctrl_size;
|
||||||
struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX];
|
struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX];
|
||||||
|
|
||||||
struct clk *bus_clks[DSI_BUS_CLK_MAX];
|
struct clk *bus_clks[DSI_BUS_CLK_MAX];
|
||||||
|
|
@ -1839,7 +1840,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
msm_host->ctrl_base = msm_ioremap(pdev, "dsi_ctrl", "DSI CTRL");
|
msm_host->ctrl_base = msm_ioremap_size(pdev, "dsi_ctrl", "DSI CTRL", &msm_host->ctrl_size);
|
||||||
if (IS_ERR(msm_host->ctrl_base)) {
|
if (IS_ERR(msm_host->ctrl_base)) {
|
||||||
pr_err("%s: unable to map Dsi ctrl base\n", __func__);
|
pr_err("%s: unable to map Dsi ctrl base\n", __func__);
|
||||||
ret = PTR_ERR(msm_host->ctrl_base);
|
ret = PTR_ERR(msm_host->ctrl_base);
|
||||||
|
|
@ -2494,7 +2495,7 @@ void msm_dsi_host_snapshot(struct msm_disp_state *disp_state, struct mipi_dsi_ho
|
||||||
|
|
||||||
pm_runtime_get_sync(&msm_host->pdev->dev);
|
pm_runtime_get_sync(&msm_host->pdev->dev);
|
||||||
|
|
||||||
msm_disp_snapshot_add_block(disp_state, msm_iomap_size(msm_host->pdev, "dsi_ctrl"),
|
msm_disp_snapshot_add_block(disp_state, msm_host->ctrl_size,
|
||||||
msm_host->ctrl_base, "dsi%d_ctrl", msm_host->id);
|
msm_host->ctrl_base, "dsi%d_ctrl", msm_host->id);
|
||||||
|
|
||||||
pm_runtime_put_sync(&msm_host->pdev->dev);
|
pm_runtime_put_sync(&msm_host->pdev->dev);
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ struct clk *msm_clk_get(struct platform_device *pdev, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
|
static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name,
|
||||||
const char *dbgname, bool quiet)
|
const char *dbgname, bool quiet, phys_addr_t *psize)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
|
|
@ -153,37 +153,28 @@ static void __iomem *_msm_ioremap(struct platform_device *pdev, const char *name
|
||||||
if (reglog)
|
if (reglog)
|
||||||
printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
|
printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
|
||||||
|
|
||||||
|
if (psize)
|
||||||
|
*psize = size;
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
|
void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
|
||||||
const char *dbgname)
|
const char *dbgname)
|
||||||
{
|
{
|
||||||
return _msm_ioremap(pdev, name, dbgname, false);
|
return _msm_ioremap(pdev, name, dbgname, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
|
void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
|
||||||
const char *dbgname)
|
const char *dbgname)
|
||||||
{
|
{
|
||||||
return _msm_ioremap(pdev, name, dbgname, true);
|
return _msm_ioremap(pdev, name, dbgname, true, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long msm_iomap_size(struct platform_device *pdev, const char *name)
|
void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name,
|
||||||
|
const char *dbgname, phys_addr_t *psize)
|
||||||
{
|
{
|
||||||
struct resource *res;
|
return _msm_ioremap(pdev, name, dbgname, false, psize);
|
||||||
|
|
||||||
if (name)
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
|
|
||||||
else
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
||||||
|
|
||||||
if (!res) {
|
|
||||||
dev_dbg(&pdev->dev, "failed to get memory resource: %s\n",
|
|
||||||
name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return resource_size(res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void msm_writel(u32 data, void __iomem *addr)
|
void msm_writel(u32 data, void __iomem *addr)
|
||||||
|
|
|
||||||
|
|
@ -450,9 +450,10 @@ struct clk *msm_clk_bulk_get_clock(struct clk_bulk_data *bulk, int count,
|
||||||
const char *name);
|
const char *name);
|
||||||
void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
|
void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
|
||||||
const char *dbgname);
|
const char *dbgname);
|
||||||
|
void __iomem *msm_ioremap_size(struct platform_device *pdev, const char *name,
|
||||||
|
const char *dbgname, phys_addr_t *size);
|
||||||
void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
|
void __iomem *msm_ioremap_quiet(struct platform_device *pdev, const char *name,
|
||||||
const char *dbgname);
|
const char *dbgname);
|
||||||
unsigned long msm_iomap_size(struct platform_device *pdev, const char *name);
|
|
||||||
void msm_writel(u32 data, void __iomem *addr);
|
void msm_writel(u32 data, void __iomem *addr);
|
||||||
u32 msm_readl(const void __iomem *addr);
|
u32 msm_readl(const void __iomem *addr);
|
||||||
void msm_rmw(void __iomem *addr, u32 mask, u32 or);
|
void msm_rmw(void __iomem *addr, u32 mask, u32 or);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user