Commit ed641dc9 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: ti-vpe: cal: Remove static const cal_regmap_config template

The global static const cal_regmap_config template is only used in a
single location, to initialize 3 fields of a local variable. Two of
those fields then get overwritten. Remove the template and set the last
remaining field manually. Simplify the code by hardcoding the field
values instead of calculating them for a variable that always has the
same value.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 9704762a
...@@ -513,19 +513,12 @@ static int cal_camerarx_regmap_init(struct cal_dev *dev, struct cc_data *cc, ...@@ -513,19 +513,12 @@ static int cal_camerarx_regmap_init(struct cal_dev *dev, struct cc_data *cc,
return 0; return 0;
} }
static const struct regmap_config cal_regmap_config = {
.reg_bits = 32,
.val_bits = 32,
.reg_stride = 4,
};
static struct regmap *cal_get_camerarx_regmap(struct cal_dev *dev) static struct regmap *cal_get_camerarx_regmap(struct cal_dev *dev)
{ {
struct platform_device *pdev = dev->pdev; struct platform_device *pdev = dev->pdev;
struct regmap_config config = { };
struct regmap *regmap; struct regmap *regmap;
void __iomem *base; void __iomem *base;
u32 reg_io_width;
struct regmap_config r_config = cal_regmap_config;
struct resource *res; struct resource *res;
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
...@@ -539,12 +532,12 @@ static struct regmap *cal_get_camerarx_regmap(struct cal_dev *dev) ...@@ -539,12 +532,12 @@ static struct regmap *cal_get_camerarx_regmap(struct cal_dev *dev)
cal_dbg(1, dev, "ioresource %s at %pa - %pa\n", cal_dbg(1, dev, "ioresource %s at %pa - %pa\n",
res->name, &res->start, &res->end); res->name, &res->start, &res->end);
reg_io_width = 4; config.reg_bits = 32;
r_config.reg_stride = reg_io_width; config.reg_stride = 4;
r_config.val_bits = reg_io_width * 8; config.val_bits = 32;
r_config.max_register = resource_size(res) - reg_io_width; config.max_register = resource_size(res) - 4;
regmap = regmap_init_mmio(NULL, base, &r_config); regmap = regmap_init_mmio(NULL, base, &config);
if (IS_ERR(regmap)) if (IS_ERR(regmap))
pr_err("regmap init failed\n"); pr_err("regmap init failed\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment