Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf/marvell: Add ACPI support to TAD uncore driver

Add support for ACPI based device registration so that the driver
can be also enabled through ACPI table.
While at that change the DT specific API's to device_* API's so that
both DT based and ACPI based probing works.

Signed-off-by: Gowthami Thiagarajan <gthiagarajan@marvell.com>
Link: https://lore.kernel.org/r/20221209053715.3930071-1-gthiagarajan@marvell.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Gowthami Thiagarajan and committed by
Will Deacon
093cf1f6 e85930f0

+16 -6
+16 -6
drivers/perf/marvell_cn10k_tad_pmu.c
··· 13 13 #include <linux/cpuhotplug.h> 14 14 #include <linux/perf_event.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/acpi.h> 16 17 17 18 #define TAD_PFC_OFFSET 0x800 18 19 #define TAD_PFC(counter) (TAD_PFC_OFFSET | (counter << 3)) ··· 255 254 256 255 static int tad_pmu_probe(struct platform_device *pdev) 257 256 { 258 - struct device_node *node = pdev->dev.of_node; 257 + struct device *dev = &pdev->dev; 259 258 struct tad_region *regions; 260 259 struct tad_pmu *tad_pmu; 261 260 struct resource *res; ··· 277 276 return -ENODEV; 278 277 } 279 278 280 - ret = of_property_read_u32(node, "marvell,tad-page-size", 281 - &tad_page_size); 279 + ret = device_property_read_u32(dev, "marvell,tad-page-size", 280 + &tad_page_size); 282 281 if (ret) { 283 282 dev_err(&pdev->dev, "Can't find tad-page-size property\n"); 284 283 return ret; 285 284 } 286 285 287 - ret = of_property_read_u32(node, "marvell,tad-pmu-page-size", 288 - &tad_pmu_page_size); 286 + ret = device_property_read_u32(dev, "marvell,tad-pmu-page-size", 287 + &tad_pmu_page_size); 289 288 if (ret) { 290 289 dev_err(&pdev->dev, "Can't find tad-pmu-page-size property\n"); 291 290 return ret; 292 291 } 293 292 294 - ret = of_property_read_u32(node, "marvell,tad-cnt", &tad_cnt); 293 + ret = device_property_read_u32(dev, "marvell,tad-cnt", &tad_cnt); 295 294 if (ret) { 296 295 dev_err(&pdev->dev, "Can't find tad-cnt property\n"); 297 296 return ret; ··· 370 369 }; 371 370 #endif 372 371 372 + #ifdef CONFIG_ACPI 373 + static const struct acpi_device_id tad_pmu_acpi_match[] = { 374 + {"MRVL000B", 0}, 375 + {}, 376 + }; 377 + MODULE_DEVICE_TABLE(acpi, tad_pmu_acpi_match); 378 + #endif 379 + 373 380 static struct platform_driver tad_pmu_driver = { 374 381 .driver = { 375 382 .name = "cn10k_tad_pmu", 376 383 .of_match_table = of_match_ptr(tad_pmu_of_match), 384 + .acpi_match_table = ACPI_PTR(tad_pmu_acpi_match), 377 385 .suppress_bind_attrs = true, 378 386 }, 379 387 .probe = tad_pmu_probe,