phy/media: Add generic MIPI C-PHY support to CSI-2 stack
Subsystems (5)
cover phy/media: Add generic MIPI C-PHY support to CSI-2 stack
George posted a C-PHY series [1] which we are currently reviewing. As discussed with Bryan, this series shares our independent implementation so the approaches can be compared.
Two aspects covered here are not in [1]:
- Settle count calculation derived from sensor-reported T_PREPARE and T_PREAMBLE timing via get_mbus_config(). [1] left this as an open question.
- Data rate based register sequence selection using effective bit rate (link_freq * 32 / 7). [1] noted downstream does this but deferred it; this series implements it.
MIPI CSI-2 operates over two physical layer variants. D-PHY uses a dedicated differential clock lane with up to four data lanes. C-PHY encodes the clock within the data stream across up to three wire trios, eliminating the dedicated clock lane.
Patch 1 extends the generic PHY framework with PHY_MODE_MIPI_CPHY and struct phy_configure_opts_mipi_cphy.
Patch 2 adds t_prepare_ns and t_preamble_ns fields to the CSI-2 media bus configuration and extends CAMSS to forward them to the PHY provider for settle count calculation. Sensor drivers must implement get_mbus_config() and return non-zero values in nanoseconds; stream-on returns -EINVAL otherwise. The strictness is deliberate: C-PHY settle timing is symbol-rate-range specific and no safe value can be derived from link frequency alone. A conservative fallback could be added if reviewers prefer.
Patches 3-6 extend the Qualcomm CSIPHY driver: refactor D-PHY register storage to accommodate C-PHY, accept C-PHY mode with multiple data rate table selection, compute settle count, and add lane power mask support for C-PHY trios.
C-PHY encodes 16 bits per 7 symbols, so the effective bit rate is:
bit_rate = link_freq * 2 * 16 / 7 = link_freq * 32 / 7
where link_freq is symbol_rate / 2 as reported by the sensor via get_mbus_config(). The rate-table entry whose bandwidth first meets or exceeds bit_rate is selected.
The settle count defines how many timer clock cycles the CSIPHY receiver waits before scanning for C-PHY sync. It is computed from the sensor's T_PREPARE and T_PREAMBLE timing. The /3 factor reflects that C-PHY distributes the preamble sequence across three trios:
settle_cnt = (t_prepare_ns + t_preamble_ns / 3) * timer_clk_rate / 1e9
D-PHY settle count is unchanged from before this series.
[1] https://lore.kernel.org/all/[email protected]/
---
Nihal Kumar Gupta (6):
phy: core: Add MIPI C-PHY configurations
media: qcom: camss: Add C-PHY timing fields and get config from sensor
phy: qcom: mipi-csi2: Split D-PHY register settings
phy: qcom: mipi-csi2: Accept C-PHY mode and add register sequence
phy: qcom: mipi-csi2: Add C-PHY settle calculation
phy: qcom: mipi-csi2: Add lane mask calculation for C-PHY
drivers/media/platform/qcom/camss/camss-csiphy.c | 90 +++++++++--- drivers/media/platform/qcom/camss/camss-csiphy.h | 2 + drivers/media/platform/qcom/camss/camss.c | 8 +- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 159 +++++++++++++++++---- drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 51 +++++-- drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 25 +++- include/linux/phy/phy.h | 47 ++++++ include/media/v4l2-mediabus.h | 2 + 8 files changed, 315 insertions(+), 69 deletions(-)
---
base-commit: 2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261017-cphy_support-2ce4d656e631
Best regards,
Signature · 1 line
Nihal Kumar Gupta <[email protected]>
RFC PATCH 1/6 phy: core: Add MIPI C-PHY configurations
MIPI CSI-2 receivers can be connected through C-PHY as well as D-PHY. C-PHY uses trios instead of lanes and needs mode-specific timings passed to the PHY provider.
Add PHY_MODE_MIPI_CPHY and C-PHY configure option carrying the link rate, trio count and C-PHY prepare/preamble timing.
--- include/linux/phy/phy.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
include/linux/phy/phy.h +47 -0
@@ -47,6 +47,7 @@ enum phy_mode {PHY_MODE_DP ,PHY_MODE_HDMI ,PHY_MODE_TBT , + PHY_MODE_MIPI_CPHY, }; enum phy_media {
@@ -64,11 +65,56 @@ union phy_notify {enum phy_ufs_state ufs_state; }; +/** +* struct phy_configure_opts_mipi_cphy - MIPI C-PHY configuration set +* +* This structure is used to represent the configuration state of a +* MIPI C-PHY phy. +*/ +struct phy_configure_opts_mipi_cphy { +/** +* @symbol_rate: +* +* Symbol rate per trio, in symbols per second. +*/ +u64 symbol_rate; + +/** +* @trios: +* +* Number of active C-PHY trios. +* +* Minimum value: 1 +* Maximum value: 3 +*/ +unsigned int trios; + +/** +* @t_prepare_ns: +* +* C-PHY T_PREPARE timing value, in nanoseconds. +* Time the transmitter drives the LP-00 state before +* starting the HS preamble sequence. +*/ +u32 t_prepare_ns; + +/** +* @t_preamble_ns: +* +* C-PHY T_PREAMBLE timing value, in nanoseconds. +* Duration of the HS preamble sequence transmitted +* before the first payload symbol. +*/ +u32 t_preamble_ns; +}; +/** * union phy_configure_opts - Opaque generic phy configuration * * @mipi_dphy: Configuration set applicable for phys supporting * the MIPI_DPHY phy mode. +* @mipi_cphy: Configuration set applicable for phys supporting +* the MIPI_CPHY phy mode. * @dp: Configuration set applicable for phys supporting * the DisplayPort protocol. * @lvds: Configuration set applicable for phys supporting
@@ -78,6 +124,7 @@ union phy_notify {*/ union phy_configure_opts {struct phy_configure_opts_mipi_dphy mipi_dphy; +struct phy_configure_opts_mipi_cphy mipi_cphy;struct phy_configure_opts_dp dp;struct phy_configure_opts_lvds lvds;struct phy_configure_opts_hdmi hdmi;
Signature · 1 line
2.34.1
RFC PATCH 2/6 media: qcom: camss: Add C-PHY timing fields and get config from sensor
In reply to Nihal Kumar GuptaC-PHY settle count is derived from the T_PREPARE and T_PREAMBLE link timing parameters reported by the transmitter. Add C-PHY prepare and preamble timing fields to the CSI-2 media bus configuration.
The endpoint bus type already describes whether the connected CSI-2 link uses D-PHY or C-PHY.
Accept C-PHY endpoints, store the parsed CSI-2 PHY type and query the remote sensor media bus configuration for C-PHY links. Pass the reported link frequency and timing to the generic PHY while keeping the existing D-PHY fallback path.
--- drivers/media/platform/qcom/camss/camss-csiphy.c | 90 +++++++++++++++++++----- drivers/media/platform/qcom/camss/camss-csiphy.h | 2 + drivers/media/platform/qcom/camss/camss.c | 8 +-- include/media/v4l2-mediabus.h | 2 + 4 files changed, 79 insertions(+), 23 deletions(-)
drivers/media/platform/qcom/camss/camss-csiphy.c +72 -18
@@ -313,6 +313,29 @@ static void csiphy_stream_off_legacy(struct csiphy_device *csiphy) csiphy->res->hw_ops->lanes_disable (csiphy, &csiphy->cfg); } +static int csiphy_get_remote_mbus_config (struct csiphy_device *csiphy, +struct v4l2_mbus_config *cfg) +{ +struct media_pad *remote; +struct v4l2_subdev *remote_sd; +int ret; + + remote =media_pad_remote_pad_first (&csiphy->pads[MSM_CSIPHY_PAD_SINK ]); +if (!remote) +return -ENOLINK ; + + remote_sd =media_entity_to_v4l2_subdev (remote->entity); +if (!remote_sd) +return -EINVAL ; + +memset (cfg,0 ,sizeof (*cfg)); + ret =v4l2_subdev_call (remote_sd, pad, get_mbus_config, + remote->index, cfg); +if (ret == -ENOIOCTLCMD ) +return -EOPNOTSUPP ; + +return ret; +}/* * csiphy_stream_on - Enable streaming on CSIPHY module * @csiphy: CSIPHY device
@@ -324,43 +347,74 @@ static void csiphy_stream_off_legacy(struct csiphy_device *csiphy)*/ static int csiphy_stream_on (struct csiphy_device *csiphy) { +struct v4l2_mbus_config mbus_cfg = { };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 }; +union phy_configure_opts opts = {0 }; +enum phy_mode mode =PHY_MODE_INVALID ;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); + ret =csiphy_get_remote_mbus_config (csiphy, &mbus_cfg); +if (ret && ret != -EOPNOTSUPP ) +return ret; -if (link_freq <=0 ) { -dev_err (dev, -"Cannot get CSI2 transmitter's link frequency\n" ); -return -EINVAL ; +if (ret == -EOPNOTSUPP && lncfg->phy_type ==V4L2_MBUS_CSI2_CPHY ) { +dev_err (dev,"C-PHY transmitter does not report media bus configuration\n" ); +return ret; } - 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 (!ret && mbus_cfg.type ==V4L2_MBUS_CSI2_CPHY ) { +struct phy_configure_opts_mipi_cphy *cphy = &opts.mipi_cphy; + + link_freq = mbus_cfg.link_freq; +if (link_freq <=0 ) { +dev_err (dev, +"Cannot get CSI2 transmitter's link frequency\n" ); +return -EINVAL ; + } + + cphy->symbol_rate = link_freq *2 ; + cphy->trios = num_lanes; + cphy->t_prepare_ns = mbus_cfg.bus.mipi_csi2.t_prepare_ns; + cphy->t_preamble_ns = mbus_cfg.bus.mipi_csi2.t_preamble_ns; + + mode =PHY_MODE_MIPI_CPHY ; + }else if (ret || mbus_cfg.type ==V4L2_MBUS_CSI2_DPHY ) { +struct phy_configure_opts_mipi_dphy *dphy = &opts.mipi_dphy; + + link_freq =camss_get_link_freq (&csiphy->subdev.entity, bpp, num_lanes); +if (link_freq <=0 ) { +dev_err (dev, +"Cannot get CSI2 transmitter's link frequency\n" ); +return -EINVAL ; + } + + ret =phy_mipi_dphy_get_default_config_for_hsclk (link_freq, num_lanes, + dphy); +if (ret <0 ) { +dev_err (dev,"Invalid config for link frequency %lld\n" , + link_freq); +return ret; + } + mode =PHY_MODE_MIPI_DPHY ; + }else { +dev_err (dev,"Unsupported mbus type %u\n" , mbus_cfg.type); +return -EINVAL ; } - ret =phy_set_mode (csiphy->phy,PHY_MODE_MIPI_DPHY ); + ret =phy_set_mode (csiphy->phy, mode);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 CSI-2 PHY\n" ); goto error; }
drivers/media/platform/qcom/camss/camss-csiphy.h +2 -0
@@ -35,11 +35,13 @@ struct csiphy_lane {* @num_data: number of data lanes * @data: data lanes configuration * @clk: clock lane configuration (only for D-PHY) +* @phy_type: CSI-2 PHY bus type */ struct csiphy_lanes_cfg {int num_data;struct csiphy_lane *data;struct csiphy_lane clk; +enum v4l2_mbus_type phy_type; };struct csiphy_csi2_cfg {
drivers/media/platform/qcom/camss/camss.c +3 -5
@@ -4694,11 +4694,8 @@ static int camss_parse_endpoint_node(struct device *dev,if (ret)return ret; -/* -* Most SoCs support both D-PHY and C-PHY standards, but currently only -* D-PHY is supported in the driver. -*/ -if (vep.bus_type !=V4L2_MBUS_CSI2_DPHY ) { +if (vep.bus_type !=V4L2_MBUS_CSI2_DPHY && + vep.bus_type !=V4L2_MBUS_CSI2_CPHY ) {dev_err (dev,"Unsupported bus type %d\n" , vep.bus_type);return -EINVAL ; }
@@ -4706,6 +4703,7 @@ static int camss_parse_endpoint_node(struct device *dev, csd->interface.csiphy_id = vep.base.port; mipi_csi2 = &vep.bus.mipi_csi2; + lncfg->phy_type = vep.bus_type; lncfg->clk.pos = mipi_csi2->clock_lane; lncfg->clk.pol = mipi_csi2->lane_polarities[0 ]; lncfg->num_data = mipi_csi2->num_data_lanes;
include/media/v4l2-mediabus.h +2 -0
@@ -109,6 +109,8 @@ struct v4l2_mbus_config_mipi_csi2 {unsigned char num_data_lanes;bool lane_polarities[1 +V4L2_MBUS_CSI2_MAX_DATA_LANES ];enum v4l2_mbus_csi2_cphy_line_orders_type line_orders[V4L2_MBUS_CSI2_MAX_DATA_LANES ]; +u32 t_prepare_ns; +u32 t_preamble_ns; };/**
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH RFC 2/6] media: qcom: camss: Add C-PHY timing fields and get config from sensor
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] media: qcom: camss: missing V4L2_CID_LINK_FREQ fallback in csiphy_stream_on() - [Low] media…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] media: qcom: camss: missing V4L2_CID_LINK_FREQ fallback in csiphy_stream_on()
- [Low] media: v4l2-mediabus: missing kernel-doc for C-PHY timing fields
--
commit 0e2de1c89a699407d4b177bc0d1a72cd888312a3
Author: Nihal Kumar Gupta <[email protected]>
media: qcom: camss: Add C-PHY timing fields and get config from sensor
This commit adds t_prepare_ns and t_preamble_ns timing fields to struct v4l2_mbus_config_mipi_csi2 and updates the CAMSS CSIPHY driver to accept C-PHY endpoints, query the remote transmitter media bus configuration, and pass C-PHY link frequency and timings to the generic PHY.
Quoted 72 lines
drivers/media/platform/qcom/camss/camss-csiphy.c +32
-14@@ -313,6 +313,29 @@ static void csiphy_stream_off_legacy(struct csiphy_device *csiphy) csiphy->res->hw_ops->lanes_disable (csiphy, &csiphy->cfg); } +static int csiphy_get_remote_mbus_config (struct csiphy_device *csiphy, +struct v4l2_mbus_config *cfg) +{ +struct media_pad *remote; +struct v4l2_subdev *remote_sd; +int ret; + + remote =media_pad_remote_pad_first (&csiphy->pads[MSM_CSIPHY_PAD_SINK ]); +if (!remote) +return -ENOLINK ; + + remote_sd =media_entity_to_v4l2_subdev (remote->entity); +if (!remote_sd) +return -EINVAL ; + +memset (cfg,0 ,sizeof (*cfg)); + ret =v4l2_subdev_call (remote_sd, pad, get_mbus_config, + remote->index, cfg); +if (ret == -ENOIOCTLCMD ) +return -EOPNOTSUPP ; + +return ret; +}/* * csiphy_stream_on - Enable streaming on CSIPHY module * @csiphy: CSIPHY device @@ -324,43 +347,74 @@ static void csiphy_stream_off_legacy(struct csiphy_device *csiphy)*/ static int csiphy_stream_on (struct csiphy_device *csiphy) { +struct v4l2_mbus_config mbus_cfg = { };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 }; +union phy_configure_opts opts = {0 }; +enum phy_mode mode =PHY_MODE_INVALID ;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); + ret =csiphy_get_remote_mbus_config (csiphy, &mbus_cfg); +if (ret && ret != -EOPNOTSUPP ) +return ret; -if (link_freq <=0 ) { -dev_err (dev, -"Cannot get CSI2 transmitter's link frequency\n" ); -return -EINVAL ; +if (ret == -EOPNOTSUPP && lncfg->phy_type ==V4L2_MBUS_CSI2_CPHY ) { +dev_err (dev,"C-PHY transmitter does not report media bus configuration\n" ); +return ret; } - 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);
drivers/media/platform/qcom/camss/camss-csiphy.c static void csiphy_stream_off_legacy(struct csiphy_device *csiphy) · line 378
Quoted 10 lines
drivers/media/platform/qcom/camss/camss-csiphy.c +9
-1-return ret; +if (!ret && mbus_cfg.type ==V4L2_MBUS_CSI2_CPHY ) { +struct phy_configure_opts_mipi_cphy *cphy = &opts.mipi_cphy; + + link_freq = mbus_cfg.link_freq; +if (link_freq <=0 ) { +dev_err (dev, +"Cannot get CSI2 transmitter's link frequency\n" ); +return -EINVAL ; + }
[Severity: Medium]
What happens in csiphy_stream_on() if a C-PHY sensor or bridge implements get_mbus_config() to report V4L2_MBUS_CSI2_CPHY and C-PHY timings, but exposes its link frequency through V4L2_CID_LINK_FREQ rather than setting mbus_cfg.link_freq?
Per Documentation/driver-api/media/tx-rx.rst and include/media/v4l2-common.h, transmitters with configurable link frequencies use V4L2_CID_LINK_FREQ and leave v4l2_mbus_config::link_freq unset, while receivers are expected to query the frequency via v4l2_get_link_freq() (which checks mbus_config.link_freq first and falls back to V4L2_CID_LINK_FREQ).
In CAMSS, both csid_set_clock_rates() indrivers/media/platform/qcom/camss/camss-csid.c:
link_freq = camss_get_link_freq(&csid->subdev.entity, fmt->bpp, csid->phy.lane_cnt);
and the D-PHY branch below call camss_get_link_freq() -> v4l2_get_link_freq(). Should the C-PHY branch also fall back to camss_get_link_freq() when mbus_cfg.link_freq is not populated (which would also make use of bpp computed at the top of csiphy_stream_on())?
[ ... ]
include/media/v4l2-mediabus.h struct v4l2_mbus_config_mipi_csi2 { · line 114
Quoted 11 lines
include/media/v4l2-mediabus.h +2
-0@@ -109,6 +109,8 @@ struct v4l2_mbus_config_mipi_csi2 {unsigned char num_data_lanes;bool lane_polarities[1 +V4L2_MBUS_CSI2_MAX_DATA_LANES ];enum v4l2_mbus_csi2_cphy_line_orders_type line_orders[V4L2_MBUS_CSI2_MAX_DATA_LANES ]; +u32 t_prepare_ns; +u32 t_preamble_ns; };
[Severity: Low]
struct v4l2_mbus_config_mipi_csi2 has a kernel-doc comment block right above it, and include/media/v4l2-mediabus.h is included by Documentation/driver-api/media/v4l2-mediabus.rst. Should @t_prepare_ns and @t_preamble_ns be added to the kernel-doc comment to avoid kernel-doc build warnings?
Quoted 2 lines
include/media/v4l2-mediabus.h +0
-0/**
Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
RFC PATCH 3/6 phy: qcom: mipi-csi2: Split D-PHY register settings
In reply to Nihal Kumar GuptaThe register sequence storage is tied to a single init table. C-PHY support needs separate D-PHY and C-PHY sequence selection without changing the existing D-PHY programming.
Wrap the existing D-PHY table in a D-PHY settings structure and route lane programming through a common register write helper.
--- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 28 +++++++++++++++------- drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 8 +++++-- 2 files changed, 26 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c +20 -8
@@ -241,14 +241,12 @@ static u8 phy_qcom_mipi_csi2_settle_cnt_calc(s64 link_freq, u32 timer_clk_rate)return settle_cnt; } -static void -phy_qcom_mipi_csi2_gen2_config_lanes (struct mipi_csi2phy_device *csi2phy, -u8 settle_cnt) +static void phy_qcom_mipi_csi2_write_regs (struct mipi_csi2phy_device *csi2phy, +const struct mipi_csi2phy_lane_regs *r, +unsigned int array_size,u8 settle_cnt) { -const struct mipi_csi2phy_device_regs *regs =csi2phy_dev_to_regs (csi2phy); -const struct mipi_csi2phy_lane_regs *r = regs->init_seq; -int i, array_size = regs->lane_array_size;u32 val; +int i;for (i =0 ; i < array_size; i++, r++) {switch (r->param_type) {
@@ -268,6 +266,16 @@ phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device *csi2phy, } } +static void +phy_qcom_mipi_csi2_gen2_config_lanes (struct mipi_csi2phy_device *csi2phy, +u8 settle_cnt) +{ +const struct mipi_csi2phy_device_regs *regs =csi2phy_dev_to_regs (csi2phy); + +phy_qcom_mipi_csi2_write_regs (csi2phy, regs->dphy->dphy_init_seq, + regs->dphy->num_regs, settle_cnt); +} +static int phy_qcom_mipi_csi2_lanes_enable (struct mipi_csi2phy_device *csi2phy,struct mipi_csi2phy_stream_cfg *cfg) {
@@ -369,11 +377,15 @@ static struct mipi_csi2_genpd x1e_genpds[] = { { .name = "mx", .scaled = true }, }; +static const struct mipi_csi2phy_dphy_rate_settings x1e80100_dphy_settings = { + .dphy_init_seq = lane_regs_x1e80100, + .num_regs =ARRAY_SIZE (lane_regs_x1e80100), +}; +const struct mipi_csi2phy_soc_cfg mipi_csi2_dphy_4nm_x1e = { .ops = &phy_qcom_mipi_csi2_ops_3ph_1_0, .reg_info = { - .init_seq = lane_regs_x1e80100, - .lane_array_size =ARRAY_SIZE (lane_regs_x1e80100), + .dphy = &x1e80100_dphy_settings, .common_regs_offset =0x1000 , }, .supply_names = (const char **)x1e_supplies,
drivers/phy/qualcomm/phy-qcom-mipi-csi2.h +6 -2
@@ -47,9 +47,13 @@ struct mipi_csi2phy_lane_regs {const u32 param_type; }; +struct mipi_csi2phy_dphy_rate_settings { +const struct mipi_csi2phy_lane_regs *dphy_init_seq; +unsigned int num_regs; +}; +struct mipi_csi2phy_device_regs { -const struct mipi_csi2phy_lane_regs *init_seq; -const int lane_array_size; +const struct mipi_csi2phy_dphy_rate_settings *dphy;const u32 common_regs_offset; };
Signature · 1 line
2.34.1
RFC PATCH 4/6 phy: qcom: mipi-csi2: Accept C-PHY mode and add register sequence
In reply to Nihal Kumar GuptaThe CSI-2 PHY core rejects all modes except D-PHY, so CAMSS cannot pass C-PHY stream configuration to the PHY provider. Accept PHY_MODE_MIPI_CPHY in set_mode() and configure(). Validate the trio count and store the C-PHY link frequency and timing in the stream configuration.
C-PHY programming needs a common base sequence and a data-rate specific sequence, while D-PHY keeps using its existing sequence. Add mipi_csi2phy_cphy_rate_settings descriptor and select the register sequence from the configured PHY mode. Leave SoC-specific C-PHY register data to separate patches.
--- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 51 +++++++++++++++++----- drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 51 ++++++++++++++++------ drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 17 ++++++++ 3 files changed, 96 insertions(+), 23 deletions(-)
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c +41 -10
@@ -266,14 +266,48 @@ static void phy_qcom_mipi_csi2_write_regs(struct mipi_csi2phy_device *csi2phy, } } -static void +static int phy_qcom_mipi_csi2_gen2_config_lanes (struct mipi_csi2phy_device *csi2phy,u8 settle_cnt) {const struct mipi_csi2phy_device_regs *regs =csi2phy_dev_to_regs (csi2phy); +u64 bit_rate; +int i; + +switch (csi2phy->phy_mode) { +case PHY_MODE_MIPI_CPHY : +if (!regs->cphy || !regs->num_cphy) +return -EINVAL ; + +/* +* link_freq = symbol_rate / 2; convert to effective bit rate +* (bits/s) for comparison against the bandwidth table: +* bit_rate = link_freq * 2 * 16 / 7 = link_freq * 32 / 7 +*/ + bit_rate =div_u64 ((u64 )csi2phy->stream_cfg.link_freq *32 ,7 ); + +for (i =0 ; i < regs->num_cphy; i++) { +if (regs->cphy[i].bandwidth >= bit_rate) +break ; + } + +if (i == regs->num_cphy) + i = regs->num_cphy -1 ; + +phy_qcom_mipi_csi2_write_regs (csi2phy, regs->cphy[i].cphy_init_seq, + regs->cphy[i].num_regs, + settle_cnt); +break ; +case PHY_MODE_MIPI_DPHY : +phy_qcom_mipi_csi2_write_regs (csi2phy, regs->dphy->dphy_init_seq, + regs->dphy->num_regs, + settle_cnt); +break ; +default : +return -EINVAL ; + } -phy_qcom_mipi_csi2_write_regs (csi2phy, regs->dphy->dphy_init_seq, - regs->dphy->num_regs, settle_cnt); +return 0 ; } static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,
@@ -283,12 +317,7 @@ static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg;u8 settle_cnt;u8 val; -int i; - -if (cfg->link_freq <=0 ) -return -EINVAL ; - - settle_cnt =phy_qcom_mipi_csi2_settle_cnt_calc (cfg->link_freq, csi2phy->timer_clk_rate); +int i, ret;if (!settle_cnt)return -ENODEV ;
@@ -329,7 +358,9 @@ static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,writel (val, csi2phy->base +CSIPHY_3PH_CMN_CSI_COMMON_CTRLn (regs->common_regs_offset,0 )); -phy_qcom_mipi_csi2_gen2_config_lanes (csi2phy, settle_cnt); + ret =phy_qcom_mipi_csi2_gen2_config_lanes (csi2phy, settle_cnt); +if (ret) +return ret;/* IRQ_MASK registers - disable all interrupts */ for (i =CSI_COMMON_STATUS_NUM ; i <CSI_CTRL_STATUS_INDEX ; i++) {
drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c +38 -13
75 lines not on this page · raw message
drivers/phy/qualcomm/phy-qcom-mipi-csi2.h +17 -0
@@ -11,6 +11,7 @@#include <linux/phy/phy.h> #define CSI2_MAX_DATA_LANES 4 +#define CSI2_MAX_DATA_TRIOS 3#define CSI2_DEFAULT_CLK_LANE 7struct mipi_csi2phy_lane {
@@ -26,6 +27,8 @@ struct mipi_csi2phy_lanes_cfg {struct mipi_csi2phy_stream_cfg {s64 link_freq;u8 num_data_lanes; +u32 t_prepare_ns; +u32 t_preamble_ns;struct mipi_csi2phy_lanes_cfg lane_cfg; };
@@ -52,8 +55,22 @@ struct mipi_csi2phy_dphy_rate_settings {unsigned int num_regs; }; +struct mipi_csi2phy_cphy_rate_settings { +/** +* @bandwidth: Maximum effective data rate for this register sequence, +* in bits/s (= symbol_rate * 16 / 7). The first entry whose bandwidth +* is >= the configured link bit rate is selected; the last entry is +* a fallback. +*/ +u64 bandwidth; +const struct mipi_csi2phy_lane_regs *cphy_init_seq; +unsigned int num_regs; +}; +struct mipi_csi2phy_device_regs {const struct mipi_csi2phy_dphy_rate_settings *dphy; +const struct mipi_csi2phy_cphy_rate_settings *cphy; +unsigned int num_cphy;const u32 common_regs_offset; };
Signature · 1 line
2.34.1
RFC PATCH 5/6 phy: qcom: mipi-csi2: Add C-PHY settle calculation
In reply to Nihal Kumar GuptaC-PHY settle timing is provided by the sensor and does not use the D-PHY T_hs_settle calculation. Add a C-PHY settle count helper and select the settle calculation from the configured PHY mode.
Use the sensor-provided t_prepare_ns and t_preamble_ns values to derive the C-PHY settle count:
settle_cnt = (t_prepare_ns + t_preamble_ns / 3) * timer_clk_rate
/ NSEC_PER_SEC
--- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 54 ++++++++++++++++++---- 1 file changed, 44 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c +44 -10
@@ -210,7 +210,7 @@ static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device *csi2phy) }/* -* phy_qcom_mipi_csi2_settle_cnt_calc - Calculate settle count value +* phy_qcom_dphy_settle_cnt - Calculate settle count value * * Helper function to calculate settle count value. This is * based on the CSI2 T_hs_settle parameter which in turn
@@ -218,7 +218,7 @@ static void phy_qcom_mipi_csi2_reset(struct mipi_csi2phy_device *csi2phy)* * Return settle count. */ -static u8 phy_qcom_mipi_csi2_settle_cnt_calc (s64 link_freq,u32 timer_clk_rate) +static u8 phy_qcom_dphy_settle_cnt (s64 link_freq,u32 timer_clk_rate) {u32 t_hs_prepare_max_ps;u32 timer_period_ps;
@@ -310,14 +310,44 @@ phy_qcom_mipi_csi2_gen2_config_lanes(struct mipi_csi2phy_device *csi2phy,return 0 ; } +static u8 phy_qcom_cphy_settle_cnt (struct mipi_csi2phy_stream_cfg *cfg, +u32 timer_clk_rate) +{ +u64 settle_cnt; + + settle_cnt = ((u64 )cfg->t_prepare_ns + +DIV_ROUND_CLOSEST (cfg->t_preamble_ns,3 )) * timer_clk_rate; +do_div (settle_cnt,NSEC_PER_SEC ); + +return settle_cnt; +} +static int phy_qcom_mipi_csi2_lanes_enable (struct mipi_csi2phy_device *csi2phy,struct mipi_csi2phy_stream_cfg *cfg) { +struct device *dev = csi2phy->dev;const struct mipi_csi2phy_device_regs *regs =csi2phy_dev_to_regs (csi2phy);struct mipi_csi2phy_lanes_cfg *lane_cfg = &cfg->lane_cfg;u8 settle_cnt;u8 val;int i, ret; + +if (cfg->link_freq <=0 ) +return -EINVAL ; + +switch (csi2phy->phy_mode) { +case PHY_MODE_MIPI_CPHY : + settle_cnt =phy_qcom_cphy_settle_cnt (cfg, + csi2phy->timer_clk_rate); +break ; +case PHY_MODE_MIPI_DPHY : + settle_cnt =phy_qcom_dphy_settle_cnt (cfg->link_freq, + csi2phy->timer_clk_rate); +break ; +default : +dev_err (dev,"Unsupported PHY mode %u\n" , csi2phy->phy_mode); +return -EINVAL ; + }if (!settle_cnt)return -ENODEV ;
@@ -334,17 +364,21 @@ static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,writel (val, csi2phy->base +CSIPHY_3PH_CMN_CSI_COMMON_CTRLn (regs->common_regs_offset,5 )); -/* Lane configuration for polarity @ CSIPHY-base + CTRL9 */ -for (i =0 ; i < cfg->num_data_lanes; i++) { -if (lane_cfg->data[i].pol) { -u8 pos = lane_cfg->data[i].pos; +if (csi2phy->phy_mode ==PHY_MODE_MIPI_DPHY ) { +/* Lane configuration for polarity @ CSIPHY-base + CTRL9 */ +for (i =0 ; i < cfg->num_data_lanes; i++) { +if (lane_cfg->data[i].pol) { +u8 pos = lane_cfg->data[i].pos; -writel (BIT (2 ), csi2phy->base +CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n (pos *2 )); +writel (BIT (2 ), csi2phy->base + +CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n (pos *2 )); + } } - } -if (lane_cfg->clk.pol) -writel (BIT (2 ), csi2phy->base +CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n (lane_cfg->clk.pos)); +if (lane_cfg->clk.pol) +writel (BIT (2 ), csi2phy->base + +CSIPHY_2PH_LN_CSI_2PHASE_CTRL9n (lane_cfg->clk.pos)); + } val =CSIPHY_3PH_CMN_CSI_COMMON_CTRL6_COMMON_PWRDN_B ; writel(val, csi2phy->base +
Signature · 1 line
2.34.1
RFC PATCH 6/6 phy: qcom: mipi-csi2: Add lane mask calculation for C-PHY
In reply to Nihal Kumar GuptaC-PHY uses trio lanes instead of D-PHY data+clock lanes. The existing lane power-up mask hard-codes D-PHY bit positions and cannot represent C-PHY trios.
Extract csiphy_get_lane_mask() and select the correct bit pattern based on the configured PHY mode. For C-PHY, data lane bits are shifted by one to target trio positions [1,3,5]; for D-PHY, the clock lane bit and even-numbered data bits [0,2,4,6] are set as before.
--- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 40 ++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c +30 -10
@@ -322,6 +322,35 @@ static u8 phy_qcom_cphy_settle_cnt(struct mipi_csi2phy_stream_cfg *cfg,return settle_cnt; } +static u8 csiphy_get_lane_mask (struct mipi_csi2phy_lanes_cfg *lane_cfg, +enum phy_mode mode,u8 num_data) +{ +u8 lane_mask =0 ; +u8 offset =0 ; + +switch (mode) { +case PHY_MODE_MIPI_CPHY : + offset =1 ; +break ; +case PHY_MODE_MIPI_DPHY : + lane_mask =BIT (lane_cfg->clk.pos); +break ; +default : +break ; + } + +/* +* CSI_COMMON_CTRL5 is a physical lane power-up bitmap: +* - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6) +* - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5) +* - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable +*/ +for (int i =0 ; i < num_data; i++) + lane_mask |=BIT ((lane_cfg->data[i].pos *2 ) + offset); + +return lane_mask; +} +static int phy_qcom_mipi_csi2_lanes_enable (struct mipi_csi2phy_device *csi2phy,struct mipi_csi2phy_stream_cfg *cfg) {
@@ -351,16 +380,7 @@ static int phy_qcom_mipi_csi2_lanes_enable(struct mipi_csi2phy_device *csi2phy,if (!settle_cnt)return -ENODEV ; -/* -* CSI_COMMON_CTRL5 is a physical lane power-up bitmap: -* - Bits [0,2,4,6] → D-PHY data lanes(LN0, LN2, LN4, LN6) -* - Bits [1,3,5] → C-PHY trio lanes(LN1, LN3, LN5) -* - Bit [7] → D-PHY clock lane(LNCK) dedicated clock enable -*/ - val =BIT (lane_cfg->clk.pos); -for (i =0 ; i < cfg->num_data_lanes; i++) - val |=BIT (lane_cfg->data[i].pos *2 ); - + val =csiphy_get_lane_mask (lane_cfg, csi2phy->phy_mode, cfg->num_data_lanes);writel (val, csi2phy->base +CSIPHY_3PH_CMN_CSI_COMMON_CTRLn (regs->common_regs_offset,5 ));
Signature · 1 line
2.34.1
Bryan O'Donoghue
maintainerQuoted 65 lines · Nihal Kumar Gupta
George posted a C-PHY series [1] which we are currently reviewing. As discussed with Bryan, this series shares our independent implementation so the approaches can be compared.
Two aspects covered here are not in [1]:
- Settle count calculation derived from sensor-reported
T_PREPAREandT_PREAMBLEtiming viaget_mbus_config(). [1] left this as an open question.- Data rate based register sequence selection using effective bit rate (
link_freq* 32 / 7). [1] noted downstream does this but deferred it; this series implements it.MIPI CSI-2 operates over two physical layer variants. D-PHY uses a dedicated differential clock lane with up to four data lanes. C-PHY encodes the clock within the data stream across up to three wire trios, eliminating the dedicated clock lane.
Patch 1 extends the generic PHY framework with
PHY_MODE_MIPI_CPHYand structphy_configure_opts_mipi_cphy.Patch 2 adds
t_prepare_nsandt_preamble_nsfields to the CSI-2 media bus configuration and extends CAMSS to forward them to the PHY provider for settle count calculation. Sensor drivers must implementget_mbus_config()and return non-zero values in nanoseconds; stream-on returns-EINVALotherwise. The strictness is deliberate: C-PHY settle timing is symbol-rate-range specific and no safe value can be derived from link frequency alone. A conservative fallback could be added if reviewers prefer.Patches 3-6 extend the Qualcomm CSIPHY driver: refactor D-PHY register storage to accommodate C-PHY, accept C-PHY mode with multiple data rate table selection, compute settle count, and add lane power mask support for C-PHY trios.
C-PHY encodes 16 bits per 7 symbols, so the effective bit rate is:
bit_rate = link_freq * 2 * 16 / 7 = link_freq * 32 / 7where
link_freqissymbol_rate/ 2 as reported by the sensor viaget_mbus_config(). The rate-table entry whose bandwidth first meets or exceedsbit_rateis selected.The settle count defines how many timer clock cycles the CSIPHY receiver waits before scanning for C-PHY sync. It is computed from the sensor's
T_PREPAREandT_PREAMBLEtiming. The /3 factor reflects that C-PHY distributes the preamble sequence across three trios:
settle_cnt= (t_prepare_ns+t_preamble_ns/ 3) *timer_clk_rate/ 1e9D-PHY settle count is unchanged from before this series.
[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Nihal Kumar Gupta <[email protected]>---
Nihal Kumar Gupta (6):
phy: core: Add MIPI C-PHY configurations
media: qcom: camss: Add C-PHY timing fields and get config from sensor
phy: qcom: mipi-csi2: Split D-PHY register settings
phy: qcom: mipi-csi2: Accept C-PHY mode and add register sequence
phy: qcom: mipi-csi2: Add C-PHY settle calculation
phy: qcom: mipi-csi2: Add lane mask calculation for C-PHY
Quoted 4 lines
drivers/media/platform/qcom/camss/camss-csiphy.c | 90 +++++++++--- drivers/media/platform/qcom/camss/camss-csiphy.h | 2 + drivers/media/platform/qcom/camss/camss.c | 8 +- drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c | 159 +++++++++++++++++----
So on thing I notice about this series and like is that there's a small change to the existing 3ph-dphy.c
- Since it supports 3ph-cphy the file should be renamed 3ph-cphy-dphy.c (or something)
- I like the progressive nature of he changes in this series as structurally the right way to add stuff in. Small digestable commits
- I think the missing piece here is data_lanes[] and lane_polarities[] per the other series from Qcom
- Another thing is the other series from Anusha has
a more advanced mipi_ops data-structure for CPHY.
Basically I like the approach taken in this series for a smaller change to the phy-qcom-mipi-csi2-3ph-dphy.c file.
I'd like the best of both series - I think there is alot to resolve on lanes, data-lanes and lane-polarities in the other series and looking at this series, it seems to me we don't need a separate phy-qcom-mipi-csi2-3ph-cphy.c, I think Konrad observed in George's series that really the file deals with 3-phase PHYs and that seems true enough.
Please work out between yourself and Anusha what's next.
If possible I would prefer to contain 3ph CPHY and DPHY to one file as is done here - at the same time the definition of CPHY ops and lane mappings is closer to the spec in the other series.
I think either you should take Anusha's structs and lane definitions or Anusha should take your approach to minimal change to the phy-qcom-mipi-csi2-3ph-dphy.c renaming it.
One of you needs to pick up the patches from the other one.
George can land his stuff on top then.
Quoted 12 lines
drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 51 +++++-- drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 25 +++- include/linux/phy/phy.h | 47 ++++++ include/media/v4l2-mediabus.h | 2 + 8 files changed, 315 insertions(+), 69 deletions(-)---
base-commit:2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261017-cphy_support-2ce4d656e631Best regards,
--
Nihal Kumar Gupta <[email protected]>
Quoted 7 lines · Bryan O'Donoghue
Quoted 2 lines
drivers/media/platform/qcom/camss/camss.c | 8 +-
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c| 159 +++++++++++++++++----So on thing I notice about this series and like is that there's a small change to the existing
3ph-dphy.c- Since it supports 3ph-cphy the file should be renamed
3ph-cphy-dphy.c(or something)
I agree with the direction here. Keeping the 3-phase CPHY and DPHY support in a single driver looks like the right model.
Quoted 10 lines
- I like the progressive nature of he changes in this series as structurally the right way to add stuff in. Small digestable commits
- I think the missing piece here is data_lanes[] and lane_polarities[] per the other series from Qcom
- Another thing is the other series from Anusha has
a more advancedmipi_opsdata-structure for CPHY.Basically I like the approach taken in this series for a smaller change to the
phy-qcom-mipi-csi2-3ph-dphy.cfile.
Quoted 9 lines
I'd like the best of both series - I think there is alot to resolve on lanes, data-lanes and lane-polarities in the other series and looking at this series, it seems to me we don't need a separate
phy-qcom-mipi-csi2-3ph-cphy.c, I think Konrad observed in George's series that really the file deals with 3-phase PHYs and that seems true enough.Please work out between yourself and Anusha what's next.
If possible I would prefer to contain 3ph CPHY and DPHY to one file as is done here - at the same time the definition of CPHY ops and lane mappings is closer to the spec in the other series.
I think either you should take Anusha's structs and lane definitions or Anusha should take your approach to minimal change to the
phy-qcom-mipi-csi2-3ph-dphy.crenaming it. One of you needs to pick up the patches from the other one.
I can pick up the CPHY ops/lane mapping pieces from Anusha's series and post the combined common series. Anusha, if you prefer to carry it instead, please feel free to take this series and fold in your CPHY ops/lane mapping changes.
The split I suggest is:
- Combined common series: driver rename + generic 3ph CPHY support + CPHY ops/lane mapping.
- Follow-up from Anusha: Lemans/Monaco-specific lane/register programming.
- Follow-up from George: Hamoa support on top of the common CPHY support.
Signature · 2 lines
Regards, Nihal Kumar Gupta
Hi Bryan,
Thanks a lot for your suggestion regarding file structuring and naming convention.
However, we think that having the separate file will make it more functionality oriented distinction. It is easier for addition and maintenance.
Also, we would like to propose to remove 3ph from the file name convention as this is misleading the operation. DPHY is 2ph, whereas CPHY is 3ph.
We are proposing to have a naming like phy-qcom-mipi-csi2-dphy.c and phy-qcom-mipi-csi2-cphy.c as the names, DPHY and CPHY are sufficient to understand the 2ph or 3ph operational mode.
Kindly provide your suggestion.
Thanks,
JZ
Quoted 110 lines · Bryan O'Donoghue
Quoted 65 lines · Nihal Kumar Gupta
George posted a C-PHY series [1] which we are currently reviewing. As discussed with Bryan, this series shares our independent implementation so the approaches can be compared.
Two aspects covered here are not in [1]:
- Settle count calculation derived from sensor-reported
T_PREPAREandT_PREAMBLEtiming viaget_mbus_config(). [1] left this as an open question.- Data rate based register sequence selection using effective bit rate (
link_freq* 32 / 7). [1] noted downstream does this but deferred it; this series implements it.MIPI CSI-2 operates over two physical layer variants. D-PHY uses a dedicated differential clock lane with up to four data lanes. C-PHY encodes the clock within the data stream across up to three wire trios, eliminating the dedicated clock lane.
Patch 1 extends the generic PHY framework with
PHY_MODE_MIPI_CPHYand structphy_configure_opts_mipi_cphy.Patch 2 adds
t_prepare_nsandt_preamble_nsfields to the CSI-2 media bus configuration and extends CAMSS to forward them to the PHY provider for settle count calculation. Sensor drivers must implementget_mbus_config()and return non-zero values in nanoseconds; stream-on returns-EINVALotherwise. The strictness is deliberate: C-PHY settle timing is symbol-rate-range specific and no safe value can be derived from link frequency alone. A conservative fallback could be added if reviewers prefer.Patches 3-6 extend the Qualcomm CSIPHY driver: refactor D-PHY register storage to accommodate C-PHY, accept C-PHY mode with multiple data rate table selection, compute settle count, and add lane power mask support for C-PHY trios.
C-PHY encodes 16 bits per 7 symbols, so the effective bit rate is:
bit_rate=link_freq* 2 * 16 / 7 =link_freq* 32 / 7where
link_freqissymbol_rate/ 2 as reported by the sensor viaget_mbus_config(). The rate-table entry whose bandwidth first meets or exceedsbit_rateis selected.The settle count defines how many timer clock cycles the CSIPHY receiver waits before scanning for C-PHY sync. It is computed from the sensor's
T_PREPAREandT_PREAMBLEtiming. The /3 factor reflects that C-PHY distributes the preamble sequence across three trios:
settle_cnt= (t_prepare_ns+t_preamble_ns/ 3) *timer_clk_rate/ 1e9D-PHY settle count is unchanged from before this series.
[1] https://lore.kernel.org/all/[email protected]/
Signed-off-by Nihal Kumar Gupta <[email protected]>---
Nihal Kumar Gupta (6):
phy: core: Add MIPI C-PHY configurations
media: qcom: camss: Add C-PHY timing fields and get config from sensor
phy: qcom: mipi-csi2: Split D-PHY register settings
phy: qcom: mipi-csi2: Accept C-PHY mode and add register sequence
phy: qcom: mipi-csi2: Add C-PHY settle calculation
phy: qcom: mipi-csi2: Add lane mask calculation for C-PHYQuoted 5 lines
drivers/media/platform/qcom/camss/camss-csiphy.c | 90 +++++++++--- drivers/media/platform/qcom/camss/camss-csiphy.h | 2 + drivers/media/platform/qcom/camss/camss.c | 8 +-
drivers/phy/qualcomm/phy-qcom-mipi-csi2-3ph-dphy.c| 159
+++++++++++++++++----So on thing I notice about this series and like is that there's a small change to the existing
3ph-dphy.c- Since it supports 3ph-cphy the file should be renamed
3ph-cphy-dphy.c(or something)
- I like the progressive nature of he changes in this series as structurally the right way to add stuff in. Small digestable commits
- I think the missing piece here is data_lanes[] and lane_polarities[] per the other series from Qcom
- Another thing is the other series from Anusha has
a more advancedmipi_opsdata-structure for CPHY.Basically I like the approach taken in this series for a smaller change to the
phy-qcom-mipi-csi2-3ph-dphy.cfile.I'd like the best of both series - I think there is alot to resolve on lanes, data-lanes and lane-polarities in the other series and looking at this series, it seems to me we don't need a separate
phy-qcom-mipi-csi2-3ph-cphy.c, I think Konrad observed in George's series that really the file deals with 3-phase PHYs and that seems true enough.Please work out between yourself and Anusha what's next.
If possible I would prefer to contain 3ph CPHY and DPHY to one file as is done here - at the same time the definition of CPHY ops and lane mappings is closer to the spec in the other series.
I think either you should take Anusha's structs and lane definitions or Anusha should take your approach to minimal change to the
phy-qcom-mipi-csi2-3ph-dphy.crenaming it.One of you needs to pick up the patches from the other one.
George can land his stuff on top then.
Quoted 12 lines
drivers/phy/qualcomm/phy-qcom-mipi-csi2-core.c | 51 +++++-- drivers/phy/qualcomm/phy-qcom-mipi-csi2.h | 25 +++- include/linux/phy/phy.h | 47 ++++++ include/media/v4l2-mediabus.h | 2 +
8 files changed, 315 insertions(+), 69 deletions(-)---
base-commit:2efb7a11f1aa4d2dc285fe2680cca22cb9f72f64
change-id: 20261017-cphy_support-2ce4d656e631Best regards,
Signature · 1 line
Nihal Kumar Gupta <[email protected]>