From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: linux-media@vger.kernel.org
Cc: linux-renesas-soc@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 2/3] adv748x: csi2: Set virtual channel when device is reset
Date: Sun, 22 Nov 2020 17:36:36 +0100 [thread overview]
Message-ID: <20201122163637.3590465-3-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20201122163637.3590465-1-niklas.soderlund+renesas@ragnatech.se>
It's not enough to set the CSI-2 virtual channel for TXA and TXB during
probe it also needs to be set when the device is reset. Move the virtual
channel selection to adv748x_reset() that is called during probe and
when the device needs to be reset.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
drivers/media/i2c/adv748x/adv748x-core.c | 8 ++++++--
drivers/media/i2c/adv748x/adv748x-csi2.c | 6 +-----
drivers/media/i2c/adv748x/adv748x.h | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/media/i2c/adv748x/adv748x-core.c b/drivers/media/i2c/adv748x/adv748x-core.c
index 8676ad2428856dd3..b578a01cfebe7217 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -530,10 +530,14 @@ static int adv748x_reset(struct adv748x_state *state)
io_write(state, ADV748X_IO_PD, ADV748X_IO_PD_RX_EN);
/* Conditionally enable TXa and TXb. */
- if (is_tx_enabled(&state->txa))
+ if (is_tx_enabled(&state->txa)) {
regval |= ADV748X_IO_10_CSI4_EN;
- if (is_tx_enabled(&state->txb))
+ adv748x_csi2_set_virtual_channel(&state->txa, 0);
+ }
+ if (is_tx_enabled(&state->txb)) {
regval |= ADV748X_IO_10_CSI1_EN;
+ adv748x_csi2_set_virtual_channel(&state->txb, 0);
+ }
io_write(state, ADV748X_IO_10, regval);
/* Use vid_std and v_freq as freerun resolution for CP */
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 99bb63d05eef1cd5..fa9278a08fdee3bb 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -14,8 +14,7 @@
#include "adv748x.h"
-static int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx,
- unsigned int vc)
+int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc)
{
return tx_write(tx, ADV748X_CSI_VC_REF, vc << ADV748X_CSI_VC_REF_SHIFT);
}
@@ -313,9 +312,6 @@ int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx)
if (!is_tx_enabled(tx))
return 0;
- /* Initialise the virtual channel */
- adv748x_csi2_set_virtual_channel(tx, 0);
-
adv748x_subdev_init(&tx->sd, state, &adv748x_csi2_ops,
MEDIA_ENT_F_VID_IF_BRIDGE,
is_txa(tx) ? "txa" : "txb");
diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h
index 747947ea3e316451..56256c1e8b0d3f01 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -439,6 +439,7 @@ int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input);
int adv748x_csi2_init(struct adv748x_state *state, struct adv748x_csi2 *tx);
void adv748x_csi2_cleanup(struct adv748x_csi2 *tx);
+int adv748x_csi2_set_virtual_channel(struct adv748x_csi2 *tx, unsigned int vc);
int adv748x_csi2_set_pixelrate(struct v4l2_subdev *sd, s64 rate);
int adv748x_hdmi_init(struct adv748x_hdmi *hdmi);
--
2.29.2
next prev parent reply other threads:[~2020-11-22 16:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-22 16:36 [PATCH 0/3] adv748x: Add support for s2ram Niklas Söderlund
2020-11-22 16:36 ` [PATCH 1/3] adv748x: afe: Select input port when device is reset Niklas Söderlund
2020-11-23 8:00 ` Sergei Shtylyov
2020-11-25 12:10 ` Kieran Bingham
2020-11-25 13:16 ` Niklas Söderlund
2020-11-22 16:36 ` Niklas Söderlund [this message]
2020-11-23 8:06 ` [PATCH 2/3] adv748x: csi2: Set virtual channel " Sergei Shtylyov
2020-11-22 16:36 ` [PATCH 3/3] adv748x: Configure device when resuming from sleep Niklas Söderlund
2020-11-23 8:09 ` Sergei Shtylyov
2020-11-23 8:05 ` [PATCH 0/3] adv748x: Add support for s2ram Sergei Shtylyov
2020-11-25 13:09 ` Kieran Bingham
2020-11-25 13:39 ` Niklas Söderlund
2020-11-25 13:58 ` Geert Uytterhoeven
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=20201122163637.3590465-3-niklas.soderlund+renesas@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).