From patchwork Wed May 31 01:42:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 687536 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 EDBA2C7EE37 for ; Wed, 31 May 2023 01:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbjEaBm4 (ORCPT ); Tue, 30 May 2023 21:42:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233617AbjEaBmz (ORCPT ); Tue, 30 May 2023 21:42:55 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B21811F for ; Tue, 30 May 2023 18:42:53 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4f4db9987f8so521148e87.1 for ; Tue, 30 May 2023 18:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685497372; x=1688089372; 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=XVVVClRGQ3W+a4D62JgYgRZeO7k7GdsG/nIGFO07NhE=; b=vOiOxUgpdUx4sO3r01yIUuAfFsasVWnW6N6FiQslNJpkAzZn2R1A6lD9HRtqR+JBLW 3zYHVJIhSHROmwc9tI9JVKkcDRHyyaJgkqhKZ0VZiekQvjsxcrX8ghiK7Nmxhqie8HOz jnTAuTGW9XnuxWmy+Jni8p2YPAvYK7wKrIXJTzrAh/jgmV6/Qmz0nqGrVbIn19PPzYpn NoQcPZ5juDx53GiFfwD9VFG43SORhakvVb1aNClcH9T+ZJeFnl87Iux0dTPY8w5NaocD ZuiXO1FcM9IPu8CANRoP/f/Cs2s9IJyZtqmXXvC3dWFpPRxzck6fwE61o79dIsz8x2qp p05g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685497372; x=1688089372; 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=XVVVClRGQ3W+a4D62JgYgRZeO7k7GdsG/nIGFO07NhE=; b=K2KkwZtXAt+CtNlqB9yUAOcfrWxl3yi2UwQtTvvlPiBkrvLEM6PBkpW3HLCt7xuSB9 gGZB2ZXKktKsqcS+WpZcVO1O0gCA+71YuyAQNWIWOLcH0mliybFc2TtSuRbaaBXCsn9e noMl8Oky3cwajRIGveKSD0L08qGf14cxGqaNWB8K3tVD+eBMR7lVmfFChOV9g+K5KB8R /ciif/MmPmX7AbUtsOXBpIUmZOPnKxgOfNrRxpbchrQIFOdrVeLsJ0FLaSaGY3XDSNmB R9fCTZ2UdUu9Ok05n4rkAX9kRByJoMVOBZvh9Ho7WweONtU+RagYOGrV7Ge8KzBLFHeb 8dbg== X-Gm-Message-State: AC+VfDy0gdTHcROPP7zsh/cpGGr6Lzk/47l0+Ge6JVzdi+4/cz8/Gnc+ O3GVJAxC/JbYrLtPP/ZKePaHEA== X-Google-Smtp-Source: ACHHUZ5xKHZHlSFAIUgV9MRQhU+bzS3GEljBXd1Ge5xA/wxIe7ClbRxK19Qjn5/oMZx7aDGwjkLbyg== X-Received: by 2002:ac2:5296:0:b0:4ed:d5ce:7dea with SMTP id q22-20020ac25296000000b004edd5ce7deamr1294562lfm.27.1685497371885; Tue, 30 May 2023 18:42:51 -0700 (PDT) Received: from lothlorien.lan (dzdqv0yyyyyyyyyyybm5y-3.rev.dnainternet.fi. [2001:14ba:a0db:1f00::ab2]) by smtp.gmail.com with ESMTPSA id q20-20020ac25294000000b004f3945751b2sm515994lfm.43.2023.05.30.18.42.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 18:42:51 -0700 (PDT) From: Dmitry Baryshkov To: Sebastian Reichel , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v3 2/4] power: reset: qcom-pon: add support for pm8941-pon Date: Wed, 31 May 2023 04:42:46 +0300 Message-Id: <20230531014248.3824043-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531014248.3824043-1-dmitry.baryshkov@linaro.org> References: <20230531014248.3824043-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org For PM8941 we don't have a defined field to store the reset reason. Support wrapping pwrkey and resin, but without writing the reset reason. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/power/reset/qcom-pon.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/power/reset/qcom-pon.c b/drivers/power/reset/qcom-pon.c index ebdcfb28c4a0..1344b361a475 100644 --- a/drivers/power/reset/qcom-pon.c +++ b/drivers/power/reset/qcom-pon.c @@ -17,6 +17,8 @@ #define GEN1_REASON_SHIFT 2 #define GEN2_REASON_SHIFT 1 +#define NO_REASON_SHIFT 0 + struct pm8916_pon { struct device *dev; struct regmap *regmap; @@ -45,6 +47,7 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot, static int pm8916_pon_probe(struct platform_device *pdev) { struct pm8916_pon *pon; + long reason_shift; int error; pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL); @@ -64,13 +67,17 @@ static int pm8916_pon_probe(struct platform_device *pdev) if (error) return error; - 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; - error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode); - if (error) { - dev_err(&pdev->dev, "can't register reboot mode\n"); - return error; + reason_shift = (long)of_device_get_match_data(&pdev->dev); + + if (reason_shift != NO_REASON_SHIFT) { + pon->reboot_mode.dev = &pdev->dev; + pon->reason_shift = reason_shift; + 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"); + return error; + } } platform_set_drvdata(pdev, pon); @@ -80,6 +87,7 @@ static int pm8916_pon_probe(struct platform_device *pdev) static const struct of_device_id pm8916_pon_id_table[] = { { .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT }, + { .compatible = "qcom,pm8941-pon", .data = (void *)NO_REASON_SHIFT }, { .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT }, { .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT }, { .compatible = "qcom,pmk8350-pon", .data = (void *)GEN2_REASON_SHIFT },