ANDROID: i2c: Add vendor hook to allow assign dev_name to I2C devices

"dev_name" for I2C devices won't have any value set, unless they are
instantiated thru ACPI interface. As a result of this, I2C driver will
assign some dynamic name in the format "%d-%04x" (e.g. 1-001f), and
further this device names are used for kernel wakelocks.

This dynamic names are difficult to associate with actual device and
hence it will help to have an ability where vendor can assign the
device name through vendor hooks.

Bug: 147496295

Signed-off-by: Manish Varma <varmam@google.com>
Change-Id: Idb417ef5330002063a9763544f9f0364f9581276
This commit is contained in:
Manish Varma
2021-03-18 13:53:57 -07:00
committed by Todd Kjos
parent 0493c72d6d
commit f9d86ad18a
4 changed files with 27 additions and 0 deletions

View File

@@ -1822,6 +1822,7 @@
__traceiter_android_vh_enable_thermal_genl_check
__traceiter_android_vh_ep_create_wakeup_source
__traceiter_android_vh_ipi_stop
__traceiter_android_vh_of_i2c_get_board_info
__traceiter_android_vh_pagecache_get_page
__traceiter_android_vh_rmqueue
__traceiter_android_vh_timerfd_create
@@ -1881,6 +1882,7 @@
__tracepoint_android_vh_enable_thermal_genl_check
__tracepoint_android_vh_ep_create_wakeup_source
__tracepoint_android_vh_ipi_stop
__tracepoint_android_vh_of_i2c_get_board_info
__tracepoint_android_vh_pagecache_get_page
__tracepoint_android_vh_rmqueue
__tracepoint_android_vh_timerfd_create

View File

@@ -27,6 +27,7 @@
#include <trace/hooks/epoch.h>
#include <trace/hooks/cpufreq.h>
#include <trace/hooks/fs.h>
#include <trace/hooks/i2c.h>
#include <trace/hooks/mm.h>
#include <trace/hooks/preemptirq.h>
#include <trace/hooks/ftrace_dump.h>
@@ -271,3 +272,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_finish_update_load_avg_se);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_selinux_is_initialized);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_inactive_ratio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_update_topology_flags_workfn);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_of_i2c_get_board_info);

View File

@@ -16,6 +16,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/sysfs.h>
#include <trace/hooks/i2c.h>
#include "i2c-core.h"
@@ -32,6 +33,8 @@ int of_i2c_get_board_info(struct device *dev, struct device_node *node,
return -EINVAL;
}
trace_android_vh_of_i2c_get_board_info(node, &(info->dev_name));
ret = of_property_read_u32(node, "reg", &addr);
if (ret) {
dev_err(dev, "of_i2c: invalid reg on %pOF\n", node);

20
include/trace/hooks/i2c.h Normal file
View File

@@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM i2c
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_I2C_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_I2C_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
DECLARE_HOOK(android_vh_of_i2c_get_board_info,
TP_PROTO(struct device_node *node, const char **dev_name),
TP_ARGS(node, dev_name));
#endif /* _TRACE_HOOK_I2C_H */
/* This part must be outside protection */
#include <trace/define_trace.h>