From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A181CC43217 for ; Tue, 29 Nov 2022 00:04:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5Hc5/RBt1RtK9dTTUO3D73Jeodk2l6YpFoSEw0kYfFo=; b=jRqozVIp/yFRna AmTVTvghL8zKSN9H+wBSVvk2EGPFIdmAWdHvJhzie4l7H1ckl/Pi1puQIhrw59Hh0xpBKW2wMfHps Q/YJYMO8AmSWkK/F6Keas2YZfxAxlcQyHVNjQ6n+NSSvVAxayngC2JmG18IZbIekr0Jpjq3RyTcSO kNj3YTB/qUDQHQHoLOlv+LHjehZ1ugbO6IIW2JpQz+kWSwvcXlhFTxOzE1ofp8bDgnZfSeYmk9ESP BPNBmIpf8UsDrZgYpTMXd0bpJs4Hu7z4dt2e2nMBl2EWD0oL8MY36T4+dNkc/sr5SOLWCKOwzNtnr fT2XBK7n0KTlLRZ27TiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozo5t-004qRx-4K; Tue, 29 Nov 2022 00:03:25 +0000 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozo5q-004qR7-GC for linux-arm-kernel@lists.infradead.org; Tue, 29 Nov 2022 00:03:23 +0000 Received: by mail-ej1-x62a.google.com with SMTP id gu23so11717919ejb.10 for ; Mon, 28 Nov 2022 16:03:20 -0800 (PST) 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=TdT+BmdIneu3TI8BLD07hqcjbUZk43YKZ9BLkChxuPo=; b=ITLzLdBFltzXasiY87QzobnsGAjZcX0eJgUsWviLRRgFDR1MRrM4wsOblh9/4+aPB4 0JfrE9SZtsCFujA8tq23N3E0AU5kGd/U9kNLDNPzO9Za1iRKHD9TomJ+/ntSxcAv0Y01 wSMzvLcdHUXNh8lqpaHHYYoxOcyrv3yD1kVbu3x+HlgbjGHJ+F1+yj3mtX3BsWqnO+63 KTIWo3kYnm8ybgI6QnNyMqUkOFHRs82X2UHVwwg/ihCrBmi5bsW6KRSxLc+CigJKDLRR Jsp60TaeQ6fZLG+iPAmuAkRt30YUaa+EjLRWAOZ7g97549Ly0HjnWS7J7uSH5/yZMJ67 W8RQ== 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=TdT+BmdIneu3TI8BLD07hqcjbUZk43YKZ9BLkChxuPo=; b=cCWoOUEE/uB0X5QCD6YLd8Wd7D53qJJADSMjPsJEKGh7oBPaq8yaMxu4ol3Sfp1wKG ni71BaDxQF3aSm+csIfpA58jJGB8jGYyEqszLwyGRNfYXotjyN0oR7AgmDwVMp3X0VrY jfuQl9LX1+C1VEhC75eleyCQ+Zh5S0tq3scziLAwzOOeRs+PwAMaYsuYtlSf9VcJ9Guk zUyaBWdQUcKxa2oAwSFAUnm66GI4n5dfSTkgx3ry2ykKRmwclGjXVUBHfVw2uSIejJir smYYB1bbH0+/m0i93lqrkDGf3NtyAXb90sJI1XhHIlfJdHFWaNevKam/ZqvprogYcEx/ 3WkA== X-Gm-Message-State: ANoB5pm6wCfhXmuVLRpLwokl3p/s99+HQvI9qk1/CQDhHnoIm7fR6myT sydY4VSJ0wu0axxYeY7D3P8u8rQrKJz405m/kZ8= X-Google-Smtp-Source: AA0mqf6fZM8tA810LE12Y15mX6MIkaG2UqDn3lS7Cb+AUhc5yb+m4XendEUXBVGYmQ36nUCanxQnZ2pOmiYUlk7SLu8= X-Received: by 2002:a17:906:79c4:b0:778:e3e2:8311 with SMTP id m4-20020a17090679c400b00778e3e28311mr31820692ejo.342.1669680198945; Mon, 28 Nov 2022 16:03:18 -0800 (PST) MIME-Version: 1.0 References: <20221031232202.131945-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20221031232202.131945-7-prabhakar.mahadev-lad.rj@bp.renesas.com> <738a2461-7a6a-286b-89e8-d46a26ec6506@xs4all.nl> In-Reply-To: <738a2461-7a6a-286b-89e8-d46a26ec6506@xs4all.nl> From: "Lad, Prabhakar" Date: Tue, 29 Nov 2022 00:02:52 +0000 Message-ID: Subject: Re: [PATCH v4 6/9] media: i2c: ov5645: Use runtime PM To: Hans Verkuil Cc: Sakari Ailus , Laurent Pinchart , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Geert Uytterhoeven , Magnus Damm , Shawn Tu , Jacopo Mondi , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Biju Das , Lad Prabhakar X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221128_160322_563222_C399F9E1 X-CRM114-Status: GOOD ( 19.06 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Hans, On Mon, Nov 28, 2022 at 1:49 PM Hans Verkuil wrote: > > Hi Prabhakar, > > On 11/1/22 00:21, Prabhakar wrote: > > From: Lad Prabhakar > > > > -static void ov5645_set_power_off(struct ov5645 *ov5645) > > -{ > > - gpiod_set_value_cansleep(ov5645->rst_gpio, 1); > > - gpiod_set_value_cansleep(ov5645->enable_gpio, 0); > > - clk_disable_unprepare(ov5645->xclk); > > - regulator_bulk_disable(OV5645_NUM_SUPPLIES, ov5645->supplies); > > -} > > - > > -static int ov5645_s_power(struct v4l2_subdev *sd, int on) > > -{ > > - struct ov5645 *ov5645 = to_ov5645(sd); > > - int ret = 0; > > - > > - mutex_lock(&ov5645->power_lock); > > - > > - /* If the power count is modified from 0 to != 0 or from != 0 to 0, > > - * update the power state. > > - */ > > - if (ov5645->power_count == !on) { > > - if (on) { > > - ret = ov5645_set_power_on(ov5645); > > - if (ret < 0) > > - goto exit; > > - > > - ret = ov5645_set_register_array(ov5645, > > - ov5645_global_init_setting, > > + ret = ov5645_set_register_array(ov5645, ov5645_global_init_setting, > > ARRAY_SIZE(ov5645_global_init_setting)); > > - if (ret < 0) { > > - dev_err(ov5645->dev, > > - "could not set init registers\n"); > > - ov5645_set_power_off(ov5645); > > - goto exit; > > - } > > - > > - usleep_range(500, 1000); > > - } else { > > - ov5645_write_reg(ov5645, OV5645_IO_MIPI_CTRL00, 0x58); > > - ov5645_set_power_off(ov5645); > > - } > > + if (ret < 0) { > > + dev_err(ov5645->dev, "could not set init registers\n"); > > + goto exit; > > } > > > > - /* Update the power count. */ > > - ov5645->power_count += on ? 1 : -1; > > - WARN_ON(ov5645->power_count < 0); > > + usleep_range(500, 1000); > > > > -exit: > > - mutex_unlock(&ov5645->power_lock); > > + return 0; > > > > +exit: > > + ov5645_set_power_off(dev); > > return ret; > > smatch gives this warning: > > drivers/media/i2c/ov5645.c:687 ov5645_set_power_on() warn: 'ov5645->xclk' from clk_prepare_enable() not released on lines: 687. > it's a false positive, as in case of error we jump to the exit label which calls ov5645_set_power_off() which internally calls clk_disable_unprepare() for xclk and on success we need to have xclk ON during s_stream(ON) and eventually the xclk will be unprepared in s_stream(OFF). Cheers, Prabhakar _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel