Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp95678lqa; Fri, 26 Apr 2024 15:59:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUzYQtMn3vbxHOeqymRzLfLzvoG7Zizs3zERdJNA9DNwXeJL5o815krWSDx7Pdq+CN5l/U0ofqc41214OwLjeiwYJaS1ZoRn5OQ3D2ScA== X-Google-Smtp-Source: AGHT+IHFkzp488Cx2fAFNfdVVUVvOyNg6JdEP3oTxF9ScWYvdBMT/mOMXdfsleE9FCgbcdHL4GCE X-Received: by 2002:a05:6402:3487:b0:572:689f:6380 with SMTP id v7-20020a056402348700b00572689f6380mr852145edc.3.1714172339904; Fri, 26 Apr 2024 15:58:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714172339; cv=pass; d=google.com; s=arc-20160816; b=JsjXU/yx1zEGTftQ4NGYu2G2o5qm76yKHVxkgKnF2y12sNL2F4wlAL2cvEMy7TUMTy J36AUrN52zLxnIe8XBQiTcG9xMuPJ3hxe/+z4qL0Q5HdIg2yQ4CfrAMaAPpxMpJ7m2K8 jybkAw+dqAV6f+wdBImjRut7x9VCx/o7NqdZVlN93bNylGkYovcyNyl/mdrQN6ngIjpE tzbzH5YwN84r0iSpx3oujvHmSLh5h1bbrl5xEI4NAEOctD7QDA44nQxGImMZYoBJKPEm RQBt09yPgR5VbrvzsVX+n0j9cSiZmK6sa5mrUl6vH2lDiD4xGgWnx6UgkuyeCeSg49cj P9HQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=e5EJs5OFkMMXkOQseHxFbsNg9C5+grICpRc78loD/PQ=; fh=v+fQpqqloRxheg66y6v5BEIIh4tqlWdyRuynNr5XQWo=; b=lyxst0h9otxl5AUWFgjaDzMUkdDwEEc2lBucYOAXavk1IkS4Isv3lKpoqag47+xRXt jEdZrgz2IPNH6X2KnG2zKyjDSpDRML2GTh+fa+/wqd1Hh5sRnEs76f8W3bBwYHk9rftq QRp7gXHKvtQjR4q3vsfWes68QCGYZEYTQHOiBQic3SgIp4TC13LssCIXRuOMNBxjMbax yQQAA439VJa+JScvFbrFGJjNb9IoKlM/A6mx8gUbZg7g9uNJSiFMim/IfRmA2GL4TmWB DuqwJn8hZjR/PZriyqpgydJt2V9DMojOripKO0sx2Jze4VVrOdGRTPtpAVjBF916mEKX qu3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cpHqITMH; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-160759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id by5-20020a0564021b0500b0056c5395c966si11576231edb.216.2024.04.26.15.58.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 15:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=cpHqITMH; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-160759-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id A000F1F224CD for ; Fri, 26 Apr 2024 22:58:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C0A53A29F; Fri, 26 Apr 2024 22:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="cpHqITMH" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 A25503987D; Fri, 26 Apr 2024 22:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714172317; cv=none; b=WDiQ9CYJa8sXymTBnehNCy8nphF/rTZ+wXmjcBYW2054dfvMINdGEL5geShoEaBZNetjwu8xq52jsR8Kc0K1NbolJ1LDeU65ENqNOMr76OyhW+8/TRAUb2lfAGf99HX9ndY2AwmpLM9ueZrK05RVCeSfxI9nZjNG7+HJKFoDEGw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714172317; c=relaxed/simple; bh=R0PXi5BpxTvbIeMG6WGSdqMAjrlasJh2Yznaym73TCw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=jEWxLQSo4Vvo/NH1qnql+H8NYbekpYvgjtVD5vxlPFY4ZFGRuUIxJym4IdPY/gaOGzxPGG/UWT5jM1jMeB2SQyoVKOlMlZ6eNX2/8MCcE+0TD+HdbqbcetMXNjp7G1MwWopFqv+oyX+xUEwYgAa/LIzCneONCSqEUPW9DCbeC1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=cpHqITMH; arc=none smtp.client-ip=217.70.183.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 59D14240002; Fri, 26 Apr 2024 22:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1714172307; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=e5EJs5OFkMMXkOQseHxFbsNg9C5+grICpRc78loD/PQ=; b=cpHqITMHeOEzVRUDjQbpOXDU6jwoQKHRfmG+uy9dodK8w3hWC6V3XKZoYoDUtr07y5E/53 Ap9ddkRAofy3uzH2yApsS2SW7Wga5ueYu8SA2JrkBhI0bps/SNk3toDo/F9eRTAUVuYyfS 1cAjl/guJk864hVWMJNY7HBWXjlTgZ3LXYSldND/tasOJEBCescevt2SSLTuzYcVCTNola OGa+9oGe+sVGxKpBZG91a8br97veKyw0BErv6nsiP79LR4bRRwHQ2YaGaxpcJTDiACGuBl qViJnWNxUvGOyJLEK15fGLR1sU5wBLkKo1RnBE06S0dgzVR5RLoYM9kjtF8TAQ== From: alexandre.belloni@bootlin.com To: Alexandre Belloni Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] pcf8563: add wakeup-source support Date: Sat, 27 Apr 2024 00:58:21 +0200 Message-ID: <20240426225821.448963-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: alexandre.belloni@bootlin.com From: Alexandre Belloni In some platforms, the RTC is able to wake up the system but is not directly connected to an IRQ. Add wakeup-source property support to be able to express this in the Device Tree. Signed-off-by: Alexandre Belloni --- drivers/rtc/rtc-pcf8563.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index ea82b89d8929..1949d7473310 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c @@ -527,7 +527,6 @@ static int pcf8563_probe(struct i2c_client *client) i2c_set_clientdata(client, pcf8563); pcf8563->client = client; - device_set_wakeup_capable(&client->dev, 1); /* Set timer to lowest frequency to save power (ref Haoyu datasheet) */ buf = PCF8563_TMRC_1_60; @@ -553,6 +552,7 @@ static int pcf8563_probe(struct i2c_client *client) /* the pcf8563 alarm only supports a minute accuracy */ set_bit(RTC_FEATURE_ALARM_RES_MINUTE, pcf8563->rtc->features); clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, pcf8563->rtc->features); + clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features); pcf8563->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; pcf8563->rtc->range_max = RTC_TIMESTAMP_END_2099; pcf8563->rtc->set_start_time = true; @@ -573,7 +573,12 @@ static int pcf8563_probe(struct i2c_client *client) return err; } } else { - clear_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features); + client->irq = 0; + } + + if (client->irq > 0 || device_property_read_bool(&client->dev, "wakeup-source")) { + device_init_wakeup(&client->dev, true); + set_bit(RTC_FEATURE_ALARM, pcf8563->rtc->features); } err = devm_rtc_register_device(pcf8563->rtc); -- 2.44.0