From patchwork Sat May 27 06:51:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 100593 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp578234qge; Fri, 26 May 2017 23:52:05 -0700 (PDT) X-Received: by 10.84.174.3 with SMTP id q3mr3873969plb.52.1495867925408; Fri, 26 May 2017 23:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495867925; cv=none; d=google.com; s=arc-20160816; b=SPhut85Xa9SMo5M66nF80tmEsxNmJWJ/3BnJq79WIOqfEwKT8n5o/mwsy8LNby8gx1 +gMqLYCfWWZ8+6hxJpr0UrXiTFZ/9sktZS7AbSqyCVM/rfZ+L7O+uS9f4KmBWpuUvsKR Tr5s8VV+e1gLOg4MauT41IPPr3/0+d6myXpkClLu8SL650umeXehgF0+bC/UsLj3m+XD 494RkqhbGzChttYnY9hR7podM8/wHuzXs+eup2hL3uKsN17tkD9fkkuGa6Zu+rMLed+Y As/noe69RbDVwxxuDDmgZuooeML3faaCp90OLln5MY4jXY6vOwN+cOnCLBuVToABtKAv rHMg== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RC4V2GBmbMalGqaPEHnhbIXqiDXgpAouYNegWwbwxxY=; b=n7a8ZrkMOYaejdC6M36i+y6Qf3WethJxQcwksb60Q4lzCBpR36nw9u8DBy3NcQIB8X Q68YqcsrBxMTqIVRozeV0D/YmP1ciY/DrCcZH5jYZ0o4viMQ3FVueLWcIPVs4R0BjAL6 RdoGP9mybUMdw0jgfagpe3gdkkKlC3fWTJhOlhT2hN0yDvcUm6cgd2Zepum+bY8aLJO8 4qo+e+F67tedw+kQ1T7NnaKR2sjhGKk7IrV6MDgi9oJfSk+/SZCZO6rVBhRhL79BAZ35 udev5fGfXI2/+K315x4Up/3XlSi1XigG87u29ZFlkIk9Up/V77HKAZqAf9BmvuHDifnx 54Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 g29si3416894pfg.174.2017.05.26.23.52.05; Fri, 26 May 2017 23:52:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750740AbdE0Gvy (ORCPT + 10 others); Sat, 27 May 2017 02:51:54 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33810 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752799AbdE0Gvg (ORCPT ); Sat, 27 May 2017 02:51:36 -0400 Received: by mail-pf0-f181.google.com with SMTP id 9so26483206pfj.1 for ; Fri, 26 May 2017 23:51:36 -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; bh=ocIGKjY2sQNS2298EisF+sghIOtfRT49AJY7yJ+KiSE=; b=Z6+bAUKvYWQr3CsvjPAw87/ook7tNaKFgaN+AnyOOwgg7WMgRXAA0TGWTztQKhaSS2 CNdFRVa9j4zkJnk+uxqKe1nLiXyetmRqT+T8hT+My39zN8Q53PZ1kLbdS+Fay3Gf9Aaw R9zXOofdPAvld5gWhjbA2f8km4kGDNrI3q4Tg= 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; bh=ocIGKjY2sQNS2298EisF+sghIOtfRT49AJY7yJ+KiSE=; b=iFCIWjTdhTu6t6UNbuMD2w+HTCtlFwjQEncP7keReBK3zc/KYrPBmsSkcl/UfdCK9m U6XwKyjU30MqDUjD73setW0picKm5r5DlZyy2ByoAfeLMoh/SFYdBf0q02QRZIUrEXjo S9na2Ra+4O6OAII3evZaz6YzbLwWUmQWx0bPAYWJVzzoY4nIyWY7LxE40+Oy4MKWr7LS n440So1R7OSDCYUVz/gTDpJTN+SIUtHOGUddHX+EDNh5DDdsViliC3rGxNqqPCvK7Ykx QYROSqDbvFtSbGWkiKOE4IzRXz5MSIj13oV1nUspzxUExaGBXOoBh8ehKRbnZwO5BmcB ouGA== X-Gm-Message-State: AODbwcBIRWZmCXgLWKT57kavf7pwp0QlQdKbup3EgcmFNU5olTgHRiB6 BKGcFInlld5czKm+ X-Received: by 10.99.43.137 with SMTP id r131mr6905955pgr.109.1495867896046; Fri, 26 May 2017 23:51:36 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id u9sm4894608pgn.55.2017.05.26.23.51.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 May 2017 23:51:35 -0700 (PDT) From: Bjorn Andersson To: Dmitry Torokhov Cc: Rob Herring , John Stultz , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Sebastian Reichel , linux-pm@vger.kernel.org Subject: [PATCH 2/2] Input: pm8941-pwrkey: Introduce reboot mode support Date: Fri, 26 May 2017 23:51:30 -0700 Message-Id: <20170527065130.3456-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170527065130.3456-1-bjorn.andersson@linaro.org> References: <20170527065130.3456-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In some Qualcomm platforms the magic for informing LK which mode to reboot into is stored in the PON_SOFT_RB_SPARE register. Register with the reboot mode helpers to expose this to the user. Signed-off-by: Bjorn Andersson --- drivers/input/misc/Kconfig | 1 + drivers/input/misc/pm8941-pwrkey.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 3872488c3fd7..56552e16fab1 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -132,6 +132,7 @@ config INPUT_PCSPKR config INPUT_PM8941_PWRKEY tristate "Qualcomm PM8941 power key support" depends on MFD_SPMI_PMIC + select REBOOT_MODE help Say Y here if you want support for the power key usually found on boards using a Qualcomm PM8941 compatible PMIC. diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c index 18ad956454f1..c48be6dbaa78 100644 --- a/drivers/input/misc/pm8941-pwrkey.c +++ b/drivers/input/misc/pm8941-pwrkey.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #define PON_REV2 0x01 @@ -42,6 +43,7 @@ #define PON_DBC_CTL 0x71 #define PON_DBC_DELAY_MASK 0x7 +#define PON_SOFT_RB_SPARE 0x8f struct pm8941_pwrkey { struct device *dev; @@ -52,8 +54,26 @@ struct pm8941_pwrkey { unsigned int revision; struct notifier_block reboot_notifier; + + struct reboot_mode_driver reboot_mode; }; +static int pm8941_reboot_mode_write(struct reboot_mode_driver *reboot, + unsigned int magic) +{ + struct pm8941_pwrkey *pwrkey = container_of(reboot, struct pm8941_pwrkey, + reboot_mode); + int ret; + + ret = regmap_update_bits(pwrkey->regmap, + pwrkey->baseaddr + PON_SOFT_RB_SPARE, + 0xfc, magic << 2); + if (ret < 0) + dev_err(pwrkey->dev, "update reboot mode bits failed\n"); + + return ret; +} + static int pm8941_reboot_notify(struct notifier_block *nb, unsigned long code, void *unused) { @@ -256,6 +276,14 @@ static int pm8941_pwrkey_probe(struct platform_device *pdev) return error; } + pwrkey->reboot_mode.dev = &pdev->dev; + pwrkey->reboot_mode.write = pm8941_reboot_mode_write; + error = devm_reboot_mode_register(&pdev->dev, &pwrkey->reboot_mode); + if (error) { + dev_err(&pdev->dev, "can't register reboot mode\n"); + return error; + } + platform_set_drvdata(pdev, pwrkey); device_init_wakeup(&pdev->dev, 1);