|
@@ -12,6 +12,7 @@
|
|
|
#define CCI_MAX_DELAY 1000000
|
|
|
|
|
|
static struct v4l2_subdev *g_cci_subdev[MAX_CCI];
|
|
|
+static struct dentry *debugfs_root;
|
|
|
|
|
|
struct v4l2_subdev *cam_cci_get_subdev(int cci_dev_index)
|
|
|
{
|
|
@@ -233,6 +234,8 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
|
|
|
CAM_ERR(CAM_CCI,
|
|
|
"Base:%pK,cci: %d, M0_Q0 NACK ERROR: 0x%x",
|
|
|
base, cci_dev->soc_info.index, irq_status0);
|
|
|
+ cam_cci_dump_registers(cci_dev, MASTER_0,
|
|
|
+ QUEUE_0);
|
|
|
complete_all(&cci_dev->cci_master_info[MASTER_0]
|
|
|
.report_q[QUEUE_0]);
|
|
|
}
|
|
@@ -240,6 +243,8 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
|
|
|
CAM_ERR(CAM_CCI,
|
|
|
"Base:%pK,cci: %d, M0_Q1 NACK ERROR: 0x%x",
|
|
|
base, cci_dev->soc_info.index, irq_status0);
|
|
|
+ cam_cci_dump_registers(cci_dev, MASTER_0,
|
|
|
+ QUEUE_1);
|
|
|
complete_all(&cci_dev->cci_master_info[MASTER_0]
|
|
|
.report_q[QUEUE_1]);
|
|
|
}
|
|
@@ -261,6 +266,8 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
|
|
|
CAM_ERR(CAM_CCI,
|
|
|
"Base:%pK, cci: %d, M1_Q0 NACK ERROR: 0x%x",
|
|
|
base, cci_dev->soc_info.index, irq_status0);
|
|
|
+ cam_cci_dump_registers(cci_dev, MASTER_1,
|
|
|
+ QUEUE_0);
|
|
|
complete_all(&cci_dev->cci_master_info[MASTER_1]
|
|
|
.report_q[QUEUE_0]);
|
|
|
}
|
|
@@ -268,6 +275,8 @@ irqreturn_t cam_cci_irq(int irq_num, void *data)
|
|
|
CAM_ERR(CAM_CCI,
|
|
|
"Base:%pK, cci: %d, M1_Q1 NACK ERROR: 0x%x",
|
|
|
base, cci_dev->soc_info.index, irq_status0);
|
|
|
+ cam_cci_dump_registers(cci_dev, MASTER_1,
|
|
|
+ QUEUE_1);
|
|
|
complete_all(&cci_dev->cci_master_info[MASTER_1]
|
|
|
.report_q[QUEUE_1]);
|
|
|
}
|
|
@@ -372,6 +381,70 @@ static const struct v4l2_subdev_ops cci_subdev_ops = {
|
|
|
|
|
|
static const struct v4l2_subdev_internal_ops cci_subdev_intern_ops;
|
|
|
|
|
|
+static int cam_cci_get_debug(void *data, u64 *val)
|
|
|
+{
|
|
|
+ struct cci_device *cci_dev = (struct cci_device *)data;
|
|
|
+
|
|
|
+ *val = cci_dev->dump_en;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+static int cam_cci_set_debug(void *data, u64 val)
|
|
|
+{
|
|
|
+ struct cci_device *cci_dev = (struct cci_device *)data;
|
|
|
+
|
|
|
+ cci_dev->dump_en = val;
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+DEFINE_DEBUGFS_ATTRIBUTE(cam_cci_debug,
|
|
|
+ cam_cci_get_debug,
|
|
|
+ cam_cci_set_debug, "%16llu\n");
|
|
|
+
|
|
|
+static int cam_cci_create_debugfs_entry(struct cci_device *cci_dev)
|
|
|
+{
|
|
|
+ int rc = 0;
|
|
|
+ struct dentry *dbgfileptr = NULL;
|
|
|
+
|
|
|
+ if (!debugfs_root) {
|
|
|
+ dbgfileptr = debugfs_create_dir("cam_cci", NULL);
|
|
|
+ if (!dbgfileptr) {
|
|
|
+ CAM_ERR(CAM_CCI, "debugfs directory creation fail");
|
|
|
+ rc = -ENOENT;
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+ debugfs_root = dbgfileptr;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cci_dev->soc_info.index == 0) {
|
|
|
+ dbgfileptr = debugfs_create_file("en_dump_cci0", 0644,
|
|
|
+ debugfs_root, cci_dev, &cam_cci_debug);
|
|
|
+ if (IS_ERR(dbgfileptr)) {
|
|
|
+ if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
|
+ CAM_WARN(CAM_CCI, "DebugFS not enabled");
|
|
|
+ else {
|
|
|
+ rc = PTR_ERR(dbgfileptr);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ dbgfileptr = debugfs_create_file("en_dump_cci1", 0644,
|
|
|
+ debugfs_root, cci_dev, &cam_cci_debug);
|
|
|
+ if (IS_ERR(dbgfileptr)) {
|
|
|
+ if (PTR_ERR(dbgfileptr) == -ENODEV)
|
|
|
+ CAM_WARN(CAM_CCI, "DebugFS not enabled");
|
|
|
+ else {
|
|
|
+ rc = PTR_ERR(dbgfileptr);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+end:
|
|
|
+ return rc;
|
|
|
+}
|
|
|
+
|
|
|
static int cam_cci_component_bind(struct device *dev,
|
|
|
struct device *master_dev, void *data)
|
|
|
{
|
|
@@ -447,6 +520,12 @@ static int cam_cci_component_bind(struct device *dev,
|
|
|
CAM_DBG(CAM_CCI, "CPAS registration successful handle=%d",
|
|
|
cpas_parms.client_handle);
|
|
|
new_cci_dev->cpas_handle = cpas_parms.client_handle;
|
|
|
+
|
|
|
+ rc = cam_cci_create_debugfs_entry(new_cci_dev);
|
|
|
+ if (rc) {
|
|
|
+ CAM_WARN(CAM_CCI, "debugfs creation failed");
|
|
|
+ rc = 0;
|
|
|
+ }
|
|
|
CAM_DBG(CAM_CCI, "Component bound successfully");
|
|
|
return rc;
|
|
|
|
|
@@ -468,6 +547,7 @@ static void cam_cci_component_unbind(struct device *dev,
|
|
|
v4l2_get_subdevdata(subdev);
|
|
|
|
|
|
cam_cpas_unregister_client(cci_dev->cpas_handle);
|
|
|
+ debugfs_remove_recursive(debugfs_root);
|
|
|
cam_cci_soc_remove(pdev, cci_dev);
|
|
|
rc = cam_unregister_subdev(&(cci_dev->v4l2_dev_str));
|
|
|
if (rc < 0)
|