Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B57FF3C1979 for ; Thu, 2 Jul 2026 14:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783001169; cv=none; b=r/xVkSDNzKKWLGUJB1kfzzt9KnNwlHskozcvcRtnNG70ZYorJfXKtxNcfskgaiHhpTNeIjrSWYbAhnmZ2Y1zI4VDoQdTt2ZZRj5wMnkK2D5X9HFZ1j0Z0GrTF+3qt0RIlnSuTClmWwsp5iUp/wrJFkwftPIjjTfRdON3uLgfHgQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783001169; c=relaxed/simple; bh=LNiHKbFpyTEFj+cKtdWEHV2GV7+AxFYFOjQkUoD9hdk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tblbJA3sla0m21/ghm32ys8AkIiWsuh5pQFE5jMn6fNHtHnDpSoILPvouoJSQT7d3RAKs6UbM85XKNZjGJfR2xwe2/Q+x3LiYOFF5Y07Xa97ZgznUxPaRLClvJFDKc7kPKNOmUf2y/SA6SHlAp+p2HjVKWiWGMHAIkOBLxC1Yg0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=V7FxE1s/; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="V7FxE1s/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1783001167; x=1814537167; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LNiHKbFpyTEFj+cKtdWEHV2GV7+AxFYFOjQkUoD9hdk=; b=V7FxE1s/etZfocPR3FfOjxuc98TrvxEQZa5f2XqpFBnIscctKuiA83xZ n7CJd5Dfcs9xpFKax2GNSCGAIICNvnO1X8IfjGl6CaiYBMorS+zLLdDw2 09CKBPaQVRGfDwYQgegnsC/OHSdKr1cvWK3RLLHM8nbczzF1Jo/EhLzlK gCoWQ4FpAmIWR84QsQzpjNyJikjKYuLnsNslACm5ThX/Goq+x/6YbEoCY ImWf/d5y+8K4Fto2EWguXWExVvinDuru2/giQk+DBvEnVjvXpz0Rz3qpU s75M3asy7IveMGH2Vof2BDPBKNBDuJLsfxqIg7swp29g4ymOSgxrzZSX0 Q==; X-CSE-ConnectionGUID: va06Vq/ORyKTfe4hUBHkrA== X-CSE-MsgGUID: kBUm3TbiRsWOB64WPBZqyg== X-IronPort-AV: E=McAfee;i="6800,10657,11835"; a="87671457" X-IronPort-AV: E=Sophos;i="6.25,143,1779174000"; d="scan'208";a="87671457" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2026 07:06:06 -0700 X-CSE-ConnectionGUID: P3a1ED0DR1GCNDQpvlwXZw== X-CSE-MsgGUID: UoKh9LiMQeqPJhlzIvIqkg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,143,1779174000"; d="scan'208";a="250214472" Received: from conormcd-mobl2.ger.corp.intel.com (HELO kekkonen.fi.intel.com) ([10.245.244.229]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jul 2026 07:06:00 -0700 Received: from kekkonen.localdomain (localhost [IPv6:::1]) by kekkonen.fi.intel.com (Postfix) with SMTP id B4D93121C2C; Thu, 02 Jul 2026 17:05:56 +0300 (EEST) Date: Thu, 2 Jul 2026 17:05:56 +0300 Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo From: Sakari Ailus To: Jai Luthra Cc: linux-media@vger.kernel.org, hans@jjverkuil.nl, laurent.pinchart@ideasonboard.com, Prabhakar , Kate Hsuan , Dave Stevenson , Tommaso Merciai , Benjamin Mugnier , Sylvain Petinot , Christophe JAILLET , Julien Massot , Naushir Patuck , Stefan Klug , Mirela Rabulea , =?iso-8859-1?Q?Andr=E9?= Apitzsch , Heimir Thor Sverrisson , Kieran Bingham , Mehdi Djait , Ricardo Ribalda Delgado , Hans de Goede , Jacopo Mondi , Tomi Valkeinen , David Plowman , "Yu, Ong Hock" , " Ng, Khai Wen" , Rishikesh Donadkar Subject: Re: [PATCH v12 60/86] media: imx219: Add embedded data support Message-ID: References: <20260409201501.975242-1-sakari.ailus@linux.intel.com> <20260409201501.975242-61-sakari.ailus@linux.intel.com> <178117996109.1799417.15021338357084733334@freya> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <178117996109.1799417.15021338357084733334@freya> Hi Jai, On Thu, Jun 11, 2026 at 05:42:41PM +0530, Jai Luthra wrote: > Hi Sakari, > > Thank you for the patch. > > Not a full review, just some things that I noticed while trying to test > this branch with libcamera.. > > Quoting Sakari Ailus (2026-04-10 01:44:35) > > From: Laurent Pinchart > > > > The IMX219 generates embedded data unconditionally. Report it as an > > additional stream, with a new internal embedded data pad, and update > > subdev operations accordingly. > > > > Signed-off-by: Laurent Pinchart > > Co-developed-by: Sakari Ailus > > Signed-off-by: Sakari Ailus > > --- > > drivers/media/i2c/imx219.c | 187 +++++++++++++++++++++++++++++++------ > > 1 file changed, 161 insertions(+), 26 deletions(-) > > > > diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c > > index d695987839e4..e744b96a08f6 100644 > > --- a/drivers/media/i2c/imx219.c > > +++ b/drivers/media/i2c/imx219.c > > @@ -154,6 +154,9 @@ > > #define IMX219_PIXEL_ARRAY_HEIGHT 2480U > > #define IMX219_NATIVE_FORMAT MEDIA_BUS_FMT_SRGGB10_1X10 > > > > +/* Embedded metadata stream height */ > > +#define IMX219_EMBEDDED_DATA_HEIGHT 2U > > + > > /* Mode : resolution and related config&values */ > > struct imx219_mode { > > /* Frame width */ > > @@ -345,11 +348,13 @@ static const struct imx219_mode supported_modes[] = { > > enum imx219_pad_ids { > > IMX219_PAD_SOURCE = 0, > > IMX219_PAD_IMAGE, > > + IMX219_PAD_EDATA, > > IMX219_NUM_PADS, > > }; > > > > enum imx219_stream_ids { > > IMX219_STREAM_IMAGE, > > + IMX219_STREAM_EDATA, > > }; > > > > struct imx219 { > > @@ -375,6 +380,8 @@ struct imx219 { > > > > /* Two or Four lanes */ > > u8 lanes; > > + > > + u64 streams_enabled; > > }; > > > > static inline struct imx219 *to_imx219(struct v4l2_subdev *_sd) > > @@ -418,6 +425,25 @@ static u32 imx219_get_format_bpp(const struct v4l2_mbus_framefmt *format) > > } > > } > > > > +static u32 > > +imx219_get_embedded_format_code(const struct v4l2_mbus_framefmt *format) > > +{ > > + switch (format->code) { > > + case MEDIA_BUS_FMT_SRGGB8_1X8: > > + case MEDIA_BUS_FMT_SGRBG8_1X8: > > + case MEDIA_BUS_FMT_SGBRG8_1X8: > > + case MEDIA_BUS_FMT_SBGGR8_1X8: > > + return MEDIA_BUS_FMT_META_8; > > + > > + case MEDIA_BUS_FMT_SRGGB10_1X10: > > + case MEDIA_BUS_FMT_SGRBG10_1X10: > > + case MEDIA_BUS_FMT_SGBRG10_1X10: > > + case MEDIA_BUS_FMT_SBGGR10_1X10: > > + default: > > + return MEDIA_BUS_FMT_META_10; > > + } > > +} > > + > > static void imx219_get_binning(struct v4l2_subdev_state *state, u8 *bin_h, > > u8 *bin_v) > > { > > @@ -749,6 +775,15 @@ static int imx219_enable_streams(struct v4l2_subdev *sd, > > struct i2c_client *client = v4l2_get_subdevdata(&imx219->sd); > > int ret; > > > > + /* > > + * The image stream controls sensor streaming, as embedded data isn't > > + * controllable independently. > > + */ > > + if (imx219->streams_enabled) { > > + imx219->streams_enabled |= streams_mask; > > + return 0; > > + } > > + > > ret = pm_runtime_resume_and_get(&client->dev); > > if (ret < 0) > > return ret; > > @@ -791,6 +826,8 @@ static int imx219_enable_streams(struct v4l2_subdev *sd, > > __v4l2_ctrl_grab(imx219->vflip, true); > > __v4l2_ctrl_grab(imx219->hflip, true); > > > > + imx219->streams_enabled = streams_mask; > > + > > return 0; > > > > err_rpm_put: > > @@ -806,6 +843,10 @@ static int imx219_disable_streams(struct v4l2_subdev *sd, > > struct i2c_client *client = v4l2_get_subdevdata(&imx219->sd); > > int ret; > > > > + imx219->streams_enabled &= ~streams_mask; > > + if (imx219->streams_enabled) > > + return 0; > > + > > /* set stream off register */ > > ret = cci_write(imx219->regmap, IMX219_REG_MODE_SELECT, > > IMX219_MODE_STANDBY, NULL); > > @@ -826,17 +867,32 @@ static int imx219_enum_mbus_code(struct v4l2_subdev *sd, > > { > > struct imx219 *imx219 = to_imx219(sd); > > > > - if (code->pad == IMX219_PAD_IMAGE) { > > - /* The internal image pad is hardwired to the native format. */ > > + switch (code->pad) { > > + case IMX219_PAD_IMAGE: > > if (code->index > 0) > > return -EINVAL; > > > > - code->code = IMX219_NATIVE_FORMAT; > > - } else { > > - /* > > - * On the source pad, the sensor supports multiple raw formats > > - * with different bit depths. > > - */ > > + code->code = MEDIA_BUS_FMT_RAW_10; > > + return 0; > > + > > + case IMX219_PAD_EDATA: > > + if (code->index > 0) > > + return -EINVAL; > > + > > + code->code = MEDIA_BUS_FMT_META_10; > > + return 0; > > + > > + case IMX219_PAD_SOURCE: > > + default: > > + break; > > + } > > + > > + /* > > + * On the source pad, the sensor supports multiple image raw formats > > + * with different bit depths. The embedded data format bit depth > > + * follows the image stream. > > + */ > > + if (code->stream == IMX219_STREAM_IMAGE) { > > u32 format; > > > > if (code->index >= ARRAY_SIZE(imx219_mbus_formats) / 4) > > @@ -844,6 +900,15 @@ static int imx219_enum_mbus_code(struct v4l2_subdev *sd, > > > > format = imx219_mbus_formats[code->index * 4]; > > code->code = imx219_get_format_code(imx219, format); > > + } else { > > + struct v4l2_mbus_framefmt *fmt; > > + > > + if (code->index > 0) > > + return -EINVAL; > > + > > + fmt = v4l2_subdev_state_get_format(state, IMX219_PAD_SOURCE, > > + IMX219_STREAM_EDATA); > > + code->code = fmt->code; > > } > > > > return 0; > > @@ -855,15 +920,33 @@ static int imx219_enum_frame_size(struct v4l2_subdev *sd, > > { > > struct imx219 *imx219 = to_imx219(sd); > > > > - if (fse->pad == IMX219_PAD_IMAGE) { > > + switch (fse->pad) { > > + case IMX219_PAD_IMAGE: > > if (fse->code != IMX219_NATIVE_FORMAT || fse->index > 0) > > This should be MEDIA_BUS_FMT_RAW_10 I believe? Yes, I'll switch to that. > > > return -EINVAL; > > > > - fse->min_width = IMX219_PIXEL_ARRAY_WIDTH; > > - fse->max_width = IMX219_PIXEL_ARRAY_WIDTH; > > - fse->min_height = IMX219_PIXEL_ARRAY_HEIGHT; > > - fse->max_height = IMX219_PIXEL_ARRAY_HEIGHT; > > - } else { > > + fse->min_width = IMX219_VISIBLE_WIDTH; > > + fse->max_width = IMX219_VISIBLE_WIDTH; > > + fse->min_height = IMX219_VISIBLE_HEIGHT; > > + fse->max_height = IMX219_VISIBLE_HEIGHT; > > + return 0; > > + > > + case IMX219_PAD_EDATA: > > + if (fse->code != MEDIA_BUS_FMT_META_8 || fse->index > 0) > > And this should be MEDIA_BUS_FMT_META_10, to match these both with what > imx219_enum_mbus_code() is doing. The embedded data is always 8-bit, albeit the sensor may send it out at 10 bits per pixel, to align with the image data format. This needs to be fixed in the EDATA pad in fact. > > But I guess we need to handle both 8 and 10 bit formats at both places. -- Kind regards, Sakari Ailus