Re: [PATCH V3 08/10] coresight: tmc: Move ACPI support from AMBA driver to platform driver

From: James Clark
Date: Fri Dec 08 2023 - 10:31:41 EST




On 08/12/2023 05:39, Anshuman Khandual wrote:
> Add support for the tmc devices in the platform driver, which can then be
> used on ACPI based platforms. This change would now allow runtime power
> management for ACPI based systems. The driver would try to enable the APB
> clock if available.
>
> Cc: Lorenzo Pieralisi <lpieralisi@xxxxxxxxxx>
> Cc: Sudeep Holla <sudeep.holla@xxxxxxx>
> Cc: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
> Cc: Mike Leach <mike.leach@xxxxxxxxxx>
> Cc: James Clark <james.clark@xxxxxxx>
> Cc: linux-acpi@xxxxxxxxxxxxxxx
> Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> Cc: coresight@xxxxxxxxxxxxxxxx
> Tested-by: Sudeep Holla <sudeep.holla@xxxxxxx> # Boot and driver probe only
> Acked-by: Sudeep Holla <sudeep.holla@xxxxxxx> # For ACPI related changes
> Signed-off-by: Anshuman Khandual <anshuman.khandual@xxxxxxx>
> ---
> Changes in V3:
>
> - Added commnets for 'drvdata->pclk'
> - Used coresight_init_driver()/coresight_remove_driver() helpers instead
> - Dropped pm_runtime_put() from __tmc_probe()
> - Added pm_runtime_put() on success path in tmc_probe()
> - Added pm_runtime_put() on success/error paths in tmc_platform_probe()
> - Check for drvdata instead of drvdata->pclk in suspend and resume paths
>
> drivers/acpi/arm64/amba.c | 2 -
> .../hwtracing/coresight/coresight-tmc-core.c | 137 ++++++++++++++++--
> drivers/hwtracing/coresight/coresight-tmc.h | 2 +
> 3 files changed, 124 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
> index 6d24a8f7914b..d3c1defa7bc8 100644
> --- a/drivers/acpi/arm64/amba.c
> +++ b/drivers/acpi/arm64/amba.c
> @@ -22,10 +22,8 @@
> static const struct acpi_device_id amba_id_list[] = {
> {"ARMH0061", 0}, /* PL061 GPIO Device */
> {"ARMH0330", 0}, /* ARM DMA Controller DMA-330 */
> - {"ARMHC501", 0}, /* ARM CoreSight ETR */
> {"ARMHC502", 0}, /* ARM CoreSight STM */
> {"ARMHC503", 0}, /* ARM CoreSight Debug */
> - {"ARMHC97C", 0}, /* ARM CoreSight SoC-400 TMC, SoC-600 ETF/ETB */
> {"", 0},
> };
>
> diff --git a/drivers/hwtracing/coresight/coresight-tmc-core.c b/drivers/hwtracing/coresight/coresight-tmc-core.c
> index ad61d02f5f75..8482830d73ef 100644
> --- a/drivers/hwtracing/coresight/coresight-tmc-core.c
> +++ b/drivers/hwtracing/coresight/coresight-tmc-core.c
> @@ -23,6 +23,8 @@
> #include <linux/of.h>
> #include <linux/coresight.h>
> #include <linux/amba/bus.h>
> +#include <linux/platform_device.h>
> +#include <linux/acpi.h>
>
> #include "coresight-priv.h"
> #include "coresight-tmc.h"
> @@ -437,24 +439,17 @@ static u32 tmc_etr_get_max_burst_size(struct device *dev)
> return burst_size;
> }
>
> -static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
> +static int __tmc_probe(struct device *dev, struct resource *res, void *dev_caps)

I don't think the dev_caps argument is used anymore since the v3 changes.