Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp20249rdb; Fri, 29 Sep 2023 15:08:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3JajCYB8QWP0RizPsQlFH24BkibtCZqynkS74G0OPzc6td5kAjicSk78EiCi4Hx70IWYA X-Received: by 2002:a05:6a20:3c8d:b0:15e:b763:2422 with SMTP id b13-20020a056a203c8d00b0015eb7632422mr8365643pzj.9.1696025330426; Fri, 29 Sep 2023 15:08:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696025330; cv=none; d=google.com; s=arc-20160816; b=jn7ndNBEMJqOWc2F0Oq36m/VtOG/L5qTOO0M3GrXVatCkQFetQFTfSuMmsAjsH9c72 7zEH7e44WOAcoKHZPdBprUmjX1O7pTnsXx5uSrdjzpjGlXoU5Xui4dHyFl+Y1GLp7ISc iv7ikyA+yhRpFWFBqj7qPV5dL8HA776MbJ9XdO0qCGeCdu3eUeQwFsrHSLj8pOz6PdgU VjreyljvCn/5SVE5NXPtJ8ddripKIYBDCZcecExxzj954IaHj6+zIw0+9hB2eR7wA+/s YmrdJcrwDls1ZN6YslgSuAYo+L/3cB1cMtq7IteI/AX4jJ9kPFc87CakELVZwZeMBuUi Zwjw== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0MWAGOIL7rWNbbxisopa42myX958tOK68iuGVtnOdbg=; fh=3FhI4ZSEu+xX1JkGSdPRVzYzt+/jEzEE+ul4mb3ZGEE=; b=UoEK43kBcHKB3tUzKYsJWEQ+/VVAu4TKwDWGnknQdNlglwUTEkOu+E35Fvu2wTKV0T otRTxiKbavaarEOya8epIOzuLlmkBOC4z817Sd60gOJef5K4CT3QN8MEJCWRgkI2ZLo7 ZUEo7p1bWqfZaLoSZoFQ61WXirsbA+tlEbrI5Q6FGjOQP1EmPqelDTS0PtwqQHAsxmaN S9eq+Z90491IaDgQiCveFkhvlKJKErUmn+Scmv2bNHl5eZjlQrFC8MA0qD9AJzgMRJOa i1sLflTwQY144H4ABDQqxhxoeFmIVH9WAbh6DFCfwz0ss/1J69QdOz+rE9jKWXtkJ8gb t3kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=io8J1gWq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id q187-20020a632ac4000000b00577a083624csi21125873pgq.89.2023.09.29.15.08.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 15:08:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@mess.org header.s=2020 header.b=io8J1gWq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mess.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 701AC82A5A53; Fri, 29 Sep 2023 09:20:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233355AbjI2QUP (ORCPT + 99 others); Fri, 29 Sep 2023 12:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232878AbjI2QUO (ORCPT ); Fri, 29 Sep 2023 12:20:14 -0400 Received: from gofer.mess.org (gofer.mess.org [IPv6:2a02:8011:d000:212::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBEA7BE; Fri, 29 Sep 2023 09:20:11 -0700 (PDT) Received: by gofer.mess.org (Postfix, from userid 1000) id 6408D1000B2; Fri, 29 Sep 2023 17:20:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mess.org; s=2020; t=1696004409; bh=NO7U8jxZgUpWr0WrNZxuq6hy5u2FsN8FVLFZSQC6DGs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=io8J1gWqNgAp0oYQnqnXaZ0ODjPn8YiBFoeog8mMiW+afnyzuONlL0UGmD40NmA3x b5dbj86ikrbxYLBjtnLZlcGCLLbaUEOikPOO6geNK+t5IjAJ1l6hrDJ9rf0LjnANGr lCugOdBmh3Lj2GZdb2KblJRDuelBK7zEl/EOCmIQSCjuMUA8SFqDB50K9NJIEHtAGI 7V/wHYWH7/7o08N66Hk/Tmo+A2nQny1HqHn4rYPPbwj9bhcliogFb8J8OdH1fspeOC YD2bpjXh0AGXNv4iwxaf92HcL7aiJ0I2FYvX28GRCQoGKc6EuXCeU0qxh+qsrjkUAB F3HxtdV4skF5w== Date: Fri, 29 Sep 2023 17:20:09 +0100 From: Sean Young To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Ivaylo Dimitrov Cc: linux-media@vger.kernel.org, Tony Lindgren , Russell King , Mauro Carvalho Chehab , Thierry Reding , Timo Kokkonen , Pali =?iso-8859-1?Q?Roh=E1r?= , "Sicelo A . Mhlongo" , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org Subject: Re: [PATCH v5 2/2] media: rc: remove ir-rx51 in favour of generic pwm-ir-tx Message-ID: References: <99f0042f-538c-bcaf-96fd-bac24a87f88e@gmail.com> <1715e2bf-5d02-4f20-1476-29a1fdf350b1@gmail.com> <179c4674-aa5c-0573-6d1f-ea6f2694d156@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <179c4674-aa5c-0573-6d1f-ea6f2694d156@gmail.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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 29 Sep 2023 09:20:27 -0700 (PDT) Hello Uwe, Just wanted to run an idea by you. On Fri, Sep 29, 2023 at 11:49:52AM +0300, Ivaylo Dimitrov wrote: > On 26.09.23 г. 23:18 ч., Sean Young wrote: > > I've never known of a solution to the pwm-ir-tx driver. If using hrtimers > > directly improves the situation even a bit, then that would be great. > > The issue with hrtimers is that we cannot use them directly, as > pwm_apply_state() may sleep, but hrtimer function is called in atomic > context. I've also been looking at this problem and came to same conclusion: the fact that pwm_apply_state() sleeps is a huge problem. 1) The vast majority of pwm drivers don't sleep, or could even be converted to spinlocks (e.g pwm-sifive.c could use spinlocks, as far as I can see). 2) Sure, some pwm devices are on i2c busses, so the driver needs to sleep. Those devices aren't great for what we're trying to do here, since the sleeping may cause delays and affect the generated signal. What would be ideal here is to have pwm-ir-tx work in atomic context if a non-sleeping pwm device is used, and another (non-optimal) code path for sleeping pwm drivers. We could even just refuse to run on sleeping pwm drivers. Uwe what do you think of this idea? The pwm api could have a bool pwm_may_sleep(struct pwm *pwm) function, and pwm_apply_state() does not contain might_sleep() - only the driver-specific apply calls might_sleep(). It would be nice if this could all be done at compile time through e.g. a device tree attribute. Thanks, Sean