| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* System Control and Management Interface (SCMI) Message Protocol Quirks |
| 4 |
* |
| 5 |
* Copyright (C) 2025 ARM Ltd. |
| 6 |
*/ |
| 7 |
#ifndef _SCMI_QUIRKS_H |
| 8 |
#define _SCMI_QUIRKS_H |
| 9 |
|
| 10 |
#include <linux/static_key.h> |
| 11 |
#include <linux/types.h> |
| 12 |
|
| 13 |
#ifdef CONFIG_ARM_SCMI_QUIRKS |
| 14 |
|
| 15 |
#define DECLARE_SCMI_QUIRK(_qn) \ |
| 16 |
DECLARE_STATIC_KEY_FALSE(scmi_quirk_ ## _qn) |
| 17 |
|
| 18 |
/* |
| 19 |
* A helper to associate the actual code snippet to use as a quirk |
| 20 |
* named as _qn. |
| 21 |
*/ |
| 22 |
#define SCMI_QUIRK(_qn, _blk) \ |
| 23 |
do { \ |
| 24 |
if (static_branch_unlikely(&(scmi_quirk_ ## _qn))) \ |
| 25 |
(_blk); \ |
| 26 |
} while (0) |
| 27 |
|
| 28 |
void scmi_quirks_initialize(void); |
| 29 |
void scmi_quirks_enable(struct device *dev, const char *vend, |
| 30 |
const char *subv, const u32 impl); |
| 31 |
|
| 32 |
#else |
| 33 |
|
| 34 |
#define DECLARE_SCMI_QUIRK(_qn) |
| 35 |
/* Force quirks compilation even when SCMI Quirks are disabled */ |
| 36 |
#define SCMI_QUIRK(_qn, _blk) \ |
| 37 |
do { \ |
| 38 |
if (0) \ |
| 39 |
(_blk); \ |
| 40 |
} while (0) |
| 41 |
|
| 42 |
static inline void scmi_quirks_initialize(void) { } |
| 43 |
static inline void scmi_quirks_enable(struct device *dev, const char *vend, |
| 44 |
const char *sub_vend, const u32 impl) { } |
| 45 |
|
| 46 |
#endif /* CONFIG_ARM_SCMI_QUIRKS */ |
| 47 |
|
| 48 |
/* Quirk delarations */ |
| 49 |
DECLARE_SCMI_QUIRK(clock_rates_triplet_out_of_spec); |
| 50 |
DECLARE_SCMI_QUIRK(perf_level_get_fc_force); |
| 51 |
|
| 52 |
#endif /* _SCMI_QUIRKS_H */ |