Skip to content

Commit

Permalink
ANDROID: GKI: regmap: Add regmap vendor hook for of_syscon_register
Browse files Browse the repository at this point in the history
For global registers access, UNISOC have one special method called set/clear
mechanism that would avoid using hardware spinlock. But now regmap framework
does not support our set/clear mechanism, so add vendor hook to support
this feature.

Bug: 228907258
Signed-off-by: Xiaopeng Bai <[email protected]>
Change-Id: I9a6651f07a048ffebd5c2d8e369a4e7b374bc182
(cherry picked from commit 53e342c183af58f03bd1445838a3f499e7fbd191)
  • Loading branch information
Xiaopeng Bai authored and Treehugger Robot committed Jul 13, 2023
1 parent 7c2b6c7 commit 8726a2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/android/vendor_hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#include <trace/hooks/psci.h>
#include <trace/hooks/psi.h>
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/regmap.h>

/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
Expand Down Expand Up @@ -310,3 +311,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_post_image_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_pageout_skip);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rmqueue_smallest_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_one_page_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_regmap_update);
2 changes: 2 additions & 0 deletions drivers/mfd/syscon.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
#include <linux/slab.h>
#include <trace/hooks/regmap.h>

static struct platform_driver syscon_driver;

Expand Down Expand Up @@ -128,6 +129,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_clk)
}
}

trace_android_vh_regmap_update(&syscon_config, regmap);
syscon->regmap = regmap;
syscon->np = np;

Expand Down
24 changes: 24 additions & 0 deletions include/trace/hooks/regmap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM regmap
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH trace/hooks

#if !defined(_TRACE_HOOK_REGMAP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_REGMAP_H
#include <trace/hooks/vendor_hooks.h>

struct regmap_config;
struct regmap;

/*
* Following tracepoints are not exported in tracefs and provide a
* mechanism for vendor modules to hook and extend functionality
*/
DECLARE_HOOK(android_vh_regmap_update,
TP_PROTO(const struct regmap_config *config, struct regmap *map),
TP_ARGS(config, map));

#endif /* _TRACE_HOOK_REGMAP_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

0 comments on commit 8726a2d

Please sign in to comment.