linux/drivers/firmware/arm_scmi/quirks.h
Johan Hovold 397f802d06 firmware: arm_scmi: quirk: Force perf level get fastchannel
The Qualcomm SCP firmware in X1E machines like the Lenovo ThinkPad T14s
does not set the FastChannel supported attribute bit for PERF_LEVEL_GET
but crashes when falling back to regular messaging.

Use the new SCMI quirk framework to force FastChannel initialisation for
this implementation.

Note that we can add an upper bound on the version matching when we
learn which version has a fix (or limit matching using a SoC compatible
string in the unlikely event that always enabling FC causes trouble
somewhere).

Link: https://lore.kernel.org/lkml/Z4Dt8E7C6upVtEGV@hovoldconsulting.com/
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Message-Id: <20250430135146.5154-1-johan+linaro@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2025-05-06 11:12:30 +01:00

52 lines
1.3 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* System Control and Management Interface (SCMI) Message Protocol Quirks
*
* Copyright (C) 2025 ARM Ltd.
*/
#ifndef _SCMI_QUIRKS_H
#define _SCMI_QUIRKS_H
#include <linux/static_key.h>
#include <linux/types.h>
#ifdef CONFIG_ARM_SCMI_QUIRKS
#define DECLARE_SCMI_QUIRK(_qn) \
DECLARE_STATIC_KEY_FALSE(scmi_quirk_ ## _qn)
/*
* A helper to associate the actual code snippet to use as a quirk
* named as _qn.
*/
#define SCMI_QUIRK(_qn, _blk) \
do { \
if (static_branch_unlikely(&(scmi_quirk_ ## _qn))) \
(_blk); \
} while (0)
void scmi_quirks_initialize(void);
void scmi_quirks_enable(struct device *dev, const char *vend,
const char *subv, const u32 impl);
#else
#define DECLARE_SCMI_QUIRK(_qn)
/* Force quirks compilation even when SCMI Quirks are disabled */
#define SCMI_QUIRK(_qn, _blk) \
do { \
if (0) \
(_blk); \
} while (0)
static inline void scmi_quirks_initialize(void) { }
static inline void scmi_quirks_enable(struct device *dev, const char *vend,
const char *sub_vend, const u32 impl) { }
#endif /* CONFIG_ARM_SCMI_QUIRKS */
/* Quirk delarations */
DECLARE_SCMI_QUIRK(clock_rates_triplet_out_of_spec);
DECLARE_SCMI_QUIRK(perf_level_get_fc_force);
#endif /* _SCMI_QUIRKS_H */