msm: camera: common: create a common root folder for debugfs

Create common root folder under debugfs root named camera at probe. Add
utility functions to create subdirectories under the common camera root.

CRs-Fixed: 3093049
Change-Id: Ia4cefb5d2263ecabf1b9d70deefa1ee624b04f07
Signed-off-by: Anand Ravi <quic_ananravi@quicinc.com>
This commit is contained in:
Anand Ravi
2021-12-13 14:49:13 -08:00
parent d123d73bc2
commit cbe499e9eb
20 changed files with 288 additions and 205 deletions

View File

@@ -360,4 +360,59 @@ const struct camera_debug_settings *cam_debug_get_settings(void);
ssize_t cam_debug_sysfs_node_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
/**
* cam_debugfs_init()
*
* @brief: create camera debugfs root folder
*/
void cam_debugfs_init(void);
/**
* cam_debugfs_deinit()
*
* @brief: remove camera debugfs root folder
*/
void cam_debugfs_deinit(void);
/**
* cam_debugfs_create_subdir()
*
* @brief: create a directory within the camera debugfs root folder
*
* @name: name of the directory
* @subdir: pointer to the newly created directory entry
*
* @return: 0 on success, negative on failure
*/
int cam_debugfs_create_subdir(const char *name, struct dentry **subdir);
/**
* cam_debugfs_lookup_subdir()
*
* @brief: lookup a directory within the camera debugfs root folder
*
* @name: name of the directory
* @subdir: pointer to the successfully found directory entry
*
* @return: 0 on success, negative on failure
*/
int cam_debugfs_lookup_subdir(const char *name, struct dentry **subdir);
/**
* cam_debugfs_available()
*
* @brief: Check if debugfs is enabled for camera. Use this function before creating any
* debugfs entries.
*
* @return: true if enabled, false otherwise
*/
static inline bool cam_debugfs_available(void)
{
#if defined(CONFIG_DEBUG_FS)
return true;
#else
return false;
#endif
}
#endif /* _CAM_DEBUG_UTIL_H_ */