Files
android/drivers/misc/mediatek/freqhopping/fhctl_new/clk-fhctl-util.h
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

52 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2020 MediaTek Inc.
* Author: Yu-Chang Wang <Yu-Chang.Wang@mediatek.com>
*/
#ifndef __CLK_FHCTL_UTIL_H
#define __CLK_FHCTL_UTIL_H
#ifdef CONFIG_MTK_AEE_FEATURE
#include <mt-plat/aee.h>
#endif
#define fh_set_field(reg, field, val) \
do { \
unsigned int tv = readl(reg); \
tv &= ~(field); \
tv |= ((val) << (ffs(field) - 1)); \
writel(tv, reg); \
} while (0)
#define fh_get_field(reg, field, val) \
do { \
unsigned int tv = readl(reg); \
val = ((tv & (field)) >> (ffs(field) - 1)); \
} while (0)
#define FHDBG(fmt, args...) pr_debug("[FHCTL], <%s(), %d> " fmt, __func__, __LINE__, ## args)
#define FHDBG_LIMIT(FREQ, fmt, args...) do {\
static DEFINE_RATELIMIT_STATE(ratelimit, HZ, FREQ);\
static int skip_cnt;\
\
if (0)\
FHDBG(fmt "<unlimit>\n", ## args);\
else { \
if (__ratelimit(&ratelimit)) {\
FHDBG(fmt ", skip_cnt<%d>\n", ## args, skip_cnt);\
skip_cnt = 0;\
} else\
skip_cnt++;\
} \
} while (0)
#endif
#ifdef CONFIG_MTK_AEE_FEATURE
static inline void notify_err(void)
{
aee_kernel_warning("fhctl", "check error\n");
}
#else
static inline void notify_err(void){}
#endif