From patchwork Wed Jul 13 15:28:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 12916901 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 8394AC433EF for ; Wed, 13 Jul 2022 15:28:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236939AbiGMP2z (ORCPT ); Wed, 13 Jul 2022 11:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236764AbiGMP2y (ORCPT ); Wed, 13 Jul 2022 11:28:54 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D49971E3FC for ; Wed, 13 Jul 2022 08:28:52 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id ez10so20460698ejc.13 for ; Wed, 13 Jul 2022 08:28:52 -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:mime-version :content-transfer-encoding; bh=RXBbWBM75/ahyxyt/rX+gGKyoO6HVWAhyJ5ys4KYc5Y=; b=h5pVaH/ybq6nKQe9QdWLLrv0ehKiYPwxogc3FObax6srqYjbUChQ9sjgq09Xqhlo3u 383fmR1rwoCtFBwU551rCtTzumyL3NETloR+LqMlQ+yBUu4meVAbXL+OHjDBDgfWiH1D 7LLEKW+TOhzJEL/rXwNwGANE1qUPiu1Z9zLAwzHuJh3nDQckxUocRSIGDnrG3cv+9WVi VDypulNL2ZtmCvdusYLheJTLk2oIIf8l6ljF+TYHcuk2R//pi1omxu5Px16lsAi+G2ue RatcuhW3Z5L7MYeDp4EozZ3k709DTbQjKcUlk/3kzZuq1rU/mGl8Dk8Y1atrDh8gUWYp gRhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=RXBbWBM75/ahyxyt/rX+gGKyoO6HVWAhyJ5ys4KYc5Y=; b=g8PymU6yQZA53x52+WklMfM3XEKpenZFy8hAbG6N7bG+8YCpRiBAMhn0MYgkWohjom j8BmYSvVuxC5uNnTmftoik1SYfr/LwZHnV59RMuBLlNjR1mBJ0P7UYjdoEec+2+JqmUp SK5lF0hjY6xHQR+cmC3aIFhrbe3ivEOjegO3E+FZv6Cq+6gZ9/zvWQmt4XZAPJ7B+R55 9Pf/0rAAopPb0fe1cqo7NazRj2vSq/lnZjNm01pkVlOtmoakSfk8MRTCst+Y8vb2qSbz 4kAvDvTBTzcNyEvm9rUk429f2WDMwxNF0IJWszlQT9xRhGlTRNBLVNZv7Ar3Dy4a3Y5c kOxw== X-Gm-Message-State: AJIora8LcmTPo5zFXROdQxDUA8Jd1Ha1qjSTYTbIUOvnTypuq84SXrIA 7eyG3meKNSHc2s8MrEaw+xQHkYG5Gf/1pw== X-Google-Smtp-Source: AGRyM1soQHvm01/6uaS0m2SGJ7gGCr/sRtil3nOppibKMGoUMJRgYpn4kNQIx+zyv+hQ/ud7t2S8nw== X-Received: by 2002:a17:907:2cca:b0:72b:4188:f95b with SMTP id hg10-20020a1709072cca00b0072b4188f95bmr4093932ejc.153.1657726131404; Wed, 13 Jul 2022 08:28:51 -0700 (PDT) Received: from localhost.localdomain ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id p13-20020a17090653cd00b006fed85c1a8fsm5008210ejo.202.2022.07.13.08.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 08:28:50 -0700 (PDT) From: Abel Vesa To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Linux Kernel Mailing List , Abel Vesa Subject: [PATCH] remoteproc: qcom_q6v5_pas: Deal silently with optional px and cx regulators Date: Wed, 13 Jul 2022 18:28:35 +0300 Message-Id: <20220713152835.3848875-1-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use _get_optional as some platforms might not provide the px and cx regulators. This avoids printing the following for each unavailable regulator: [ 4.350229] qcom_q6v5_pas 5c00000.remoteproc: supply cx not found, using dummy regulator [ 4.374224] qcom_q6v5_pas 5c00000.remoteproc: supply px not found, using dummy regulator Signed-off-by: Abel Vesa Acked-by: Manivannan Sadhasivam --- drivers/remoteproc/qcom_q6v5_pas.c | 32 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 6ae39c5653b1..3c3affaff7ac 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -185,13 +185,17 @@ static int adsp_start(struct rproc *rproc) if (ret) goto disable_xo_clk; - ret = regulator_enable(adsp->cx_supply); - if (ret) - goto disable_aggre2_clk; + if (adsp->cx_supply) { + ret = regulator_enable(adsp->cx_supply); + if (ret) + goto disable_aggre2_clk; + } - ret = regulator_enable(adsp->px_supply); - if (ret) - goto disable_cx_supply; + if (adsp->px_supply) { + ret = regulator_enable(adsp->px_supply); + if (ret) + goto disable_cx_supply; + } ret = qcom_scm_pas_auth_and_reset(adsp->pas_id); if (ret) { @@ -212,9 +216,11 @@ static int adsp_start(struct rproc *rproc) return 0; disable_px_supply: - regulator_disable(adsp->px_supply); + if (adsp->px_supply) + regulator_disable(adsp->px_supply); disable_cx_supply: - regulator_disable(adsp->cx_supply); + if (adsp->cx_supply) + regulator_disable(adsp->cx_supply); disable_aggre2_clk: clk_disable_unprepare(adsp->aggre2_clk); disable_xo_clk: @@ -231,8 +237,10 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5) { struct qcom_adsp *adsp = container_of(q6v5, struct qcom_adsp, q6v5); - regulator_disable(adsp->px_supply); - regulator_disable(adsp->cx_supply); + if (adsp->px_supply) + regulator_disable(adsp->px_supply); + if (adsp->cx_supply) + regulator_disable(adsp->cx_supply); clk_disable_unprepare(adsp->aggre2_clk); clk_disable_unprepare(adsp->xo); adsp_pds_disable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); @@ -326,13 +334,13 @@ static int adsp_init_clock(struct qcom_adsp *adsp) static int adsp_init_regulator(struct qcom_adsp *adsp) { - adsp->cx_supply = devm_regulator_get(adsp->dev, "cx"); + adsp->cx_supply = devm_regulator_get_optional(adsp->dev, "cx"); if (IS_ERR(adsp->cx_supply)) return PTR_ERR(adsp->cx_supply); regulator_set_load(adsp->cx_supply, 100000); - adsp->px_supply = devm_regulator_get(adsp->dev, "px"); + adsp->px_supply = devm_regulator_get_optional(adsp->dev, "px"); return PTR_ERR_OR_ZERO(adsp->px_supply); }