From patchwork Thu Oct 18 08:52:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 149102 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1699053lji; Thu, 18 Oct 2018 01:52:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV604pUmI/py9A06GBE6/X7OkZpV8tneLb3VFNPRi+ihJzRozBlv9zQuUmAovtElD4zT/c7fM X-Received: by 2002:a65:5103:: with SMTP id f3-v6mr27664014pgq.54.1539852768794; Thu, 18 Oct 2018 01:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852768; cv=none; d=google.com; s=arc-20160816; b=h34eZKlVf9HALmiWNXzK81e8uRrlGZzG1olH6OP3ExFeJFHGwf8dCJnTPHLUHuDtX1 ZDgHSxSFa5LyiPIhSvm2Uiij7iawXGHkDC/FJ6eMx8t4QCRdLx5LK1v4bDsNiFHMIvNe eTmmU4v3ymAo0FfWFW4HfqT1Rsf58kHBHNar+M85zUAdzIRbYYtD/JA2PgUvXtITXS6h e//ETsCuRVM7Ej4CZOUQUjj7Z/qKM/lmmzZHAUtQKmI798i6Afe+UgbHzx5VE7TR+duN CmsI+sxDzgZ1qlCSc7lNpQxXLp8UZe29MSUBbVjXvtZ/l93gJk0hrVIkwANQA9be1CR2 hKaQ== 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=9kZYDpmsySRWfvSPa6Kfurc5wRQJDTAyv7Jhjoe/kD4=; b=vZOtpIdKLPW+AI60eNqN6BrVWBfphI3Q/58fwRwaHLnaDONXu8mP3s93agvY7iT/IQ OZaLEtvB+yNFga07rkr8/lek3h2UITUsk5e07ZmA58fwReec108sDaEgMcbI+EfbJvPV H7x6X9p4ruXOEyUb1+HO/DG5nW1h+LNOJ75xiBVUhMjduZlJn8LeRWjL75Vjb6oCqO3W AnOP+6p6rAPrACdKCoA+UHkRyR/WCEwsMz9kJyiudgoz/cPRkfkvHQG3vxe71eFSWUBb OBeJi/lwm3U6My65x+rZhHb2QMkpwbLQIz+HVSJusB4RYbo3CPi1fPr50b/i3DMMu6d4 D8Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ia/bx3bj"; 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 d12-v6si21840964pga.81.2018.10.18.01.52.48; Thu, 18 Oct 2018 01:52:48 -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="ia/bx3bj"; 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 S1727853AbeJRQwp (ORCPT + 32 others); Thu, 18 Oct 2018 12:52:45 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:43916 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeJRQwp (ORCPT ); Thu, 18 Oct 2018 12:52:45 -0400 Received: by mail-pl1-f194.google.com with SMTP id 30-v6so14000703plb.10 for ; Thu, 18 Oct 2018 01:52:46 -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=9kZYDpmsySRWfvSPa6Kfurc5wRQJDTAyv7Jhjoe/kD4=; b=ia/bx3bj2+ZiSg36oHYXpcIdN64t31sLLMkBnf4K7Zu5H8yJ8nnU4M2KJ0jHpLTogS ZeQqaH8smRzI0al7GLQ8xXfZbCH+5dLlNWlEBEBqCh1mTxqNbJPyAx6FjlQpmUbG22nu 91w6g+AUsUL8oQG0Qb2UNWq1y1S/RBzTHKCOU= 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=9kZYDpmsySRWfvSPa6Kfurc5wRQJDTAyv7Jhjoe/kD4=; b=Mg/BPreuLyHshTEf+PhyzDLhV9p/xj6kKLip1/ohsx3x026LEVeK3GpzFTIKbi/vyn xXTEtAoWT/1Qmqbxfr2pHptM+35LMhNAYSTD1VWGKiNyXVEKI23/7f2GBjpEJl2WKTzA 6VRp4xOA2dRpqhmnMGYRAXo6hVRuBLycIn4Fq9Ew5dXfkqzRWZKHTU/Pd565QQpVcu/n VXgVlkNeI9pj9KOll+aQQesRrJxDkfvGsnXCGbEl/6Zt+i6FzLkwaykj3Bt7Jcm3JGYW WAuM0A18SfCy+8F1ivutkbQaP1ps9Uk3tRrhYrHjSCP6YrXwFyfyvuVscrbdfuDo3l6p dLYQ== X-Gm-Message-State: ABuFfoi2HGaPi8BmYPXQyC4171PDhKUKiGBg7k/jC9zNwti0NLnjKiQ6 xWNdZ/P13vx4MoKCEAr8UhgLaA== X-Received: by 2002:a17:902:4583:: with SMTP id n3-v6mr29427180pld.255.1539852766364; Thu, 18 Oct 2018 01:52:46 -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.43 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Oct 2018 01:52:45 -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 1/5] rtc: sc27xx: Set wakeup capability before registering rtc device Date: Thu, 18 Oct 2018 16:52:26 +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 Set wakeup capability before registering rtc device, in case the alarmtimer can find one available rtc device. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index deea5c3..8afba12 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -631,16 +631,18 @@ static int sprd_rtc_probe(struct platform_device *pdev) return ret; } + device_init_wakeup(&pdev->dev, 1); + rtc->rtc->ops = &sprd_rtc_ops; rtc->rtc->range_min = 0; rtc->rtc->range_max = 5662310399LL; ret = rtc_register_device(rtc->rtc); if (ret) { dev_err(&pdev->dev, "failed to register rtc device\n"); + device_init_wakeup(&pdev->dev, 0); return ret; } - device_init_wakeup(&pdev->dev, 1); return 0; } From patchwork Thu Oct 18 08:52:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 149103 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1699099lji; Thu, 18 Oct 2018 01:52:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Nn3cbD2ubk8mQIX5HyJ3usfhoLxHGCv/DLWyopHRzFTdc+ySAvhBsFIzvO18GZ0j1Ky92 X-Received: by 2002:a62:8708:: with SMTP id i8-v6mr29763739pfe.150.1539852772660; Thu, 18 Oct 2018 01:52:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852772; cv=none; d=google.com; s=arc-20160816; b=KVCtakaO1ZztvqbTbg+kyYOrXEMsUxI7v5CXPzCVzSSweFE+QYZLzGb4u/Oe+FIsW3 NqmbCduDNMj1En83Wv3JztQ4R/p92bVeMGw329j+Xvoub0u2XTgDt3ko9Vkmx8F1Y8VX +IE6b8Rj/ukBvgWDPG+o/2KFK87uI2V4bL7PWOblNgvzWaIKsIbXhmzzukWHrB6XQoBO OLXDGBBKmWJlUBG9rOrDZhmu1SR/eD/mZeXL/Vp7fgCWyzr4C5aScCswxPqF4czqFT1v /Ma8e4/EJ0LKfoo9BA3GaxrrvAUGt+v1xhNkwcZpVQmjZUTCcocFUTxLSlbvL0vfrhnS yYKQ== 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=7f3p8DaD+OJHNqlVoz6G4mjpM3q6Pg5QN2ip5mfsPB0=; b=MP0F27zeVt0PVHu9PHTomoeYmFHMPlcrnEjiCrq/tBarx6BrzRA+wbQNDzWBCok696 +70X7yzo4CMKxINdQq2bFA12bKPVLjz0RjNkSD9odoVhODjjwbObtWeOHs6PIelopev+ uO+aQb7iYOWdeB3BxFOnBqTl9H3kErdD7LPyFEhO29rLdhCtU20/I3uoIUwEV0nOfnIK nzUY54h2I801ydYAWJzncQZcdcR1e33kAfX9IIbisGlIuAyg8C/xIerirNkcJZxLQBvx qdP5589vQkBe4vigAEtlv1RE85g+M49aQaG7Ie3m6Hd1GepLTENywQu2BHNIcI+u7aHC tOfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F0npjnwn; 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 h17-v6si18410168pfi.84.2018.10.18.01.52.52; Thu, 18 Oct 2018 01:52:52 -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=F0npjnwn; 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 S1727946AbeJRQws (ORCPT + 32 others); Thu, 18 Oct 2018 12:52:48 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36078 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeJRQwr (ORCPT ); Thu, 18 Oct 2018 12:52:47 -0400 Received: by mail-pl1-f194.google.com with SMTP id y11-v6so14015877plt.3 for ; Thu, 18 Oct 2018 01:52:49 -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=7f3p8DaD+OJHNqlVoz6G4mjpM3q6Pg5QN2ip5mfsPB0=; b=F0npjnwn8iNGfJ7j+3osZduTcfk1BvnsV0b5S1jvevzglGfqx11GYx2jkrUFjOFfBk aC5Tz0xe7fxBPWueVQa+pgp9OkIOiG4o9pVk1VFXjmpulESXea/fV6+AouxON2Jq6uRd 7pRn+6LdZE0J3wFoUxbAH+Uqd/oPozsF+NYTM= 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=7f3p8DaD+OJHNqlVoz6G4mjpM3q6Pg5QN2ip5mfsPB0=; b=FtU8RjL+3maqGxe1o/J9fF0RC8PPU0Ijv+q/BJIn9LLqlzzseOoRgw/sc4/m8Vm43g a8Z77pSfcc/CMe4VPYgtt4DcqrIVA/fm7FzZ2XqGmfvQfNhU+wabWff+YmQRY4zuBnBp idw+w3MT71jXTEsjcwqDknDZ/+CInw++UJw0Y4v9GIbfkFcv8JUDTSY/jC1PRBMzAtw8 ecO7/Wu/QxgXseHpwYqeKZ3qXcdXlqPi8py++E+OcWbIu2Y8G16O65Ra2b0iLiDwsnbD +5FDzbJjNm2Pa85H1hylVlF1pIysd5nkYiNDbWnStyHbbnWrFdrRGo3v5uiMowrjF0B5 G1LA== X-Gm-Message-State: ABuFfojYsbr9EJ9DxU9rke84g3i6KXhS7nMVD3TuGIgAw640jqhyqa6H Vf0dtx0ElLO8h2GYCTnyimxCfvdHIrmFMw== X-Received: by 2002:a17:902:74c9:: with SMTP id f9-v6mr662553plt.99.1539852769501; Thu, 18 Oct 2018 01:52:49 -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.46 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Oct 2018 01:52:48 -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 2/5] rtc: sc27xx: Clear SPG value update interrupt status Date: Thu, 18 Oct 2018 16:52:27 +0800 Message-Id: <43a12635d57b134fc55d664af8f715b31bbc5f3b.1539851865.git.baolin.wang@linaro.org> 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 We should clear the SPG value update interrupt status once the SPG value is updated successfully, in case incorrect status validation for next time. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 1.7.9.5 diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 8afba12..6ac5653 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -172,7 +172,8 @@ static int sprd_rtc_lock_alarm(struct sprd_rtc *rtc, bool lock) return ret; } - return 0; + return regmap_write(rtc->regmap, rtc->base + SPRD_RTC_INT_CLR, + SPRD_RTC_SPG_UPD_EN); } static int sprd_rtc_get_secs(struct sprd_rtc *rtc, enum sprd_rtc_reg_types type, From patchwork Thu Oct 18 08:52:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 149104 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1699133lji; Thu, 18 Oct 2018 01:52:56 -0700 (PDT) X-Google-Smtp-Source: ACcGV61FzvPZjYu+SeQMW92iISck3AUxuztoNZW2qdu+6O0h9n28K+8VSxKJEoQaJiZieyFzsWYT X-Received: by 2002:a17:902:104:: with SMTP id 4-v6mr29485122plb.189.1539852776106; Thu, 18 Oct 2018 01:52:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852776; cv=none; d=google.com; s=arc-20160816; b=fMiugL3ZKLciPumKAcDSHn0A/Q12sUauzbIgHppUrQgqoLQFxuh3QxAnA+FZO/sFTK sOO/ZL2w09xZxVeZZpgvf5+QUX7/Ayb89x/qQFOM13aPTSWVnLMJbS+ly6JD0jUmBas4 VG1Oize9NftOZCQHhiORaVZm2YQGuU5zj55ccSOsz3AIufJDOTHDvMiQmtxSgnTKjx19 QnHoqBAGU4D3CIoF2I2xIpupFlpXviqJR+vMidrZA7MBYyvyVU9Ve54nfLj2g46xVQAS 0HYpgHL3XARY3tMyzo+VaJsZ4TkIm4hTeb8/BeHruGoKH2VbG10QSH/OQIBmdWYPIho3 GKJw== 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=wuTLNNFPtvGEn50eKaEyNEzBPZsJcfU/sfOOV2dCAmc=; b=Ml+we3ye6DwC3HKUE8/4q5yBhD6wfkn0Qx5IvwkaBwAeoRYqiO3N8mBSezpDpPsDUb oWuhfYgdPhDU1f+7ke9nxCYhDz23WC9XJdATZ+acYbOkW/RUupJkW/WTJqtM9ISFJYJJ 7cAICwqvK60rsxxTwS4ZzzoMG2bQqCu8mW8FPHHtT4Mu+B/fu+Hghdfy7kqTNodYrUoM LxONpG4UgiUQE8pLRLVX4iL1sEk5nIhSDGvV9UNHepNfq72kfTXW6Rsrk7aImkvDVZO9 Z/jdRuDpAVa6NfrRra9j24cRAtNJR2zx4SAD1CBhV3RHrEc0jKWFSmZD6XceG7eN3C81 EOEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IBd11yo1; 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 l1-v6si20313458pld.375.2018.10.18.01.52.55; Thu, 18 Oct 2018 01:52:56 -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=IBd11yo1; 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 S1727974AbeJRQww (ORCPT + 32 others); Thu, 18 Oct 2018 12:52:52 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33376 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727813AbeJRQwv (ORCPT ); Thu, 18 Oct 2018 12:52:51 -0400 Received: by mail-pf1-f195.google.com with SMTP id 78-v6so12194454pfq.0 for ; Thu, 18 Oct 2018 01:52:53 -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=wuTLNNFPtvGEn50eKaEyNEzBPZsJcfU/sfOOV2dCAmc=; b=IBd11yo1pLxVL9pACURpAokeSMvwGB54pTZFTBDD8U5OhJPNp3MNjH0YCSLKPohgeh yrDeKbJ/OYUvodz7eVGrF6ejRZf1J4ke0j10tG1jg9CufQfMuHkz9oxysyphJpDPDf5q u4WAzthRr82U7sXz01PHWT3BVFCRPns9eZl7I= 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=wuTLNNFPtvGEn50eKaEyNEzBPZsJcfU/sfOOV2dCAmc=; b=KUD8pS8WvIAGGwormG5ebMNS5B/CvI0sa/vjT78HnrhTx1CzmOgyWoq7F7ionZsJ9y KUJfsfNhyavFyAJintdwY33Yiua6ILjg6Sc1tJcBqRuknMsbrOUuVRO55IjHVW+LMH1Y MtxZhPa0Y+z+whbxCABXae0xOX20hfMX97yLSd2ej/05nGKpOd/5DBdTO3P1FJyGOSu9 Vu2ad0k9A/zcr59ESIilcBnyN4PoIs3RYumu2ufAIh2VY6lkR/daqNhagqN79tHlz2Ix 81CTzSZeqI8T/3/C/84yXSJNuG2YbxfV8JHmblI9F0kKwe0EQc9ZlvXyW6/frDn6ZfEA reEA== X-Gm-Message-State: ABuFfojNsN35cZNtIK5ho8rvPU/YIEfYYJyHp4kjqJf+T5ldcn8U3IYj FFBuz4jZDhTtneI+48UNPPR1uQ== X-Received: by 2002:a63:5021:: with SMTP id e33-v6mr27572885pgb.306.1539852772874; Thu, 18 Oct 2018 01:52:52 -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.49 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Oct 2018 01:52:51 -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 3/5] rtc: sc27xx: Remove interrupts disable and clear in probe() Date: Thu, 18 Oct 2018 16:52:28 +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 issuing __rtc_read_alarm(). So we should not disable the RTC interrupts and clear the interrupts status in probe() function. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 20 -------------------- 1 file changed, 20 deletions(-) -- 1.7.9.5 diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 6ac5653..4ecabe6 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -129,19 +129,6 @@ static int sprd_rtc_clear_alarm_ints(struct sprd_rtc *rtc) SPRD_RTC_ALM_INT_MASK); } -static int sprd_rtc_disable_ints(struct sprd_rtc *rtc) -{ - int ret; - - ret = regmap_update_bits(rtc->regmap, rtc->base + SPRD_RTC_INT_EN, - SPRD_RTC_INT_MASK, 0); - if (ret) - return ret; - - return regmap_write(rtc->regmap, rtc->base + SPRD_RTC_INT_CLR, - SPRD_RTC_INT_MASK); -} - static int sprd_rtc_lock_alarm(struct sprd_rtc *rtc, bool lock) { int ret; @@ -609,13 +596,6 @@ static int sprd_rtc_probe(struct platform_device *pdev) rtc->dev = &pdev->dev; platform_set_drvdata(pdev, rtc); - /* clear all RTC interrupts and disable all RTC interrupts */ - ret = sprd_rtc_disable_ints(rtc); - if (ret) { - dev_err(&pdev->dev, "failed to disable RTC interrupts\n"); - return ret; - } - /* check if RTC time values are valid */ ret = sprd_rtc_check_power_down(rtc); if (ret) { From patchwork Thu Oct 18 08:52:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 149105 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1699163lji; Thu, 18 Oct 2018 01:52:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV62PfJumgNLqsLL3m3gwPiCWRYI6aGs1X4lb5cpoXOiOmhTPjr9ZUxx5bS5WmpMoaXl7I/a0 X-Received: by 2002:a17:902:1e2:: with SMTP id b89-v6mr29727364plb.296.1539852779387; Thu, 18 Oct 2018 01:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852779; cv=none; d=google.com; s=arc-20160816; b=C4q10Z3NKTBz5NYvfQ9sqbz2Khmn5dvHqcThLVKq20G3mbNjgSHYERQaSu9p20tRfY Fn2kgOhih8EbVrf7XSb/Y90zfoLY4QRfAKD/4AmRT9ZviGyMcZVvZ36ZRDqQ7ydRpKdf AHS5lHAXmYv6WE2ZtnBMP4nAzJtqnmc2NaMZDBi5a8BBiuRL0pLYfyRfN3F4sYNSr4Sl GO6NPft1v+teISuOixHZQ+n4N97q9JY19oRlEKyek3M/uOtgfrPA0LhpzEhlzSr5hoK6 xl+Rp6VuENt4QwSXfQlGRIcwZ+E1/g7xgZ22n+WBSFoWKTvSHq7GLYSy08Ft71UIh/Nm mlLw== 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=x1nRgoQUZ83pegJhrhtQ6KjoIL98LywhZ2h6g+wmhPg=; b=QYYxEZus6eCAw4i+lEUkHY9IhmPETGJJQ8hy799L3I8pZ2za0VqRrJKEMRC+QOqCuS KOj6n5W69FIItn3h6FVLxdp4aaIs9SnbG5kAXp00vk/fSehEMVLPltajs0VBGf6psjjV dkGNeyX/9+5UAWDvH7v8Rdj7gFV/U/NixGmcvIn4wb4xPxDKuDGHUcitQSSI+tv3SwF1 E3d2HQDihDr4h7NfuQLz2JHft/bnEe901aTuWAouVg5lfR2+nt4nUWFgkXJtmsNQOILI Z0J5yH1snZdw7mtQyEItf5Rv4NLNtMJwEkc3sJg8RPYN59pimY9Yg1ySIIY2GrUKIB8M LC4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XqOW8k7j; 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 s64-v6si20960609pfi.134.2018.10.18.01.52.59; Thu, 18 Oct 2018 01:52:59 -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=XqOW8k7j; 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 S1727986AbeJRQwz (ORCPT + 32 others); Thu, 18 Oct 2018 12:52:55 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:40701 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727489AbeJRQwy (ORCPT ); Thu, 18 Oct 2018 12:52:54 -0400 Received: by mail-pl1-f196.google.com with SMTP id 1-v6so14014008plv.7 for ; Thu, 18 Oct 2018 01:52:56 -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=x1nRgoQUZ83pegJhrhtQ6KjoIL98LywhZ2h6g+wmhPg=; b=XqOW8k7jjTgAWLYpZfRfud/yIu2mDZv3OPT7bqPN/Pm289Hvi37fhtx6uKf/M576oE Hp8wdCDZJQRo0LC7Zp7EXzQ1ddEJ5+qLB5D0/riHdTy4fpeTFwkqRsdxAleHmBPHBNmR OzMUIlKj+UZJ/yUYLMUuvr6dMTYAIRgKmxg00= 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=x1nRgoQUZ83pegJhrhtQ6KjoIL98LywhZ2h6g+wmhPg=; b=JmzXhgZjYjadRIm9mM/qu9WcfOfO4mFHtTUwvIGGTrUT9Y3mctd5kceNtkOEGJXj9v QFvv/Ny4RK3lCM6ydOQAnAlnHdNsqWOi/E7mDdO+ipn/k5Gh3mULqT8jHeVFf/6lAM0R SXOHCsuPfHDLLL00mH1fbWIeKi/9M9k755OEiXk8V/PCa/todyyG6i5mZs5zjUEaecv8 D0kOLTuHg5tql7GAP/hyz2SubMzTatD0R3G7N1RvZ45sp86puKXN+pkSADB++1youCCO 3Go0kdVmL7DvyMsTX3qqoTXemvFnqH6jpg6Mx7vi/Iacu+/u5J7L7rRZOiAUCN4Rpkq3 sIfQ== X-Gm-Message-State: ABuFfojBIZ3P1tTIZBKZegenuuN+zLmSWZ3O6b1XuLc1ODSo9Vkfykeo wOgb44jgKl46xaWAXwEJuR2pLw== X-Received: by 2002:a17:902:7e0b:: with SMTP id b11-v6mr28875383plm.246.1539852775833; Thu, 18 Oct 2018 01:52:55 -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.53 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Oct 2018 01:52:54 -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 4/5] rtc: sc27xx: Add check to see if need to enable the alarm interrupt Date: Thu, 18 Oct 2018 16:52:29 +0800 Message-Id: <4b0d13b57a64b6ba6ba65c4c2b60319633911427.1539851865.git.baolin.wang@linaro.org> 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 The RTC interrupt enable register is not put in always-power-on region supplied by VDDRTC, so we should check if we need enable the alarm interrupt when system booting. Signed-off-by: Baolin Wang --- drivers/rtc/rtc-sc27xx.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) -- 1.7.9.5 diff --git a/drivers/rtc/rtc-sc27xx.c b/drivers/rtc/rtc-sc27xx.c index 4ecabe6..72bb002 100644 --- a/drivers/rtc/rtc-sc27xx.c +++ b/drivers/rtc/rtc-sc27xx.c @@ -563,6 +563,32 @@ static int sprd_rtc_check_power_down(struct sprd_rtc *rtc) return 0; } +static int sprd_rtc_check_alarm_int(struct sprd_rtc *rtc) +{ + u32 val; + int ret; + + ret = regmap_read(rtc->regmap, rtc->base + SPRD_RTC_SPG_VALUE, &val); + if (ret) + return ret; + + /* + * The SPRD_RTC_INT_EN register is not put in always-power-on region + * supplied by VDDRTC, so we should check if we need enable the alarm + * interrupt when system booting. + * + * If we have set SPRD_RTC_POWEROFF_ALM_FLAG which is saved in + * always-power-on region, that means we have set one alarm last time, + * so we should enable the alarm interrupt to help RTC core to see if + * there is an alarm already set in RTC hardware. + */ + if (!(val & SPRD_RTC_POWEROFF_ALM_FLAG)) + return 0; + + return regmap_update_bits(rtc->regmap, rtc->base + SPRD_RTC_INT_EN, + SPRD_RTC_ALARM_EN, SPRD_RTC_ALARM_EN); +} + static int sprd_rtc_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -596,6 +622,13 @@ static int sprd_rtc_probe(struct platform_device *pdev) rtc->dev = &pdev->dev; platform_set_drvdata(pdev, rtc); + /* check if we need set the alarm interrupt */ + ret = sprd_rtc_check_alarm_int(rtc); + if (ret) { + dev_err(&pdev->dev, "failed to check RTC alarm interrupt\n"); + return ret; + } + /* check if RTC time values are valid */ ret = sprd_rtc_check_power_down(rtc); if (ret) { From patchwork Thu Oct 18 08:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 149106 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1699204lji; Thu, 18 Oct 2018 01:53:02 -0700 (PDT) X-Google-Smtp-Source: ACcGV617UCOyGALt6rYPttrwKXrYHEsPkc3VYpHZMBIH4mw4rSSahR7cl+JNepoTbHVootGPihMU X-Received: by 2002:a63:c251:: with SMTP id l17-v6mr328117pgg.146.1539852782274; Thu, 18 Oct 2018 01:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539852782; cv=none; d=google.com; s=arc-20160816; b=yxe+1Jgh/WTQOLjgX+qN4G/iU+pXvA0DWthpgcE5MDvKyLgBbbVbM/5heHUQ/jIYX7 QXX4CCphzTeSIyvksc/OzAGaTZQPzRSNZ7me7OMYuV4nZquDYI3xQTyES4GqaJBX+nzs fCi552ogmeITyp3F8VbUTTpTtvK2HKRNTNmgfJqaZeByHI18pXCxZbFfHVBAcNtT0Td3 KoZEGkq+bKiKBVsKafchJvIW3OaAJH9wQM6fZgQU7p0L97XTO3qZO3dbSUHS/Qs2FJFf 8PdZJNXEZFPMuSOP5FxojRv9LrF55HZL9QggX08+hv9aY+xD1G9yJvwXhJYjpVq+QlPa mr8g== 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 t10-v6si21639830pfk.252.2018.10.18.01.53.01; Thu, 18 Oct 2018 01:53:02 -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 S1728001AbeJRQw6 (ORCPT + 32 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(-) -- 1.7.9.5 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);