From patchwork Fri Sep 1 12:00:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 719671 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B47ECA0FE1 for ; Fri, 1 Sep 2023 12:01:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233205AbjIAMBF (ORCPT ); Fri, 1 Sep 2023 08:01:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236323AbjIAMBF (ORCPT ); Fri, 1 Sep 2023 08:01:05 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8E4BE7B for ; Fri, 1 Sep 2023 05:01:01 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-99bcf2de59cso229973066b.0 for ; Fri, 01 Sep 2023 05:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693569660; x=1694174460; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Vs/PRb2b7V6rR58f88F1xUyXEBig3vOWtcP0jsGuDGI=; b=oMRBCeSDBsXI89x168ye82aAfo7KOm/WJVB1zF0W5myedlyoSR7uSw9sUknO7srDGX Vdxg1FANQn5JJ7227oYZ1P90uMCfAvP0Qgzxs2sohpmPf4Z0QUOBZGmAEu/Ch3m07nM5 mCuudL8sQmqX12Nl0gnyNtiplrh3BK3i1kkJoXaZGwelRyOWefJ1S4wkXozEyZHYJNdH 0/NYg2yoRIyJJfkwC2cayr33h5teTn5mf6FsBi43AbGsSC1Bz5XjIiCc1EOJlU+GGQvK QGw0iX45rquFCYAJuEEMIZmWcqk17iJACRBVTDnvtApaz9WZsC5A5NHzabTiZvL0rI0D jwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693569660; x=1694174460; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Vs/PRb2b7V6rR58f88F1xUyXEBig3vOWtcP0jsGuDGI=; b=aSyDV+5icrPXlqUahamYThxl5E/A7+T+QH+WFLaI3yyx8wsKcwf/q+yZbPh23ZOMBI ZuCiz++nJ7WG9DjH0TG1LtRgTIFC540nn0MeYE5KQZAhoFHp1yrC0KmpfQYiicESrImv mWI4MnmbLSpxE/ipvwn3vpZ79+srSGsktnJq8GYGMlTJK26zOeR9ieEhifpcIfkSka8F TEF3wpue5B91fQi4qVm9eUHW90JdvD8bemSXPOIyxeFIPkdqukCO+Xrry5dwvGl3qjvg s4hkbwHO49Y+NS7cNTlWAZjzhFYPlfiU6HpyXkBRUrhPxI/4zRumw7q++05/ftd4wPG/ fs5Q== X-Gm-Message-State: AOJu0YzXWFy8djSRHkTHgBMuH/DqCrPMoxfQtE92vE+3hoo4Yp0yEak4 TdvPQQ5bHMn2sDCA61DyX1kECw== X-Google-Smtp-Source: AGHT+IG3WoF6WkfiDpXFLy4paG6AbtYn6jxN1oPMmMoQbVt+83Mf/3i7rbvu6QvyebF/Iz2uTyzQwQ== X-Received: by 2002:a17:906:30d9:b0:9a1:f96c:4baf with SMTP id b25-20020a17090630d900b009a1f96c4bafmr1285349ejb.5.1693569660354; Fri, 01 Sep 2023 05:01:00 -0700 (PDT) Received: from krzk-bin.. (77-252-46-238.static.ip.netia.com.pl. [77.252.46.238]) by smtp.gmail.com with ESMTPSA id kg12-20020a17090776ec00b00993928e4d1bsm1877343ejc.24.2023.09.01.05.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 05:00:59 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 1/3] dt-bindings: power: syscon-poweroff: get regmap from parent node Date: Fri, 1 Sep 2023 14:00:55 +0200 Message-Id: <20230901120057.47018-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Just like syscon-reboot device, the syscon-poweroff is supposed to be a child of syscon node, thus we can take the same approach as syscon-poweroff: deprecate the 'regmap' field in favor of taking it from the parent's node. Signed-off-by: Krzysztof Kozlowski --- See also syscon-regmap: https://lore.kernel.org/all/20200526135102.21236-1-Sergey.Semin@baikalelectronics.ru/ --- .../bindings/power/reset/syscon-poweroff.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml index 3412fe7e1e80..3c58f8251882 100644 --- a/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml +++ b/Documentation/devicetree/bindings/power/reset/syscon-poweroff.yaml @@ -15,6 +15,9 @@ description: |+ defined by the register map pointed by syscon reference plus the offset with the value and mask defined in the poweroff node. Default will be little endian mode, 32 bit access only. + The SYSCON registers map is normally retrieved from the parental dt-node. So + the SYSCON poweroff node should be represented as a sub-node of a "syscon", + "simple-mfd" node. properties: compatible: @@ -30,7 +33,10 @@ properties: regmap: $ref: /schemas/types.yaml#/definitions/phandle - description: Phandle to the register map node. + deprecated: true + description: + Phandle to the register map node. This property is deprecated in favor of + the syscon-poweroff node been a child of a system controller node. value: $ref: /schemas/types.yaml#/definitions/uint32 @@ -38,7 +44,6 @@ properties: required: - compatible - - regmap - offset additionalProperties: false @@ -56,7 +61,6 @@ examples: - | poweroff { compatible = "syscon-poweroff"; - regmap = <®mapnode>; offset = <0x0>; mask = <0x7a>; }; From patchwork Fri Sep 1 12:00:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 719844 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7E59CA0FE9 for ; Fri, 1 Sep 2023 12:01:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349322AbjIAMBJ (ORCPT ); Fri, 1 Sep 2023 08:01:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240499AbjIAMBI (ORCPT ); Fri, 1 Sep 2023 08:01:08 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107C710E5 for ; Fri, 1 Sep 2023 05:01:03 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-52c61344429so632049a12.2 for ; Fri, 01 Sep 2023 05:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693569661; x=1694174461; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3Q8dcqWIi8qfe4rFjMBwnA3MXBS8IlDgEZlXPHxdDbc=; b=f8Cn8PhEmbugxXX8cp1rtapLm/lwjUWOyM87Jft36Svsf+RM3R1a8pYFAziRaNv9nO FtKbTm2RDVtBwUSc28HRCgn+DMOntkl2uJnIFb/FPDhgfqGgrwfFz8kgivSxuSr9cQRF VrQEY4skRoTTtcstIHaAo6ynysdYbCljdgou9VR5CJbvgKEgnkuyhG4qhH3Y3JH6UR2y 4eGI2tOytw8bfwMQoKxfswDn+C8u49g7in/PakdtoNXsfbSMpGI/QStuXDrsGJeByL99 APCQDZ9s7zvhWrYUqLwJX337AXRaBTmwdvjDufLYMdj+yRdkwIB5UmlM/X8+ZnJhpPwS KTBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693569661; x=1694174461; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3Q8dcqWIi8qfe4rFjMBwnA3MXBS8IlDgEZlXPHxdDbc=; b=KLWgNy6/OkBASKIkqYeG0CFQfcr0yMwN2tMwiJ3UdLR7HIST7junfi+xGPVk8nKeup 7jrxPacv5cZ9GgUI0foHArrBgPYqY79cmsZahO9ZmqYShLe7hGCjnLPM528wAQA5VLME xPnFbBP4Q2//ug+e9YaeDh6ctGw6Ji3GDk5giP31b68s1JQtVfAKOaU42Ko+g2dgj3EP awDyN6+3QRXXhIqgaKyW7FkX5JmSD/bodBU//W5PFes6RTbn8dWRImkxDvHTwxEKC4tY zmq1UBjFgXlN50hBy35qT1gF9PNDjYmexoSgyLZjODMw4LnKudmj+qJ1/a5WDP2aFVp+ BgSg== X-Gm-Message-State: AOJu0YzVjLL6l2z/JWd2R+C6/MVNItwOpfEVycPVDbyVi6RZfwLjMp/V uvxl+1NkGIaooz9hHW898pJ1lQ== X-Google-Smtp-Source: AGHT+IFO69PhfApiWoJ10ALX5LCVOgGWPETEhTDqrXyG9F36Yfc1fiNItFAnBKhYo0wBJNtMIHfaag== X-Received: by 2002:a17:907:7608:b0:99c:c50f:7fb4 with SMTP id jx8-20020a170907760800b0099cc50f7fb4mr1581342ejc.1.1693569661575; Fri, 01 Sep 2023 05:01:01 -0700 (PDT) Received: from krzk-bin.. (77-252-46-238.static.ip.netia.com.pl. [77.252.46.238]) by smtp.gmail.com with ESMTPSA id kg12-20020a17090776ec00b00993928e4d1bsm1877343ejc.24.2023.09.01.05.01.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 05:01:01 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 2/3] power: reset: syscon-poweroff: simplify pdev->dev usage Date: Fri, 1 Sep 2023 14:00:56 +0200 Message-Id: <20230901120057.47018-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901120057.47018-1-krzysztof.kozlowski@linaro.org> References: <20230901120057.47018-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Make the probe() code a bit simpler and shorter by storing all the '&pdev->dev' as 'dev'. Signed-off-by: Krzysztof Kozlowski --- drivers/power/reset/syscon-poweroff.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index 430d440d55c6..11b955983279 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -32,23 +32,24 @@ static void syscon_poweroff(void) static int syscon_poweroff_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; int mask_err, value_err; - map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "regmap"); + map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap"); if (IS_ERR(map)) { - dev_err(&pdev->dev, "unable to get syscon"); + dev_err(dev, "unable to get syscon"); return PTR_ERR(map); } - if (of_property_read_u32(pdev->dev.of_node, "offset", &offset)) { - dev_err(&pdev->dev, "unable to read 'offset'"); + if (of_property_read_u32(dev->of_node, "offset", &offset)) { + dev_err(dev, "unable to read 'offset'"); return -EINVAL; } - value_err = of_property_read_u32(pdev->dev.of_node, "value", &value); - mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &mask); + value_err = of_property_read_u32(dev->of_node, "value", &value); + mask_err = of_property_read_u32(dev->of_node, "mask", &mask); if (value_err && mask_err) { - dev_err(&pdev->dev, "unable to read 'value' and 'mask'"); + dev_err(dev, "unable to read 'value' and 'mask'"); return -EINVAL; } @@ -62,7 +63,7 @@ static int syscon_poweroff_probe(struct platform_device *pdev) } if (pm_power_off) { - dev_err(&pdev->dev, "pm_power_off already claimed for %ps", + dev_err(dev, "pm_power_off already claimed for %ps", pm_power_off); return -EBUSY; } From patchwork Fri Sep 1 12:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 719670 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D7C3CA0FE8 for ; Fri, 1 Sep 2023 12:01:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349324AbjIAMBM (ORCPT ); Fri, 1 Sep 2023 08:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347333AbjIAMBJ (ORCPT ); Fri, 1 Sep 2023 08:01:09 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43038B5 for ; Fri, 1 Sep 2023 05:01:04 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-52a4737a08fso2346693a12.3 for ; Fri, 01 Sep 2023 05:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693569663; x=1694174463; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oS/0ElWUbV8BeVd+6AgHAloG3yh8d3D/aZCsvM27g5c=; b=dYtJR3J8jVBGQWSRkwxQC1Mjk4V89T+SFg0OVPktOEX173pBH1RMBoA7Y5YY+6oXIB 2DGKImoqatGQ1QeAy0hnb33T9YbQdsAJZ2UHsVOnaPWFqSdd6hJM+5F2Oy/AHQzocv6m W7zDoXC1XLctatW4Nxq0lEOfmHAR3Qs0NxAcC82jX88rn/LknrXLaVrJ5yr9gapMqJAQ UU2No4Aw9s0+nOLulNGyKcU5pgVyGehB7H8aQroL0jgEZAV8rFK/CaumQF5fSjoPxSJw DZWuI0YHl+5xZL1gLcOabkNABzxkkcHZxCSl/Q5odhRNhqdY4jkR6U0Ii84fpyviP2LT KW/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693569663; x=1694174463; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oS/0ElWUbV8BeVd+6AgHAloG3yh8d3D/aZCsvM27g5c=; b=giUO4fM9JWZsA+MfSjekkYDYeZcpu1QZ9z5DYD8Vfvd0vABNt3SLdBGmQC4orHkz9z I7QbTJbcCIhYcr5sPB2mEwL+HbsJNw4749oR4JJuQc1S9wZ0mv5eDFBu4M3rZqtiJvCH gY+S2YbJfCayZbxE8eaOdGYQyuSzdae6Re0O+zO+WNnpFPwDxzZHqCBURJ1wZ+F2aAj8 2bSYLrbvD82VugYez0758jatIj2BLjp2CvKT9nsLVW3JQLI0+uWAwFvfJpsi6VTsl9xN xUwlTsNIhvSu15yDq0VFTikbuvGHHyayUIlYeZlabqftZUG3Lt1ZbvVCZin100NsnWG8 1g3Q== X-Gm-Message-State: AOJu0Yz242Z5dHZk2uJgHjdB57iU40btZylQxgGoHnWleTULLsbf9XFL p9k9E/dgclOH16luL831VC+5/Q== X-Google-Smtp-Source: AGHT+IEV6aXOvW/K5E49cBpDsHJ6RPd3sDkgSq3TDoEjuLdw9Iaukbt/a2aU3OL05Q/sA3k8mg4Ynw== X-Received: by 2002:a17:906:189:b0:9a2:1df2:8e08 with SMTP id 9-20020a170906018900b009a21df28e08mr1670600ejb.45.1693569662760; Fri, 01 Sep 2023 05:01:02 -0700 (PDT) Received: from krzk-bin.. (77-252-46-238.static.ip.netia.com.pl. [77.252.46.238]) by smtp.gmail.com with ESMTPSA id kg12-20020a17090776ec00b00993928e4d1bsm1877343ejc.24.2023.09.01.05.01.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 05:01:02 -0700 (PDT) From: Krzysztof Kozlowski To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] power: reset: syscon-poweroff: get regmap from parent node Date: Fri, 1 Sep 2023 14:00:57 +0200 Message-Id: <20230901120057.47018-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901120057.47018-1-krzysztof.kozlowski@linaro.org> References: <20230901120057.47018-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Just like syscon-reboot device, the syscon-poweroff is supposed to be a child of syscon node, thus we can take the same approach as syscon-poweroff: deprecate the 'regmap' field in favor of taking it from the parent's node. Signed-off-by: Krzysztof Kozlowski --- drivers/power/reset/syscon-poweroff.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/power/reset/syscon-poweroff.c b/drivers/power/reset/syscon-poweroff.c index 11b955983279..764aeea6c34a 100644 --- a/drivers/power/reset/syscon-poweroff.c +++ b/drivers/power/reset/syscon-poweroff.c @@ -37,8 +37,11 @@ static int syscon_poweroff_probe(struct platform_device *pdev) map = syscon_regmap_lookup_by_phandle(dev->of_node, "regmap"); if (IS_ERR(map)) { - dev_err(dev, "unable to get syscon"); - return PTR_ERR(map); + map = syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(map)) { + dev_err(dev, "unable to get syscon"); + return PTR_ERR(map); + } } if (of_property_read_u32(dev->of_node, "offset", &offset)) {