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

Commit 0fcdf68e authored by illa lakshmi soujanya's avatar illa lakshmi soujanya Committed by Sridhar Gujje
Browse files

msm: camera: sensor: Add changes to prevent unmap buffers



The function cam_mem_mgr_release can unmap buffers when in use.
This change with cam_mem_put_cpu_buf prevents unmaping the buffers in use.

CRs-Fixed: 3489559
Change-Id: I9c4e284c5961a2eb4ff0df362c93d6cea7d77cab
Signed-off-by: default avatarilla lakshmi soujanya <quic_illa@quicinc.com>
parent 1e66a744
Loading
Loading
Loading
Loading
+3 −1
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) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -564,6 +564,7 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl,
				}
				break;
			}
			cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
		}

		if (a_ctrl->cam_act_state == CAM_ACTUATOR_ACQUIRE) {
@@ -733,6 +734,7 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl,
	}

end:
	cam_mem_put_cpu_buf(config.packet_handle);
	return rc;
}

+5 −1
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) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -363,6 +364,8 @@ int32_t cam_cmd_buf_parser(struct csiphy_device *csiphy_dev,
		csiphy_dev->csiphy_info[index].data_rate,
		csiphy_dev->csiphy_info[index].mipi_flags);

	cam_mem_put_cpu_buf(cmd_desc->mem_handle);
	cam_mem_put_cpu_buf(cfg_dev->packet_handle);
	return rc;

reset_settings:
@@ -374,7 +377,8 @@ int32_t cam_cmd_buf_parser(struct csiphy_device *csiphy_dev,
	csiphy_dev->csiphy_info[index].mipi_flags = 0;
	csiphy_dev->csiphy_info[index].secure_mode = 0;
	csiphy_dev->csiphy_info[index].hdl_data.device_hdl = -1;

	cam_mem_put_cpu_buf(cfg_dev->packet_handle);
	cam_mem_put_cpu_buf(cmd_desc->mem_handle);
	return rc;
}

+9 −1
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) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -891,9 +891,12 @@ static int32_t cam_eeprom_parse_write_memory_packet(
				break;
			}
		}
		cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
	}
	return rc;

end:
	cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
	return rc;
}

@@ -1050,9 +1053,12 @@ static int32_t cam_eeprom_init_pkt_parser(struct cam_eeprom_ctrl_t *e_ctrl,
			}
		}
		e_ctrl->cal_data.num_map = num_map + 1;
		cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
	}
	return rc;

end:
	cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
	return rc;
}

@@ -1122,6 +1128,7 @@ static int32_t cam_eeprom_get_cal_data(struct cam_eeprom_ctrl_t *e_ctrl,
				e_ctrl->cal_data.num_data);
			memcpy(read_buffer, e_ctrl->cal_data.mapdata,
					e_ctrl->cal_data.num_data);
			cam_mem_put_cpu_buf(io_cfg->mem_handle[0]);
		} else {
			CAM_ERR(CAM_EEPROM, "Invalid direction");
			rc = -EINVAL;
@@ -1370,6 +1377,7 @@ static int32_t cam_eeprom_pkt_parse(struct cam_eeprom_ctrl_t *e_ctrl, void *arg)
		break;
	}

	cam_mem_put_cpu_buf(dev_config.packet_handle);
	return rc;
power_down:
	cam_eeprom_power_down(e_ctrl);
+9 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -1214,6 +1215,7 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)

				break;
			}
			cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
		}
		power_info = &fctrl->power_info;
		if (!power_info) {
@@ -1363,6 +1365,7 @@ int cam_flash_i2c_pkt_parser(struct cam_flash_ctrl *fctrl, void *arg)
			fctrl->bridge_intf.crm_cb->add_req(&add_req);
		CAM_DBG(CAM_FLASH, "add req to req_mgr= %lld", add_req.req_id);
	}
	cam_mem_put_cpu_buf(config.packet_handle);
	return rc;
}

@@ -1547,6 +1550,8 @@ int cam_flash_pmic_gpio_pkt_parser(
			rc = -EINVAL;
			return rc;
		}

		cam_mem_put_cpu_buf(cmd_desc->mem_handle);
		break;
	}
	case CAM_FLASH_PACKET_OPCODE_SET_OPS: {
@@ -1643,6 +1648,8 @@ int cam_flash_pmic_gpio_pkt_parser(
			rc = -EINVAL;
			return rc;
		}

		cam_mem_put_cpu_buf(cmd_desc->mem_handle);
		break;
	}
	case CAM_FLASH_PACKET_OPCODE_NON_REALTIME_SET_OPS: {
@@ -1792,6 +1799,7 @@ int cam_flash_pmic_gpio_pkt_parser(
			return rc;
		}

		cam_mem_put_cpu_buf(cmd_desc->mem_handle);
		break;
	}
	case CAM_PKT_NOP_OPCODE: {
@@ -1840,6 +1848,7 @@ int cam_flash_pmic_gpio_pkt_parser(
		CAM_DBG(CAM_FLASH, "add req to req_mgr= %lld", add_req.req_id);
	}

	cam_mem_put_cpu_buf(config.packet_handle);
	return rc;
}

+3 −1
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) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/module.h>
@@ -571,6 +571,7 @@ static int cam_ois_pkt_parse(struct cam_ois_ctrl_t *o_ctrl, void *arg)
			}
			break;
			}
			cam_mem_put_cpu_buf(cmd_desc[i].mem_handle);
		}

		if (o_ctrl->cam_ois_state != CAM_OIS_CONFIG) {
@@ -729,6 +730,7 @@ static int cam_ois_pkt_parse(struct cam_ois_ctrl_t *o_ctrl, void *arg)
			(csl_packet->header.op_code & 0xFFFFFF));
		return -EINVAL;
	}
	cam_mem_put_cpu_buf(dev_config.packet_handle);

	if (!rc)
		return rc;
Loading