Loading drivers/cam_sensor_module/cam_flash/cam_flash_dev.c +25 −4 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -131,6 +131,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl, CAM_DBG(CAM_FLASH, "CAM_QUERY_CAP"); flash_cap.slot_info = fctrl->soc_info.index; flash_cap.flash_type = soc_private->flash_type; for (i = 0; i < fctrl->flash_num_sources; i++) { flash_cap.max_current_flash[i] = soc_private->flash_max_current[i]; Loading Loading @@ -403,6 +404,7 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev) int32_t rc = 0, i = 0; struct cam_flash_ctrl *fctrl = NULL; struct device_node *of_parent = NULL; struct cam_hw_soc_info *soc_info = NULL; CAM_DBG(CAM_FLASH, "Enter"); if (!pdev->dev.of_node) { Loading Loading @@ -458,6 +460,25 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev) fctrl->io_master_info.cci_client->cci_device = fctrl->cci_num; CAM_DBG(CAM_FLASH, "cci-index %d", fctrl->cci_num, rc); soc_info = &fctrl->soc_info; if (!soc_info->gpio_data) { CAM_INFO(CAM_FLASH, "No GPIO found"); rc = 0; return rc; } if (!soc_info->gpio_data->cam_gpio_common_tbl_size) { CAM_INFO(CAM_FLASH, "No GPIO found"); return -EINVAL; } rc = cam_sensor_util_init_gpio_pin_tbl(soc_info, &fctrl->power_info.gpio_num_info); if ((rc < 0) || (!fctrl->power_info.gpio_num_info)) { CAM_ERR(CAM_FLASH, "No/Error Flash GPIOs"); return -EINVAL; } fctrl->i2c_data.per_frame = kzalloc(sizeof(struct i2c_settings_array) * MAX_PER_FRAME_ARRAY, GFP_KERNEL); Loading drivers/cam_sensor_module/cam_flash/cam_flash_dev.h +4 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved. */ #ifndef _CAM_FLASH_DEV_H_ Loading @@ -24,6 +24,7 @@ #include "cam_subdev.h" #include "cam_mem_mgr.h" #include "cam_sensor_cmn_header.h" #include "cam_sensor_util.h" #include "cam_soc_util.h" #include "cam_debug_util.h" #include "cam_sensor_io.h" Loading Loading @@ -130,6 +131,7 @@ struct cam_flash_frame_setting { * @torch_op_current : Torch operational current * @torch_max_current : Max supported current for LED in torch mode * @is_wled_flash : Detection between WLED/LED flash * @flash_type : Flash type */ struct cam_flash_private_soc { Loading @@ -142,6 +144,7 @@ struct cam_flash_private_soc { uint32_t torch_op_current[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t torch_max_current[CAM_FLASH_MAX_LED_TRIGGERS]; bool is_wled_flash; uint32_t flash_type; }; struct cam_flash_func_tbl { Loading drivers/cam_sensor_module/cam_flash/cam_flash_soc.c +9 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2018, 2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, 2020, 2021 The Linux Foundation. All rights reserved. */ #include <linux/of.h> #include <linux/of_gpio.h> #include "cam_flash_soc.h" #include "cam_res_mgr_api.h" #include <dt-bindings/msm/msm-camera.h> static int32_t cam_get_source_node_info( struct device_node *of_node, Loading @@ -22,6 +23,13 @@ static int32_t cam_get_source_node_info( soc_private->is_wled_flash = of_property_read_bool(of_node, "wled-flash-support"); rc = of_property_read_u32(of_node, "flash-type", &soc_private->flash_type); if (rc) { CAM_ERR(CAM_FLASH, "flash-type read failed rc=%d", rc); soc_private->flash_type = CAM_FLASH_TYPE_PMIC; } switch_src_node = of_parse_phandle(of_node, "switch-source", 0); if (!switch_src_node) { CAM_WARN(CAM_FLASH, "switch_src_node NULL"); Loading include/uapi/media/cam_sensor.h +3 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved. */ #ifndef __UAPI_CAM_SENSOR_H__ Loading Loading @@ -474,6 +474,7 @@ struct cam_flash_query_curr { * @max_current_flash : max supported current for flash * @max_duration_flash : max flash turn on duration * @max_current_torch : max supported current for torch * @flash_type : Indicates about the flash type -I2C,GPIO,PMIC * */ struct cam_flash_query_cap_info { Loading @@ -481,6 +482,7 @@ struct cam_flash_query_cap_info { uint32_t max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t flash_type; } __attribute__ ((packed)); #endif Loading
drivers/cam_sensor_module/cam_flash/cam_flash_dev.c +25 −4 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include <linux/module.h> Loading Loading @@ -131,6 +131,7 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl, CAM_DBG(CAM_FLASH, "CAM_QUERY_CAP"); flash_cap.slot_info = fctrl->soc_info.index; flash_cap.flash_type = soc_private->flash_type; for (i = 0; i < fctrl->flash_num_sources; i++) { flash_cap.max_current_flash[i] = soc_private->flash_max_current[i]; Loading Loading @@ -403,6 +404,7 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev) int32_t rc = 0, i = 0; struct cam_flash_ctrl *fctrl = NULL; struct device_node *of_parent = NULL; struct cam_hw_soc_info *soc_info = NULL; CAM_DBG(CAM_FLASH, "Enter"); if (!pdev->dev.of_node) { Loading Loading @@ -458,6 +460,25 @@ static int32_t cam_flash_platform_probe(struct platform_device *pdev) fctrl->io_master_info.cci_client->cci_device = fctrl->cci_num; CAM_DBG(CAM_FLASH, "cci-index %d", fctrl->cci_num, rc); soc_info = &fctrl->soc_info; if (!soc_info->gpio_data) { CAM_INFO(CAM_FLASH, "No GPIO found"); rc = 0; return rc; } if (!soc_info->gpio_data->cam_gpio_common_tbl_size) { CAM_INFO(CAM_FLASH, "No GPIO found"); return -EINVAL; } rc = cam_sensor_util_init_gpio_pin_tbl(soc_info, &fctrl->power_info.gpio_num_info); if ((rc < 0) || (!fctrl->power_info.gpio_num_info)) { CAM_ERR(CAM_FLASH, "No/Error Flash GPIOs"); return -EINVAL; } fctrl->i2c_data.per_frame = kzalloc(sizeof(struct i2c_settings_array) * MAX_PER_FRAME_ARRAY, GFP_KERNEL); Loading
drivers/cam_sensor_module/cam_flash/cam_flash_dev.h +4 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2019, 2021 The Linux Foundation. All rights reserved. */ #ifndef _CAM_FLASH_DEV_H_ Loading @@ -24,6 +24,7 @@ #include "cam_subdev.h" #include "cam_mem_mgr.h" #include "cam_sensor_cmn_header.h" #include "cam_sensor_util.h" #include "cam_soc_util.h" #include "cam_debug_util.h" #include "cam_sensor_io.h" Loading Loading @@ -130,6 +131,7 @@ struct cam_flash_frame_setting { * @torch_op_current : Torch operational current * @torch_max_current : Max supported current for LED in torch mode * @is_wled_flash : Detection between WLED/LED flash * @flash_type : Flash type */ struct cam_flash_private_soc { Loading @@ -142,6 +144,7 @@ struct cam_flash_private_soc { uint32_t torch_op_current[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t torch_max_current[CAM_FLASH_MAX_LED_TRIGGERS]; bool is_wled_flash; uint32_t flash_type; }; struct cam_flash_func_tbl { Loading
drivers/cam_sensor_module/cam_flash/cam_flash_soc.c +9 −1 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2018, 2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2018, 2020, 2021 The Linux Foundation. All rights reserved. */ #include <linux/of.h> #include <linux/of_gpio.h> #include "cam_flash_soc.h" #include "cam_res_mgr_api.h" #include <dt-bindings/msm/msm-camera.h> static int32_t cam_get_source_node_info( struct device_node *of_node, Loading @@ -22,6 +23,13 @@ static int32_t cam_get_source_node_info( soc_private->is_wled_flash = of_property_read_bool(of_node, "wled-flash-support"); rc = of_property_read_u32(of_node, "flash-type", &soc_private->flash_type); if (rc) { CAM_ERR(CAM_FLASH, "flash-type read failed rc=%d", rc); soc_private->flash_type = CAM_FLASH_TYPE_PMIC; } switch_src_node = of_parse_phandle(of_node, "switch-source", 0); if (!switch_src_node) { CAM_WARN(CAM_FLASH, "switch_src_node NULL"); Loading
include/uapi/media/cam_sensor.h +3 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved. */ #ifndef __UAPI_CAM_SENSOR_H__ Loading Loading @@ -474,6 +474,7 @@ struct cam_flash_query_curr { * @max_current_flash : max supported current for flash * @max_duration_flash : max flash turn on duration * @max_current_torch : max supported current for torch * @flash_type : Indicates about the flash type -I2C,GPIO,PMIC * */ struct cam_flash_query_cap_info { Loading @@ -481,6 +482,7 @@ struct cam_flash_query_cap_info { uint32_t max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS]; uint32_t flash_type; } __attribute__ ((packed)); #endif