mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
msm: camera: flash: Add support for I2C flash
- Add Regulator power up for I2C flash - Add GPIO support in probe call for I2C flash - Add flash type in query capability call of flash. CRs-Fixed: 2938804 Change-Id: I7d5575ecdf4c1c3b329e6bf49586771e37611e5a Signed-off-by: shiwgupt <shiwgupt@codeaurora.org>
This commit is contained in:
parent
d313b62f5e
commit
de2b0fb94b
5 changed files with 34 additions and 4 deletions
|
|
@ -133,7 +133,8 @@ static int32_t cam_flash_driver_cmd(struct cam_flash_ctrl *fctrl,
|
|||
struct cam_flash_query_cap_info flash_cap = {0};
|
||||
|
||||
CAM_DBG(CAM_FLASH, "CAM_QUERY_CAP");
|
||||
flash_cap.slot_info = fctrl->soc_info.index;
|
||||
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];
|
||||
|
|
@ -390,6 +391,7 @@ static int cam_flash_component_bind(struct device *dev,
|
|||
struct cam_flash_ctrl *fctrl = NULL;
|
||||
struct device_node *of_parent = NULL;
|
||||
struct platform_device *pdev = to_platform_device(dev);
|
||||
struct cam_hw_soc_info *soc_info = NULL;
|
||||
|
||||
CAM_DBG(CAM_FLASH, "Binding flash component");
|
||||
if (!pdev->dev.of_node) {
|
||||
|
|
@ -445,6 +447,19 @@ static int cam_flash_component_bind(struct device *dev,
|
|||
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;
|
||||
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;
|
||||
}
|
||||
rc = cam_sensor_util_regulator_powerup(soc_info);
|
||||
if (rc < 0) {
|
||||
CAM_ERR(CAM_FLASH, "regulator power up for flash failed %d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
fctrl->i2c_data.per_frame =
|
||||
kzalloc(sizeof(struct i2c_settings_array) *
|
||||
MAX_PER_FRAME_ARRAY, GFP_KERNEL);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef _CAM_FLASH_DEV_H_
|
||||
|
|
@ -30,6 +30,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"
|
||||
|
|
@ -137,6 +138,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 {
|
||||
|
|
@ -149,6 +151,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 {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// 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/of.h>
|
||||
|
|
@ -73,6 +73,12 @@ 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);
|
||||
}
|
||||
|
||||
switch_src_node = of_parse_phandle(of_node, "switch-source", 0);
|
||||
if (!switch_src_node) {
|
||||
CAM_WARN(CAM_FLASH, "switch_src_node NULL");
|
||||
|
|
|
|||
|
|
@ -2407,6 +2407,10 @@ int cam_sensor_util_power_down(struct cam_sensor_power_ctrl_t *ctrl,
|
|||
case SENSOR_CUSTOM_GPIO1:
|
||||
case SENSOR_CUSTOM_GPIO2:
|
||||
|
||||
if (!gpio_num_info) {
|
||||
CAM_ERR(CAM_SENSOR, "failed: No gpio");
|
||||
continue;
|
||||
}
|
||||
if (!gpio_num_info->valid[pd->seq_type])
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
|
||||
/*
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __UAPI_CAM_SENSOR_H__
|
||||
|
|
@ -476,6 +476,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 {
|
||||
|
|
@ -483,6 +484,7 @@ struct cam_flash_query_cap_info {
|
|||
__u32 max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS];
|
||||
__u32 max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS];
|
||||
__u32 max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS];
|
||||
__u32 flash_type;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue