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 33D86C001DB for ; Thu, 10 Aug 2023 07:30:49 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0tFavPmPG7XTvKrd9MyMPgcy0yTRfeXnKN++mhVKqcI=; b=RJy3u6bX/A3u0R Nk6xZFWSq00F4ZaA1QTLUql2im4ua0xQAtJg/BbZTk3rjm4IKb1ZsvWqf/goC/yFxTX/+mcF/2uDc 0wu7l1BZ0kCznwSdlXwK7e13pGtAO/MHUfiF66cR6dAR9/u/8bIx6mwQjWvOtLQi/bYQhl6YNbNZY ku13aAanQkkYRbXbbwzLWG9NVxMGWSSJRazluqfeji4+yAvYYK1YAlta/jySo0EKmZkYn0yV4UHNg AS3DdvHqXFb5GAbmBJsbDw3YvsLD8AHdMR0XtFLp8dN3JkkMgRjxtm5GwWMauMi+l60r0nTu+b1KB rSBzzlrDv3GoVr4qSLyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qU07k-006kna-06; Thu, 10 Aug 2023 07:30:24 +0000 Received: from relay6-d.mail.gandi.net ([217.70.183.198]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qU07h-006kmf-0h for linux-arm-kernel@lists.infradead.org; Thu, 10 Aug 2023 07:30:23 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 3E8A3C000C; Thu, 10 Aug 2023 07:30:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1691652616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iuypy1p6ook3tCaKkFtNgD/qaSVZXlKQHOWGSdH8/vs=; b=O8+LzBWAp0Cie7swpzb3xVJSTCbbwdVDbCDyoIuO62ahqPrcNZfg9CD2+MRXGXF1u5ku3x sC+GxVNAkSZex6QwVABp0u6reTfOB+OKgUfqEAC7JXfvrKgeSw/sRyXT4AioYJG0Yn9WId vKZPoKQELeD68eQJpAaKfpY0iq3pXjesTqgJrlXRxlKnZVKLqBBwYT4p6zNjQ9hzmxuquU Ye3LE3ozc1xr8xZrrgTJkyEPSbPL2V4POcKLD5cfFBgME2wyIKtPZIMbqsT7UeGnld0TTS 1D8X/fQ6W28aO615atqWv2kgdELriff5TnE852M/5gnfBfEZn0R4GKP4eTgBug== Date: Thu, 10 Aug 2023 09:30:15 +0200 From: Alexandre Belloni To: Jacky Huang Cc: a.zummo@towertech.it, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, soc@kernel.org, mjchen@nuvoton.com, schung@nuvoton.com, Jacky Huang Subject: Re: [RESEND PATCH v2 3/3] rtc: Add driver for Nuvoton ma35d1 rtc controller Message-ID: <20230810073015d5545903@mail.local> References: <20230809011542.429945-1-ychuang570808@gmail.com> <20230809011542.429945-4-ychuang570808@gmail.com> <20230809021025a7c0daec@mail.local> <426130f6-7b8a-91f9-559b-afc5afdc656e@gmail.com> <2023080922515326db190e@mail.local> <347cf148-bda8-852b-768c-fa2b57ce5bcb@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <347cf148-bda8-852b-768c-fa2b57ce5bcb@gmail.com> X-GND-Sasl: alexandre.belloni@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230810_003021_519785_8433B110 X-CRM114-Status: GOOD ( 23.55 ) 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="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/08/2023 15:21:47+0800, Jacky Huang wrote: > > > > > + return 0; > > > > > +} > > > > > + > > > > > +static int ma35d1_rtc_suspend(struct platform_device *pdev, pm_m= essage_t state) > > > > > +{ > > > > > + struct ma35_rtc *rtc =3D platform_get_drvdata(pdev); > > > > > + u32 regval; > > > > > + > > > > > + if (device_may_wakeup(&pdev->dev)) > > > > > + enable_irq_wake(rtc->irq_num); > > > > > + > > > > > + regval =3D rtc_reg_read(rtc, MA35_REG_RTC_INTEN); > > > > > + regval &=3D ~RTC_INTEN_TICKIEN; > > > > > + rtc_reg_write(rtc, MA35_REG_RTC_INTEN, regval); > > > > This is not what the user is asking, don't do this. Also, how was t= his > > > > tested? > > > Sure, I will remove these three lines of code. > > > = > > > We test it with "echo mem > /sys/power/state". > > > = > > Yes, my point is that if UIE is enabled, then the user wants to be woken > > up every second. If this is not what is wanted, then UIE has to be > > disabled before going to suspend. > > = > > My question is why are you enabling RTC_INTEN_TICKIEN in probe? I don't > > expect anyone to use an actual hardware tick interrupt, unless the alarm > > is broken and can't be set every second. This is why I questioned the > > RTC_UF path because I don't expect it to be taken at all. > = > Yes, we will remove TICKIEN from probe and modify ma35d1_alarm_irq_enable= (). > TICKIEN will be enabled only if UIE is enabled. > = > static int ma35d1_alarm_irq_enable(struct device *dev, unsigned int enabl= ed) > { > =A0=A0 =A0struct ma35d1_rtc *rtc =3D dev_get_drvdata(dev); > = > =A0=A0 =A0if (enabled) { > =A0=A0 =A0=A0=A0=A0 if (rtc->rtc->uie_rtctimer.enabled) > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 rtc_reg_write(rtc, NVT_RTC_INTEN, > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (rtc_reg_read(rtc, > NVT_RTC_INTEN)|(RTC_INTEN_TICKIEN))); Don't do that unless the regular alarm can't be set every second. Simply always use ALMIEN, then check rtctest is passing properly. > =A0=A0 =A0=A0=A0=A0 if (rtc->rtc->aie_timer.enabled) > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 rtc_reg_write(rtc, NVT_RTC_INTEN, > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (rtc_reg_read(rtc, > NVT_RTC_INTEN)|(RTC_INTEN_ALMIEN))); > =A0=A0 =A0} else { > =A0=A0 =A0=A0=A0=A0 if (rtc->rtc->uie_rtctimer.enabled) > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 rtc_reg_write(rtc, NVT_RTC_INTEN, > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (rtc_reg_read(rtc= , NVT_RTC_INTEN) & > (~RTC_INTEN_TICKIEN))); > =A0=A0 =A0=A0=A0=A0 if (rtc->rtc->aie_timer.enabled) > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 rtc_reg_write(rtc, NVT_RTC_INTEN, > =A0=A0 =A0=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0=A0=A0 (rtc_reg_read(rtc= , NVT_RTC_INTEN) & > (~RTC_INTEN_ALMIEN))); > =A0=A0 =A0} > =A0=A0 =A0return 0; > } > = -- = Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel