From patchwork Thu Mar 14 03:33:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jianbin zhang X-Patchwork-Id: 1911961 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=im4JxuWT; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-rtc+bounces-820-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TwCfv6NMpz1yX0 for ; Thu, 14 Mar 2024 14:34:31 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id ABE531C20DBC for ; Thu, 14 Mar 2024 03:34:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4173D46A0; Thu, 14 Mar 2024 03:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="im4JxuWT" X-Original-To: linux-rtc@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C8A22C9E; Thu, 14 Mar 2024 03:34:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710387266; cv=none; b=AtoEHtAiwmBNwmXAZzPZxWcM5hckZ7NjfmOoTGQ1q6sFcPVOLug9kmmEv7+n7FiexZ7Gr2EI+Ac8SORLFjKgYQT1WagErM3jRO6sjm8593t7WrMeNqAXegMYTrlDdcU8TSDmR/tAbR+7GIQkcy8pFQ37ZZgflcO8pM0VZqlQJMI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710387266; c=relaxed/simple; bh=sMCI+Eki3k6bMGoPCwpX7UtcUSX85eB7VdABW3sdS88=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=oByWZhCHydl7TN0wj864rRRzvcwpoEHfa4OCFPvtdjyz52iNzM53E4WeEULrd3v/FpUTEpdNqRrMVsxmOd0PFN2tUf6HhujcUO/fNI5eMVvVFOWyCOvbXQrKYhCpXEtrmW5V0lit0YYP7PTCOsGa8apqwHd8iICGs/maDB6MLPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=im4JxuWT; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42E3ME3L023173; Thu, 14 Mar 2024 03:34:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= qcppdkim1; bh=V25r6/TDI+6iO9K99zk/ZBZ3Oe1/Km8mgnWrUIzMNsk=; b=im 4JxuWTgopI3LU1c74HSp0PQ16oeXEIPAnBa1+NRc1p2InAGpSFXvhzku6ZQTqDMP 2zJqvtpUDLf+DoJCFz65OGEjVLTi57BT81UrhA6U6R2aK4cv9BTsynwbJNqilbCT X5iwANRcrozc2eIUnlARkJRR8LqwLml7edORHRMFnwcVz+hmvmUxLGmqIKaLRcdM 728RDa+Zaj2N/+oqRo1v6kt+xAMOPBoh8SilhLkoh7w2dMvytmY1L52wAYTTVsNe CRkwAxLw5i5kBTDQW+sX7DNWbpKl8ekLycUnksZCZzTeEkMs/BVUFqKa/cbkNuPs uRn/1f9srWRkkKTHvcfg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wuggr15d6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 03:34:14 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42E3YDLi029515 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 03:34:13 GMT Received: from jianbinz-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 13 Mar 2024 20:34:11 -0700 From: jianbinz To: , CC: jianbinz , , Subject: [PATCH v3 1/2] rtc: rtc-pm8xxx: clear the interrupt in probe Date: Thu, 14 Mar 2024 11:33:44 +0800 Message-ID: <20240314033344.10775-1-quic_jianbinz@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-rtc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: GvA417Q_5vJcp1ApofK7cPTS919vEJVB X-Proofpoint-ORIG-GUID: GvA417Q_5vJcp1ApofK7cPTS919vEJVB X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-13_11,2024-03-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1011 impostorscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=901 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403140021 If the alarm is triggered before the driver gets probed, the alarm interrupt will be missed and it won't be detected, so clear the stale interrupt in probe. Changes in v3: *clear the interrupt in driver probe Changes in v2: *Adapt the V1 patch according to the newest rtc-pm8xxx link to v2: https://lore.kernel.org/linux-rtc/20240124024023df15ef6e@mail.local/ Changes in v1: *During driver probe: read ALARM_EN, read ALARM_DATA, read RTC_RDATA, if (ALARM_DATA < RTC_DATA), Trigger the alarm event and clear the alarm settins Link to v1:https://lore.kernel.org/linux-rtc/20220321090514.4523-1-quic_jianbinz@quicinc.com/ Changes in original: link to original: https://lore.kernel.org/linux-rtc/YTusgJlMUdXOKQaL@piout.net/ Signed-off-by: jianbinz --- drivers/rtc/rtc-pm8xxx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index f6b779c12ca7..1b5a96924e57 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -527,6 +527,10 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) if (rc) return rc; + rc = regmap_update_bits(rtc_dd->regmap, rtc_dd->regs->alarm_ctrl2, PM8xxx_RTC_ALARM_CLEAR, 1); + if (rc) + return rc; + return 0; } From patchwork Thu Mar 14 03:34:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jianbin zhang X-Patchwork-Id: 1911962 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=quicinc.com header.i=@quicinc.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=P4WKLS75; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-rtc+bounces-821-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TwCgx6ZQCz1yWt for ; Thu, 14 Mar 2024 14:35:25 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 814A71C20F84 for ; Thu, 14 Mar 2024 03:35:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47DD64A15; Thu, 14 Mar 2024 03:35:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="P4WKLS75" X-Original-To: linux-rtc@vger.kernel.org Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB9975382; Thu, 14 Mar 2024 03:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710387320; cv=none; b=WG+5DfUY4ZPnaq6pCHPaEKd0GbTqjU333hOdJ8afmxNSSC3OkJ5aN3kr5uqf7CMlWkXaGZgl9MBv6c+lZZaXs+8PwJGBCcvUA4HEpk5YTnbSB8s7OsTSaoC4j5BGUF8z+q9b9BZcNZ/MLWJ8Y8k6NXr/mGrS+RIh7rPIWrka+8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710387320; c=relaxed/simple; bh=NuDzEDNYx6YKKpBICkTZyYKSx1sK/Y/xy3RKoL8Jb6A=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=fro24aE3A6lG27wdh8WLTzyGU65nciIQuBgQ6894mzGkmTGwOxPGvGlAderYsm+SHjCaLRfkew4gLWwDMinqDnKjt4lfOYvUJtpRrtd33+CoUjwL4bEVrZsu23n+2zSA0YyNgFxoyDCYaW4Yl3OJcT0X3f2Y4WvOUUY2D4GTSnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=P4WKLS75; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42E2t1hT019312; Thu, 14 Mar 2024 03:35:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= qcppdkim1; bh=xTD/5k4skNhdlRysNb4xXP9Vxfsw5BHAK7h7rBCm8ww=; b=P4 WKLS75xIp5fckK4ZLrDSdfpVLdI8gSCH5IbJcUWInuLidHAziYd5cQ1jxziWW9QJ 27X9QYathkRdX7mAbFnyjQyXzazeXPf6ia9DAKn7tIKUWbptoCyFdfLYM9xqCHpa god69ZqVCi1uNBxTcK9a363DTfY9o7BxgyrwrSrWeIQbkasktNs0FeeFDb61N+24 /7WlVEfcSbvpy4AbX0QM45rTh5WrazL8M35jptLP5kppK7iqFTNWpBO4OSka3qnN WzdwoFyuRcIvKrU+DGUhLbNLKIfWaWWCBLfmiFsWL+myAdEUCAZLFxwCKiA6d5aQ kfZ6Pm242NkN+GYQKEDw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wuam5j134-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 03:35:07 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42E3Z6ZF030324 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Mar 2024 03:35:06 GMT Received: from jianbinz-gv.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 13 Mar 2024 20:35:04 -0700 From: jianbinz To: , CC: jianbinz , , Subject: [PATCH v3 2/2] rtc: rtc-pm8xxx: Correct the PM8xxx_RTC_ALARM_CLEAR vaule in trigger Date: Thu, 14 Mar 2024 11:34:49 +0800 Message-ID: <20240314033449.10872-1-quic_jianbinz@quicinc.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-rtc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: IIDOZQm7jgEEmchZa-fnSImiZ_j_w69_ X-Proofpoint-ORIG-GUID: IIDOZQm7jgEEmchZa-fnSImiZ_j_w69_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-13_11,2024-03-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxlogscore=861 impostorscore=0 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403140020 Change in v3: *Correct the vaule that writed into the PM8xxx_RTC_ALARM_CLEAR to 1. Change in v2: *Switch to using regmap_update_bits() instead of open coding read-modify-write accesses. Link to v2: https://lore.kernel.org/lkml/20230202155448.6715-4-johan+linaro@kernel.org/ Signed-off-by: jianbinz --- drivers/rtc/rtc-pm8xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index 1b5a96924e57..8a9be78d0b0b 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c @@ -391,7 +391,7 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) /* Clear alarm status */ rc = regmap_update_bits(rtc_dd->regmap, regs->alarm_ctrl2, - PM8xxx_RTC_ALARM_CLEAR, 0); + PM8xxx_RTC_ALARM_CLEAR, 1); if (rc) return IRQ_NONE;