From: Antti Laakso <antti.laakso@linux.intel.com>
To: linux-media@vger.kernel.org, mchehab@kernel.org,
sakari.ailus@linux.intel.com, sarang.sapre@intel.com
Cc: daxing.li@intel.com, ong.hock.yu@intel.com, antti.laakso@linux.intel.com
Subject: [PATCH v3 28/44] media: ipu6: Split ipu6 csi2 stream enable/disable
Date: Thu, 27 Aug 2026 15:33:20 +0300 [thread overview]
Message-ID: <20260827123336.2219048-29-antti.laakso@linux.intel.com> (raw)
In-Reply-To: <20260827123336.2219048-1-antti.laakso@linux.intel.com>
Instead of single function, split csi2 receiver stream enable and
disable into own functions. This make it easier to add ipu7 support.
Signed-off-by: Antti Laakso <antti.laakso@linux.intel.com>
---
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c | 98 ++++++++-----------
1 file changed, 43 insertions(+), 55 deletions(-)
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
index 7e539a0c6c92..7b63b08f5c54 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c
@@ -228,64 +228,55 @@ void ipu6_isys_csi2_error(struct ipu6_isys_csi2 *csi2)
}
}
-static int ipu6_isys_csi2_set_stream(struct v4l2_subdev *sd,
- const struct ipu6_isys_csi2_timing *timing,
- unsigned int nlanes, int enable)
+static void ipu6_isys_csi2_stream_disable(struct ipu6_isys_csi2 *csi2)
{
- struct ipu6_isys_subdev *asd = to_ipu6_isys_subdev(sd);
- struct ipu6_isys_csi2 *csi2 = to_ipu6_isys_csi2(asd);
struct ipu6_isys *isys = csi2->isys;
- struct device *dev = &isys->adev->auxdev.dev;
struct ipu6_isys_csi2_config cfg;
- unsigned int nports;
- int ret = 0;
- u32 mask = 0;
- u32 i;
+ u32 mask = isys->pdata->ipdata->csi2.irq_mask;
+
+ cfg.port = csi2->port;
+ cfg.nlanes = csi2->nlanes;
+
+ writel(0, csi2->base + CSI_REG_CSI_FE_ENABLE);
+ writel(0, csi2->base + CSI_REG_PPI2CSI_ENABLE);
+ writel(0, csi2->base + CSI_PORT_REG_BASE_IRQ_CSI +
+ CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET);
+ writel(mask, csi2->base + CSI_PORT_REG_BASE_IRQ_CSI +
+ CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET);
+ writel(0, csi2->base + CSI_PORT_REG_BASE_IRQ_CSI_SYNC +
+ CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET);
+ writel(0xffffffff, csi2->base + CSI_PORT_REG_BASE_IRQ_CSI_SYNC +
+ CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET);
- dev_dbg(dev, "stream %s CSI2-%u with %u lanes\n", enable ? "on" : "off",
- csi2->port, nlanes);
+ isys->phy_set_power(isys, &cfg, NULL, false);
+
+ writel(0, isys->pdata->base + CSI_REG_HUB_FW_ACCESS_PORT
+ (isys->pdata->ipdata->csi2.fw_access_port_ofs, csi2->port));
+ writel(0, isys->pdata->base + CSI_REG_HUB_DRV_ACCESS_PORT(csi2->port));
+}
+
+static int ipu6_isys_csi2_stream_enable(struct ipu6_isys_csi2 *csi2)
+{
+ struct ipu6_isys *isys = csi2->isys;
+ struct ipu6_isys_csi2_timing timing = { };
+ struct ipu6_isys_csi2_config cfg;
+ unsigned int nports;
+ u32 mask;
+ int ret;
cfg.port = csi2->port;
- cfg.nlanes = nlanes;
+ cfg.nlanes = csi2->nlanes;
mask = isys->pdata->ipdata->csi2.irq_mask;
nports = isys->pdata->ipdata->csi2.nports;
- if (!enable) {
- writel(0, csi2->base + CSI_REG_CSI_FE_ENABLE);
- writel(0, csi2->base + CSI_REG_PPI2CSI_ENABLE);
-
- writel(0,
- csi2->base + CSI_PORT_REG_BASE_IRQ_CSI +
- CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET);
- writel(mask,
- csi2->base + CSI_PORT_REG_BASE_IRQ_CSI +
- CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET);
- writel(0,
- csi2->base + CSI_PORT_REG_BASE_IRQ_CSI_SYNC +
- CSI_PORT_REG_BASE_IRQ_ENABLE_OFFSET);
- writel(0xffffffff,
- csi2->base + CSI_PORT_REG_BASE_IRQ_CSI_SYNC +
- CSI_PORT_REG_BASE_IRQ_CLEAR_OFFSET);
-
- isys->phy_set_power(isys, &cfg, timing, false);
-
- writel(0, isys->pdata->base + CSI_REG_HUB_FW_ACCESS_PORT
- (isys->pdata->ipdata->csi2.fw_access_port_ofs,
- csi2->port));
- writel(0, isys->pdata->base +
- CSI_REG_HUB_DRV_ACCESS_PORT(csi2->port));
-
- return ret;
- }
-
/* reset port reset */
writel(0x1, csi2->base + CSI_REG_PORT_GPREG_SRST);
usleep_range(100, 200);
writel(0x0, csi2->base + CSI_REG_PORT_GPREG_SRST);
/* enable port clock */
- for (i = 0; i < nports; i++) {
+ for (unsigned int i = 0; i < nports; i++) {
writel(1, isys->pdata->base + CSI_REG_HUB_DRV_ACCESS_PORT(i));
writel(1, isys->pdata->base + CSI_REG_HUB_FW_ACCESS_PORT
(isys->pdata->ipdata->csi2.fw_access_port_ofs, i));
@@ -329,18 +320,18 @@ static int ipu6_isys_csi2_set_stream(struct v4l2_subdev *sd,
writel(CSI_SENSOR_INPUT, csi2->base + CSI_REG_CSI_FE_MUX_CTRL);
writel(CSI_CNTR_SENSOR_LINE_ID | CSI_CNTR_SENSOR_FRAME_ID,
csi2->base + CSI_REG_CSI_FE_SYNC_CNTR_SEL);
- writel(FIELD_PREP(PPI_INTF_CONFIG_NOF_ENABLED_DLANES_MASK, nlanes - 1),
+ writel(FIELD_PREP(PPI_INTF_CONFIG_NOF_ENABLED_DLANES_MASK,
+ csi2->nlanes - 1),
csi2->base + CSI_REG_PPI2CSI_CONFIG_PPI_INTF);
writel(1, csi2->base + CSI_REG_PPI2CSI_ENABLE);
writel(1, csi2->base + CSI_REG_CSI_FE_ENABLE);
- ret = isys->phy_set_power(isys, &cfg, timing, true);
+ ret = ipu6_isys_csi2_calc_timing(csi2, &timing, CSI2_ACCINV);
if (ret)
- dev_err(dev, "csi-%d phy power up failed %d\n", csi2->port,
- ret);
+ return ret;
- return ret;
+ return isys->phy_set_power(isys, &cfg, &timing, true);
}
static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
@@ -349,7 +340,6 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
{
struct ipu6_isys_subdev *asd = to_ipu6_isys_subdev(sd);
struct ipu6_isys_csi2 *csi2 = to_ipu6_isys_csi2(asd);
- struct ipu6_isys_csi2_timing timing = { };
struct v4l2_subdev *remote_sd;
struct media_pad *remote_pad;
u64 sink_streams;
@@ -362,18 +352,14 @@ static int ipu6_isys_csi2_enable_streams(struct v4l2_subdev *sd,
v4l2_subdev_state_xlate_streams(state, pad, CSI2_PAD_SINK,
&streams_mask);
- ret = ipu6_isys_csi2_calc_timing(csi2, &timing, CSI2_ACCINV);
- if (ret)
- return ret;
-
- ret = ipu6_isys_csi2_set_stream(sd, &timing, csi2->nlanes, true);
+ ret = ipu6_isys_csi2_stream_enable(csi2);
if (ret)
return ret;
ret = v4l2_subdev_enable_streams(remote_sd, remote_pad->index,
sink_streams);
if (ret) {
- ipu6_isys_csi2_set_stream(sd, NULL, 0, false);
+ ipu6_isys_csi2_stream_disable(csi2);
return ret;
}
@@ -384,6 +370,8 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,
struct v4l2_subdev_state *state,
u32 pad, u64 streams_mask)
{
+ struct ipu6_isys_subdev *asd = to_ipu6_isys_subdev(sd);
+ struct ipu6_isys_csi2 *csi2 = to_ipu6_isys_csi2(asd);
struct v4l2_subdev *remote_sd;
struct media_pad *remote_pad;
u64 sink_streams;
@@ -395,7 +383,7 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,
remote_pad = media_pad_remote_pad_first(&sd->entity.pads[CSI2_PAD_SINK]);
remote_sd = media_entity_to_v4l2_subdev(remote_pad->entity);
- ipu6_isys_csi2_set_stream(sd, NULL, 0, false);
+ ipu6_isys_csi2_stream_disable(csi2);
v4l2_subdev_disable_streams(remote_sd, remote_pad->index, sink_streams);
--
2.55.0
next prev parent reply other threads:[~2026-08-27 12:34 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 12:32 [PATCH v3 00/44] media: ipu6: Add support for ipu7 hardware Antti Laakso
2026-08-27 12:32 ` [PATCH v3 01/44] media: ipu6: Add helpers for IPU runtime variation Antti Laakso
2026-08-27 12:32 ` [PATCH v3 02/44] media: ipu6: Rename pointer to firmware context Antti Laakso
2026-08-27 12:32 ` [PATCH v3 03/44] media: ipu6: Rename buttress_ipc pointer Antti Laakso
2026-08-27 12:32 ` [PATCH v3 04/44] media: ipu6: Remove duplicate warnings in cpd validation Antti Laakso
2026-08-27 12:32 ` [PATCH v3 05/44] media: ipu6: Remove unused ipu6 firmware struct Antti Laakso
2026-08-27 12:32 ` [PATCH v3 06/44] media: ipu6: Cleanup ipu6_mmu_init() Antti Laakso
2026-08-27 12:32 ` [PATCH v3 07/44] media: ipu6: Simplify firmware com arguments Antti Laakso
2026-08-27 12:33 ` [PATCH v3 08/44] media: ipu6: Add helper to identify ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 09/44] media: ipu6: Prepare buttress for ipu7 support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 10/44] media: ipu6: Use single struct for registers Antti Laakso
2026-08-27 12:33 ` [PATCH v3 11/44] media: ipu6: Rename IPU subsys ID Antti Laakso
2026-08-27 12:33 ` [PATCH v3 12/44] media: ipu6: Add ipu7 buttress support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 13/44] media: ipu6: Prepare mmu driver for hw variation Antti Laakso
2026-08-27 12:33 ` [PATCH v3 14/44] media: ipu6: Add ipu7 mmu support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 15/44] media: ipu6: Add ipu7 cpd handling Antti Laakso
2026-08-27 12:33 ` [PATCH v3 16/44] media: ipu6: Add check for pkg_dir before freeing Antti Laakso
2026-08-27 12:33 ` [PATCH v3 17/44] media: ipu6: Rename isys fw msg union Antti Laakso
2026-08-27 12:33 ` [PATCH v3 18/44] media: ipu6: Move isys isr handlers to fw file Antti Laakso
2026-08-27 12:33 ` [PATCH v3 19/44] media: ipu6: Move hw specific buffer handling down Antti Laakso
2026-08-27 12:33 ` [PATCH v3 20/44] media: ipu6: Isolate hw specific buffer handling Antti Laakso
2026-08-27 12:33 ` [PATCH v3 21/44] media: ipu6: Add isys firmware ops Antti Laakso
2026-08-27 12:33 ` [PATCH v3 22/44] media: ipu6: Add ipu7 fw start/stop functionality Antti Laakso
2026-08-27 12:33 ` [PATCH v3 23/44] media: ipu6: Add ipu7 fw com methods Antti Laakso
2026-08-27 12:33 ` [PATCH v3 24/44] media: ipu6: Add ipu7 fw isys ops Antti Laakso
2026-08-27 12:33 ` [PATCH v3 25/44] media: ipu6: Add ipu7 csi2 register definitions Antti Laakso
2026-08-27 12:33 ` [PATCH v3 26/44] media: ipu6: Add ipu7 isr handler Antti Laakso
2026-08-27 12:33 ` [PATCH v3 27/44] media: ipu6: Add ipu7 csi phy driver Antti Laakso
2026-08-27 12:33 ` Antti Laakso [this message]
2026-08-27 12:33 ` [PATCH v3 29/44] media: ipu6: Add support for ipu7 csi2 receiver Antti Laakso
2026-08-27 12:33 ` [PATCH v3 30/44] media: ipu6: Parse bus type for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 31/44] media: ipu6: Enable ipu7 isys interrupts Antti Laakso
2026-08-27 12:33 ` [PATCH v3 32/44] media: ipu6: Skip watermark configuration for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 33/44] media: ipu6: The SPC init is valid only for ipu6 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 34/44] media: ipu6: The VC arbitration mechanism is ipu6 only Antti Laakso
2026-08-27 12:33 ` [PATCH v3 35/44] media: ipu6: Move buttress mem alloc out from probe Antti Laakso
2026-08-27 12:33 ` [PATCH v3 36/44] media: ipu6: Read correct SKU ID for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 37/44] media: ipu6: Add support for fixed iova region Antti Laakso
2026-08-27 12:33 ` [PATCH v3 38/44] media: ipu6: Make fw mapping function reusable Antti Laakso
2026-08-27 12:33 ` [PATCH v3 39/44] media: ipu6: Move isys fw mapping to pci_probe Antti Laakso
2026-08-27 12:33 ` [PATCH v3 40/44] media: ipu6: Map ipu7 firmware Antti Laakso
2026-08-27 12:33 ` [PATCH v3 41/44] media: ipu6: Set model name for ipu7 Antti Laakso
2026-08-27 12:33 ` [PATCH v3 42/44] media: ipu6: Add ipu7.5 buttress support Antti Laakso
2026-08-27 12:33 ` [PATCH v3 43/44] media: ipu6: Add ipu7.5 mmu initialization data Antti Laakso
2026-08-27 12:33 ` [PATCH v3 44/44] media: ipu6: Enable ipu7 and ipu7.5 Antti Laakso
2026-09-02 8:01 ` [PATCH 1/1] media: ipu6: Add a Kconfig option for IPU 7, 7.5 support Sakari Ailus
[not found] ` <6a983846.bd8478ff.19809f.007e@mx.google.com>
2026-09-02 19:06 ` [media-ci] Re: [1/1] " Ricardo Ribalda Delgado
2026-09-02 19:24 ` Sakari Ailus
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=20260827123336.2219048-29-antti.laakso@linux.intel.com \
--to=antti.laakso@linux.intel.com \
--cc=daxing.li@intel.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=ong.hock.yu@intel.com \
--cc=sakari.ailus@linux.intel.com \
--cc=sarang.sapre@intel.com \
/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 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.