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

Commit e7a8ed4c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: add one property to fix same sensor probe issue."

parents 4fe9f77e c182a1bf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ Optional properties:
   property should contain phandle of respective eeprom nodes
- qcom,ois-src : if optical image stabilization is supported by this sensor,
   this property should contain phandle of respective ois node
- qcom,special-support-sensors: if only some special sensors are supported
   on this board, add sensor name in this property.

* Qualcomm MSM ACTUATOR

+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -209,6 +209,7 @@
		cell-index = <0>;
		compatible = "qcom,camera";
		reg = <0x0>;
		qcom,special-support-sensors="ov13850_q13v06k";
		qcom,csiphy-sd-index = <0>;
		qcom,csid-sd-index = <0>;
		qcom,mount-angle = <90>;
+58 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -625,6 +625,23 @@ static void msm_sensor_fill_sensor_info(struct msm_sensor_ctrl_t *s_ctrl,
}

/* static function definition */
int32_t msm_sensor_driver_is_special_support(
	struct msm_sensor_ctrl_t *s_ctrl,
	char* sensor_name)
{
	int32_t rc = FALSE;
	int32_t i = 0;
	struct msm_camera_sensor_board_info *sensordata = s_ctrl->sensordata;
	for (i = 0; i < sensordata->special_support_size; i++) {
		if (!strcmp(sensordata->special_support_sensors[i],
			sensor_name)) {
			rc = TRUE;
			break ;
		}
	}
	return rc;
}

int32_t msm_sensor_driver_probe(void *setting,
	struct msm_sensor_info_t *probed_info, char *entity_name)
{
@@ -765,6 +782,16 @@ int32_t msm_sensor_driver_probe(void *setting,
		goto free_slave_info;
	}

	if (s_ctrl->sensordata->special_support_size > 0) {
		if (!msm_sensor_driver_is_special_support(s_ctrl,
			slave_info->sensor_name)) {
			pr_err("%s:%s is not support on this board\n",
				__func__, slave_info->sensor_name);
			rc = 0;
			goto free_slave_info;
		}
	}

	rc = msm_sensor_get_power_settings(setting, slave_info,
		&s_ctrl->sensordata->power_info);
	if (rc < 0) {
@@ -1010,6 +1037,7 @@ static int32_t msm_sensor_driver_get_dt_data(struct msm_sensor_ctrl_t *s_ctrl)
	struct msm_camera_sensor_board_info *sensordata = NULL;
	struct device_node                  *of_node = s_ctrl->of_node;
	uint32_t                             cell_id;
	int32_t                              i;

	s_ctrl->sensordata = kzalloc(sizeof(*sensordata), GFP_KERNEL);
	if (!s_ctrl->sensordata) {
@@ -1044,6 +1072,34 @@ static int32_t msm_sensor_driver_get_dt_data(struct msm_sensor_ctrl_t *s_ctrl)
		goto FREE_SENSOR_DATA;
	}

	sensordata->special_support_size =
		of_property_count_strings(of_node, "qcom,special-support-sensors");

	if (sensordata->special_support_size < 0)
		sensordata->special_support_size = 0;

	if (sensordata->special_support_size > MAX_SPECIAL_SUPPORT_SIZE) {
		pr_err("%s:support_size exceed max support size\n",__func__);
		sensordata->special_support_size = MAX_SPECIAL_SUPPORT_SIZE;
	}

	if (sensordata->special_support_size) {
		for( i = 0; i < sensordata->special_support_size; i++) {
			rc = of_property_read_string_index(of_node,
				"qcom,special-support-sensors", i,
				&(sensordata->special_support_sensors[i]));
			if(rc < 0 ) {
				/* if read sensor support names failed,
				*   set support all sensors, break;
				*/
				sensordata->special_support_size = 0;
				break ;
			}
			CDBG("%s special_support_sensors[%d] = %s\n", __func__,
				i, sensordata->special_support_sensors[i]);
		}
	}

	/* Read subdev info */
	rc = msm_sensor_get_sub_module_index(of_node, &sensordata->sensor_info);
	if (rc < 0) {
+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -19,6 +19,7 @@
#include <linux/of_platform.h>
#include <linux/of_device.h>
#include <linux/of.h>
#define MAX_SPECIAL_SUPPORT_SIZE 10

enum msm_camera_device_type_t {
	MSM_CAMERA_I2C_DEVICE,
@@ -93,6 +94,8 @@ struct msm_camera_sensor_board_info {
	const char *eeprom_name;
	const char *actuator_name;
	const char *ois_name;
	const char *special_support_sensors[MAX_SPECIAL_SUPPORT_SIZE];
	int32_t special_support_size ;
	struct msm_camera_slave_info *slave_info;
	struct msm_camera_csi_lane_params *csi_lane_params;
	struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;
+4 −2
Original line number Diff line number Diff line
/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -19,7 +19,7 @@
#include <linux/of_platform.h>
#include <linux/of_device.h>
#include <linux/of.h>

#define MAX_SPECIAL_SUPPORT_SIZE 10

enum msm_camera_device_type_t {
	MSM_CAMERA_I2C_DEVICE,
@@ -147,6 +147,8 @@ struct msm_camera_sensor_board_info {
	const char *eeprom_name;
	const char *actuator_name;
	const char *ois_name;
	const char *special_support_sensors[MAX_SPECIAL_SUPPORT_SIZE];
	int32_t special_support_size;
	struct msm_camera_slave_info *slave_info;
	struct msm_camera_csi_lane_params *csi_lane_params;
	struct msm_camera_sensor_strobe_flash_data *strobe_flash_data;