Message ID | 20230616135922.442979-16-tomi.valkeinen@ideasonboard.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1379275vqr; Fri, 16 Jun 2023 07:20:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70x50i4Xhe2ol5FfeELH0r5/55oFTSkeEOyz4LucR6tv3cyYoRw7BY544YJOk2pmSGlZXw X-Received: by 2002:a05:6a20:6a24:b0:103:d538:5ea6 with SMTP id p36-20020a056a206a2400b00103d5385ea6mr2625873pzk.48.1686925259343; Fri, 16 Jun 2023 07:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686925259; cv=none; d=google.com; s=arc-20160816; b=Tm+DNnvZolrKWOuVK5r7QA89L8ZRK8RrDeZ38ID4sIMSt3Pp0xDasdenZftJZzIQWd MDHBQYUnhS6w7ff0SB1IJ11UyWhupdOaERkzS/jUkDk5qC1RhEw0NEZ6h7RxjScJJarZ hay6hr9GVoWPi9saCxyF2fE/qtZbgYB+EufMa8T8zSTsB64cwmS+ilyEJTz+IP4U7m+l /nCsnvUjmLAMCuBabv5H22uXzNBxAK3aur8nSagLNro9pod4UpCRWxXLS2sthrasKugw U3Wm9bisqN1YyNgX8WgU/Es9sHKvwKaV8J0eV+ohmWzithaVf+y+9M6AT5vO3K1aWJqT URhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IAUsrGNaof6Ck5q/zmxRB6NgSmdqpjOdNP9ePxzHIiE=; b=Jwt7fP3DkNVlC6wagnbXyct95qmRb3E6gU0chXU3ZTOf4gkN92CBPD9Lqai5akJ4l2 G7G+PbTJyRSsnMSxrTycw9DjvSeja7wRuDhteFvp4jHALLvQYL1L2QdEK2m9sNmfJLN8 K0m2MCZQMyL7q6FV92LuvWV4ozHnQYOLgV1s0Q8sIbOqdTVy7iKBO9UTtHTH+xqi/p+k KrBIg9qGbyVZTpBl65kIVKIs537qkci8CsfoSKD8N+UnpBzY76fmea3S2LCt51SAP8UZ wBMl/4wS6D0TPYlg5pClEophWlkB7UFMkMs00w2K7AFFNzO0mvZruyL0+1ppQTbCqvcS WqNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aB0KB4+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020aa79e88000000b006665f0400a7si5518616pfq.197.2023.06.16.07.20.44; Fri, 16 Jun 2023 07:20:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=aB0KB4+j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345444AbjFPOB2 (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 16 Jun 2023 10:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345406AbjFPOAr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Jun 2023 10:00:47 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DA23ABE; Fri, 16 Jun 2023 07:00:38 -0700 (PDT) Received: from desky.lan (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 4BB43209A; Fri, 16 Jun 2023 16:00:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1686924002; bh=nED/RJDHJyg29w/DBB3glM12/4xdeiqHHA4Jmrf1gCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aB0KB4+j1275iIuPK4NaBWo3JzF/LkoqbjTuJ2h8VDrcU63PrkOMnIxpKOjFEwDbG rhcq4+wUgWLLNdDXSF+M+RfgtHDXl6DBz1lz5X591gLLmtcJJxD6vuiU66iGgTld++ oenKicSavewUKIJko3lJ72EFDFxAdJ1HDdCqKh2U= From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Luca Ceresoli <luca.ceresoli@bootlin.com>, Andy Shevchenko <andriy.shevchenko@intel.com>, Matti Vaittinen <Matti.Vaittinen@fi.rohmeurope.com>, Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Sakari Ailus <sakari.ailus@linux.intel.com> Cc: Wolfram Sang <wsa@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Mauro Carvalho Chehab <mchehab@kernel.org>, Peter Rosin <peda@axentia.se>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Michael Tretter <m.tretter@pengutronix.de>, Hans Verkuil <hverkuil@xs4all.nl>, Mike Pagano <mpagano@gentoo.org>, =?utf-8?q?Krzysztof_Ha=C5=82asa?= <khalasa@piap.pl>, Marek Vasut <marex@denx.de>, Satish Nagireddy <satish.nagireddy@getcruise.com>, Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Subject: [PATCH v14 15/18] media: i2c: ds90ub953: Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK Date: Fri, 16 Jun 2023 16:59:19 +0300 Message-Id: <20230616135922.442979-16-tomi.valkeinen@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230616135922.442979-1-tomi.valkeinen@ideasonboard.com> References: <20230616135922.442979-1-tomi.valkeinen@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768869340710664340?= X-GMAIL-MSGID: =?utf-8?q?1768869340710664340?= |
Series |
i2c-atr and FPDLink
|
|
Commit Message
Tomi Valkeinen
June 16, 2023, 1:59 p.m. UTC
Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX
continuous/non-continuous clock register.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
drivers/media/i2c/ds90ub953.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
On Fri, Jun 16, 2023 at 04:59:19PM +0300, Tomi Valkeinen wrote: > Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX > continuous/non-continuous clock register. ... > struct regmap *regmap; I forgot if we discussed this along with i2c_client *client nearby. Since I reviewed Hans' patches the pure struct device *dev (instead of *client) might make more sense, despite being duplicative with regmap associated device. > u32 num_data_lanes; > + bool non_cont_clk; > > struct gpio_chip gpio_chip; And also try to place this as a first member and see (by using bloat-o-meter, for example) if it saves bytes. I'm wondering if we have tools like pahole but which suggests the better layout based on the code generation... Maybe something along with clang?
On 16/06/2023 17:33, Andy Shevchenko wrote: > On Fri, Jun 16, 2023 at 04:59:19PM +0300, Tomi Valkeinen wrote: >> Handle V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK flag to configure the CSI-2 RX >> continuous/non-continuous clock register. > > ... > >> struct regmap *regmap; > > I forgot if we discussed this along with i2c_client *client nearby. Since I > reviewed Hans' patches the pure struct device *dev (instead of *client) might > make more sense, despite being duplicative with regmap associated device. > >> u32 num_data_lanes; >> + bool non_cont_clk; >> >> struct gpio_chip gpio_chip; > > And also try to place this as a first member and see (by using bloat-o-meter, > for example) if it saves bytes. > > I'm wondering if we have tools like pahole but which suggests the better layout > based on the code generation... Maybe something along with clang? Isn't all this a bit on the side of pointless micro-optimizations? We're talking about possibly saving a few tens of bytes in a struct that's likely allocated a few times, by possibly messing up the (cosmetic) grouping and ordering of the fields in the struct? If there's a common rule-of-thumb wrt. struct members that everyone should follow, I'm good with that and can change this accordingly. But just trying to hunt for a field order that happens to save a few bytes here... It doesn't sound like time well spent. If things were perfect, this would be something the compiler would optimize, presuming the field ordering in the struct doesn't matter. Tomi
diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c index 5b586855c77b..f2e950a00d64 100644 --- a/drivers/media/i2c/ds90ub953.c +++ b/drivers/media/i2c/ds90ub953.c @@ -138,6 +138,7 @@ struct ub953_data { struct regmap *regmap; u32 num_data_lanes; + bool non_cont_clk; struct gpio_chip gpio_chip; @@ -1140,6 +1141,9 @@ static int ub953_parse_dt(struct ub953_data *priv) priv->num_data_lanes = nlanes; + priv->non_cont_clk = vep.bus.mipi_csi2.flags & + V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK; + return 0; } @@ -1202,7 +1206,7 @@ static int ub953_hw_init(struct ub953_data *priv) return dev_err_probe(dev, ret, "i2c init failed\n"); ub953_write(priv, UB953_REG_GENERAL_CFG, - UB953_REG_GENERAL_CFG_CONT_CLK | + (priv->non_cont_clk ? 0 : UB953_REG_GENERAL_CFG_CONT_CLK) | ((priv->num_data_lanes - 1) << UB953_REG_GENERAL_CFG_CSI_LANE_SEL_SHIFT) | UB953_REG_GENERAL_CFG_CRC_TX_GEN_ENABLE);