Skip to content

Commit

Permalink
drm/starfive: crtc: Use devm_platform_ioremap_resource_byname
Browse files Browse the repository at this point in the history
Signed-off-by: Emil Renner Berthing <[email protected]>
  • Loading branch information
esmil committed Dec 27, 2021
1 parent baa7cb4 commit e4b380e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
28 changes: 9 additions & 19 deletions drivers/gpu/drm/starfive/starfive_drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@
#include "starfive_drm_vpp.h"
//#include <video/sys_comm_regs.h>

struct resource_name {
char name[10];
};

static const struct resource_name mem_res_name[] = {
{"lcdc"},
{"vpp0"},
{"vpp1"},
{"vpp2"},
{"clk"},
{"rst"},
{"sys"}
};

static inline struct drm_encoder *
starfive_head_atom_get_encoder(struct starfive_crtc *sf_crtc)
{
Expand Down Expand Up @@ -313,13 +299,14 @@ int starfive_crtc_create(struct drm_device *drm_dev,

static int starfive_crtc_get_memres(struct platform_device *pdev, struct starfive_crtc *sf_crtc)
{
struct device *dev = &pdev->dev;
static const char *const mem_res_name[] = {
"lcdc", "vpp0", "vpp1", "vpp2", "clk", "rst", "sys"
};
int i;

for (i = 0; i < ARRAY_SIZE(mem_res_name); i++) {
const char *name = mem_res_name[i].name;
struct resource *res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
void __iomem *regs = devm_ioremap_resource(dev, res);
const char *name = mem_res_name[i];
void __iomem *regs = devm_platform_ioremap_resource_byname(pdev, name);

if (IS_ERR(regs))
return PTR_ERR(regs);
Expand Down Expand Up @@ -421,7 +408,10 @@ static int starfive_crtc_bind(struct device *dev, struct device *master, void *d

spin_lock_init(&crtcp->reg_lock);

starfive_crtc_get_memres(pdev, crtcp);
ret = starfive_crtc_get_memres(pdev, crtcp);
if (ret)
return ret;

ret = starfive_parse_dt(dev, crtcp);

crtcp->pp_conn_lcdc = starfive_pp_get_2lcdc_id(crtcp);
Expand Down
10 changes: 0 additions & 10 deletions drivers/gpu/drm/starfive/starfive_drm_lcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,6 @@
#include "starfive_drm_lcdc.h"
#include "starfive_drm_vpp.h"

static const struct res_name mem_res_name[] = {
{"lcdc"},
{"vpp0"},
{"vpp1"},
{"vpp2"},
{"clk"},
{"rst"},
{"sys"}
};

static u32 sf_fb_clkread32(struct starfive_crtc *sf_crtc, u32 reg)
{
return ioread32(sf_crtc->base_clk + reg);
Expand Down
4 changes: 0 additions & 4 deletions drivers/gpu/drm/starfive/starfive_drm_vpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
//vout clk registers
#define CLK_LCDC_OCLK_CTRL 0x14

struct res_name {
char name[10];
};

enum PP_LCD_PATH {
SYS_BUS_OUTPUT = 0,
FIFO_OUTPUT = 1,
Expand Down

0 comments on commit e4b380e

Please sign in to comment.