2023-07-31 14:51:19

by Tomi Valkeinen

[permalink] [raw]
Subject: [PATCH v3 0/9] media: i2c: ds90ub9xx: Misc improvements

This series contains small miscellaneous improvements to the FPD-Link
drivers.

These were sent originally in v14 of the "i2c-atr and FPDLink" series
(link below), but were then left out for v15. So I have assigned v2 to
the "first" version of this series.

I have trimmed the to/cc list a bit, as these don't really deal with i2c
and dt anymore.

Signed-off-by: Tomi Valkeinen <[email protected]>
---
Changes in v3:
- New patch which fixes the async sub-device matching
- Addressed all the comments from Laurent
- Added Laurent's & Andy's Rbs
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- New patch which renames ASYNC to NONSYNC
- Minor cosmetic change
- I didn't take u32_fract into use (as suggested by Andy), as I think it
makes the driver a bit more confusing.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Tomi Valkeinen (9):
media: i2c: ds90ub9x3: Fix sub-device matching
media: i2c: ds90ub960: Configure CSI-2 continuous clock
media: i2c: ds90ub953: Use v4l2_fwnode_endpoint_parse()
media: i2c: ds90ub913: Use v4l2_fwnode_endpoint_parse()
media: i2c: ds90ub953: Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK
media: i2c: ds90ub960: Allow FPD-Link async mode
media: i2c: ds90ub953: Restructure clkout management
media: i2c: ds90ub953: Support non-sync mode
media: i2c: ds90ub960: Rename RXPORT_MODE_CSI2_ASYNC to RXPORT_MODE_CSI2_NONSYNC

drivers/media/i2c/ds90ub913.c | 47 +++++----
drivers/media/i2c/ds90ub953.c | 215 ++++++++++++++++++++++++------------------
drivers/media/i2c/ds90ub960.c | 31 +++---
3 files changed, 164 insertions(+), 129 deletions(-)
---
base-commit: 38d6a03d2511bee97455b2ea0314c918537ef1ec
change-id: 20230720-fpdlink-additions-fb5397336725

Best regards,
--
Tomi Valkeinen <[email protected]>



2023-07-31 15:09:09

by Tomi Valkeinen

[permalink] [raw]
Subject: [PATCH v3 3/9] media: i2c: ds90ub953: Use v4l2_fwnode_endpoint_parse()

Use v4l2_fwnode_endpoint_parse() to parse the sink endpoint parameters.

Signed-off-by: Tomi Valkeinen <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/media/i2c/ds90ub953.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c
index 20b9cf893f74..1032c8633809 100644
--- a/drivers/media/i2c/ds90ub953.c
+++ b/drivers/media/i2c/ds90ub953.c
@@ -25,6 +25,8 @@
#include <media/i2c/ds90ub9xx.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
+#include <media/v4l2-fwnode.h>
+#include <media/v4l2-mediabus.h>
#include <media/v4l2-subdev.h>

#define UB953_PAD_SINK 0
@@ -1111,7 +1113,11 @@ static const struct regmap_config ub953_regmap_config = {
static int ub953_parse_dt(struct ub953_data *priv)
{
struct device *dev = &priv->client->dev;
+ struct v4l2_fwnode_endpoint vep = {
+ .bus_type = V4L2_MBUS_CSI2_DPHY,
+ };
struct fwnode_handle *ep_fwnode;
+ unsigned char nlanes;
int ret;

ep_fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(dev),
@@ -1119,19 +1125,20 @@ static int ub953_parse_dt(struct ub953_data *priv)
if (!ep_fwnode)
return dev_err_probe(dev, -ENOENT, "no endpoint found\n");

- ret = fwnode_property_count_u32(ep_fwnode, "data-lanes");
+ ret = v4l2_fwnode_endpoint_parse(ep_fwnode, &vep);

fwnode_handle_put(ep_fwnode);

- if (ret < 0)
+ if (ret)
return dev_err_probe(dev, ret,
- "failed to parse property 'data-lanes'\n");
+ "failed to parse sink endpoint data\n");

- if (ret != 1 && ret != 2 && ret != 4)
+ nlanes = vep.bus.mipi_csi2.num_data_lanes;
+ if (nlanes != 1 && nlanes != 2 && nlanes != 4)
return dev_err_probe(dev, -EINVAL,
- "bad number of data-lanes: %d\n", ret);
+ "bad number of data-lanes: %u\n", nlanes);

- priv->num_data_lanes = ret;
+ priv->num_data_lanes = nlanes;

return 0;
}

--
2.34.1


2023-07-31 15:11:08

by Tomi Valkeinen

[permalink] [raw]
Subject: [PATCH v3 2/9] media: i2c: ds90ub960: Configure CSI-2 continuous clock

Use 'clock-noncontinuous' from DT to configure the
continuous/non-continuous clock setting for the TX ports.

Signed-off-by: Tomi Valkeinen <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
---
drivers/media/i2c/ds90ub960.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index 4833b39b9178..b840c9160bf2 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -149,6 +149,7 @@

#define UB960_TR_CSI_CTL 0x33
#define UB960_TR_CSI_CTL_CSI_CAL_EN BIT(6)
+#define UB960_TR_CSI_CTL_CSI_CONTS_CLOCK BIT(1)
#define UB960_TR_CSI_CTL_CSI_ENABLE BIT(0)

#define UB960_TR_CSI_CTL2 0x34
@@ -485,6 +486,7 @@ struct ub960_txport {
u8 nport; /* TX port number, and index in priv->txport[] */

u32 num_data_lanes;
+ bool non_continous_clk;
};

struct ub960_data {
@@ -1133,6 +1135,9 @@ static int ub960_parse_dt_txport(struct ub960_data *priv,
goto err_free_txport;
}

+ txport->non_continous_clk = vep.bus.mipi_csi2.flags &
+ V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK;
+
txport->num_data_lanes = vep.bus.mipi_csi2.num_data_lanes;

if (vep.nr_of_link_frequencies != 1) {
@@ -1744,6 +1749,9 @@ static void ub960_init_tx_port(struct ub960_data *priv,

csi_ctl |= (4 - txport->num_data_lanes) << 4;

+ if (!txport->non_continous_clk)
+ csi_ctl |= UB960_TR_CSI_CTL_CSI_CONTS_CLOCK;
+
ub960_txport_write(priv, nport, UB960_TR_CSI_CTL, csi_ctl);
}


--
2.34.1