Skip to content

Commit 38d6efd

Browse files
Camera Software IntegrationGerrit - the friendly Code Review server
authored andcommitted
Merge "msm: camera: cci: Add sysfs utility to control cci and sensor powerup" into camera-kernel.qclinux.1.0
2 parents ff7c91c + fe681fa commit 38d6efd

10 files changed

Lines changed: 935 additions & 7 deletions

File tree

Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ camera_$(CAMERA_ARCH)-$(CONFIG_SPECTRA_TFE) += \
496496
camera/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid.o \
497497
camera/drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.o
498498

499+
camera_$(CAMERA_ARCH)-$(CONFIG_SPECTRA_SENSOR_SYSFS_UTIL) += \
500+
camera/drivers/cam_sensor_module/cam_cci/cam_cci_sysfs_util.o
501+
499502
camera_$(CAMERA_ARCH)-y += camera/drivers/camera_main.o
500503

501504
obj-m += camera_$(CAMERA_ARCH).o

camera/drivers/cam_sensor_module/cam_cci/cam_cci_dev.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,13 @@ static int cam_cci_component_bind(struct device *dev,
770770
CAM_WARN(CAM_CCI, "debugfs creation failed");
771771
rc = 0;
772772
}
773+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
774+
if (cam_sysfs_add_cci(new_cci_dev)) {
775+
CAM_DBG(CAM_CCI, "CCI%d sysfs creation success", soc_info->index);
776+
} else {
777+
CAM_DBG(CAM_CCI, "CCI%d sysfs creation failed", soc_info->index);
778+
}
779+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
773780
head = 0;
774781
tail = 0;
775782
CAM_DBG(CAM_CCI, "Component bound successfully");
@@ -809,11 +816,13 @@ static void cam_cci_component_unbind(struct device *dev,
809816

810817
cam_cpas_unregister_client(cci_dev->cpas_handle);
811818
debugfs_root = NULL;
819+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
820+
cam_sysfs_remove_cci(cci_dev);
821+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
812822
cam_cci_soc_remove(pdev, cci_dev);
813823
rc = cam_unregister_subdev(&(cci_dev->v4l2_dev_str));
814824
if (rc < 0)
815825
CAM_ERR(CAM_CCI, "Fail with cam_unregister_subdev. rc:%d", rc);
816-
817826
devm_kfree(&pdev->dev, cci_dev);
818827
}
819828

@@ -865,6 +874,9 @@ int cam_cci_init_module(void)
865874

866875
void cam_cci_exit_module(void)
867876
{
877+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
878+
cam_sysfs_exit();
879+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
868880
platform_driver_unregister(&cci_driver);
869881
}
870882

camera/drivers/cam_sensor_module/cam_cci/cam_cci_dev.h

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0-only */
22
/*
33
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2022-2024, Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
55
*/
66

77
#ifndef _CAM_CCI_DEV_H_
@@ -181,6 +181,15 @@ enum cam_cci_state_t {
181181
CCI_STATE_DISABLED,
182182
};
183183

184+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
185+
struct cci_sysfs {
186+
int32_t master;
187+
int32_t cci_dev;
188+
struct kobject sysfs_kobj;
189+
struct mutex cci_mutex;
190+
};
191+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
192+
184193
/**
185194
* struct cci_device
186195
* @pdev: Platform device
@@ -253,6 +262,10 @@ struct cci_device {
253262
struct mutex init_mutex;
254263
uint64_t dump_en;
255264
bool is_probing;
265+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
266+
struct cci_sysfs cci_master_sysfs[MASTER_MAX];
267+
int32_t num_masters;
268+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
256269
};
257270

258271
enum cam_cci_i2c_cmd_type {
@@ -332,6 +345,17 @@ struct v4l2_subdev *cam_cci_get_subdev(int cci_dev_index);
332345
void cam_cci_dump_registers(struct cci_device *cci_dev,
333346
enum cci_i2c_master_t master, enum cci_i2c_queue_t queue);
334347

348+
#ifdef CONFIG_SPECTRA_SENSOR_SYSFS_UTIL
349+
/**
350+
* @brief : API to update client bus information.
351+
* @bus_id : cci bus id, this is basically cci cel index
352+
* @cci_dev : cci device handle
353+
* @master_id : master id of the client
354+
*/
355+
int32_t cam_cci_get_bus_info(int32_t bus_id, int32_t cci_idx,
356+
int32_t *cci_dev, int32_t *master_id);
357+
#endif /*CONFIG_SPECTRA_SENSOR_SYSFS_UTIL*/
358+
335359
/**
336360
* @brief : API to register CCI hw to platform framework.
337361
* @return struct platform_device pointer on on success, or ERR_PTR() on error.

0 commit comments

Comments
 (0)