|
@@ -1,6 +1,6 @@
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
|
|
|
|
|
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
|
|
*/
|
|
*/
|
|
|
|
|
|
#include "cam_csiphy_dev.h"
|
|
#include "cam_csiphy_dev.h"
|
|
@@ -10,6 +10,8 @@
|
|
#include <media/cam_sensor.h>
|
|
#include <media/cam_sensor.h>
|
|
#include "camera_main.h"
|
|
#include "camera_main.h"
|
|
|
|
|
|
|
|
+static struct dentry *root_dentry;
|
|
|
|
+
|
|
static void cam_csiphy_subdev_handle_message(
|
|
static void cam_csiphy_subdev_handle_message(
|
|
struct v4l2_subdev *sd,
|
|
struct v4l2_subdev *sd,
|
|
enum cam_subdev_message_type_t message_type,
|
|
enum cam_subdev_message_type_t message_type,
|
|
@@ -29,6 +31,51 @@ static void cam_csiphy_subdev_handle_message(
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int cam_csiphy_debug_register(struct csiphy_device *csiphy_dev)
|
|
|
|
+{
|
|
|
|
+ int rc = 0;
|
|
|
|
+ struct dentry *dbgfileptr = NULL;
|
|
|
|
+ char debugfs_name[25];
|
|
|
|
+
|
|
|
|
+ if (!csiphy_dev) {
|
|
|
|
+ CAM_ERR(CAM_CSIPHY, "null CSIPHY dev ptr");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!root_dentry) {
|
|
|
|
+ dbgfileptr = debugfs_create_dir("camera_csiphy", NULL);
|
|
|
|
+ if (!dbgfileptr) {
|
|
|
|
+ CAM_ERR(CAM_CSIPHY,
|
|
|
|
+ "Debugfs could not create directory!");
|
|
|
|
+ rc = -ENOENT;
|
|
|
|
+ goto end;
|
|
|
|
+ }
|
|
|
|
+ /* Store parent inode for cleanup in caller */
|
|
|
|
+ root_dentry = dbgfileptr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ snprintf(debugfs_name, 25, "%s%d%s", "csiphy",
|
|
|
|
+ csiphy_dev->soc_info.index,
|
|
|
|
+ "_en_irq_dump");
|
|
|
|
+ dbgfileptr = debugfs_create_bool(debugfs_name, 0644,
|
|
|
|
+ root_dentry, &csiphy_dev->enable_irq_dump);
|
|
|
|
+
|
|
|
|
+ if (IS_ERR(dbgfileptr)) {
|
|
|
|
+ if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
|
|
+ CAM_WARN(CAM_CSIPHY, "DebugFS not enabled in kernel!");
|
|
|
|
+ else
|
|
|
|
+ rc = PTR_ERR(dbgfileptr);
|
|
|
|
+ }
|
|
|
|
+end:
|
|
|
|
+ return rc;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void cam_csiphy_debug_unregister(void)
|
|
|
|
+{
|
|
|
|
+ debugfs_remove_recursive(root_dentry);
|
|
|
|
+ root_dentry = NULL;
|
|
|
|
+}
|
|
|
|
+
|
|
static long cam_csiphy_subdev_ioctl(struct v4l2_subdev *sd,
|
|
static long cam_csiphy_subdev_ioctl(struct v4l2_subdev *sd,
|
|
unsigned int cmd, void *arg)
|
|
unsigned int cmd, void *arg)
|
|
{
|
|
{
|
|
@@ -212,6 +259,7 @@ static int cam_csiphy_component_bind(struct device *dev,
|
|
cpas_parms.userdata = new_csiphy_dev;
|
|
cpas_parms.userdata = new_csiphy_dev;
|
|
|
|
|
|
strlcpy(cpas_parms.identifier, "csiphy", CAM_HW_IDENTIFIER_LENGTH);
|
|
strlcpy(cpas_parms.identifier, "csiphy", CAM_HW_IDENTIFIER_LENGTH);
|
|
|
|
+
|
|
rc = cam_cpas_register_client(&cpas_parms);
|
|
rc = cam_cpas_register_client(&cpas_parms);
|
|
if (rc) {
|
|
if (rc) {
|
|
CAM_ERR(CAM_CSIPHY, "CPAS registration failed rc: %d", rc);
|
|
CAM_ERR(CAM_CSIPHY, "CPAS registration failed rc: %d", rc);
|
|
@@ -227,6 +275,9 @@ static int cam_csiphy_component_bind(struct device *dev,
|
|
|
|
|
|
CAM_DBG(CAM_CSIPHY, "%s component bound successfully",
|
|
CAM_DBG(CAM_CSIPHY, "%s component bound successfully",
|
|
pdev->name);
|
|
pdev->name);
|
|
|
|
+
|
|
|
|
+ cam_csiphy_debug_register(new_csiphy_dev);
|
|
|
|
+
|
|
return rc;
|
|
return rc;
|
|
|
|
|
|
csiphy_unregister_subdev:
|
|
csiphy_unregister_subdev:
|
|
@@ -246,6 +297,7 @@ static void cam_csiphy_component_unbind(struct device *dev,
|
|
struct v4l2_subdev *subdev = platform_get_drvdata(pdev);
|
|
struct v4l2_subdev *subdev = platform_get_drvdata(pdev);
|
|
struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(subdev);
|
|
struct csiphy_device *csiphy_dev = v4l2_get_subdevdata(subdev);
|
|
|
|
|
|
|
|
+ cam_csiphy_debug_unregister();
|
|
CAM_INFO(CAM_CSIPHY, "Unbind CSIPHY component");
|
|
CAM_INFO(CAM_CSIPHY, "Unbind CSIPHY component");
|
|
cam_cpas_unregister_client(csiphy_dev->cpas_handle);
|
|
cam_cpas_unregister_client(csiphy_dev->cpas_handle);
|
|
cam_csiphy_soc_release(csiphy_dev);
|
|
cam_csiphy_soc_release(csiphy_dev);
|