From: Alex Riesen <alexander.riesen@cetitec.com> To: Kieran Bingham <kieran.bingham@ideasonboard.com> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Rob Herring <robh+dt@kernel.org>, "Mark Rutland" <mark.rutland@arm.com>, <devel@driverdev.osuosl.org>, <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-renesas-soc@vger.kernel.org> Subject: [PATCH 1/8] media: adv748x: add a device-specific wrapper for register block read Date: Mon, 13 Jan 2020 15:15:09 +0100 [thread overview] Message-ID: <20200113141509.GB3606@pflmari> (raw) In-Reply-To: <cover.1578924232.git.alexander.riesen@cetitec.com> 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@cetitec.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
WARNING: multiple messages have this Message-ID (diff)
From: Alex Riesen <alexander.riesen@cetitec.com> To: Kieran Bingham <kieran.bingham@ideasonboard.com> Cc: Mark Rutland <mark.rutland@arm.com>, devel@driverdev.osuosl.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Rob Herring <robh+dt@kernel.org>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Hans Verkuil <hverkuil-cisco@xs4all.nl>, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-media@vger.kernel.org Subject: [PATCH 1/8] media: adv748x: add a device-specific wrapper for register block read Date: Mon, 13 Jan 2020 15:15:09 +0100 [thread overview] Message-ID: <20200113141509.GB3606@pflmari> (raw) In-Reply-To: <cover.1578924232.git.alexander.riesen@cetitec.com> 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@cetitec.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 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2020-01-13 14:15 UTC|newest] Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-01-13 14:19 [PATCH 0/8] media: i2c: adv748x: add support for HDMI audio Alex Riesen 2020-01-13 14:19 ` Alex Riesen 2020-01-13 14:15 ` Alex Riesen [this message] 2020-01-13 14:15 ` [PATCH 1/8] media: adv748x: add a device-specific wrapper for register block read Alex Riesen 2020-01-13 14:15 ` [PATCH 2/8] media: adv748x: add audio mute control and output selection ioctls Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-03-13 8:16 ` Hans Verkuil 2020-03-13 8:16 ` Hans Verkuil 2020-03-13 10:26 ` Alex Riesen 2020-03-13 10:26 ` Alex Riesen 2020-03-13 10:52 ` Hans Verkuil 2020-03-13 10:52 ` Hans Verkuil 2020-03-13 11:00 ` Alex Riesen 2020-03-13 11:00 ` Alex Riesen 2020-01-13 14:15 ` [PATCH 3/8] media: adv748x: add log_status ioctl Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-01-13 14:15 ` [PATCH 4/8] media: adv748x: reserve space for the audio (I2S) port in the driver structures Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-01-13 14:15 ` [PATCH 5/8] media: adv748x: add an ASoC DAI definition to the driver Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-01-13 14:15 ` [PATCH 6/8] media: adv748x: reduce amount of code for bitwise modification of device registers Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-01-13 14:15 ` [PATCH 7/8] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM) Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-01-13 22:32 ` Rob Herring 2020-01-13 22:32 ` Rob Herring 2020-01-13 14:15 ` [PATCH 8/8] arm64: dts: renesas: salvator: add a connection from adv748x codec (HDMI input) to the R-Car SoC Alex Riesen 2020-01-13 14:15 ` Alex Riesen 2020-03-02 12:28 ` Geert Uytterhoeven 2020-03-02 12:28 ` Geert Uytterhoeven 2020-03-02 13:40 ` Alex Riesen 2020-03-02 13:40 ` Alex Riesen 2020-03-02 13:47 ` Geert Uytterhoeven 2020-03-02 13:47 ` Geert Uytterhoeven 2020-03-02 15:07 ` Alex Riesen 2020-03-02 15:07 ` Alex Riesen 2020-03-02 15:32 ` Geert Uytterhoeven 2020-03-02 15:32 ` Geert Uytterhoeven 2020-03-02 16:09 ` Alex Riesen 2020-03-02 16:09 ` Alex Riesen 2020-03-02 16:13 ` Geert Uytterhoeven 2020-03-02 16:13 ` Geert Uytterhoeven 2020-03-05 14:36 ` Alex Riesen 2020-03-05 14:36 ` Alex Riesen 2020-03-06 12:21 ` Geert Uytterhoeven 2020-03-06 12:21 ` Geert Uytterhoeven 2020-03-06 13:16 ` Laurent Pinchart 2020-03-06 13:16 ` Laurent Pinchart 2020-03-06 13:41 ` Alex Riesen 2020-03-06 13:41 ` Alex Riesen 2020-03-06 13:45 ` Laurent Pinchart 2020-03-06 13:45 ` Laurent Pinchart 2020-03-09 1:31 ` Kuninori Morimoto 2020-03-09 1:31 ` Kuninori Morimoto 2020-03-09 11:09 ` Alex Riesen 2020-03-09 11:09 ` Alex Riesen 2020-03-10 1:07 ` Kuninori Morimoto 2020-03-10 1:07 ` Kuninori Morimoto 2020-03-10 8:17 ` Alex Riesen 2020-03-10 8:17 ` Alex Riesen 2020-03-10 10:39 ` Laurent Pinchart 2020-03-10 10:39 ` Laurent Pinchart
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200113141509.GB3606@pflmari \ --to=alexander.riesen@cetitec.com \ --cc=devel@driverdev.osuosl.org \ --cc=devicetree@vger.kernel.org \ --cc=hverkuil-cisco@xs4all.nl \ --cc=kieran.bingham@ideasonboard.com \ --cc=laurent.pinchart@ideasonboard.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=linux-renesas-soc@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mchehab@kernel.org \ --cc=robh+dt@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.