Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3501998pxy; Tue, 4 May 2021 03:53:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdAN0Vb2uYeZu67n0SNQ0aX0etKcynbsP41Rb68ovPbJjAbwfAEN0h5qeCLY2+k2jseLMs X-Received: by 2002:a17:906:6ace:: with SMTP id q14mr22371788ejs.79.1620125602862; Tue, 04 May 2021 03:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620125602; cv=none; d=google.com; s=arc-20160816; b=pRbcunYOQeTlXFY0Edl0CjkZdMLWlOjedWhYtulYwzrSuMt/invvMYTbfLUcRNMHHY N2azlTjY5MeCtk33CgjHV4SjQEGzmr66vYg9qUkqdrAPPpzw7zlZr1sAOYPhHAbM9q0C AkzdZB1UvB1hzngolX1FAs+YhxexTkbPUlKcPRhaAPD30x0dIuzjATT/8MviTqkAnM37 l5eu6vbi65b+d1giZzd0Y/M0TLkvU/FMoKfogmWhhDawfAY8SOcMh6Qw/NVJ3DvJh6Nn NuM3q84NKS78Yf0d9JapsF0ChrhJDDngkPQXLylqf5NYxeD6x7Yab/Vg7wbsJ1GCB0s4 gd8w== 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=zxrjsV6fnr+AyufS+WQM4Sqgj+OHbar0/fnVAzCxjbk=; b=C8sB9H/YKgt5kIzOSBgB+cAiatKjgDxoCruTOKiHPQ33t5byt0FyhX/6aCKqjQkSnR w4wt+HNnUi0dhlndETr0ueEVIKi3ZN0jUvTzNWwwqxyeNKYKl2gBo3lPeQSKYSbuO7NM FgoeFlX6xWQun/JAzzFpeqanBikXB5+EzUuMIe9+OgvRdbrATrTWw8l//VjEKLRddiX2 JgVE7vxfrHmynpyeEDnt3m1pAowQOmGxElkyV0iygmYLOz8/0+dPOjkWpfIy/9o/cvLl yj8z7ce0TlXobaUNwxvUTeJW3++Web2/y8SuoYYTY2wdQIE5DaiIOBBw+eE8biloEoPl b4Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si2357216ejr.598.2021.05.04.03.52.58; Tue, 04 May 2021 03:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbhEDKKE (ORCPT + 99 others); Tue, 4 May 2021 06:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbhEDKKD (ORCPT ); Tue, 4 May 2021 06:10:03 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FD3EC061574; Tue, 4 May 2021 03:09:08 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1ldrz8-0005ZI-4O; Tue, 04 May 2021 12:08:58 +0200 Date: Tue, 4 May 2021 12:08:58 +0200 From: Martin Kaiser To: Alexandre Belloni Cc: Alessandro Zummo , Shawn Guo , Pengutronix Kernel Team , Fabio Estevam , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd Subject: Re: [PATCH] rtc: imxdi: add wakeup support Message-ID: <20210504100858.4i2crnfwchlcopr7@viti.kaiser.cx> References: <20210430093210.7034-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org (added Stephen for alarmtimer) Hi Alexandre and all, Thus wrote Alexandre Belloni (alexandre.belloni@bootlin.com): > > platform_set_drvdata(pdev, imxdi); > > + device_set_wakeup_capable(&pdev->dev, true); > Maybe it makes sense to simply use device_init_wakeup here. the explanation for device_init_wakeup "By default, most devices should leave wakeup disabled. The exceptions are devices that everyone expects to be wakeup sources: keyboards, power buttons, ..." made me think that device_set_wakeup_capable is more appropriate here. I can change this if you want. However, if I compile rtc-imxdi as a module and use device_init_wakeup, the module can't be unloaded any more. The reason is that alarmtimer (kernel/time/alarmtimer.c) starts using rtc-imxdi as its backing rtc device and holds a reference to it. It seems that alarmtimer has no way to relinquish its backing rtc device, regardless of any pending alarms. What is the right approach here? Are there any rtc drivers that act as a wakeup source and can still be unloaded if compiled as a module? > > + > > +static SIMPLE_DEV_PM_OPS(dryice_pm, dryice_suspend, dryice_resume); > > + > I'm wondering, can't you use dev_pm_set_wake_irq to avoid having to > keep the changes to a minimum? I did a quick test, this seems to work. I'll change it in v2. Thanks, Martin