Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1109168rwi; Wed, 26 Oct 2022 10:52:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7UCErE1+cCaEwqjZ0dGLqC7uhJ3JBCGVKZvHt9pkjxDaDkXnHdy9ljNyAiDye7SAVOFmO8 X-Received: by 2002:aa7:df94:0:b0:461:aff8:d3e1 with SMTP id b20-20020aa7df94000000b00461aff8d3e1mr18338651edy.10.1666806751624; Wed, 26 Oct 2022 10:52:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666806751; cv=none; d=google.com; s=arc-20160816; b=YL3mkTST1FkJvZ44Zi9Cs+uW/WJi6JMT3oy7aMMKt/1z5DmHJ+D/mHPNSi5uSB8pIn +IeTrDgzx4ACs1PYiq1mp54zwFV3wfYK6LACBhINoeQ5x53OpypM2JbpGjkhJtvJyGmI n2t8mKzutYIO1/1FVnmYqeWtzenMIF9eOTpVJYG5XLYs1bnonLl1VmAUTbUD+GyTne1i OhSLfhknOpbDTR5rD9Xbg4Gs0xF/W0PmyaG4I6ursHi98dz2D0XcZCXC/vb5809p1uUd OxOjqJ6LaEouik5/ZtrrJv8zmfHEYyFmg8IonF3Q8WjoFZBQCoz4MkGyLf1+YZrHoKD9 LcEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7AA9h8SmdIJH6hpfSaQ1dsYeLBKSIK0Dj9U7LImgfDg=; b=wcSb75HaV2Rvhh3fv3QuWYbeFLHp0kUDv8kHwOxov6vZ+s1QL54LFtTVRGduNfUlr3 gOL4ooX2U1tpgR1OAiDlGmbtBOC/mYyDt0aITZp4zmN64pNoCmKer0UWQ7P6YDgdNx7l fO4uwOQbuagEPkqftjoOiJegCFM+aly/8E2hPcjw8EpQdVzCwNYqH/+nAdnMg8SvTr5X 20nN3/7vD0rY62T39l2oEk7I9O6gLNBSR4Ts1cm25jCRgfxA34fCsumgNItcW6fyxWWt I6Om/lcKeEQLCVwsBsTm9R8QB6P+yt9ATSDQr9rxhffCizS3Wk4bqvZr6KDTZk0TxOzx OGEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GEAxVKOt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g42-20020a056402322a00b0046231a0a57esi4296529eda.186.2022.10.26.10.52.05; Wed, 26 Oct 2022 10:52:31 -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 header.i=@gmail.com header.s=20210112 header.b=GEAxVKOt; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234035AbiJZR36 (ORCPT + 99 others); Wed, 26 Oct 2022 13:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234220AbiJZR3r (ORCPT ); Wed, 26 Oct 2022 13:29:47 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27DFA32EF8; Wed, 26 Oct 2022 10:29:38 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id y69so23714957ede.5; Wed, 26 Oct 2022 10:29:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7AA9h8SmdIJH6hpfSaQ1dsYeLBKSIK0Dj9U7LImgfDg=; b=GEAxVKOtuirXdsRDTvEMEotHUyxwYr1Iu9/ZqJKdAmUoqPCxTnr3Zq/2aRaKDkqrIA INabHPdOdnZc2DB+ZC9YB2RKlCd8qATeZjqxC16bRjR4ShmWummnyJ/6Fv35YUY4cCwu vjYx7HLi5qwgoag6GUicDNb+mP/g948GWBO9g7IB3TwQzAgz8PnT6HFwjSibiwgLDU1f +kNvO6+Bnl0mkylu2ydieM5IZ5YoiT9g2U0BP78Fo3zkYVOTohSUHuROG1g2Dy3glMRu PvX/X08H2vwdmPRZ+fwYDCS5oMJoR8ChM9poMOMQruGDudHIso0aMGRjek9+Bs899yAH jwTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7AA9h8SmdIJH6hpfSaQ1dsYeLBKSIK0Dj9U7LImgfDg=; b=0d0krf8T67uKTf+sK0c9OOJooL9mLb9pEBsvhdc9vmSdds7FPrZX/rYmxKPnGKWJdH CFEceu7Nv6F11B1S8ugIzFYCbhUsqUPknUyrt4dPnUEtMsBax2ibOVj2FZ064YueCDU9 oneIh7V8TCGe4pslIJy8NLAHA1dF2Td4Z6deqBtK4+lufB2P1bhqPSwUW4c1WbGR/7MP gvEun8e/ofRvC0pekOiLTWY5kNlaUhWuYMUC4A9gj90nB++shnfuyWXB6LgDTTHBAQCl JF4XLtpxItI1O4n4CEqS2k+Gj5sXSNM2pSxh3BGg8rbOiOW0vShT5w9HgAOW5QUILpyZ kR8A== X-Gm-Message-State: ACrzQf0IkfqEhc8czXlO1cawV75nCbCaXeaB4Lmr0h7Y5JUyDQtzbK+7 E0PmFjPXrtzIXHDyNQp5eIRwK9fDhW01gOBOHsQ= X-Received: by 2002:a05:6402:2552:b0:45d:ecf:b23 with SMTP id l18-20020a056402255200b0045d0ecf0b23mr42421584edb.255.1666805376698; Wed, 26 Oct 2022 10:29:36 -0700 (PDT) MIME-Version: 1.0 References: <20221004234343.54777-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221004234343.54777-5-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: "Lad, Prabhakar" Date: Wed, 26 Oct 2022 18:29:10 +0100 Message-ID: Subject: Re: [PATCH v3 4/4] media: platform: Add Renesas RZ/G2L CRU driver To: Sakari Ailus Cc: Mauro Carvalho Chehab , Laurent Pinchart , Rob Herring , Krzysztof Kozlowski , Philipp Zabel , Jacopo Mondi , =?UTF-8?Q?Niklas_S=C3=B6derlund?= , Hans Verkuil , Geert Uytterhoeven , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sakari, Thank you for the review. On Tue, Oct 25, 2022 at 11:33 PM Sakari Ailus wrote: > > Hi Prabhakar, > > A few comments below... apologies for not reviewing this earlier. Looks > good in general but there are a few points that need some attention. > > On Wed, Oct 05, 2022 at 12:43:43AM +0100, Prabhakar wrote: > ... > > +static int rzg2l_cru_ip_pre_streamon(struct v4l2_subdev *sd, u32 flags) > > +{ > > + struct rzg2l_cru_dev *cru; > > + int ret; > > + > > + cru = v4l2_get_subdevdata(sd); > > + > > + if (!cru->is_csi) > > + return -EINVAL; > > + > > + ret = v4l2_subdev_call(cru->ip.remote, video, pre_streamon, 0); > > If you're calling pre_streamon successfully, you'll have to have an > equivalent number of post_streamoff calls. > Agreed, I will implement the post_streamoff() > ... > > > +static int rzg2l_cru_set_stream(struct rzg2l_cru_dev *cru, int on) > > +{ > > + struct media_pipeline *pipe; > > + struct v4l2_subdev *sd; > > + struct media_pad *pad; > > + unsigned long flags; > > + int ret; > > + > > + pad = media_pad_remote_pad_first(&cru->pad); > > + if (!pad) > > + return -EPIPE; > > + > > + sd = media_entity_to_v4l2_subdev(pad->entity); > > + > > + if (!on) { > > + media_pipeline_stop(&cru->vdev.entity); > > + return v4l2_subdev_call(sd, video, s_stream, 0); > > Ditto. > OK. > > + } > > + > > + ret = rzg2l_cru_mc_validate_format(cru, sd, pad); > > + if (ret) > > + return ret; > > + > > + ret = v4l2_subdev_call(sd, video, pre_streamon, 0); > > + if (ret == -ENOIOCTLCMD) > > + ret = 0; > > + if (ret) > > + return ret; > > For all cases below where streaming on doesn't succeed, you'll have to have > a call of post_streamoff. > Agreed, I missed that I will call post_streamoff in the error paths. > > + > > + spin_lock_irqsave(&cru->qlock, flags); > > + > > + /* Select a video input */ > > + if (cru->is_csi) > > + rzg2l_cru_write(cru, CRUnCTRL, CRUnCTRL_VINSEL(0)); > > + > > + /* Cancel the software reset for image processing block */ > > + rzg2l_cru_write(cru, CRUnRST, CRUnRST_VRESETN); > > + > > + /* Disable and clear the interrupt before using */ > > + rzg2l_cru_write(cru, CRUnIE, 0); > > + rzg2l_cru_write(cru, CRUnINTS, 0x001f000f); > > + > > + /* Initialize the AXI master */ > > + rzg2l_cru_initialize_axi(cru); > > + > > + /* Initialize image convert */ > > + ret = rzg2l_cru_initialize_image_conv(cru); > > + if (ret) { > > + spin_unlock_irqrestore(&cru->qlock, flags); > > + return ret; > > + } > > + > > + /* Enable interrupt */ > > + rzg2l_cru_write(cru, CRUnIE, CRUnIE_EFE); > > + > > + /* Enable image processing reception */ > > + rzg2l_cru_write(cru, ICnEN, ICnEN_ICEN); > > + > > + spin_unlock_irqrestore(&cru->qlock, flags); > > + > > + pipe = sd->entity.pipe ? sd->entity.pipe : &cru->vdev.pipe; > > + ret = media_pipeline_start(&cru->vdev.entity, pipe); > > + if (ret) > > + return ret; > > + > > + clk_disable_unprepare(cru->vclk); > > + > > + ret = v4l2_subdev_call(sd, video, s_stream, 1); > > + if (ret == -ENOIOCTLCMD) > > + ret = 0; > > + if (ret) { > > + /* enable back vclk so that release() disables it */ > > + clk_prepare_enable(cru->vclk); > > + media_pipeline_stop(&cru->vdev.entity); > > + return ret; > > + } > > + > > + ret = clk_prepare_enable(cru->vclk); > > What will happen if enabling vclk will fail here? (Or above?) > Hmm, I will have to undo the stuff here. I will fix that in the next version and for the above failure I'll add a warning message as s_stream(1) itself has failed. Cheers Prabhakar