From patchwork Sun Jul 4 07:40:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 470048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C067C07E9B for ; Sun, 4 Jul 2021 07:41:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6EF06193E for ; Sun, 4 Jul 2021 07:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229569AbhGDHns (ORCPT ); Sun, 4 Jul 2021 03:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbhGDHnr (ORCPT ); Sun, 4 Jul 2021 03:43:47 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92A53C061765 for ; Sun, 4 Jul 2021 00:41:12 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id e20so15002415pgg.0 for ; Sun, 04 Jul 2021 00:41:12 -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=BVkVvoLhlvv3KppO1b0TRg6fddRYWUrnF61FALx2Tlg=; b=L104DLL8FcAW/cRK4M1tuNWAZxySEdyg7SYSbJBWAGDXZfpbvHFajRY/8sKBUgXWKm FCMOVrvRf1PmvmNIwaPoQBV6tTwpyqhMQklB5lCJPall/PgB+ctWH87wNjuyIz46yh1c UelpuJJMgvmUCjHHpErgWIKL1p+s3f/ykwUyvolIZCsY8vAI2y+jWPT6LUenekoGd89a e7AduzCvwA1mnFLMMA5YuSut8G/Ji8KrIvTCH08ybVPikuA4kiQV89/AsbX/in0YRnup iXte75oOPu+9uJ8NAqCaecHxRMU8Zmn7FWOGOaYuZYtJJsQ6qq2gudbsvOtxItC/n1r8 sAHw== 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=BVkVvoLhlvv3KppO1b0TRg6fddRYWUrnF61FALx2Tlg=; b=dU8Yyd4iOBIgXOK3Vi3BieOXlI7Yk5voU7VBzFzo5pl1dWB+0Io0c4Tr0WeBD93bR3 HAjUnkY/dstqwjmk+tvncsSja911iIdmkPjyD/suPPgJYjGN9hx1YmvKOQKX/oHHX30v c1dhiTrp2ZnE+NiczZWwBTntvk6MUWuzTN0LoSgRiV/x6/fvMc11BU1DFReWLEe+/0a3 tXTmyZk8Ev1u/YtgNYga6T7BhoBtBueeuuWq7cWrrItn8RE2ycMcHZyQGhKgJFUrz1Ic wi2dXsLP0cs6vMk9QhG3O+p/D3oT52qfz5m9WWXWH6swFIHWHf35b/RW1nKKZMyRVN6z pqtA== X-Gm-Message-State: AOAM532hMaCXhXOjTyqXBp1BooCe6HDLdpAUfx7F1VXjmNR/pb8/5FnK kMRhhypTFmHXhASgfss1afRztw== X-Google-Smtp-Source: ABdhPJxMsKdlrrke3nZmg678vp0ECRSg02fRH0TGnsIwhRe9oCS96zdfgouNd+A453lg26+DSpieqA== X-Received: by 2002:aa7:86c4:0:b029:316:98ff:30c with SMTP id h4-20020aa786c40000b029031698ff030cmr8605594pfo.66.1625384472105; Sun, 04 Jul 2021 00:41:12 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id gz24sm7052956pjb.0.2021.07.04.00.41.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 00:41:11 -0700 (PDT) From: Shawn Guo To: Sebastian Reichel Cc: Rob Herring , Vinod Koul , Bjorn Andersson , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo Subject: [PATCH 1/3] dt-bindings: power: reset: Convert qcom, pon to DT schema Date: Sun, 4 Jul 2021 15:40:43 +0800 Message-Id: <20210704074045.21643-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704074045.21643-1-shawn.guo@linaro.org> References: <20210704074045.21643-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org It converts qcom,pon DT bindings from legacy bare text to YAML format. Signed-off-by: Shawn Guo --- .../bindings/power/reset/qcom,pon.txt | 49 ------------------- .../bindings/power/reset/qcom,pon.yaml | 49 +++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.txt create mode 100644 Documentation/devicetree/bindings/power/reset/qcom,pon.yaml diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt b/Documentation/devicetree/bindings/power/reset/qcom,pon.txt deleted file mode 100644 index 0c0dc3a1e693..000000000000 --- a/Documentation/devicetree/bindings/power/reset/qcom,pon.txt +++ /dev/null @@ -1,49 +0,0 @@ -Qualcomm PON Device - -The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey -and resin along with the Android reboot-mode. - -This DT node has pwrkey and resin as sub nodes. - -Required Properties: --compatible: Must be one of: - "qcom,pm8916-pon" - "qcom,pms405-pon" - "qcom,pm8998-pon" - --reg: Specifies the physical address of the pon register - -Optional subnode: --pwrkey: Specifies the subnode pwrkey and should follow the - qcom,pm8941-pwrkey.txt description. --resin: Specifies the subnode resin and should follow the - qcom,pm8xxx-pwrkey.txt description. - -The rest of the properties should follow the generic reboot-mode description -found in reboot-mode.txt - -Example: - - pon@800 { - compatible = "qcom,pm8916-pon"; - - reg = <0x800>; - mode-bootloader = <0x2>; - mode-recovery = <0x1>; - - pwrkey { - compatible = "qcom,pm8941-pwrkey"; - interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>; - debounce = <15625>; - bias-pull-up; - linux,code = ; - }; - - resin { - compatible = "qcom,pm8941-resin"; - interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>; - debounce = <15625>; - bias-pull-up; - linux,code = ; - }; - }; diff --git a/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml new file mode 100644 index 000000000000..7764c804af1d --- /dev/null +++ b/Documentation/devicetree/bindings/power/reset/qcom,pon.yaml @@ -0,0 +1,49 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/reset/qcom,pon.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm PON Device + +maintainers: + - Vinod Koul + +description: | + The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey + and resin along with the Android reboot-mode. + +properties: + compatible: + enum: + - qcom,pm8916-pon + - qcom,pms405-pon + - qcom,pm8998-pon + + reg: + maxItems: 1 + +patternProperties: + "^mode-.+": + $ref: /schemas/types.yaml#/definitions/uint32 + description: Vendor-specific mode value written to the mode register + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + pmic { + #address-cells = <1>; + #size-cells = <0>; + + pon@800 { + compatible = "qcom,pm8916-pon"; + reg = <0x800>; + mode-bootloader = <0x2>; + mode-recovery = <0x1>; + }; + }; From patchwork Sun Jul 4 07:40:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 470036 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2941528jao; Sun, 4 Jul 2021 00:41:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Cml+7L/Ajz3fcQhYBTXy2gwy+P2+TJ+CltdHIH4/n9MvFoTHAfZGJ1NPbiLAdpCV0ma3 X-Received: by 2002:a02:cdc7:: with SMTP id m7mr6814337jap.127.1625384478658; Sun, 04 Jul 2021 00:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625384478; cv=none; d=google.com; s=arc-20160816; b=p9NCaKrUCz2ayrPXysEVI66qALodnF259JMpY+NFax5Swx55ZHdfRxVK6pe3AQZ9oI dV3k0821elH7d0hDRojQo7FwCbrBrzjijkdwKudnItkUhBRF5Jg+yiLHW968K8L3wK4g 3+ZBbhlA+9W2nwm45qmWddtg5B9GwP8R/fs4TULfyLFTfIgXiPWcpS4pzsGA01ik7LO1 DQuS7AKLMd0atff+H7/KliJ7ri3r6jdlrXSHgJjaiTW7wfOdc86CjQ6wHwQA315BrNYz wWwGyp+IGacm+xekslluu6f9q2dTEYNwqltnChSUymUxEtO38inq/Pq/72HPRgYxObw7 fWAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=HDIrJvvsYWuc6ETGsLx0yysZhuZFRshLStXAyTVxX4g=; b=Y9T8WWAVWXCr0dhr4435xpLLhw15Wa/ymc7CLdXWwronxuFJ4V9tpk8PLUrPj7inch XYoDGBlQBll+atzb4WbpzSXGeceFhwdzWAfJCUPQBTsYxtEMh1jyEOCbULupNc37o/z6 EgxHbMS3zGMkDn554lPUjGht50y+0ekwF0afwFatDICYI87sHd29xzwJvl4eKjFCU/lu 9QfLh6rprsj17nZDSDVMTZR4SuMcljlKxxkqzgQYI7djw+9oBeibXzgcQPw0UGjEW9Zj nRZtgN0i3yQ+rofeBjRqexrCx6jqeGUUupxyHXmHm4WprtrBpoGV+KvbeG4eAKg1etRV GkTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="G9buf/mi"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 a1si9488287ioe.96.2021.07.04.00.41.18; Sun, 04 Jul 2021 00:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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="G9buf/mi"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S229636AbhGDHnw (ORCPT + 17 others); Sun, 4 Jul 2021 03:43:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229570AbhGDHnw (ORCPT ); Sun, 4 Jul 2021 03:43:52 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A507C061764 for ; Sun, 4 Jul 2021 00:41:17 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id b14-20020a17090a7aceb029017261c7d206so6401409pjl.5 for ; Sun, 04 Jul 2021 00:41:17 -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=HDIrJvvsYWuc6ETGsLx0yysZhuZFRshLStXAyTVxX4g=; b=G9buf/mi2kfYFqNAooOgyOcPIo1rXsZbVNvtetH9l8NOmQEN5UgVNjEQLaufuxZBct C6NoODOdpBytyS5VVR7o7isLsfrIQ0cHw6I+H057eDB/oVKE7g6xMp2ivmAHOrtmmK3x o+wkarBQqhC9//45GRpSVZpUEIwO3UxUfnCN/fEtXH3W+v3fMecfCrkBjzaNBFHy26O8 01pQ2MqU4ibhIhQkRzllM8uSZJpjShNXUonMqxVhi7/K+Rnv/wdLO5SmRi/nnWThqmiZ v2yp/rwEtZEa8FL6uzM1bn2yviBSJn36D+YVh9T5lVSq2ckIH9N28JEyHIORogWctRgJ zx+w== 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=HDIrJvvsYWuc6ETGsLx0yysZhuZFRshLStXAyTVxX4g=; b=NGbL5b1ksyh1XnoZhK1wR+HgdvX3Ig4/IH/+3NjqDfT/p9RM/fV14158u9N8gGq+7V RCRZAU3ryTQq63dE8W9J+ey+Kt9c90QyjXVNbsAQSxWvdKP5r7WSMemyP9AiyttVoOip UboWlXWhTvsaLuL236Te9Usi7qO9ok7p3XgjB4pUOoeYWyx5vzOy33rrpH69h7f/+LsS T9x98m5Na6oG57wBAwI8ek3JRKtytDrd1yRJtNUbHX4dpnrKiVgg+Js7gy5sDzy3sldG vA35bXVqIdpLT4jVNWIh9ArlK5WlzIsgOkrD0gwuI8Edsf8bt+U71Aa7+5u8s0BRMWkK pmNg== X-Gm-Message-State: AOAM532ETho0xHTRVyu8YJXX03Xa2GXie8wNh+42WQsVQ23WNsryIWoI ZPytr8fJeNDxyuTrAT1xh9iIqA== X-Received: by 2002:a17:902:d217:b029:105:e265:65c7 with SMTP id t23-20020a170902d217b0290105e26565c7mr7290765ply.16.1625384477169; Sun, 04 Jul 2021 00:41:17 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id gz24sm7052956pjb.0.2021.07.04.00.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 00:41:16 -0700 (PDT) From: Shawn Guo To: Sebastian Reichel Cc: Rob Herring , Vinod Koul , Bjorn Andersson , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, Shawn Guo Subject: [PATCH 3/3] power: reset: qcom-pon: Add support for 'qcom, mode-in-imem' Date: Sun, 4 Jul 2021 15:40:45 +0800 Message-Id: <20210704074045.21643-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704074045.21643-1-shawn.guo@linaro.org> References: <20210704074045.21643-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add support for DT property 'qcom,mode-in-imem', which is used on devices like Sony Xperia M4 Aqua phone (MSM8939) to store a different set of mode values IMEM rather than PON register. Signed-off-by: Shawn Guo --- drivers/power/reset/qcom-pon.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index 4a688741a88a..f63d49c72f55 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -42,6 +42,24 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, return ret; } +static int pm8916_reboot_mode_write_imem(struct reboot_mode_driver *reboot, + unsigned int magic) +{ + struct pm8916_pon *pon = container_of(reboot, struct pm8916_pon, + reboot_mode); + void __iomem *imem; + + imem = devm_ioremap(pon->dev, pon->baseaddr, 4); + if (!imem) { + dev_err(pon->dev, "failed to map imem\n"); + return -ENOMEM; + } + + writel(magic, imem); + + return 0; +} + static int pm8916_pon_probe(struct platform_device *pdev) { struct pm8916_pon *pon; @@ -66,7 +84,12 @@ static int pm8916_pon_probe(struct platform_device *pdev) pon->reboot_mode.dev = &pdev->dev; pon->reason_shift = (long)of_device_get_match_data(&pdev->dev); - pon->reboot_mode.write = pm8916_reboot_mode_write; + + if (device_property_present(&pdev->dev, "qcom,mode-in-imem")) + pon->reboot_mode.write = pm8916_reboot_mode_write_imem; + else + pon->reboot_mode.write = pm8916_reboot_mode_write; + error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); if (error) { dev_err(&pdev->dev, "can't register reboot mode\n");