Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4943491yba; Tue, 30 Apr 2019 06:53:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9hB8W9/2xrVEFNyQsQ9tr0t+uzeevarpNN2P2z5yn6Zi7GTI46D6YXjTg9NGyDEwDtJIt X-Received: by 2002:a65:4185:: with SMTP id a5mr65995175pgq.82.1556632393363; Tue, 30 Apr 2019 06:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556632393; cv=none; d=google.com; s=arc-20160816; b=LBaYa4nF49RqQLwhu2pWpY1/ZovNoEJPev3s5SFy6sGDEV6P/MP1rt2LybuA7YZwiz igX1PJHYUg+hpm18P6jFW+qz5UkhnnkPeO1ElYX/MVCRPZs5NS/Zn2xGO149igQi6PIS KWmXtAnm6wXBQQfAqVjI3QZ7tkRqCT3cuajbUfUSqxPyHPmkb+cMTheXJfS3rydGa90V zy6kHxGZVLD1X8qfH7mCNNDI09aKIWiOuDsVdqTs3r8gn5qTZZL9D19VRxiCHs+ESghf FpLaXqkpczUtIhhTXqG86mnnF7/u3h7bP+IW6QbDvhrcZeTSv07nUE+PenWNV6SsfxBJ yB8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3fvAkD9b6GgMe2jzKEyVTt1BahNQLmE3eSO7bdab+Sk=; b=WQZSmmgRPzyng5Mgcg8AYO525VJN34conHkOeI9nQvJ9CjnHcyRBeZ9HEfk2IagEEZ NMSw1g2CKKsvwng6G9Gn/wQB3xQgKP2jGx3ZvMSxfZcE0MrBthn7AzMxn91uCLntJdrS jMW3Ww+PPnH/3wk7UQJtBNUxWTbV8L2roiMAHI1CiQht2HXlTRDNtpJUZAVAELJRvSAQ HP3o3yqJU/GMLEmp+YSsFPPJ1E2krzWlMFfjv4zf0FCTkRBtZhfBYPjMT1EFqlBVLqtt jn+Iukk25oYKKBgXd41V4AKPP+uubMFKK41YgnKW8weSE9uJpdXfGtH2BY7c1WTT6CDb sdaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j11si37258619pff.216.2019.04.30.06.52.56; Tue, 30 Apr 2019 06:53:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=iki.fi Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727478AbfD3Nt4 (ORCPT + 99 others); Tue, 30 Apr 2019 09:49:56 -0400 Received: from retiisi.org.uk ([95.216.213.190]:43624 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727138AbfD3Ntz (ORCPT ); Tue, 30 Apr 2019 09:49:55 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 4C576634C7B; Tue, 30 Apr 2019 16:49:45 +0300 (EEST) Received: from sailus by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1hLT8i-0000hV-Td; Tue, 30 Apr 2019 16:49:44 +0300 Date: Tue, 30 Apr 2019 16:49:44 +0300 From: Sakari Ailus To: Nicholas Mc Guire Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] media: smiapp: core: add range to usleep_range Message-ID: <20190430134944.6sutxdztj6crgo6w@valkosipuli.retiisi.org.uk> References: <1554603364-10500-1-git-send-email-hofrat@opentech.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1554603364-10500-1-git-send-email-hofrat@opentech.at> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nicholas, On Sun, Apr 07, 2019 at 04:16:02AM +0200, Nicholas Mc Guire wrote: > Allow the hrtimer subsystem to coalesce delay timers of lower accuracy > by providing a suitable range > > Signed-off-by: Nicholas Mc Guire > --- > > Problem located by an experimental coccinelle script > > hrtimers in atomic context have limited accuracy due to possible > context-switching and interruption so the accuracy is limited > anyway. Giving the hrtimer subsystem a reasonable range for merging > hrtimers helps to reduce the load on the hrtimer subsystem. As this > delays do not seem to mandate high accuracy the range of a factor > two seems acceptable. > > Patch was compile tested with: x86_64_defconfig + MEDIA_SUPPORT=m, > MEDIA_CAMERA_SUPPORT=y, MEDIA_CONTROLLER=y, VIDEO_V4L2_SUBDEV_API=y, > VIDEO_SMIAPP=m > (with a number of sparse warnings on sizeof() usage) > > Patch is against 5.1-rc3 (localversion-next is next-20190405) The delays are exact for the reason that they are user-visible delays in image capturing related use cases. Sometimes milliseconds matter, or at least adding more does not help. > > drivers/media/i2c/smiapp/smiapp-core.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c > index 58a45c3..c0c29ec 100644 > --- a/drivers/media/i2c/smiapp/smiapp-core.c > +++ b/drivers/media/i2c/smiapp/smiapp-core.c > @@ -1222,19 +1222,19 @@ static int smiapp_power_on(struct device *dev) > dev_err(&client->dev, "failed to enable vana regulator\n"); > return rval; > } > - usleep_range(1000, 1000); > + usleep_range(1000, 2000); > > rval = clk_prepare_enable(sensor->ext_clk); > if (rval < 0) { > dev_dbg(&client->dev, "failed to enable xclk\n"); > goto out_xclk_fail; > } > - usleep_range(1000, 1000); > + usleep_range(1000, 2000); > > gpiod_set_value(sensor->xshutdown, 1); > > sleep = SMIAPP_RESET_DELAY(sensor->hwcfg->ext_clk); > - usleep_range(sleep, sleep); > + usleep_range(sleep, sleep*2); > > mutex_lock(&sensor->mutex); > > @@ -1381,7 +1381,7 @@ static int smiapp_power_off(struct device *dev) > > gpiod_set_value(sensor->xshutdown, 0); > clk_disable_unprepare(sensor->ext_clk); > - usleep_range(5000, 5000); > + usleep_range(5000, 10000); > regulator_disable(sensor->vana); > sensor->streaming = false; > -- Sakari Ailus