From: George Neacsu <geocausa@gmail.com>
To: Bryan O'Donoghue <bod@kernel.org>, Vinod Koul <vkoul@kernel.org>,
David Heidelberg <david@ixit.cz>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
linux-phy@lists.infradead.org, linux-media@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
George Neacsu <geocausa@gmail.com>
Subject: [PATCH RFC 4/4] media: qcom: camss: Configure C-PHY through the PHY API
Date: Thu, 15 Oct 2026 23:20:39 +0100 [thread overview]
Message-ID: <20261015-x1e-cphy-rfc-v1-4-1f3fa9af940a@gmail.com> (raw)
In-Reply-To: <20261015-x1e-cphy-rfc-v1-0-1f3fa9af940a@gmail.com>
With a PHY API CSIPHY, csiphy_stream_on() always asks for D-PHY. Ask for
C-PHY when the endpoint is C-PHY, and pass the trio count and the symbol
rate, which by the V4L2 convention is twice the link frequency.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: George Neacsu <geocausa@gmail.com>
---
drivers/media/platform/qcom/camss/camss-csiphy.c | 35 ++++++++++++++----------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index f44f2aeb9..8e1b4335a 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -329,17 +329,15 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
u8 bpp = csiphy_get_bpp(csiphy->res->formats->formats, csiphy->res->formats->nformats,
csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
struct csiphy_lanes_cfg *lncfg = &csiphy->cfg.csi2->lane_cfg;
- struct phy_configure_opts_mipi_dphy *dphy_cfg;
- union phy_configure_opts dphy_opts = { 0 };
+ const bool cphy = lncfg->phy_cfg == V4L2_MBUS_CSI2_CPHY;
+ union phy_configure_opts opts = { 0 };
struct device *dev = csiphy->camss->dev;
u8 num_lanes = lncfg->num_data;
s64 link_freq;
int ret;
- dphy_cfg = &dphy_opts.mipi_dphy;
-
link_freq = camss_get_link_freq(&csiphy->subdev.entity, bpp, num_lanes,
- csiphy->cfg.csi2->lane_cfg.phy_cfg == V4L2_MBUS_CSI2_CPHY);
+ cphy);
if (link_freq <= 0) {
dev_err(dev,
@@ -347,23 +345,32 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
return -EINVAL;
}
- ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq, num_lanes,
- dphy_cfg);
- if (ret < 0) {
- dev_err(dev, "Invalid config for link frequency %lld\n",
- link_freq);
- return ret;
+ if (cphy) {
+ /* A C-PHY link frequency is half the symbol rate. */
+ opts.mipi_cphy.symbol_rate = link_freq * 2;
+ opts.mipi_cphy.lanes = num_lanes;
+ } else {
+ ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq,
+ num_lanes,
+ &opts.mipi_dphy);
+ if (ret < 0) {
+ dev_err(dev, "Invalid config for link frequency %lld\n",
+ link_freq);
+ return ret;
+ }
}
- ret = phy_set_mode(csiphy->phy, PHY_MODE_MIPI_DPHY);
+ ret = phy_set_mode(csiphy->phy,
+ cphy ? PHY_MODE_MIPI_CPHY : PHY_MODE_MIPI_DPHY);
if (ret) {
dev_err(dev, "Failed to set phy mode\n");
return ret;
}
- ret = phy_configure(csiphy->phy, &dphy_opts);
+ ret = phy_configure(csiphy->phy, &opts);
if (ret) {
- dev_err(dev, "failed to configure MIPI D-PHY\n");
+ dev_err(dev, "failed to configure MIPI %s\n",
+ cphy ? "C-PHY" : "D-PHY");
goto error;
}
--
2.53.0
WARNING: multiple messages have this Message-ID (diff)
From: George Neacsu via B4 Relay <devnull+geocausa.gmail.com@kernel.org>
To: Bryan O'Donoghue <bod@kernel.org>, Vinod Koul <vkoul@kernel.org>,
David Heidelberg <david@ixit.cz>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
linux-phy@lists.infradead.org, linux-media@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
George Neacsu <geocausa@gmail.com>
Subject: [PATCH RFC 4/4] media: qcom: camss: Configure C-PHY through the PHY API
Date: Thu, 15 Oct 2026 23:20:39 +0100 [thread overview]
Message-ID: <20261015-x1e-cphy-rfc-v1-4-1f3fa9af940a@gmail.com> (raw)
In-Reply-To: <20261015-x1e-cphy-rfc-v1-0-1f3fa9af940a@gmail.com>
From: George Neacsu <geocausa@gmail.com>
With a PHY API CSIPHY, csiphy_stream_on() always asks for D-PHY. Ask for
C-PHY when the endpoint is C-PHY, and pass the trio count and the symbol
rate, which by the V4L2 convention is twice the link frequency.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: George Neacsu <geocausa@gmail.com>
---
drivers/media/platform/qcom/camss/camss-csiphy.c | 35 ++++++++++++++----------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index f44f2aeb9..8e1b4335a 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -329,17 +329,15 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
u8 bpp = csiphy_get_bpp(csiphy->res->formats->formats, csiphy->res->formats->nformats,
csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
struct csiphy_lanes_cfg *lncfg = &csiphy->cfg.csi2->lane_cfg;
- struct phy_configure_opts_mipi_dphy *dphy_cfg;
- union phy_configure_opts dphy_opts = { 0 };
+ const bool cphy = lncfg->phy_cfg == V4L2_MBUS_CSI2_CPHY;
+ union phy_configure_opts opts = { 0 };
struct device *dev = csiphy->camss->dev;
u8 num_lanes = lncfg->num_data;
s64 link_freq;
int ret;
- dphy_cfg = &dphy_opts.mipi_dphy;
-
link_freq = camss_get_link_freq(&csiphy->subdev.entity, bpp, num_lanes,
- csiphy->cfg.csi2->lane_cfg.phy_cfg == V4L2_MBUS_CSI2_CPHY);
+ cphy);
if (link_freq <= 0) {
dev_err(dev,
@@ -347,23 +345,32 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
return -EINVAL;
}
- ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq, num_lanes,
- dphy_cfg);
- if (ret < 0) {
- dev_err(dev, "Invalid config for link frequency %lld\n",
- link_freq);
- return ret;
+ if (cphy) {
+ /* A C-PHY link frequency is half the symbol rate. */
+ opts.mipi_cphy.symbol_rate = link_freq * 2;
+ opts.mipi_cphy.lanes = num_lanes;
+ } else {
+ ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq,
+ num_lanes,
+ &opts.mipi_dphy);
+ if (ret < 0) {
+ dev_err(dev, "Invalid config for link frequency %lld\n",
+ link_freq);
+ return ret;
+ }
}
- ret = phy_set_mode(csiphy->phy, PHY_MODE_MIPI_DPHY);
+ ret = phy_set_mode(csiphy->phy,
+ cphy ? PHY_MODE_MIPI_CPHY : PHY_MODE_MIPI_DPHY);
if (ret) {
dev_err(dev, "Failed to set phy mode\n");
return ret;
}
- ret = phy_configure(csiphy->phy, &dphy_opts);
+ ret = phy_configure(csiphy->phy, &opts);
if (ret) {
- dev_err(dev, "failed to configure MIPI D-PHY\n");
+ dev_err(dev, "failed to configure MIPI %s\n",
+ cphy ? "C-PHY" : "D-PHY");
goto error;
}
--
2.53.0
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: George Neacsu via B4 Relay <devnull+geocausa.gmail.com@kernel.org>
To: Bryan O'Donoghue <bod@kernel.org>, Vinod Koul <vkoul@kernel.org>,
David Heidelberg <david@ixit.cz>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>,
Loic Poulain <loic.poulain@oss.qualcomm.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Manivannan Sadhasivam <mani@kernel.org>,
linux-phy@lists.infradead.org, linux-media@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
George Neacsu <geocausa@gmail.com>
Subject: [PATCH RFC 4/4] media: qcom: camss: Configure C-PHY through the PHY API
Date: Thu, 15 Oct 2026 23:20:39 +0100 [thread overview]
Message-ID: <20261015-x1e-cphy-rfc-v1-4-1f3fa9af940a@gmail.com> (raw)
In-Reply-To: <20261015-x1e-cphy-rfc-v1-0-1f3fa9af940a@gmail.com>
From: George Neacsu <geocausa@gmail.com>
With a PHY API CSIPHY, csiphy_stream_on() always asks for D-PHY. Ask for
C-PHY when the endpoint is C-PHY, and pass the trio count and the symbol
rate, which by the V4L2 convention is twice the link frequency.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: George Neacsu <geocausa@gmail.com>
---
drivers/media/platform/qcom/camss/camss-csiphy.c | 35 ++++++++++++++----------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index f44f2aeb9..8e1b4335a 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -329,17 +329,15 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
u8 bpp = csiphy_get_bpp(csiphy->res->formats->formats, csiphy->res->formats->nformats,
csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
struct csiphy_lanes_cfg *lncfg = &csiphy->cfg.csi2->lane_cfg;
- struct phy_configure_opts_mipi_dphy *dphy_cfg;
- union phy_configure_opts dphy_opts = { 0 };
+ const bool cphy = lncfg->phy_cfg == V4L2_MBUS_CSI2_CPHY;
+ union phy_configure_opts opts = { 0 };
struct device *dev = csiphy->camss->dev;
u8 num_lanes = lncfg->num_data;
s64 link_freq;
int ret;
- dphy_cfg = &dphy_opts.mipi_dphy;
-
link_freq = camss_get_link_freq(&csiphy->subdev.entity, bpp, num_lanes,
- csiphy->cfg.csi2->lane_cfg.phy_cfg == V4L2_MBUS_CSI2_CPHY);
+ cphy);
if (link_freq <= 0) {
dev_err(dev,
@@ -347,23 +345,32 @@ static int csiphy_stream_on(struct csiphy_device *csiphy)
return -EINVAL;
}
- ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq, num_lanes,
- dphy_cfg);
- if (ret < 0) {
- dev_err(dev, "Invalid config for link frequency %lld\n",
- link_freq);
- return ret;
+ if (cphy) {
+ /* A C-PHY link frequency is half the symbol rate. */
+ opts.mipi_cphy.symbol_rate = link_freq * 2;
+ opts.mipi_cphy.lanes = num_lanes;
+ } else {
+ ret = phy_mipi_dphy_get_default_config_for_hsclk(link_freq,
+ num_lanes,
+ &opts.mipi_dphy);
+ if (ret < 0) {
+ dev_err(dev, "Invalid config for link frequency %lld\n",
+ link_freq);
+ return ret;
+ }
}
- ret = phy_set_mode(csiphy->phy, PHY_MODE_MIPI_DPHY);
+ ret = phy_set_mode(csiphy->phy,
+ cphy ? PHY_MODE_MIPI_CPHY : PHY_MODE_MIPI_DPHY);
if (ret) {
dev_err(dev, "Failed to set phy mode\n");
return ret;
}
- ret = phy_configure(csiphy->phy, &dphy_opts);
+ ret = phy_configure(csiphy->phy, &opts);
if (ret) {
- dev_err(dev, "failed to configure MIPI D-PHY\n");
+ dev_err(dev, "failed to configure MIPI %s\n",
+ cphy ? "C-PHY" : "D-PHY");
goto error;
}
--
2.53.0
next prev parent reply other threads:[~2026-10-15 22:20 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 22:20 [PATCH RFC 0/4] phy: qcom-mipi-csi2: C-PHY for X1E80100 George Neacsu
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-15 22:20 ` [PATCH RFC 1/4] phy: Add MIPI C-PHY mode and configuration options George Neacsu
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-16 9:13 ` Bryan O'Donoghue
2026-10-16 9:13 ` Bryan O'Donoghue
2026-10-16 9:24 ` Loic Poulain
2026-10-16 9:24 ` Loic Poulain
2026-10-15 22:20 ` [PATCH RFC 2/4] phy: qcom-mipi-csi2: Add C-PHY support for X1E80100 George Neacsu
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-16 9:29 ` Bryan O'Donoghue
2026-10-16 9:29 ` Bryan O'Donoghue
2026-10-16 10:06 ` George Neacsu
2026-10-16 10:06 ` George Neacsu
2026-10-16 10:12 ` Bryan O'Donoghue
2026-10-16 10:12 ` Bryan O'Donoghue
2026-10-16 9:59 ` Nihal Kumar Gupta
2026-10-16 9:59 ` Nihal Kumar Gupta
2026-10-16 10:06 ` George Neacsu
2026-10-16 10:06 ` George Neacsu
2026-10-16 10:23 ` Konrad Dybcio
2026-10-16 10:23 ` Konrad Dybcio
2026-10-15 22:20 ` [PATCH RFC 3/4] media: qcom: camss: csid-680: Select C-PHY in the receiver George Neacsu
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-16 7:50 ` Loic Poulain
2026-10-16 7:50 ` Loic Poulain
2026-10-15 22:20 ` George Neacsu [this message]
2026-10-15 22:20 ` [PATCH RFC 4/4] media: qcom: camss: Configure C-PHY through the PHY API George Neacsu via B4 Relay
2026-10-15 22:20 ` George Neacsu via B4 Relay
2026-10-16 7:56 ` Loic Poulain
2026-10-16 7:56 ` Loic Poulain
2026-10-16 8:59 ` Bryan O'Donoghue
2026-10-16 8:59 ` Bryan O'Donoghue
2026-10-16 9:09 ` Bryan O'Donoghue
2026-10-16 9:09 ` Bryan O'Donoghue
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=20261015-x1e-cphy-rfc-v1-4-1f3fa9af940a@gmail.com \
--to=geocausa@gmail.com \
--cc=bod@kernel.org \
--cc=david@ixit.cz \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mani@kernel.org \
--cc=mchehab@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=vkoul@kernel.org \
--cc=vladimir.zapolskiy@linaro.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 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.