Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp462439lqc; Fri, 8 Mar 2024 02:43:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULZl9H2qFGtzgesneMDxN2nshgPRllyZjt8KKXVvZcUueXRwbvZHYz5k1nm6TlRY6WGiFoaqah+eite24FWrKxk7HF3GmxFH3fSSNDPw== X-Google-Smtp-Source: AGHT+IHDHRUtX6aXfot9GKOSczbHiDcmu9ohUgYePXxjbbUuhoRT4HqgoAxpjuRCQ71nfOeS/uk/ X-Received: by 2002:a17:906:616:b0:a45:8ab6:5f3b with SMTP id s22-20020a170906061600b00a458ab65f3bmr8816314ejb.6.1709894592691; Fri, 08 Mar 2024 02:43:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709894592; cv=pass; d=google.com; s=arc-20160816; b=asosSJ1/hKCBl/roIksiM8Ook9SGeVXMVf47tz/WAhtn89FDX7exIm/q4BSA9taivF iIBmmYXNeRwsWA8vQNPjMJd4e4r+teqvgc13rS0nJio2/XnKf04wsz4eepAPjyYbt109 8cii3Zweu6kv+vPwu4NUW353lh8MBoEYfYEGhzWAXYWJx7WCcNqrk3NraZH6hElOh7sS r0QxIXNa8obvY6m2WWiZMfLE5Xr0QRFOuzGQfYGsVvz0S4hLhBEgSWyXiKg3CczjmEVa qGkTcuw/VH7x6s/o9DPXyzf5CRHKqYBegMaB/pIYOeVwgINgjeXDfgBrAiaOlEQSnjYe rp8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YnXeKNe3Pth18IqLBpLGUfhGrY47izo6nmAUIr2+va0=; fh=g+XHGie3xQj5MWg24SZy72LIZUvshtfzZocvnO90kO8=; b=i72aUVa9sGvj0dCDeZ+OeHAcHP/uZr0yembLeUNHrsREsI1BnbOoUvgLbcD8wN9VWm i+mGF2eCFnsrqZtqpldrGo+JBMjvDzDLCi0NzDjQ2BD9GZ2HuGcNPv//PG4ZGOHysolS EEPaeyu325PDWIIcjD0QAtL73jXdp2VqD0iuhPf9N+fJXxyeELHgeDTlRgA6+hoaiohP vHJwXSJJHeUelUYofNxMbmH+zX1dPVfp9EaP858zYGRY/M2k4LnuXBKjjYLL/fL1HCHH ZaLtshX7I3HPhGaetQ3JecJCb2vVBEUaM1TKDItc2R6NsQYc+FUOwTVGrNr/Kn2/t4E7 Ok/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="UCuKD/a7"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-96860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id me20-20020a170906aed400b00a45ae9ee865si2823563ejb.374.2024.03.08.02.43.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 02:43:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-96860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="UCuKD/a7"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-96860-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-96860-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3F4371F22C80 for ; Fri, 8 Mar 2024 10:43:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 960BC55777; Fri, 8 Mar 2024 10:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UCuKD/a7" Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 107A242061; Fri, 8 Mar 2024 10:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709894581; cv=none; b=G/e87pai25nt82558PU5qs+O4C4cwvHsaEK2j3YW5+n/vLrFxUP61T8GqI8aUzRsnwF6U4PjLSrj6GdVSag27s3yjapCSI/EXdGxfeSA9mubAFY43uT6sgsfqcMGw1mAbFVzcROJ3n0cPGNqIKpMMxjQwAt99sB6gQwEPhVKn60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709894581; c=relaxed/simple; bh=Hskuh0jcTrLaj35GMhuvTS9BPTLaCsiZ/Ramp31XeMo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fKLb8QxN6u3IpJz0ZPokDiQt/8sT5/u5VJ6y2RGZdNNO7DsH1UpR2KYSRDOyUvHn+7XNM2EnGmQQ1CDhsMwXE+Z45HCTopLCwDD/AJ57QNpDRA+hTY2D8ziZ0/ybonuuwThQRQ6Kyg5p/z2XU+2fNW17petdxheCwXK6Z/Hw36w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UCuKD/a7; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a45bb2a9c20so246512966b.0; Fri, 08 Mar 2024 02:42:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709894578; x=1710499378; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YnXeKNe3Pth18IqLBpLGUfhGrY47izo6nmAUIr2+va0=; b=UCuKD/a7Gz0QlR2l7xXHAtWsRAo00atLD3GGYIancPJeWMjwU3T4/LKdoqztxSe6pp pfKWUg1aNy8MP1hh/hc5MfoD0ZxL9FevQCBMkt+2Y/sWY5ZUKsahAuelQ5/r6GybcBNE RuhSR+tTdQeUdLXfFAyZGC52NSbw4OC+7qxt8TIOsR+VTRNeUHAmcigtfcYNsVC7ELXT IoODx3rWu7iuqmREjMX+XrK2yqCVcGWT1uVuLY7+/382hqvPI3+Eeu/dA7a+lsKlcnu7 4ToIh5Xt/V6ZEsGXk0l5PFBnpL4EA48Rjzeqp/yfeeYOu4Kf93MKYFSjY7w2Hb35pb7v 0T3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709894578; x=1710499378; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YnXeKNe3Pth18IqLBpLGUfhGrY47izo6nmAUIr2+va0=; b=NL30iFdx1TIPsTaDPPGousZY5ftV+GA9pgORzMXO4E+lpNfMyykFDO5QvDpTDY4gpw aKSnEcpSE8/ntB/G3ovxukT4HDipvsY3dxpLwq8+QoEc8xZAmZZSFyWvzBBTEALkupAc 8ltQATfV7mY9dHFPZ2BtwlzO7T23XoTN0b4csMIzfighPxqXX1ZPh9hQaTCI9LJ9QxGk eKU3tB7P8gHwJDCYeDuQRB5aZsughxwc4O8SnmsApj33xr1rsH+KKKaCTucAIP1YgoEg sbU8LNlf+HOVb6oTJlTZcWOQbrfm6+Xl6lpt0Tahr4aDoQqPO4z58rTRX+Ce3e1P365a QLlw== X-Forwarded-Encrypted: i=1; AJvYcCX9e1PFZd4AtJZsatnX3cgWNUOHp5EvEUk5XLE3TMDw+B30YembHJITniIPASxikn0szZs/6jg5/VMagnCj0X71BXP9suZ8UZGYW0Q7 X-Gm-Message-State: AOJu0YyGH0/znOyR2tKyzJD0fqJgzRx6yi9BzmGlbohjq5mOsxwSbMef McqYD7gisC5pON3WWlsT6iRF0RVLFHb5CJUEVq4DEkoVrUFxI1Jk X-Received: by 2002:a17:906:3bd5:b0:a3f:ac54:5aa1 with SMTP id v21-20020a1709063bd500b00a3fac545aa1mr15553263ejf.21.1709894577966; Fri, 08 Mar 2024 02:42:57 -0800 (PST) Received: from tom-HP-ZBook-Fury-15-G7-Mobile-Workstation (net-188-217-49-82.cust.vodafonedsl.it. [188.217.49.82]) by smtp.gmail.com with ESMTPSA id wk15-20020a170907054f00b00a4519304f8bsm6208907ejb.14.2024.03.08.02.42.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 02:42:57 -0800 (PST) Date: Fri, 8 Mar 2024 11:42:55 +0100 From: Tommaso Merciai To: Umang Jain Cc: linux-media@vger.kernel.org, Alexander Shiyan , Kieran Bingham , Sakari Ailus , open list , Dave Stevenson Subject: Re: [PATCH v2 1/6] media: imx335: Support 2 or 4 lane operation modes Message-ID: References: <20240308083312.90279-1-umang.jain@ideasonboard.com> <20240308083312.90279-2-umang.jain@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@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: <20240308083312.90279-2-umang.jain@ideasonboard.com> Hi Umang, On Fri, Mar 08, 2024 at 02:03:07PM +0530, Umang Jain wrote: > From: Kieran Bingham > > The IMX335 can support both 2 and 4 lane configurations. > Extend the driver to configure the lane mode accordingly. > Update the pixel rate depending on the number of lanes in use. > > Signed-off-by: Kieran Bingham > Signed-off-by: Umang Jain > --- > drivers/media/i2c/imx335.c | 21 ++++++++++++++++++++- > 1 file changed, 20 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/imx335.c b/drivers/media/i2c/imx335.c > index b47ec71054c3..7162b0a3cef3 100644 > --- a/drivers/media/i2c/imx335.c > +++ b/drivers/media/i2c/imx335.c > @@ -21,6 +21,11 @@ > #define IMX335_MODE_STANDBY 0x01 > #define IMX335_MODE_STREAMING 0x00 > > +/* Data Lanes */ > +#define IMX335_LANEMODE 0x3a01 > +#define IMX335_2LANE 1 > +#define IMX335_4LANE 3 > + > /* Lines per frame */ > #define IMX335_REG_LPFR 0x3030 > > @@ -145,6 +150,7 @@ struct imx335_mode { > * @exp_ctrl: Pointer to exposure control > * @again_ctrl: Pointer to analog gain control > * @vblank: Vertical blanking in lines > + * @lane_mode Mode for number of connected data lanes > * @cur_mode: Pointer to current selected sensor mode > * @mutex: Mutex for serializing sensor controls > * @link_freq_bitmap: Menu bitmap for link_freq_ctrl > @@ -169,6 +175,7 @@ struct imx335 { > struct v4l2_ctrl *again_ctrl; > }; > u32 vblank; > + u32 lane_mode; > const struct imx335_mode *cur_mode; > struct mutex mutex; > unsigned long link_freq_bitmap; > @@ -934,6 +941,11 @@ static int imx335_start_streaming(struct imx335 *imx335) > return ret; > } > > + /* Configure lanes */ > + ret = imx335_write_reg(imx335, IMX335_LANEMODE, 1, imx335->lane_mode); > + if (ret) > + return ret; > + > /* Setup handler will write actual exposure and gain */ > ret = __v4l2_ctrl_handler_setup(imx335->sd.ctrl_handler); > if (ret) { > @@ -1094,7 +1106,14 @@ static int imx335_parse_hw_config(struct imx335 *imx335) > if (ret) > return ret; > > - if (bus_cfg.bus.mipi_csi2.num_data_lanes != IMX335_NUM_DATA_LANES) { > + switch (bus_cfg.bus.mipi_csi2.num_data_lanes) { > + case 2: > + imx335->lane_mode = IMX335_2LANE; > + break; > + case 4: > + imx335->lane_mode = IMX335_4LANE; > + break; > + default: > dev_err(imx335->dev, > "number of CSI2 data lanes %d is not supported\n", > bus_cfg.bus.mipi_csi2.num_data_lanes); Looks good to me. Similar on what we have on imx219 drv: ret = imx219_configure_lanes(imx219); Reviewed-by: Tommaso Merciai Thanks & Regards, Tommaso > -- > 2.43.0 > >