msm: camera: Add parsing of LED flash property
Add parsing of LED flash property in camera sensor driver. If camera
sensor supports LED flash functionality, led-flash-src property
shall point to phandle of respective LED flash device.
Change-Id: Ic94c166d02cd77cff68dff427c5706b267eb7714
Signed-off-by: Sreesudhan Ramakrish Ramkumar <srramku@codeaurora.org>
diff --git a/Documentation/devicetree/bindings/media/video/msm-cci.txt b/Documentation/devicetree/bindings/media/video/msm-cci.txt
index 6309068..1a034dd 100644
--- a/Documentation/devicetree/bindings/media/video/msm-cci.txt
+++ b/Documentation/devicetree/bindings/media/video/msm-cci.txt
@@ -131,7 +131,8 @@
- 1 -> MASTER 1
- qcom,actuator-src : if auto focus is supported by this sensor, this
property should contain phandle of respective actuator node
-
+- qcom,led-flash-src : if LED flash is supported by this sensor, this
+ property should contain phandle of respective LED flash node
* Qualcomm MSM ACTUATOR
Required properties:
@@ -191,6 +192,7 @@
qcom,csiphy-sd-index = <2>;
qcom,csid-sd-index = <0>;
qcom,actuator-src = <&actuator0>;
+ qcom,led-flash-src = <&led_flash0>;
qcom,mount-angle = <90>;
qcom,sensor-name = "s5k3l1yx";
cam_vdig-supply = <&pm8941_l3>;
diff --git a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
index 9062a9c..453b14a 100644
--- a/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
+++ b/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
@@ -90,17 +90,21 @@
sensordata->sensor_info->subdev_id[SUB_MODULE_EEPROM] = val;
}
- if (of_property_read_bool(of_node, "qcom,led-flash-sd-index") ==
- true) {
- rc = of_property_read_u32(of_node, "qcom,led-flash-sd-index",
- &val);
- CDBG("%s qcom,led-flash-sd-index %d, rc %d\n", __func__, val,
- rc);
+ src_node = of_parse_phandle(of_node, "qcom,led-flash-src", 0);
+ if (!src_node) {
+ CDBG("%s:%d src_node NULL\n", __func__, __LINE__);
+ } else {
+ rc = of_property_read_u32(src_node, "cell-index", &val);
+ CDBG("%s qcom,led flash cell index %d, rc %d\n", __func__,
+ val, rc);
if (rc < 0) {
- pr_err("%s:%d failed rc %d\n", __func__, __LINE__, rc);
+ pr_err("%s:%d failed %d\n", __func__, __LINE__, rc);
goto ERROR;
}
- sensordata->sensor_info->subdev_id[SUB_MODULE_LED_FLASH] = val;
+ sensordata->sensor_info->
+ subdev_id[SUB_MODULE_LED_FLASH] = val;
+ of_node_put(src_node);
+ src_node = NULL;
}
if (of_property_read_bool(of_node, "qcom,strobe-flash-sd-index") ==