From patchwork Tue Jun 29 03:05:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 468293 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4545209jao; Mon, 28 Jun 2021 20:05:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNBfmvgj+9S/Wagh98xPlokwVm4+vgASii57sUu0sZ942eNaeJbIEM0JYCIP2+2fKiAsKq X-Received: by 2002:a5d:9c43:: with SMTP id 3mr2041406iof.123.1624935919899; Mon, 28 Jun 2021 20:05:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624935919; cv=none; d=google.com; s=arc-20160816; b=u9A6abKOWwPo/voGWJuuOTj1ToVcXOMwmEp7jf6PFMGhQWF2Ybz8X/vvfp3mGRarlS V7D9VQFNp+y9aHZnwvkjno/DZpmN4cjSjnaoRaMDE5lERjQyRUf7hv45rhgFIwQAJ9DE +RoN+G04s/jcMm5m16vNwW3C2iMEKxAb1hx3blQEjRzdFSJDoKNBinKGWyAx8F/PIbuq bxU4fXjj7Z/E6SxBFp+UUIhoT4sXV25fozPVDEhM6hHTjr+rk3pWMTxQB1JYLZH3yalL 36Bg0c4722gwj19kS5tpxa4ZaFlEHH1zanDXxhlWa74Sk43yK1YVD2G5GcT3eRAJjDU/ h6oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=l1bjuoaTVbYtnhNI71QZX5Bx6fnm6uPZuv4M80rHUjI=; b=TN86GjL0eYczpdVxe0HTMKlD35gSycva5546uvbGdxbMl//9XrXc4WkaST64nYKoef BY3uRZGudjjjnr9k6CmQEjmisdfvDdIecrO+vTL9vHJ4axNGuMeAZ+8uKbZWU7bkPRui mcWieflEe5bAFOY4xjjEArjkTy4ZrOHH+EHGNBEWgztMrRgtWaclYMKYNExpbLzu/T5i /flRJDfDhpxQK/GnWlXEVkV8aB9NZP4aDHO90C8gyZIBGp0XOeWCBwh05Z40bOje4/Dx /XI/PwK3kFwf1+9QCMR6TX8WI/oTjc3qSlpz/SDbT55GjDIs37lGAWdbcuuyt0hqF/S4 eH2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EFPrS5/I"; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l12si17011495ilv.105.2021.06.28.20.05.19; Mon, 28 Jun 2021 20:05:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="EFPrS5/I"; spf=pass (google.com: domain of linux-input-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-input-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231332AbhF2DHn (ORCPT + 1 other); Mon, 28 Jun 2021 23:07:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231219AbhF2DHm (ORCPT ); Mon, 28 Jun 2021 23:07:42 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 096FDC061574 for ; Mon, 28 Jun 2021 20:05:16 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id l11so11493896pji.5 for ; Mon, 28 Jun 2021 20:05:16 -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; bh=l1bjuoaTVbYtnhNI71QZX5Bx6fnm6uPZuv4M80rHUjI=; b=EFPrS5/IJmf67dyAm4KZznFpmXEsnAa2yEGDVtpNxOLdO65IWgWwfwgGT+RNfTijOV pT9AHojI9B4wdqFrbbuDK9Iyq1NtRAkonZuR3EgTCLL9+XLZvvSPTJExSdHhPpX3rfgR jISwbhxauiV+PhGAeb3h1AThAj6H/JbNvO++U0QOfpkm6nXW0dTLu2uKXd1yVImMa164 G1PitWSzoNldBkGugs/r+oiQrgbveIvdCtzfFtR1deZpP147mtbS0RxJnUIBk/pw7jfE M+6wVVfBjuhE8xit8VPLe7uy72BYfMR+bNpy/SDf9islfRADLhXMBwHoDrjVaxeKg2ZV bkbQ== 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; bh=l1bjuoaTVbYtnhNI71QZX5Bx6fnm6uPZuv4M80rHUjI=; b=H8EVZJehhV4YX12VV8qIp0ChyQOE016zt9ZCr6FXHcyoVMRc9eEoq9lulKE8e3K5C/ KNTxbhEXU1Tm2NlurReIqeUCTNrWIUEz5xZ6QeQ/tHYT2WdAC+JcI7SjiON50/vAhHQU HbsbQr7zSOYDa061D4Y1EgTmziMVqXUBILzThYD97shC8kif3qk325BvuwEtW+vaRw82 oZmVFkR0O786rXh+IpJwRgdHmSu2ZdTib9XozcMOJATThuRnqCpRFP5fe/zZpEiQGE64 imMQZNFD9CReXTNFVTYzKr14rkfuUz3InQmrAzA4PB69ZnJu6DlBIzaE+Jvk03PLds/d 41Tw== X-Gm-Message-State: AOAM531IzrYfTFbt1rloRDZUBPrNG2dk01Ot1VXgYSMHZJSmiSigHtbr AXiyt0gpZFG4nhLK/Wd50RF38w== X-Received: by 2002:a17:90a:17ad:: with SMTP id q42mr41885724pja.181.1624935915630; Mon, 28 Jun 2021 20:05:15 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id i20sm15617163pfo.130.2021.06.28.20.05.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 20:05:15 -0700 (PDT) From: Shawn Guo To: Dmitry Torokhov Cc: Bjorn Andersson , linux-arm-msm@vger.kernel.org, linux-input@vger.kernel.org, Shawn Guo Subject: [PATCH] Input: pm8941-pwrkey - respect reboot_mode for warm reset Date: Tue, 29 Jun 2021 11:05:09 +0800 Message-Id: <20210629030509.2893-1-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org On some devices, e.g. Sony Xperia M4 Aqua, warm reset is used to reboot device into bootloader and recovery mode. Instead of always doing hard reset, add a check on reboot_mode for possible warm reset. Signed-off-by: Shawn Guo --- drivers/input/misc/pm8941-pwrkey.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/input/misc/pm8941-pwrkey.c b/drivers/input/misc/pm8941-pwrkey.c index cf8104454e74..9b14d6eb1918 100644 --- a/drivers/input/misc/pm8941-pwrkey.c +++ b/drivers/input/misc/pm8941-pwrkey.c @@ -27,6 +27,7 @@ #define PON_PS_HOLD_RST_CTL2 0x5b #define PON_PS_HOLD_ENABLE BIT(7) #define PON_PS_HOLD_TYPE_MASK 0x0f +#define PON_PS_HOLD_TYPE_WARM_RESET 1 #define PON_PS_HOLD_TYPE_SHUTDOWN 4 #define PON_PS_HOLD_TYPE_HARD_RESET 7 @@ -93,7 +94,10 @@ static int pm8941_reboot_notify(struct notifier_block *nb, break; case SYS_RESTART: default: - reset_type = PON_PS_HOLD_TYPE_HARD_RESET; + if (reboot_mode == REBOOT_WARM) + reset_type = PON_PS_HOLD_TYPE_WARM_RESET; + else + reset_type = PON_PS_HOLD_TYPE_HARD_RESET; break; }