Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1659290imm; Thu, 18 Oct 2018 01:53:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62fCp1vRCucMBKWAfAlvT50oTi4EZCUPs4dABSkVaEajGkWhvPeI3yd1YTxdl0VXX0RSc7C X-Received: by 2002:a63:2747:: with SMTP id n68-v6mr4789781pgn.443.1539852826360; Thu, 18 Oct 2018 01:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852826; cv=none; d=google.com; s=arc-20160816; b=yydWUR9TbZq/EBGkvFOPEyB9Zn8Gng6ExIID60E9OtCR4qt3koSCnKkFFcWBkBO1FX y2vzLvuggZTEtmCx9jH8On43hQsAhZdoGa2gTqCMl/49oph+7qiDGAo2Hw2oTK8uoIXr 0hTNyjaq3FFpkpNoae4tbRGiA5aVZrk/LVwL4OZ80ynACJa4oC+vTK3No2Le/aRyxqTL lqv1xDEM5czDsCYQSFgkvw6ArKk6mFQsR3DCqfiDdXgAUJlGptpwgBjqmOg/r7C8YftB H/Opv3U80ecZ92mJ6HMA9eoOpxuKtuDoPY7jepNeZ2DKF8S3VrwqbsKKjL/XtVXBFDxT W7RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=F4klET77vpC5MSEg+hHmdmnyA+1l2CceneKVm/fwxIY=; b=Okx6PymVZbtQzrjy8MNrmvwXsl2sBL60FB6dntQGBBRUo03UxcPgUKshE8Kak4c0Os BF/zqBsxH3SEMa4guQfSs7esYguaCV/h6gK/rLSk4Tf8gdaKCCu2kRYl0M+SwI2ukNNF hZixCWO0+yM9H4hLqNTfABA39UPywC53IZk0wEmgVsOk2XtM9V0kuL3TxW4L5+hhttCC mDs67t41K/yXa1qdU2XY8BEvsksAtUVwep4GJuA40fjv11iE9aLKF3lNHMBpjALYeTV1 GgacFSkrIN+A1bgLZkG8cyatZiAPWh6qzFmWaIHuG6eK/veQpMGTM+59i/12fMI4Iwqe Vy2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jrmlzE8X; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y18-v6si17593932plr.365.2018.10.18.01.53.31; Thu, 18 Oct 2018 01:53:46 -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; dkim=pass header.i=@linaro.org header.s=google header.b=jrmlzE8X; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbeJRQw6 (ORCPT + 99 others); Thu, 18 Oct 2018 12:52:58 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35944 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727489AbeJRQw5 (ORCPT ); Thu, 18 Oct 2018 12:52:57 -0400 Received: by mail-pf1-f196.google.com with SMTP id l81-v6so14575323pfg.3 for ; Thu, 18 Oct 2018 01:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=F4klET77vpC5MSEg+hHmdmnyA+1l2CceneKVm/fwxIY=; b=jrmlzE8X9PBk3QfRv1Cfp60C33vylp0lkBxz8T8RarUCjyKz6a1ADpSvyxlGTXcWeA +C7BFa4VEqFP3Vyz+liAkIzoN/XnwIsIYagiL2aZINDGlAV3ltWKccQbbSjfY4yPsChx kOFHxcL8czMaX07ElOvCBIR53cXdDby3bYxXA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=F4klET77vpC5MSEg+hHmdmnyA+1l2CceneKVm/fwxIY=; b=mWcCbRLaw7fa85qeS4rqa9/xUotuevXcAid+akPk80RtpgVELE5x4ideM4UVZLoiRJ K6RwqGD/TKazQuJTp1d0i2Vua8NR8pZJ6ecpYY8uDxTzQx7fY/flD9jvl3pcAJNz5mMi 6AwGTcZsuW2FXs26qBklE3MX/JMbnzi4KijojDIWSXG1OeWDP9qvm+ugGna8bs/ZKy6s +FgLoHYzVt4anwbq0UrGzNP0WYtUF5Wo/cfE5S/YX2jnxAeDIV1pYxlxYdVxpM0FXdIV 28rm2F9WbiDvHB7FVK8XHebIpzhbUYASgg3L/JsL+y4UHaS9B/74pYGbeMIc82YLHia1 0R4w== X-Gm-Message-State: ABuFfojF99Vo0fNgyWbero6I4IOa5swZcMN50hOY9acR80+v9ekNzWvC CXMchnBTv6GKxktVMU2qOtyTiA== X-Received: by 2002:a63:e918:: with SMTP id i24-v6mr27451960pgh.64.1539852778961; Thu, 18 Oct 2018 01:52:58 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id x186-v6sm18467528pfb.125.2018.10.18.01.52.56 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Oct 2018 01:52:58 -0700 (PDT) From: Baolin Wang To: a.zummo@towertech.it, alexandre.belloni@bootlin.com Cc: broonie@kernel.org, linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, baolin.wang@linaro.org Subject: [PATCH 5/5] rtc: sc27xx: Always read normal alarm when registering RTC device Date: Thu, 18 Oct 2018 16:52:30 +0800 Message-Id: X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When registering one RTC device, it will check to see if there is an alarm already set in RTC hardware by reading RTC alarm, at this time we should always read the normal alarm put in always-on region by checking the rtc->registered flag. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 72bb002..b4eb3b3 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -415,10 +415,14 @@ static int sprd_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) u32 val; /* - * If aie_timer is enabled, we should get the normal alarm time. + * Before RTC device is registered, it will check to see if there is an + * alarm already set in RTC hardware, and we always read the normal + * alarm at this time. + * + * Or if aie_timer is enabled, we should get the normal alarm time. * Otherwise we should get auxiliary alarm time. */ - if (rtc->rtc && rtc->rtc->aie_timer.enabled == 0) + if (rtc->rtc && rtc->rtc->registered && rtc->rtc->aie_timer.enabled == 0) return sprd_rtc_read_aux_alarm(dev, alrm); ret = sprd_rtc_get_secs(rtc, SPRD_RTC_ALARM, &secs); -- 1.7.9.5