Skip to content

Commit 093cf1f

Browse files
Gowthami Thiagarajanwilldeacon
authored andcommitted
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>
1 parent e85930f commit 093cf1f

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

drivers/perf/marvell_cn10k_tad_pmu.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/cpuhotplug.h>
1414
#include <linux/perf_event.h>
1515
#include <linux/platform_device.h>
16+
#include <linux/acpi.h>
1617

1718
#define TAD_PFC_OFFSET 0x800
1819
#define TAD_PFC(counter) (TAD_PFC_OFFSET | (counter << 3))
@@ -254,7 +255,7 @@ static const struct attribute_group *tad_pmu_attr_groups[] = {
254255

255256
static int tad_pmu_probe(struct platform_device *pdev)
256257
{
257-
struct device_node *node = pdev->dev.of_node;
258+
struct device *dev = &pdev->dev;
258259
struct tad_region *regions;
259260
struct tad_pmu *tad_pmu;
260261
struct resource *res;
@@ -276,21 +277,21 @@ static int tad_pmu_probe(struct platform_device *pdev)
276277
return -ENODEV;
277278
}
278279

279-
ret = of_property_read_u32(node, "marvell,tad-page-size",
280-
&tad_page_size);
280+
ret = device_property_read_u32(dev, "marvell,tad-page-size",
281+
&tad_page_size);
281282
if (ret) {
282283
dev_err(&pdev->dev, "Can't find tad-page-size property\n");
283284
return ret;
284285
}
285286

286-
ret = of_property_read_u32(node, "marvell,tad-pmu-page-size",
287-
&tad_pmu_page_size);
287+
ret = device_property_read_u32(dev, "marvell,tad-pmu-page-size",
288+
&tad_pmu_page_size);
288289
if (ret) {
289290
dev_err(&pdev->dev, "Can't find tad-pmu-page-size property\n");
290291
return ret;
291292
}
292293

293-
ret = of_property_read_u32(node, "marvell,tad-cnt", &tad_cnt);
294+
ret = device_property_read_u32(dev, "marvell,tad-cnt", &tad_cnt);
294295
if (ret) {
295296
dev_err(&pdev->dev, "Can't find tad-cnt property\n");
296297
return ret;
@@ -369,10 +370,19 @@ static const struct of_device_id tad_pmu_of_match[] = {
369370
};
370371
#endif
371372

373+
#ifdef CONFIG_ACPI
374+
static const struct acpi_device_id tad_pmu_acpi_match[] = {
375+
{"MRVL000B", 0},
376+
{},
377+
};
378+
MODULE_DEVICE_TABLE(acpi, tad_pmu_acpi_match);
379+
#endif
380+
372381
static struct platform_driver tad_pmu_driver = {
373382
.driver = {
374383
.name = "cn10k_tad_pmu",
375384
.of_match_table = of_match_ptr(tad_pmu_of_match),
385+
.acpi_match_table = ACPI_PTR(tad_pmu_acpi_match),
376386
.suppress_bind_attrs = true,
377387
},
378388
.probe = tad_pmu_probe,

0 commit comments

Comments
 (0)