Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b822d424 authored by junwen.ye's avatar junwen.ye Committed by android-t1
Browse files

[ALM:10872982] [FP4]:camera module info

 &&&%%%comment:[FP4]:camera module info
 &&&%%%bug number:10872982
 &&&%%%product name:sm7225_r_fp4
 &&&%%%root cause:coding
 &&&%%%Bug category:T2M
 &&&%%%Module_Impact:kernel
 &&&%%%Test_Suggestion:NA
 &&&%%%Solution:NA
 &&&%%%Test_Report:ok in native
 &&&%%%VAL Can Test:NA
parent 67cae93f
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -772,6 +772,10 @@ int cam_sensor_match_id(struct cam_sensor_ctrl_t *s_ctrl)
	return rc;
}

extern char main_camera_status[32];
extern char aux_camera_status[32];
extern char front_camera_status[32];

int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
	void *arg)
{
@@ -878,6 +882,25 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
			s_ctrl->sensordata->slave_info.sensor_id);

		cam_sensor_free_power_reg_rsc(s_ctrl);

		if (s_ctrl->soc_info.index == 0 && s_ctrl->sensordata->slave_info.sensor_id == 0x582)
		{
		       CAM_INFO(CAM_SENSOR, "match SONY_imx582_sma");
		       snprintf(main_camera_status, sizeof(main_camera_status), "SONY_IMX582_SMA");
		}

		if (s_ctrl->soc_info.index == 2 && s_ctrl->sensordata->slave_info.sensor_id == 0x576)
		{
		       CAM_INFO(CAM_SENSOR, "match SONY_imx576");
		       snprintf(front_camera_status, sizeof(front_camera_status), "SONY_IMX576");
		}

		if (s_ctrl->soc_info.index == 1 && s_ctrl->sensordata->slave_info.sensor_id == 0x582)
		{
		       CAM_INFO(CAM_SENSOR, "match SONY_imx582_UW");
		       snprintf(aux_camera_status, sizeof(aux_camera_status), "SONY_IMX582_UW");
		}

		rc = cam_sensor_power_down(s_ctrl);
		if (rc < 0) {
			CAM_ERR(CAM_SENSOR, "fail in Sensor Power Down");
+78 −0
Original line number Diff line number Diff line
@@ -402,6 +402,82 @@ static struct i2c_driver cam_sensor_driver_i2c = {
	},
};

char main_camera_status[32] = {0};
char aux_camera_status[32] = {0};
char front_camera_status[32] = {0};

static ssize_t main_camera_show (struct device* dev,
    struct device_attribute *attr,
    char *buf)
{
       return sprintf(buf, "%s\n", main_camera_status);
}

static DEVICE_ATTR(camera_main, S_IRUGO,
    main_camera_show,
    NULL);

static ssize_t aux_camera_show (struct device* dev,
    struct device_attribute *attr,
    char *buf)
{
       return sprintf(buf, "%s\n", aux_camera_status);
}

static DEVICE_ATTR(camera_aux, S_IRUGO,
    aux_camera_show,
    NULL);

static ssize_t front_camera_show (struct device* dev,
    struct device_attribute *attr,
    char *buf)
{
       return sprintf(buf, "%s\n", front_camera_status);
}

static DEVICE_ATTR(camera_front, S_IRUGO,
    front_camera_show,
    NULL);

struct kobject *device_sensor_module_kobj = NULL;


static int sensor_module_sysfs_init(void)
{
       int rc = 0;

       device_sensor_module_kobj = kobject_create_and_add("sensor_module", NULL);
       if (device_sensor_module_kobj == NULL) {
               pr_err("kobject_creat_and_add(/sys/sensor_module/) failed!");
               return -ENOMEM;
       }

       rc = sysfs_create_file(device_sensor_module_kobj,&dev_attr_camera_main.attr);
       if (rc) {
               pr_err("sysfs_creat_file(/sys/sensor_module/camera_main) failed!");
               goto destroy_kobj;
       }

       rc = sysfs_create_file(device_sensor_module_kobj, &dev_attr_camera_aux.attr);
       if (rc) {
               pr_err("sysfs_create_file('/sys/sensor_module/camera_aux') failed");
               goto destroy_kobj;
       }

       rc = sysfs_create_file(device_sensor_module_kobj, &dev_attr_camera_front.attr);
       if (rc) {
               pr_err("sysfs_create_file('/sys/sensor_module/camera_front') failed");
               goto destroy_kobj;
       }

               return rc;

       destroy_kobj:
               kobject_put(device_sensor_module_kobj);
               return rc;

}

static int __init cam_sensor_driver_init(void)
{
	int32_t rc = 0;
@@ -413,6 +489,8 @@ static int __init cam_sensor_driver_init(void)
		return rc;
	}

	rc = sensor_module_sysfs_init();

	rc = i2c_add_driver(&cam_sensor_driver_i2c);
	if (rc)
		CAM_ERR(CAM_SENSOR, "i2c_add_driver failed rc = %d", rc);