[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200113141509.GB3606@pflmari>
Date: Mon, 13 Jan 2020 15:15:09 +0100
From: Alex Riesen <alexander.riesen@...itec.com>
To: Kieran Bingham <kieran.bingham@...asonboard.com>
CC: Mauro Carvalho Chehab <mchehab@...nel.org>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Rob Herring <robh+dt@...nel.org>,
"Mark Rutland" <mark.rutland@....com>,
<devel@...verdev.osuosl.org>, <linux-media@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>
Subject: [PATCH 1/8] media: adv748x: add a device-specific wrapper for
register block read
Some of the devices I2C-accessible registers (for instance, cs_data for
stereo channel information or tmds_params for TMDS channel information)
located in adjacent cells. According to manufacturers information, these
registers can be read using block transactions.
Signed-off-by: Alexander Riesen <alexander.riesen@...itec.com>
---
drivers/media/i2c/adv748x/adv748x-core.c | 15 +++++++++++++++
drivers/media/i2c/adv748x/adv748x.h | 2 ++
2 files changed, 17 insertions(+)
diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
index 23e02ff27b17..bc49aa93793c 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -97,6 +97,21 @@ static const struct adv748x_register_map adv748x_default_addresses[] = {
[ADV748X_PAGE_TXA] = { "txa", 0x4a },
};
+int adv748x_read_block(struct adv748x_state *state, u8 client_page, u8 reg,
+ void *val, size_t reg_count)
+{
+ struct i2c_client *client = state->i2c_clients[client_page];
+ int err;
+
+ err = regmap_bulk_read(state->regmap[client_page], reg, val, reg_count);
+ if (err) {
+ adv_err(state, "error reading %02x, %02x-%02lx: %d\n",
+ client->addr, reg, reg + reg_count - 1, err);
+ return err;
+ }
+ return 0;
+}
+
static int adv748x_read_check(struct adv748x_state *state,
int client_page, u8 reg)
{
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index 5042f9e94aee..db6346a06351 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -387,6 +387,8 @@ struct adv748x_state {
/* Register handling */
int adv748x_read(struct adv748x_state *state, u8 addr, u8 reg);
+int adv748x_read_block(struct adv748x_state *state, u8 page, u8 reg,
+ void *val, size_t reg_count);
int adv748x_write(struct adv748x_state *state, u8 page, u8 reg, u8 value);
int adv748x_write_block(struct adv748x_state *state, int client_page,
unsigned int init_reg, const void *val,
--
2.24.1.508.g91d2dafee0
Powered by blists - more mailing lists