Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1117488pxb; Fri, 6 Nov 2020 01:08:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwdOXl7fDXSLtecEuQ8ucFlthrLUCpG4g1YDx8aF1/GZyf5CgGGDhh/M8z/UOutl1GiVcn X-Received: by 2002:a17:906:b18:: with SMTP id u24mr1096696ejg.501.1604653705132; Fri, 06 Nov 2020 01:08:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604653705; cv=none; d=google.com; s=arc-20160816; b=P/tw6dYVHIOUeTfiATMa1LwKO3WrW3yfa4c4+ZfymnPzl2Fat0TuKytaiB7HBL9x7u Ko7w51cOvJRsCBS9qBX+SK6h43k2ps9S34Z48qz/HDTcjJ7oyp5zI296hUwb/dv0rupG UUENfJaJCB0BFOkO4gn5/L7aXIKoi56cGWjTosfi0OxqEw5BSqyYbUE0bXC0wiQ5YAWw +uTMQc9jpkluPbvyrpm4NWyl/JGfRrWoGv0Jcs4pBzIHruSPtyfGpcWGOl4/+5xT0zrF sdZtjT55ZijO/LbXzbevbPtKTbUqNaVFj6uprP8tWtcvKs47Kj72mscMdaL75loeXq0j QMeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Od3Nad82C572xoGc5fNLqqGJLJbV+5bAgd9kD4Em5dE=; b=kx1cFkH4lt3E6/4Rcl41MuXFr72rDGl0aPjzQFLYldKxKB3ZFFDdMw8N0h5SfrvXEB AwaNsx+JX40Ed/F7kAxe+o9Pdyezg+DljsajX7/tVO3cIFlbNNtkICAsOoqQ+CvaTAJF URRPdcOOLxxbXuCknc3hTg60FDUGAcfGl4HjeSBV2jZKDQ6eK2xT52XN9/G1CN1vxRbg CDpgc7aJkWjMN5mLsULFeoJrcSUOOjESj9mQTB5Z7J5vjGu4V5JdcpelYwBrlBnLkskU QEjxp/WxagM3jHrH39Ob03ywROOOJxg8XAoOtSaBfGSAphAlmbOZ6W7PLuKfZAb2P3Fu oDAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u26si542596edb.100.2020.11.06.01.08.02; Fri, 06 Nov 2020 01:08:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726127AbgKFJGl (ORCPT + 99 others); Fri, 6 Nov 2020 04:06:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgKFJGk (ORCPT ); Fri, 6 Nov 2020 04:06:40 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77674C0613CF; Fri, 6 Nov 2020 01:06:40 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 7CFBB1F467A1 From: Guillaume Tucker To: Alessandro Zummo , Alexandre Belloni , Heiko Stuebner Cc: Andrew Morton , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Guillaume Tucker Subject: [PATCH v2] rtc: hym8563: enable wakeup when applicable Date: Fri, 6 Nov 2020 09:06:31 +0000 Message-Id: <1ea023e2ba50a4dab6e39be93d7de3146af71a60.1604653374.git.guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Enable wakeup in the hym8563 driver if the IRQ was successfully requested or if wakeup-source is set in the devicetree. As per the description of device_init_wakeup(), it should be enabled for "devices that everyone expects to be wakeup sources". One would expect this to be the case with a real-time clock. Tested on rk3288-rock2-square, which has an IRQ configured for the RTC. As a result, wakeup was enabled during driver initialisation. Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver") Reported-by: kernelci.org bot Signed-off-by: Guillaume Tucker --- Notes: v2: enable wakeup if irq or wakeup-source drivers/rtc/rtc-hym8563.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index 0fb79c4afb46..24e0095be058 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c @@ -527,8 +527,6 @@ static int hym8563_probe(struct i2c_client *client, hym8563->client = client; i2c_set_clientdata(client, hym8563); - device_set_wakeup_capable(&client->dev, true); - ret = hym8563_init_device(client); if (ret) { dev_err(&client->dev, "could not init device, %d\n", ret); @@ -547,6 +545,11 @@ static int hym8563_probe(struct i2c_client *client, } } + if (client->irq > 0 || + device_property_read_bool(&client->dev, "wakeup-source")) { + device_init_wakeup(&client->dev, true); + } + /* check state of calendar information */ ret = i2c_smbus_read_byte_data(client, HYM8563_SEC); if (ret < 0) -- 2.20.1