mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Frank Li <Frank.Li@nxp.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Hans Verkuil" <hverkuil+cisco@kernel.org>,
	"Laurent Pinchart" <laurent.pinchart@ideasonboard.com>,
	"Mehdi Djait" <mehdi.djait@linux.intel.com>,
	"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Daniel Scally" <dan.scally+renesas@ideasonboard.com>,
	"Nas Chung" <nas.chung@chipsnmedia.com>,
	"Isaac Scott" <isaac.scott@ideasonboard.com>,
	"Paul Cercueil" <paul@crapouillou.net>,
	"open list:MEDIA INPUT INFRASTRUCTURE (V4L/DVB)"
	<linux-media@vger.kernel.org>,
	"open list" <linux-kernel@vger.kernel.org>,
	imx@lists.linux.dev
Subject: Re: [PATCH v5 1/1] media: v4l2-common: Add helper function media_bus_fmt_to_csi2_(bpp|dt)()
Date: Fri, 15 May 2026 12:41:02 +0300	[thread overview]
Message-ID: <agbqLmzZ5p33N18o@kekkonen.localdomain> (raw)
In-Reply-To: <20260514183357.3088564-1-Frank.Li@nxp.com>

Hi Frank,

Thanks for the update!

On Thu, May 14, 2026 at 02:33:53PM -0400, Frank Li wrote:
> +static const struct media_bus_fmt_info *media_bus_fmt_info_get(u32 bus_fmt)
> +{
> +	for (unsigned int i = 0; i < ARRAY_SIZE(media_bus_fmt_info); i++) {
> +		if (media_bus_fmt_info[i].code == bus_fmt)
> +			return &media_bus_fmt_info[i];
> +	}
> +
> +	return NULL;
> +}
> +
> +u32 media_bus_fmt_to_csi2_dt(u32 bus_fmt)

I meant to use int and a negative return value here, too.

I'll pick this into my set and change this as well.

> +{
> +	const struct media_bus_fmt_info *info = media_bus_fmt_info_get(bus_fmt);
> +
> +	if (!info)
> +		return MIPI_CSI2_DT_INVALID;
> +
> +	/* Check bpp because 0 (MIPI_CSI2_DT_FS) is a valid data type code */
> +	return info->bpp ? info->dt : MIPI_CSI2_DT_INVALID;
> +}
> +EXPORT_SYMBOL_GPL(media_bus_fmt_to_csi2_dt);
> +
> +int media_bus_fmt_to_csi2_bpp(u32 bus_fmt)
> +{
> +	const struct media_bus_fmt_info *info = media_bus_fmt_info_get(bus_fmt);
> +
> +	if (!info)
> +		return -EINVAL;
> +
> +	return info->bpp ? info->bpp : -EINVAL;
> +}
> +EXPORT_SYMBOL_GPL(media_bus_fmt_to_csi2_bpp);

-- 
Kind regards,

Sakari Ailus

  reply	other threads:[~2026-05-15  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 18:33 Frank Li
2026-05-15  9:41 ` Sakari Ailus [this message]
2026-05-15 14:03   ` Frank Li

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=agbqLmzZ5p33N18o@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=Frank.Li@nxp.com \
    --cc=dan.scally+renesas@ideasonboard.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=isaac.scott@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=nas.chung@chipsnmedia.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=paul@crapouillou.net \
    /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®