mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Rishikesh Donadkar <r-donadkar@ti.com>, jai.luthra@linux.dev
Cc: r-donadkar@ti.com, y-abhilashchandra@ti.com, devarsht@ti.com,
	vigneshr@ti.com, mchehab@kernel.org,
	tomi.valkeinen@ideasonboard.com, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH 4/4] media: i2c: ds90ub960: Use VC mapping specific to ub9702
Date: Mon, 08 Jun 2026 22:46:24 +0530	[thread overview]
Message-ID: <178093898477.19620.2275596910999709059@freya> (raw)
In-Reply-To: <20260608142901.3971821-5-r-donadkar@ti.com>

Quoting Rishikesh Donadkar (2026-06-08 19:59:01)
> Add a dedicated virtual channel mapping for ub9702 deserializers which
> require different VC configuration compared to ub960. Update the
> configuration logic to select the appropriate map based on the
> deserializer type.
> 
> Signed-off-by: Rishikesh Donadkar <r-donadkar@ti.com>
> ---
>  drivers/media/i2c/ds90ub960.c | 44 ++++++++++++++++++++++++++++-------
>  1 file changed, 35 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
> index d1597659639f..9ce6d9e6e3e8 100644
> --- a/drivers/media/i2c/ds90ub960.c
> +++ b/drivers/media/i2c/ds90ub960.c
> @@ -3482,7 +3482,18 @@ static int ub960_rxport_handle_events(struct ub960_data *priv, u8 nport)
>   * as that is the most common HW configuration found on boards with DS90UB960.
>   * For using both CSI TX0 & TX1 the below method will need significant changes.
>   *
> + * VC mapping differs between ub960 and ub9702 deserializers:
> + * For ub960:
> + *             - Each VC uses 2 bits in the mapping register
> + *             - Supports up to 4 virtual channels (VC0-VC3)
> + * For ub9702:
> + *             - Each VC uses 4 bits in the mapping register
> + *             - Currently uses only 2 virtual channels (VC0, VC1)
> + *
> + * The mapping registers determine which output VC a given input VC
> + * will be mapped to when forwarding data from the deserializer.
>   */
> +
>  static void ub960_get_vc_maps(struct ub960_data *priv, u8 *vc_map)
>  {
>         struct device *dev = &priv->client->dev;
> @@ -3518,14 +3529,26 @@ static void ub960_get_vc_maps(struct ub960_data *priv, u8 *vc_map)
>                 }
>  
>                 /* Start with all channels mapped to first free output */
> -               map = (cur_vc << 6) | (cur_vc << 4) | (cur_vc << 2) |
> -                       (cur_vc << 0);
> +
> +               if (priv->hw_data->chip_type == UB960) {
> +                       map = (cur_vc << 6) | (cur_vc << 4) | (cur_vc << 2) |
> +                               (cur_vc << 0);
> +               } else {
> +                       map = (cur_vc << 4) | (cur_vc << 0);
> +               }
>  

Same comment as last patch, I think this means that UB9702 would be broken
without this patch, which is never a good idea in mainline.

Please squash together patches so that each patch is an independent change
that doesn't break any device.

I'm fine with a Co-developed-by tag in the final single patch as it's been
quite a while since I looked at this :-)

Thanks,
    Jai

>                 /* Map actually used to channels to distinct free outputs */
>                 for (vc = 0; vc < UB960_MAX_VC; ++vc) {
>                         if (used_vc[vc]) {
> -                               map &= ~(0x03 << (2 * vc));
> -                               map |= (cur_vc << (2 * vc));
> +                               if (priv->hw_data->chip_type == UB960) {
> +                                       /* For ub960: 2 bits per VC */
> +                                       map &= ~(0x03 << (2 * vc));
> +                                       map |= (cur_vc << (2 * vc));
> +                               } else {
> +                                       /* For ub9702: 4 bits per VC */
> +                                       map &= ~(0x0f << (4 * vc));
> +                                       map |= (cur_vc << (4 * vc));
> +                               }
>                                 ++cur_vc;
>                         }
>                 }
> @@ -3705,8 +3728,7 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv,
>                                 for (i = 0; i < 8; i++)
>                                         ub960_rxport_write(priv, nport,
>                                                            UB9702_RR_VC_ID_MAP(i),
> -                                                          (nport << 4) | nport,
> -                                                          &ret);
> +                                                          vc_map[nport], &ret);
>                         }
>  
>                         break;
> @@ -4018,9 +4040,13 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
>                 fd->entry[fd->num_entries].length = source_entry->length;
>                 fd->entry[fd->num_entries].pixelcode = source_entry->pixelcode;
>  
> -               fd->entry[fd->num_entries].bus.csi2.vc =
> -                       ub960_get_output_vc(vc_map[nport],
> -                                           source_entry->bus.csi2.vc);
> +               if (priv->hw_data->chip_type == UB960)
> +                       fd->entry[fd->num_entries].bus.csi2.vc =
> +                               (vc_map[nport] >> (2 * source_entry->bus.csi2.vc)) & 0x03;
> +               else
> +                       fd->entry[fd->num_entries].bus.csi2.vc =
> +                               (vc_map[nport] >> (4 * source_entry->bus.csi2.vc)) & 0x0f;
> +
>                 dev_dbg(dev, "Mapping sink %d/%d to output VC %d",
>                         route->sink_pad, route->sink_stream,
>                         fd->entry[fd->num_entries].bus.csi2.vc);
> -- 
> 2.34.1
>

      reply	other threads:[~2026-06-08 17:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 14:28 [PATCH 0/4] media: i2c: ds90ub960: VC mapping improvements and TX1 support Rishikesh Donadkar
2026-06-08 14:28 ` [PATCH 1/4] media: i2c: ds90ub960: Enable CSI TX1 port Rishikesh Donadkar
2026-06-08 14:28 ` [PATCH 2/4] media: i2c: ds90ub960: Support multi-channel sensors Rishikesh Donadkar
2026-06-08 17:09   ` Jai Luthra
2026-06-08 14:29 ` [PATCH 3/4] media: i2c: ds90ub960: Fix VC mapping when ports skipped Rishikesh Donadkar
2026-06-08 17:11   ` Jai Luthra
2026-06-08 14:29 ` [PATCH 4/4] media: i2c: ds90ub960: Use VC mapping specific to ub9702 Rishikesh Donadkar
2026-06-08 17:16   ` Jai Luthra [this message]

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=178093898477.19620.2275596910999709059@freya \
    --to=jai.luthra@ideasonboard.com \
    --cc=devarsht@ti.com \
    --cc=jai.luthra@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=r-donadkar@ti.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=vigneshr@ti.com \
    --cc=y-abhilashchandra@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®