Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2177600rdf; Mon, 6 Nov 2023 06:58:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFheVtOvvf4aFSeixY1c9oms8yzIba+KvbepAIdaNRjnnPnbPxrVCrPQeO2CTmj1eT5zjwn X-Received: by 2002:a17:903:78d:b0:1cc:520a:54c with SMTP id kn13-20020a170903078d00b001cc520a054cmr17224074plb.56.1699282736497; Mon, 06 Nov 2023 06:58:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699282736; cv=none; d=google.com; s=arc-20160816; b=j33tMLNMKJnQWTQxMrjUizECRc6xP7QE90sfbzkBETcGTKaAcEXhW/Apko/VUmO/ol +NUnfk5HbEKtR7LrGX2UpBy5xzzXeEF+Alvn0jwaIUutSrHr9MkmA+iWU6wJLxG3TWbS bYM7M+/OPh1sc3v6AheTxBQuQ3MKx+wMcuulmcYPrNO/1k7aEwDpuctM/xI7rXTmdofk +M1irITfRwch1V1JzY5RuqkzTZNU8F5UWUttWMsQx4C9kbneIqxDpX1mJ5IqiITP0lxY Oy8tlRuVC9naOkE83HoWoQ6Ev7W2xcxMueU6Ni+2b/4qtif+rqBTip6h64q6xcL3/g0o j/Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ivpJSuGY4bSyBLV57NC7HA0MvTDqIRRzvqXn3ZSpC70=; fh=PuT56cSTXzbtrJUQbPx7GafhVqY7PP93VvsN+Z2ba00=; b=VarXnSMwNjWdjmOBQCRjBLpT5NzuaGZ4pRuzkH7mJ+D7H9sADWtlQci/4ts2bpHRwU a4aIEY3h6mlBIwZK7a2EjdZmiEJ5/0DYPAowM3ZqbxmuJGldx/ikwLAgH8zCzmFMvM04 vB4odtXKdJAcb8PQN7qYbG5kPO7SuxgBtH5COjUAleb5fHDIW8tewTK86H22uBQxLM7q 57c9huojKz+AF2cjYAsJ95gvLlgkHAwO5U4dqZNha/Mko3ZaqupHDOzpPhgW3QFL3vO2 5767dYijiyeNR22Uupl6YfQUw4bznywteP6mLM7Dl8ic8qsozaUaoHdV/En8QpyXnfXE zulw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VHdOuGRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id iw17-20020a170903045100b001c755810f80si7707238plb.28.2023.11.06.06.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 06:58:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VHdOuGRk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9C96680B8381; Mon, 6 Nov 2023 06:58:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231699AbjKFO6j (ORCPT + 99 others); Mon, 6 Nov 2023 09:58:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjKFO6i (ORCPT ); Mon, 6 Nov 2023 09:58:38 -0500 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5674DA4; Mon, 6 Nov 2023 06:58:33 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2A71C40015; Mon, 6 Nov 2023 14:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1699282711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ivpJSuGY4bSyBLV57NC7HA0MvTDqIRRzvqXn3ZSpC70=; b=VHdOuGRkOd7jg0jknuL8rYuwUTtIp8tREWQktA5NbOAqvfEGVg2twj2PQWkxUCWOIDFfFS +o+PfrchdcMzJfsJpFv1KLH+JMZEzwqHgsMejBgUd7hrZ2kypegkniJoMTylF8RhewjtjY U19S4YR2a7TxK0qOBBxOkuuRxLNIYkdwmAtvoZoXkEDuSaxdBpeInKtXycM3ZG/sxr+C5z SO6xcy/KgQGD8iw+nIvN2ZyzlSrUB2n9V+srLsmnsK9kL/DhaAIhFk0897aqk6FTZiA4Zh bY0gBa80FwA2p8GN+Lj8g2hyaIHqE/VsuXBqxEGIljhmGswL1BbAdyMjUA8hhQ== Date: Mon, 6 Nov 2023 15:58:29 +0100 From: Mehdi Djait To: Paul Kocialkowski Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, conor+dt@kernel.org, laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, alexandre.belloni@bootlin.com, maxime.chevallier@bootlin.com Subject: Re: [PATCH v7 3/3] media: i2c: Introduce a driver for the Techwell TW9900 decoder Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-GND-Sasl: mehdi.djait@bootlin.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 06 Nov 2023 06:58:53 -0800 (PST) Hi Paul, thank you for the review! On Thu, Nov 02, 2023 at 11:03:42AM +0100, Paul Kocialkowski wrote: > > +static int tw9900_write_reg(struct i2c_client *client, u8 reg, u8 val) > > +{ > > + int ret; > > + > > + ret = i2c_smbus_write_byte_data(client, reg, val); > > Is this an SMBUS device in particular? Or is there any reason to use the SMBUS > API instead of the general I2C API? > I think I will keep using the SMBUS API here. The reason is in the kernel documentation: -------------------------------------------------------------------------------- If you write a driver for some I2C device, please try to use the SMBus commands if at all possible (if the device uses only that subset of the I2C protocol). This makes it possible to use the device driver on both SMBus adapters and I2C adapters (the SMBus command set is automatically translated to I2C on I2C adapters, but plain I2C commands can not be handled at all on most pure SMBus adapters). -------------------------------------------------------------------------------- And the vast majority of the drivers under /media/i2c are using the SMBUS API. > > +static void tw9900_fill_fmt(const struct tw9900_mode *mode, > > + struct v4l2_mbus_framefmt *fmt) > > +{ > > + fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; > > + fmt->width = mode->width; > > + fmt->height = mode->height; > > + fmt->field = V4L2_FIELD_NONE; > > + fmt->quantization = V4L2_QUANTIZATION_DEFAULT; > > + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; > > + fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SMPTE170M); > > + fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SMPTE170M); > > +} > > + > > +static int tw9900_cfg_fmt(struct v4l2_subdev *sd, > > You might have to differentiate between set_fmt/get_fmt to return -EBUSY > if streaming is on in set_fmt. However I understand it will just copy the > current mode in both cases, but this might still be required to follow v4l2 > semantics (please double-check). > This should be done in the driver calling the pad subdev_call set_fmt, right ? -- Kind Regards Mehdi Djait