Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2449582rdb; Thu, 21 Sep 2023 21:12:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwidmwq1dYmWyrQhmhjY5SdvwpaPh7l8/2nc0a8ny5knNuBei4+mqJyn5p+ZzLqodLW2nC X-Received: by 2002:a05:6358:4411:b0:142:fba8:dcfc with SMTP id z17-20020a056358441100b00142fba8dcfcmr7587916rwc.16.1695355954498; Thu, 21 Sep 2023 21:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695355954; cv=none; d=google.com; s=arc-20160816; b=CBv4RWEx2JmqbzE6IPcmLKouptedFl8y9yLt4hqS/cqaaQK8Es/BDOPsdMJlPRQSe+ QB0FD2OrN2JWfWp+Z/rIyDsJIz9ltHQLoth4ziXlhZew1etoygK8EiaG2JzR0FYSN+yC 59+nnbeEIokjZomel7rUHoezJxZdzd3UIxul20LhSpEzbnLpg9aFKgweZM8dsOaf+NRk iQEqnKC8WxP2VwzSwHb/E9ZWbChdyWnI1WO5xS4+hN0x4cBOhqnXc+PPQsnKZjy7A5C4 EVDNmX9mD0c+wZ9ZIR4Z7kjmpiDq7AUExVGXHG+2Lwun0BFzsMWTixqjZI7T3OWJzCkL 2oVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=6oC9bUovWYxj8ME33Y2hALL73ZmlzmTaCPdEjHseA3g=; fh=y5GGcDy3pDUVW/wtd6/Iv3+wZ2wRxklimCX1bKk/zjs=; b=zq/AvSo709p8tjb1F4UvX3Wp/VkbTi9ZnuHITQuIODc029Df/XxiL3g5Huen44Ev90 3EDWLFl+DFSEXzifa/7CjtNRH3faSC+AkGSHkyuhHLNYlB0KexAoZIGAkq5RLAgYGi+d Tursx7CekPguhEGF4yKGYwcR1PTxPXqMujvs1KTk6SiwGX4lAQ5dSvNeqSkh46SOwi7t j73Pafeed92RKXew+4YKiTMoIJej1N1qkCb8TWb9M820J90xJMOgHeDBWN8Nu3yZmZco JHLpAZ5WU6LlDpFcLs2j2lMt+BI2ajw5KrbpGydpmiuIU2Dcb3cXhqeTYcszum+s9L3t 5h2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id 14-20020a63020e000000b00565342470c4si2779180pgc.801.2023.09.21.21.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 21:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B32DA819F9AA; Thu, 21 Sep 2023 21:10:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229639AbjIVEK1 (ORCPT + 99 others); Fri, 22 Sep 2023 00:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjIVEK0 (ORCPT ); Fri, 22 Sep 2023 00:10:26 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 36B3E122 for ; Thu, 21 Sep 2023 21:10:19 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7BAC0DA7; Thu, 21 Sep 2023 21:10:54 -0700 (PDT) Received: from [10.163.32.251] (unknown [10.163.32.251]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5D48C3F59C; Thu, 21 Sep 2023 21:10:15 -0700 (PDT) Message-ID: Date: Fri, 22 Sep 2023 09:40:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [RFC RESEND 1/7] coresight: replicator: Move ACPI support from AMBA driver to platform driver Content-Language: en-US To: Suzuki K Poulose , linux-arm-kernel@lists.infradead.org Cc: James Clark , Mike Leach , coresight@lists.linaro.org, linux-kernel@vger.kernel.org References: <20230921042040.1334641-1-anshuman.khandual@arm.com> <20230921042040.1334641-2-anshuman.khandual@arm.com> <6a72387f-2749-0e27-000f-aeec265cb789@arm.com> From: Anshuman Khandual In-Reply-To: <6a72387f-2749-0e27-000f-aeec265cb789@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 21:10:44 -0700 (PDT) On 9/21/23 16:40, Suzuki K Poulose wrote: > On 21/09/2023 05:20, Anshuman Khandual wrote: >> Add support for the dynamic replicator device in the platform driver, which >> can then be used on ACPI based platforms. This change would now allow >> runtime power management for repliacator devices on ACPI based systems. >> >> The driver would try to enable the APB clock if available. Also, rename the >> code to reflect the fact that it now handles both static and dynamic >> replicators. >> >> Signed-off-by: Anshuman Khandual >> --- >>   drivers/acpi/arm64/amba.c                     |  1 - >>   .../coresight/coresight-replicator.c          | 44 ++++++++++++------- >>   2 files changed, 27 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c >> index 60be8ee1dbdc..ac59ce50de07 100644 >> --- a/drivers/acpi/arm64/amba.c >> +++ b/drivers/acpi/arm64/amba.c >> @@ -27,7 +27,6 @@ static const struct acpi_device_id amba_id_list[] = { >>       {"ARMHC503", 0}, /* ARM CoreSight Debug */ >>       {"ARMHC979", 0}, /* ARM CoreSight TPIU */ >>       {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */ >> -    {"ARMHC98D", 0}, /* ARM CoreSight Dynamic Replicator */ >>       {"ARMHC9CA", 0}, /* ARM CoreSight CATU */ >>       {"ARMHC9FF", 0}, /* ARM CoreSight Dynamic Funnel */ >>       {"", 0}, >> diff --git a/drivers/hwtracing/coresight/coresight-replicator.c b/drivers/hwtracing/coresight/coresight-replicator.c >> index b6be73034996..a18d5e8fcba1 100644 >> --- a/drivers/hwtracing/coresight/coresight-replicator.c >> +++ b/drivers/hwtracing/coresight/coresight-replicator.c >> @@ -38,6 +38,7 @@ DEFINE_CORESIGHT_DEVLIST(replicator_devs, "replicator"); >>   struct replicator_drvdata { >>       void __iomem        *base; >>       struct clk        *atclk; >> +    struct clk        *pclk; >>       struct coresight_device    *csdev; >>       spinlock_t        spinlock; >>       bool            check_idfilter_val; >> @@ -243,6 +244,10 @@ static int replicator_probe(struct device *dev, struct resource *res) >>               return ret; >>       } >>   +    drvdata->pclk = coresight_get_enable_apb_pclk(dev); >> +    if (IS_ERR(drvdata->pclk)) >> +        return -ENODEV; >> + >>       /* >>        * Map the device base for dynamic-replicator, which has been >>        * validated by AMBA core >> @@ -301,16 +306,16 @@ static int replicator_remove(struct device *dev) >>       return 0; >>   } >>   -static int static_replicator_probe(struct platform_device *pdev) >> +static int replicator_platform_probe(struct platform_device *pdev) >>   { >> +    struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >>       int ret; >>         pm_runtime_get_noresume(&pdev->dev); >>       pm_runtime_set_active(&pdev->dev); >>       pm_runtime_enable(&pdev->dev); >>   -    /* Static replicators do not have programming base */ >> -    ret = replicator_probe(&pdev->dev, NULL); >> +    ret = replicator_probe(&pdev->dev, res); >>         if (ret) { >>           pm_runtime_put_noidle(&pdev->dev); >> @@ -320,7 +325,7 @@ static int static_replicator_probe(struct platform_device *pdev) >>       return ret; >>   } >>   -static int static_replicator_remove(struct platform_device *pdev) >> +static int replicator_platform_remove(struct platform_device *pdev) >>   { >>       replicator_remove(&pdev->dev); >>       pm_runtime_disable(&pdev->dev); >> @@ -335,6 +340,8 @@ static int replicator_runtime_suspend(struct device *dev) >>       if (drvdata && !IS_ERR(drvdata->atclk)) >>           clk_disable_unprepare(drvdata->atclk); >>   +    if (drvdata && !IS_ERR(drvdata->pclk)) > > !IS_ERR_OR_NULL() ? If we don't have pclk, drvdata->pclk is always NULL Agreed, IS_ERR_OR_NULL() should be used instead. > > Same applies throughout the series. Updated suspend/resume callbacks in each driver to use IS_ERR_OR_NULL().