Skip to contentSkip to conversation

Extend phy_configure_opts_mipi_dphy to support position and polarity

PATCH In review Bryan O'Donoghue 2 participants 6 messages Mar 25 – May 19 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

cover Extend phy_configure_opts_mipi_dphy to support position and polarity

struct phy_configure_opts_mipi_dphy currently passes @lanes as a linear count of data-lanes starting from lane zero to a consuming DPHY driver.

This proves insufficient when we want to specify lane location and lane polarity.

To address this gap extend the structure to pass four new fields.

- lane_positions
An array indicating the physical position of each data-lane

- lane_polarities
An array indicating the polarity of each data-lane

- clock_lane_position
A singleton indicating the physical location of the clock-lane

- clock_lane_polarity
A singleton indicating the polarity of the clock lane

These properties correspond to data-lanes, clock-lanes and lane-polarities as defined in video-interfaces.yaml and already parsed by v4l2_fwnode_endpoint_parse.

A controller can use these fields to pass down the relevant data to the PHY driver over and above the assumption of simple linear consecutive data-lanes as has been possible to this point.

---
Bryan O'Donoghue (4):
phy: dphy: Add lane_positions to DPHY config struct
phy: dphy: Add lane_polarities to DPHY config struct
phy: dphy: Add clock_lane_position to DPHY config struct
phy: dphy: Add clock_lane_polarity to DPHY config struct

 include/linux/phy/phy-mipi-dphy.h | 37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

---
base-commit: c824345288d11e269ce41b36c105715bc2286050
change-id: 20260325-dphy-params-extension-5fcd9ba8af61

Best regards,

Signature · 1 line
Bryan O'Donoghue <[email protected]>
#1 lore raw

PATCH 1/4 phy: dphy: Add lane_positions to DPHY config struct

Add lane_positions to the DPHY configuration struct. This data-field represents the physical positions of the data-lanes indexed by lane number.

---
 include/linux/phy/phy-mipi-dphy.h | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
include/linux/phy/phy-mipi-dphy.h +13 -2
index 1ac128d78dfeb..c7eb11c41d7ec 100644
@@ -6,6 +6,8 @@
 #ifndef __PHY_MIPI_DPHY_H_
 #define __PHY_MIPI_DPHY_H_
 
+#define PHY_MIPI_DPHY_MAX_DATA_LANES    4
+
 /**
  * struct phy_configure_opts_mipi_dphy - MIPI D-PHY configuration set
  *
@@ -269,10 +271,19 @@ struct phy_configure_opts_mipi_dphy {
 	/**
 	 * @lanes:
 	 *
-	 * Number of active, consecutive, data lanes, starting from
-	 * lane 0, used for the transmissions.
+	 * Number of active data lanes used for the transmission.
+	 * When @lane_positions is not populated, lanes are consecutive
+	 * starting from lane 0.
 	 */
 	unsigned char		lanes;
+
+	/**
+	 * @lane_positions:
+	 *
+	 * Array representing the physical positions of the data-lanes.
+	 * Indexed by logical lane number.
+	 */
+	unsigned char		lane_positions[PHY_MIPI_DPHY_MAX_DATA_LANES];
 };
 
 int phy_mipi_dphy_get_default_config(unsigned long pixel_clock,
Signature · 1 line
2.52.0
#2 lore raw

PATCH 2/4 phy: dphy: Add lane_polarities to DPHY config struct

In reply to Bryan O'Donoghue

Pass an array of data-lane polarities from controller to PHY. A true value means the lane polarity is inverted.

---
 include/linux/phy/phy-mipi-dphy.h | 8 ++++++++
 1 file changed, 8 insertions(+)
include/linux/phy/phy-mipi-dphy.h +8 -0
index c7eb11c41d7ec..3e0333b5a1a71 100644
@@ -284,6 +284,14 @@ struct phy_configure_opts_mipi_dphy {
 	 * Indexed by logical lane number.
 	 */
 	unsigned char		lane_positions[PHY_MIPI_DPHY_MAX_DATA_LANES];
+
+	/**
+	 * @lane_polarities:
+	 *
+	 * Array representing data-lane polarities. True means inverted.
+	 * Indexed by logical lane number.
+	 */
+	bool			lane_polarities[PHY_MIPI_DPHY_MAX_DATA_LANES];
 };
 
 int phy_mipi_dphy_get_default_config(unsigned long pixel_clock,
Signature · 1 line
2.52.0
#3 lore raw

PATCH 3/4 phy: dphy: Add clock_lane_position to DPHY config struct

In reply to Bryan O'Donoghue

We need to identify which lane is the clock-lane as many different PHYs allow for a range of lanes, potentially any of the lanes to be the clock input lane on a PHY.

---
 include/linux/phy/phy-mipi-dphy.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/linux/phy/phy-mipi-dphy.h +7 -0
index 3e0333b5a1a71..76d41580e225a 100644
@@ -292,6 +292,13 @@ struct phy_configure_opts_mipi_dphy {
 	 * Indexed by logical lane number.
 	 */
 	bool			lane_polarities[PHY_MIPI_DPHY_MAX_DATA_LANES];
+
+	/**
+	 * @clock_lane_position:
+	 *
+	 * Physical lane number used as the clock lane.
+	 */
+	unsigned char		clock_lane_position;
 };
 
 int phy_mipi_dphy_get_default_config(unsigned long pixel_clock,
Signature · 1 line
2.52.0
#4 lore raw

PATCH 4/4 phy: dphy: Add clock_lane_polarity to DPHY config struct

In reply to Bryan O'Donoghue

Specify the polarity of the clock lane in DPHY mode. When true this bool means the polarity is inverted.

---
 include/linux/phy/phy-mipi-dphy.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/linux/phy/phy-mipi-dphy.h +7 -0
index 76d41580e225a..f7b4ad29e6f83 100644
@@ -299,6 +299,13 @@ struct phy_configure_opts_mipi_dphy {
 	 * Physical lane number used as the clock lane.
 	 */
 	unsigned char		clock_lane_position;
+
+	/**
+	 * @clock_lane_polarity:
+	 *
+	 * Clock lane polarity. True means inverted.
+	 */
+	bool			clock_lane_polarity;
 };
 
 int phy_mipi_dphy_get_default_config(unsigned long pixel_clock,
Signature · 1 line
2.52.0
maintainer
#5 lore raw
In reply to Bryan O'Donoghue
Quoted 7 lines · Bryan O'Donoghue

struct phy_configure_opts_mipi_dphy currently passes @lanes as a linear count of data-lanes starting from lane zero to a consuming DPHY driver.

This proves insufficient when we want to specify lane location and lane polarity.

To address this gap extend the structure to pass four new fields.

Sure, but where is the user...?
Please repost with users added in

Thanks

pw-bot: cr

Signature · 1 line
~Vinod