Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4232427ybb; Tue, 7 Apr 2020 03:29:18 -0700 (PDT) X-Google-Smtp-Source: APiQypI7smveGToRHF1ZbyZ63lGcilizGu0O4FKBfNxi8+DcAOV+YQ2Iu1Ge/+2lOalsZuLSsDuI X-Received: by 2002:aca:4d13:: with SMTP id a19mr1055768oib.105.1586255357982; Tue, 07 Apr 2020 03:29:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586255357; cv=none; d=google.com; s=arc-20160816; b=ejRoc8dvYN/qsHIJAL9NqUA4H0htyY2w3eijJWABglR6MVTd7wgrGgIXcoLPwazuMo 3QysF8D7GlOowwKHIGuiGYT92Kbyo+ZTVS1G5N33ovRc7rT2nOpBbT6pDG0VS7WKbQAJ ELaFb/7KLgVaRMZpLT5PpcZS3qaCs/+wtKOK0WFwNvAIg0C9evnjdcTbwC9RyJh+jXqj PkpW/WjpboAu5a0zf17Fi1qbUN9w4Q4tvH70Gq4JWeW2IWv2v9Fe2K6LkaSJgtJF7jLu ppNdtXMlX4zvtE6gdeMqv6by3HqJA2rNrGI4j7lxpMElsk/QU4Va2Zf4lwhW/Ysl0j4I qx0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JEsxr1zAITBfHZuuJOr0Q/n9Kxc7/5CibcG7CH3fpxE=; b=zITwNSKIchOCje1uOhc9HPBLJxvgPoZLDkJsrQ8HomB53HhWHdHMEe64ljsEExYW3b Q553VAub9VDN5VelxM2blLX+wzIeU/Prgh6O0ePs4SrenHLf6dodUTQugFGsRGDSkBnU NPF7Fwnj71lvIwT2yF7mxEQ1uHKYiKq7ux6sLVGFOj1H4vUrBNd//KCiTPyfRlGS0w8t cjveE5DcM3PoBICzKr1vZBP2r2qpIqhqyUSgz9rSXeGr/d9Zhb+5O9pSPXpncFTU0gT2 RJK6JD5wktA/G27uwN2uK36BorMLsNKsqG+7U7mrj0xtS6cOefweMZX0qFU6CY3co5CY 0HJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=O2JJXIYu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a190si522833oib.146.2020.04.07.03.29.06; Tue, 07 Apr 2020 03:29:17 -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=@kernel.org header.s=default header.b=O2JJXIYu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729013AbgDGKZp (ORCPT + 99 others); Tue, 7 Apr 2020 06:25:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:36424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728629AbgDGKZn (ORCPT ); Tue, 7 Apr 2020 06:25:43 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A034420771; Tue, 7 Apr 2020 10:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586255142; bh=h2kS5Qz/xwausVLpxQPYmK+Zqwh3u5tCcA85lqQVuNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2JJXIYuBIX2iXBZWLCGTr4AqwhCRowYpWlk92UcmB8D/j+0sfyTVHo2EOXXJJSf3 Im91JUms5Y26HyjFJx0WOeMZaLYo0VfaNTUOA934PrpDAA8umuVz1HlWxdaWv33iSY u9YLV59WygwexJP9Ho3p1w8/JJ+4XwekVTqttIZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Chanwoo Choi Subject: [PATCH 5.5 29/46] extcon: axp288: Add wakeup support Date: Tue, 7 Apr 2020 12:22:00 +0200 Message-Id: <20200407101502.607883725@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200407101459.502593074@linuxfoundation.org> References: <20200407101459.502593074@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans de Goede commit 9c94553099efb2ba873cbdddfd416a8a09d0e5f1 upstream. On devices with an AXP288, we need to wakeup from suspend when a charger is plugged in, so that we can do charger-type detection and so that the axp288-charger driver, which listens for our extcon events, can configure the input-current-limit accordingly. Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede Signed-off-by: Chanwoo Choi Signed-off-by: Greg Kroah-Hartman --- drivers/extcon/extcon-axp288.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) --- a/drivers/extcon/extcon-axp288.c +++ b/drivers/extcon/extcon-axp288.c @@ -443,9 +443,40 @@ static int axp288_extcon_probe(struct pl /* Start charger cable type detection */ axp288_extcon_enable(info); + device_init_wakeup(dev, true); + platform_set_drvdata(pdev, info); + + return 0; +} + +static int __maybe_unused axp288_extcon_suspend(struct device *dev) +{ + struct axp288_extcon_info *info = dev_get_drvdata(dev); + + if (device_may_wakeup(dev)) + enable_irq_wake(info->irq[VBUS_RISING_IRQ]); + return 0; } +static int __maybe_unused axp288_extcon_resume(struct device *dev) +{ + struct axp288_extcon_info *info = dev_get_drvdata(dev); + + /* + * Wakeup when a charger is connected to do charger-type + * connection and generate an extcon event which makes the + * axp288 charger driver set the input current limit. + */ + if (device_may_wakeup(dev)) + disable_irq_wake(info->irq[VBUS_RISING_IRQ]); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend, + axp288_extcon_resume); + static const struct platform_device_id axp288_extcon_table[] = { { .name = "axp288_extcon" }, {}, @@ -457,6 +488,7 @@ static struct platform_driver axp288_ext .id_table = axp288_extcon_table, .driver = { .name = "axp288_extcon", + .pm = &axp288_extcon_pm_ops, }, };