Commit 28b9e227 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

media: tvp5150: convert register access to regmap

Regmap provides built in debugging, caching and provides dedicated
accessors for bit manipulations in registers, which make the following
changes a lot simpler.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarMarco Felsch <m.felsch@pengutronix.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 2d29bcc8
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_graph.h> #include <linux/of_graph.h>
#include <linux/regmap.h>
#include <media/v4l2-async.h> #include <media/v4l2-async.h>
#include <media/v4l2-device.h> #include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h> #include <media/v4l2-ctrls.h>
...@@ -53,6 +54,7 @@ struct tvp5150 { ...@@ -53,6 +54,7 @@ struct tvp5150 {
#endif #endif
struct v4l2_ctrl_handler hdl; struct v4l2_ctrl_handler hdl;
struct v4l2_rect rect; struct v4l2_rect rect;
struct regmap *regmap;
v4l2_std_id norm; /* Current set standard */ v4l2_std_id norm; /* Current set standard */
u32 input; u32 input;
...@@ -77,32 +79,14 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl) ...@@ -77,32 +79,14 @@ static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr) static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
{ {
struct i2c_client *c = v4l2_get_subdevdata(sd); struct tvp5150 *decoder = to_tvp5150(sd);
int rc; int ret, val;
rc = i2c_smbus_read_byte_data(c, addr);
if (rc < 0) {
dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
return rc;
}
dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: read 0x%02x = %02x\n", addr, rc);
return rc;
}
static int tvp5150_write(struct v4l2_subdev *sd, unsigned char addr,
unsigned char value)
{
struct i2c_client *c = v4l2_get_subdevdata(sd);
int rc;
dev_dbg_lvl(sd->dev, 2, debug, "tvp5150: writing %02x %02x\n", addr, value); ret = regmap_read(decoder->regmap, addr, &val);
rc = i2c_smbus_write_byte_data(c, addr, value); if (ret < 0)
if (rc < 0) return ret;
dev_err(sd->dev, "i2c i/o error: rc == %d\n", rc);
return rc; return val;
} }
static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init, static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,
...@@ -294,8 +278,8 @@ static void tvp5150_selmux(struct v4l2_subdev *sd) ...@@ -294,8 +278,8 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
decoder->input, decoder->output, decoder->input, decoder->output,
input, opmode); input, opmode);
tvp5150_write(sd, TVP5150_OP_MODE_CTL, opmode); regmap_write(decoder->regmap, TVP5150_OP_MODE_CTL, opmode);
tvp5150_write(sd, TVP5150_VD_IN_SRC_SEL_1, input); regmap_write(decoder->regmap, TVP5150_VD_IN_SRC_SEL_1, input);
/* /*
* Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For * Setup the FID/GLCO/VLK/HVLK and INTREQ/GPCL/VBLK output signals. For
...@@ -314,7 +298,7 @@ static void tvp5150_selmux(struct v4l2_subdev *sd) ...@@ -314,7 +298,7 @@ static void tvp5150_selmux(struct v4l2_subdev *sd)
val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK; val = (val & ~TVP5150_MISC_CTL_GPCL) | TVP5150_MISC_CTL_HVLK;
else else
val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL; val = (val & ~TVP5150_MISC_CTL_HVLK) | TVP5150_MISC_CTL_GPCL;
tvp5150_write(sd, TVP5150_MISC_CTL, val); regmap_write(decoder->regmap, TVP5150_MISC_CTL, val);
}; };
struct i2c_reg_value { struct i2c_reg_value {
...@@ -589,8 +573,10 @@ static struct i2c_vbi_ram_value vbi_ram_default[] = { ...@@ -589,8 +573,10 @@ static struct i2c_vbi_ram_value vbi_ram_default[] = {
static int tvp5150_write_inittab(struct v4l2_subdev *sd, static int tvp5150_write_inittab(struct v4l2_subdev *sd,
const struct i2c_reg_value *regs) const struct i2c_reg_value *regs)
{ {
struct tvp5150 *decoder = to_tvp5150(sd);
while (regs->reg != 0xff) { while (regs->reg != 0xff) {
tvp5150_write(sd, regs->reg, regs->value); regmap_write(decoder->regmap, regs->reg, regs->value);
regs++; regs++;
} }
return 0; return 0;
...@@ -598,15 +584,17 @@ static int tvp5150_write_inittab(struct v4l2_subdev *sd, ...@@ -598,15 +584,17 @@ static int tvp5150_write_inittab(struct v4l2_subdev *sd,
static int tvp5150_vdp_init(struct v4l2_subdev *sd) static int tvp5150_vdp_init(struct v4l2_subdev *sd)
{ {
struct tvp5150 *decoder = to_tvp5150(sd);
struct regmap *map = decoder->regmap;
unsigned int i; unsigned int i;
int j; int j;
/* Disable Full Field */ /* Disable Full Field */
tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0); regmap_write(map, TVP5150_FULL_FIELD_ENA, 0);
/* Before programming, Line mode should be at 0xff */ /* Before programming, Line mode should be at 0xff */
for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++) for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
tvp5150_write(sd, i, 0xff); regmap_write(map, i, 0xff);
/* Load Ram Table */ /* Load Ram Table */
for (j = 0; j < ARRAY_SIZE(vbi_ram_default); j++) { for (j = 0; j < ARRAY_SIZE(vbi_ram_default); j++) {
...@@ -615,11 +603,12 @@ static int tvp5150_vdp_init(struct v4l2_subdev *sd) ...@@ -615,11 +603,12 @@ static int tvp5150_vdp_init(struct v4l2_subdev *sd)
if (!regs->type.vbi_type) if (!regs->type.vbi_type)
continue; continue;
tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8); regmap_write(map, TVP5150_CONF_RAM_ADDR_HIGH, regs->reg >> 8);
tvp5150_write(sd, TVP5150_CONF_RAM_ADDR_LOW, regs->reg); regmap_write(map, TVP5150_CONF_RAM_ADDR_LOW, regs->reg);
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
tvp5150_write(sd, TVP5150_VDP_CONF_RAM_DATA, regs->values[i]); regmap_write(map, TVP5150_VDP_CONF_RAM_DATA,
regs->values[i]);
} }
return 0; return 0;
} }
...@@ -699,10 +688,10 @@ static int tvp5150_set_vbi(struct v4l2_subdev *sd, ...@@ -699,10 +688,10 @@ static int tvp5150_set_vbi(struct v4l2_subdev *sd,
reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI; reg = ((line - 6) << 1) + TVP5150_LINE_MODE_INI;
if (fields & 1) if (fields & 1)
tvp5150_write(sd, reg, type); regmap_write(decoder->regmap, reg, type);
if (fields & 2) if (fields & 2)
tvp5150_write(sd, reg + 1, type); regmap_write(decoder->regmap, reg + 1, type);
return type; return type;
} }
...@@ -769,7 +758,7 @@ static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std) ...@@ -769,7 +758,7 @@ static int tvp5150_set_std(struct v4l2_subdev *sd, v4l2_std_id std)
} }
dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt); dev_dbg_lvl(sd->dev, 1, debug, "Set video std register to %d.\n", fmt);
tvp5150_write(sd, TVP5150_VIDEO_STD, fmt); regmap_write(decoder->regmap, TVP5150_VIDEO_STD, fmt);
return 0; return 0;
} }
...@@ -812,7 +801,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val) ...@@ -812,7 +801,7 @@ static int tvp5150_reset(struct v4l2_subdev *sd, u32 val)
tvp5150_set_std(sd, decoder->norm); tvp5150_set_std(sd, decoder->norm);
if (decoder->mbus_type == V4L2_MBUS_PARALLEL) if (decoder->mbus_type == V4L2_MBUS_PARALLEL)
tvp5150_write(sd, TVP5150_DATA_RATE_SEL, 0x40); regmap_write(decoder->regmap, TVP5150_DATA_RATE_SEL, 0x40);
return 0; return 0;
}; };
...@@ -824,16 +813,17 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl) ...@@ -824,16 +813,17 @@ static int tvp5150_s_ctrl(struct v4l2_ctrl *ctrl)
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
tvp5150_write(sd, TVP5150_BRIGHT_CTL, ctrl->val); regmap_write(decoder->regmap, TVP5150_BRIGHT_CTL, ctrl->val);
return 0; return 0;
case V4L2_CID_CONTRAST: case V4L2_CID_CONTRAST:
tvp5150_write(sd, TVP5150_CONTRAST_CTL, ctrl->val); regmap_write(decoder->regmap, TVP5150_CONTRAST_CTL, ctrl->val);
return 0; return 0;
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
tvp5150_write(sd, TVP5150_SATURATION_CTL, ctrl->val); regmap_write(decoder->regmap, TVP5150_SATURATION_CTL,
ctrl->val);
return 0; return 0;
case V4L2_CID_HUE: case V4L2_CID_HUE:
tvp5150_write(sd, TVP5150_HUE_CTL, ctrl->val); regmap_write(decoder->regmap, TVP5150_HUE_CTL, ctrl->val);
return 0; return 0;
case V4L2_CID_TEST_PATTERN: case V4L2_CID_TEST_PATTERN:
decoder->enable = ctrl->val ? false : true; decoder->enable = ctrl->val ? false : true;
...@@ -931,17 +921,17 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd, ...@@ -931,17 +921,17 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd,
hmax - TVP5150_MAX_CROP_TOP - rect.top, hmax - TVP5150_MAX_CROP_TOP - rect.top,
hmax - rect.top, 0, 0); hmax - rect.top, 0, 0);
tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_START, rect.top);
tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_STOP,
rect.top + rect.height - hmax); rect.top + rect.height - hmax);
tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_MSB, regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_ST_MSB,
rect.left >> TVP5150_CROP_SHIFT); rect.left >> TVP5150_CROP_SHIFT);
tvp5150_write(sd, TVP5150_ACT_VD_CROP_ST_LSB, regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_ST_LSB,
rect.left | (1 << TVP5150_CROP_SHIFT)); rect.left | (1 << TVP5150_CROP_SHIFT));
tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_MSB, regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_MSB,
(rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >> (rect.left + rect.width - TVP5150_MAX_CROP_LEFT) >>
TVP5150_CROP_SHIFT); TVP5150_CROP_SHIFT);
tvp5150_write(sd, TVP5150_ACT_VD_CROP_STP_LSB, regmap_write(decoder->regmap, TVP5150_ACT_VD_CROP_STP_LSB,
rect.left + rect.width - TVP5150_MAX_CROP_LEFT); rect.left + rect.width - TVP5150_MAX_CROP_LEFT);
decoder->rect = rect; decoder->rect = rect;
...@@ -1089,7 +1079,7 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable) ...@@ -1089,7 +1079,7 @@ static int tvp5150_s_stream(struct v4l2_subdev *sd, int enable)
val |= TVP5150_MISC_CTL_SYNC_OE; val |= TVP5150_MISC_CTL_SYNC_OE;
} }
tvp5150_write(sd, TVP5150_MISC_CTL, val); regmap_write(decoder->regmap, TVP5150_MISC_CTL, val);
return 0; return 0;
} }
...@@ -1113,6 +1103,8 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd, ...@@ -1113,6 +1103,8 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd,
static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
{ {
struct tvp5150 *decoder = to_tvp5150(sd);
/* /*
* this is for capturing 36 raw vbi lines * this is for capturing 36 raw vbi lines
* if there's a way to cut off the beginning 2 vbi lines * if there's a way to cut off the beginning 2 vbi lines
...@@ -1122,16 +1114,18 @@ static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt ...@@ -1122,16 +1114,18 @@ static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt
*/ */
if (fmt->sample_format == V4L2_PIX_FMT_GREY) if (fmt->sample_format == V4L2_PIX_FMT_GREY)
tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70); regmap_write(decoder->regmap, TVP5150_LUMA_PROC_CTL_1, 0x70);
if (fmt->count[0] == 18 && fmt->count[1] == 18) { if (fmt->count[0] == 18 && fmt->count[1] == 18) {
tvp5150_write(sd, TVP5150_VERT_BLANKING_START, 0x00); regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_START,
tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP, 0x01); 0x00);
regmap_write(decoder->regmap, TVP5150_VERT_BLANKING_STOP, 0x01);
} }
return 0; return 0;
} }
static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi) static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format *svbi)
{ {
struct tvp5150 *decoder = to_tvp5150(sd);
int i; int i;
if (svbi->service_set != 0) { if (svbi->service_set != 0) {
...@@ -1142,17 +1136,17 @@ static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f ...@@ -1142,17 +1136,17 @@ static int tvp5150_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
0xf0, i, 3); 0xf0, i, 3);
} }
/* Enables FIFO */ /* Enables FIFO */
tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 1); regmap_write(decoder->regmap, TVP5150_FIFO_OUT_CTRL, 1);
} else { } else {
/* Disables FIFO*/ /* Disables FIFO*/
tvp5150_write(sd, TVP5150_FIFO_OUT_CTRL, 0); regmap_write(decoder->regmap, TVP5150_FIFO_OUT_CTRL, 0);
/* Disable Full Field */ /* Disable Full Field */
tvp5150_write(sd, TVP5150_FULL_FIELD_ENA, 0); regmap_write(decoder->regmap, TVP5150_FULL_FIELD_ENA, 0);
/* Disable Line modes */ /* Disable Line modes */
for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++) for (i = TVP5150_LINE_MODE_INI; i <= TVP5150_LINE_MODE_END; i++)
tvp5150_write(sd, i, 0xff); regmap_write(decoder->regmap, i, 0xff);
} }
return 0; return 0;
} }
...@@ -1190,7 +1184,9 @@ static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register * ...@@ -1190,7 +1184,9 @@ static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *
static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg) static int tvp5150_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_register *reg)
{ {
return tvp5150_write(sd, reg->reg & 0xff, reg->val & 0xff); struct tvp5150 *decoder = to_tvp5150(sd);
return regmap_write(decoder->regmap, reg->reg & 0xff, reg->val & 0xff);
} }
#endif #endif
...@@ -1297,11 +1293,83 @@ static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = { ...@@ -1297,11 +1293,83 @@ static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = {
I2C Client & Driver I2C Client & Driver
****************************************************************************/ ****************************************************************************/
static const struct regmap_range tvp5150_readable_ranges[] = {
{
.range_min = TVP5150_VD_IN_SRC_SEL_1,
.range_max = TVP5150_AUTOSW_MSK,
}, {
.range_min = TVP5150_COLOR_KIL_THSH_CTL,
.range_max = TVP5150_CONF_SHARED_PIN,
}, {
.range_min = TVP5150_ACT_VD_CROP_ST_MSB,
.range_max = TVP5150_HORIZ_SYNC_START,
}, {
.range_min = TVP5150_VERT_BLANKING_START,
.range_max = TVP5150_INTT_CONFIG_REG_B,
}, {
.range_min = TVP5150_VIDEO_STD,
.range_max = TVP5150_VIDEO_STD,
}, {
.range_min = TVP5150_CB_GAIN_FACT,
.range_max = TVP5150_REV_SELECT,
}, {
.range_min = TVP5150_MSB_DEV_ID,
.range_max = TVP5150_STATUS_REG_5,
}, {
.range_min = TVP5150_CC_DATA_INI,
.range_max = TVP5150_TELETEXT_FIL_ENA,
}, {
.range_min = TVP5150_INT_STATUS_REG_A,
.range_max = TVP5150_FIFO_OUT_CTRL,
}, {
.range_min = TVP5150_FULL_FIELD_ENA,
.range_max = TVP5150_FULL_FIELD_MODE_REG,
},
};
bool tvp5150_volatile_reg(struct device *dev, unsigned int reg)
{
switch (reg) {
case TVP5150_VERT_LN_COUNT_MSB:
case TVP5150_VERT_LN_COUNT_LSB:
case TVP5150_INT_STATUS_REG_A:
case TVP5150_INT_STATUS_REG_B:
case TVP5150_INT_ACTIVE_REG_B:
case TVP5150_STATUS_REG_1:
case TVP5150_STATUS_REG_2:
case TVP5150_STATUS_REG_3:
case TVP5150_STATUS_REG_4:
case TVP5150_STATUS_REG_5:
/* CC, WSS, VPS, VITC data? */
case TVP5150_VBI_FIFO_READ_DATA:
case TVP5150_VDP_STATUS_REG:
case TVP5150_FIFO_WORD_COUNT:
return true;
default:
return false;
}
}
static const struct regmap_access_table tvp5150_readable_table = {
.yes_ranges = tvp5150_readable_ranges,
.n_yes_ranges = ARRAY_SIZE(tvp5150_readable_ranges),
};
static struct regmap_config tvp5150_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0xff,
.cache_type = REGCACHE_RBTREE,
.rd_table = &tvp5150_readable_table,
.volatile_reg = tvp5150_volatile_reg,
};
static int tvp5150_detect_version(struct tvp5150 *core) static int tvp5150_detect_version(struct tvp5150 *core)
{ {
struct v4l2_subdev *sd = &core->sd; struct v4l2_subdev *sd = &core->sd;
struct i2c_client *c = v4l2_get_subdevdata(sd); struct i2c_client *c = v4l2_get_subdevdata(sd);
unsigned int i;
u8 regs[4]; u8 regs[4];
int res; int res;
...@@ -1309,11 +1377,10 @@ static int tvp5150_detect_version(struct tvp5150 *core) ...@@ -1309,11 +1377,10 @@ static int tvp5150_detect_version(struct tvp5150 *core)
* Read consequent registers - TVP5150_MSB_DEV_ID, TVP5150_LSB_DEV_ID, * Read consequent registers - TVP5150_MSB_DEV_ID, TVP5150_LSB_DEV_ID,
* TVP5150_ROM_MAJOR_VER, TVP5150_ROM_MINOR_VER * TVP5150_ROM_MAJOR_VER, TVP5150_ROM_MINOR_VER
*/ */
for (i = 0; i < 4; i++) { res = regmap_bulk_read(core->regmap, TVP5150_MSB_DEV_ID, regs, 4);
res = tvp5150_read(sd, TVP5150_MSB_DEV_ID + i); if (res < 0) {
if (res < 0) dev_err(&c->dev, "reading ID registers failed: %d\n", res);
return res; return res;
regs[i] = res;
} }
core->dev_id = (regs[0] << 8) | regs[1]; core->dev_id = (regs[0] << 8) | regs[1];
...@@ -1329,7 +1396,7 @@ static int tvp5150_detect_version(struct tvp5150 *core) ...@@ -1329,7 +1396,7 @@ static int tvp5150_detect_version(struct tvp5150 *core)
dev_info(sd->dev, "tvp5150am1 detected.\n"); dev_info(sd->dev, "tvp5150am1 detected.\n");
/* ITU-T BT.656.4 timing */ /* ITU-T BT.656.4 timing */
tvp5150_write(sd, TVP5150_REV_SELECT, 0); regmap_write(core->regmap, TVP5150_REV_SELECT, 0);
} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) { } else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
dev_info(sd->dev, "tvp5151 detected.\n"); dev_info(sd->dev, "tvp5151 detected.\n");
} else { } else {
...@@ -1476,6 +1543,7 @@ static int tvp5150_probe(struct i2c_client *c, ...@@ -1476,6 +1543,7 @@ static int tvp5150_probe(struct i2c_client *c,
struct tvp5150 *core; struct tvp5150 *core;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
struct device_node *np = c->dev.of_node; struct device_node *np = c->dev.of_node;
struct regmap *map;
int res; int res;
/* Check if the adapter supports the needed features */ /* Check if the adapter supports the needed features */
...@@ -1491,6 +1559,11 @@ static int tvp5150_probe(struct i2c_client *c, ...@@ -1491,6 +1559,11 @@ static int tvp5150_probe(struct i2c_client *c,
if (!core) if (!core)
return -ENOMEM; return -ENOMEM;
map = devm_regmap_init_i2c(c, &tvp5150_config);
if (IS_ERR(map))
return PTR_ERR(map);
core->regmap = map;
sd = &core->sd; sd = &core->sd;
if (IS_ENABLED(CONFIG_OF) && np) { if (IS_ENABLED(CONFIG_OF) && np) {
......
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