Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp735972rwb; Sat, 14 Jan 2023 07:37:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXuEMTSIhTZdvPTMAjRHUYc3GqyMkS+CksaY91GiX5kjViLhFNhiyBdgP7ctNk1piRDqulbV X-Received: by 2002:a05:6a20:8f25:b0:b0:2b4f:a9d9 with SMTP id b37-20020a056a208f2500b000b02b4fa9d9mr20117181pzk.5.1673710656288; Sat, 14 Jan 2023 07:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673710656; cv=none; d=google.com; s=arc-20160816; b=FwDPO6r1BPuQScg/ow2m2F1Uznzmx0aRWAOu+S41mPAYaJ9D93vp2f8JukHnA6aEi/ n+tAMu8uXVz+2cLxe6wLvUxlR6Ui0JE0jr5TCkO+Q4awe5q4ii9AV/JD3KF4sKBayrH8 i9xKuJT6B1EdNxG5zvUj2GmStUJZ7sJFlQyo5VnZx5nNZBUbFgjMQXhfLpyyC0qvRgru H3hJv5r8fb8/WKgHXypuFQagjBD4NU5Z6uXC23vNvwMdIO4MjhyO9yAMrCAl7b0xd7SN n47a0xyasIJfbQN8YcbAO4QUsI6u0WfY740o5DqdEjq8XOIYyO3lABG2EdtgvG4+qGKP 8HBw== 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=Hp83Hzqa44Ah5tgHkJB6yyLWzBIaHZyHdVpaLxCNm8Q=; b=Eshr5nxdXlNuZVcGZehvcTfywtcLLZfgXTRmcmu8gA2iPkVVxazXjYJ4H1do4WBuii n/tL9fxSBYu/gx0RJDYuKNiErOMnzooVGDxmN7OiyJ8hbk/NBxQArDL3kufExjDfVfZM guQSHHCNatsR7oCaijC+Tpr/ZWUUjVEvjpTQmzfPn2wvLt+lsWkylSA4SyJt9xjuGi7a YSdvvmqdcTM9+OLGrVtTNkfU9gmi44OYpIZ5aSMz3GArnMRGEzsY8p1d3nOwQPFHJ9mS 5qdko5xXyTVHz+rROgCkui+BPODnBWq2bjPJruUAg3y0fDDN8Ysopi1AHojbwc8szEE2 Pl7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=uCwTnM+P; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m18-20020a63fd52000000b00476c6b9cf69si24612165pgj.856.2023.01.14.07.37.30; Sat, 14 Jan 2023 07:37:36 -0800 (PST) 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=uCwTnM+P; 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 S230115AbjANPTO (ORCPT + 52 others); Sat, 14 Jan 2023 10:19:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbjANPTM (ORCPT ); Sat, 14 Jan 2023 10:19:12 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8907EC3; Sat, 14 Jan 2023 07:19:11 -0800 (PST) Received: from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1D803E68; Sat, 14 Jan 2023 16:19:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673709549; bh=8DdFlTYIVYx7MH33ENuQ32ueX7/jjHZyqYmBP6RymQ8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uCwTnM+POwxmPx9k1hfd/HTR/7druFEY/2QbW4vZHQ1srpjmMaxN7lQAKi6ej7QOh NOoq+iaKGUsCfBVI2hXqFpKardxh4nsYtR5Wj1VmZzBKkop3RiPuHJdJlEDzYz7JsG l9wLRKGZCqTptqqxK6Xw5kMWvn63VDFVmTQhnEh4= Date: Sat, 14 Jan 2023 16:19:06 +0100 From: Jacopo Mondi To: Sakari Ailus Cc: Andrey Skvortsov , Steve Longerbeam , Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: ov5640: Update last busy timestamp to reset autosuspend timer Message-ID: <20230114151906.gkgmhzpq64dhwouu@uno.localdomain> References: <20230114112109.982005-1-andrej.skvortzov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 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 On Sat, Jan 14, 2023 at 02:29:14PM +0200, Sakari Ailus wrote: > Hi Andrey, > > On Sat, Jan 14, 2023 at 02:21:09PM +0300, Andrey Skvortsov wrote: > > Otherwise autosuspend delay doesn't work and power is cut off > > immediately as device is freed. > > > > Signed-off-by: Andrey Skvortsov > > --- > > drivers/media/i2c/ov5640.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > > index ac35350..f71c0f7 100644 > > --- a/drivers/media/i2c/ov5640.c > > +++ b/drivers/media/i2c/ov5640.c > > @@ -1238,6 +1238,7 @@ static int ov5640_write_reg(struct ov5640_dev *sensor, u16 reg, u8 val) > > return ret; > > } > > > > + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); > > return 0; > > } > > > > @@ -1305,6 +1306,7 @@ static int ov5640_read_reg(struct ov5640_dev *sensor, u16 reg, u8 *val) > > } > > > > *val = buf[0]; > > + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); > > I wouldn't add these calls to register accesses. It's generally relevant > with autosuspend_put(). > > The rest seems fine to me. > Does it mean the same should be done for the all the sensor drivers that use autosuspend ? I count 8 of them, not a huge number. > > return 0; > > } > > > > @@ -3615,6 +3617,7 @@ static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl) > > break; > > } > > > > + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); > > pm_runtime_put_autosuspend(&sensor->i2c_client->dev); > > > > return 0; > > @@ -3702,6 +3705,7 @@ static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl) > > break; > > } > > > > + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); > > pm_runtime_put_autosuspend(&sensor->i2c_client->dev); > > > > return ret; > > @@ -4034,8 +4038,10 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable) > > out: > > mutex_unlock(&sensor->lock); > > > > - if (!enable || ret) > > + if (!enable || ret) { > > + pm_runtime_mark_last_busy(&sensor->i2c_client->dev); > > pm_runtime_put_autosuspend(&sensor->i2c_client->dev); > > + } > > > > return ret; > > } > > @@ -4203,6 +4209,7 @@ static int ov5640_probe(struct i2c_client *client) > > > > pm_runtime_set_autosuspend_delay(dev, 1000); > > pm_runtime_use_autosuspend(dev); > > + pm_runtime_mark_last_busy(dev); > > pm_runtime_put_autosuspend(dev); > > > > return 0; > > -- > Kind regards, > > Sakari Ailus