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

Commit e421fea5 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: common: Fixes the exit module code flow" into camera-kernel.lnx.4.0

parents eb02dbe3 279dfebf
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -2206,11 +2206,20 @@ static void cam_hw_cdm_component_unbind(struct device *dev,
		return;
	}

	if (cdm_hw->hw_state == CAM_HW_STATE_POWER_UP) {
		rc = cam_hw_cdm_deinit(cdm_hw, NULL, 0);
		if (rc) {
			CAM_ERR(CAM_CDM, "Deinit failed for hw");
			return;
		}
	}

	rc = cam_cdm_intf_deregister_hw_cdm(cdm_hw_intf,
		cdm_hw->soc_info.soc_private, CAM_HW_CDM, cdm_core->index);
	if (rc) {
		CAM_ERR(CAM_CDM,
			"HW_CDM interface deregistration failed: rd: %d", rc);
	}

	rc = cam_cpas_unregister_client(cdm_core->cpas_handle);
	if (rc) {
+3 −8
Original line number Diff line number Diff line
@@ -171,7 +171,8 @@ static int cam_icp_component_bind(struct device *dev,

	hw_mgr_intf = kzalloc(sizeof(*hw_mgr_intf), GFP_KERNEL);
	if (!hw_mgr_intf) {
		rc = -EINVAL;
		rc = -ENOMEM;
		CAM_ERR(CAM_ICP, "Memory allocation fail");
		goto hw_alloc_fail;
	}

@@ -225,7 +226,6 @@ static void cam_icp_component_unbind(struct device *dev,
{
	int i;
	struct v4l2_subdev *sd;
	struct cam_subdev *subdev;
	struct platform_device *pdev = to_platform_device(dev);

	if (!pdev) {
@@ -239,15 +239,10 @@ static void cam_icp_component_unbind(struct device *dev,
		return;
	}

	subdev = v4l2_get_subdevdata(sd);
	if (!subdev) {
		CAM_ERR(CAM_ICP, "cam subdev is NULL");
		return;
	}

	for (i = 0; i < CAM_ICP_CTX_MAX; i++)
		cam_icp_context_deinit(&g_icp_dev.ctx_icp[i]);

	cam_icp_hw_mgr_deinit();
	cam_node_deinit(g_icp_dev.node);
	cam_subdev_remove(&g_icp_dev.sd);
	mutex_destroy(&g_icp_dev.icp_lock);
+22 −2
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ static int cam_a5_component_bind(struct device *dev,
	return 0;

cpas_reg_failed:
	cam_a5_deinit_soc_resources(&a5_dev->soc_info);
init_soc_failure:
match_err:
	kfree(a5_dev->core_info);
@@ -200,9 +201,21 @@ static int cam_a5_component_bind(struct device *dev,
static void cam_a5_component_unbind(struct device *dev,
	struct device *master_dev, void *data)
{
	struct cam_hw_info *a5_dev = NULL;
	struct cam_hw_intf *a5_dev_intf = NULL;
	struct cam_a5_device_core_info *core_info = NULL;
	struct platform_device *pdev = to_platform_device(dev);

	CAM_DBG(CAM_ICP, "Unbinding component: %s", pdev->name);
	a5_dev_intf = platform_get_drvdata(pdev);
	a5_dev = a5_dev_intf->hw_priv;
	core_info = (struct cam_a5_device_core_info *)a5_dev->core_info;
	cam_cpas_unregister_client(core_info->cpas_handle);
	cam_a5_deinit_soc_resources(&a5_dev->soc_info);
	memset(&cam_a5_soc_info, 0, sizeof(struct a5_soc_info));
	kfree(a5_dev->core_info);
	a5_dev->core_info = NULL;
	kfree(a5_dev);
	kfree(a5_dev_intf);
}

const static struct component_ops cam_a5_component_ops = {
@@ -222,6 +235,12 @@ int cam_a5_probe(struct platform_device *pdev)
	return rc;
}

static int cam_a5_remove(struct platform_device *pdev)
{
	component_del(&pdev->dev, &cam_a5_component_ops);
	return 0;
}

static const struct of_device_id cam_a5_dt_match[] = {
	{
		.compatible = "qcom,cam-a5",
@@ -233,6 +252,7 @@ MODULE_DEVICE_TABLE(of, cam_a5_dt_match);

struct platform_driver cam_a5_driver = {
	.probe = cam_a5_probe,
	.remove = cam_a5_remove,
	.driver = {
		.name = "cam-a5",
		.owner = THIS_MODULE,
+10 −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-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/io.h>
@@ -174,6 +174,15 @@ int cam_a5_init_soc_resources(struct cam_hw_soc_info *soc_info,
	return rc;
}

void cam_a5_deinit_soc_resources(struct cam_hw_soc_info *soc_info)
{
	int rc = 0;

	rc = cam_soc_util_release_platform_resource(soc_info);
	if (rc)
		CAM_WARN(CAM_ICP, "release platform resources fail");
}

int cam_a5_enable_soc_resources(struct cam_hw_soc_info *soc_info)
{
	int rc = 0;
+3 −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-2020, The Linux Foundation. All rights reserved.
 */

#ifndef CAM_A5_SOC_H
@@ -30,6 +30,8 @@ struct a5_soc_info {
int cam_a5_init_soc_resources(struct cam_hw_soc_info *soc_info,
	irq_handler_t a5_irq_handler, void *irq_data);

void cam_a5_deinit_soc_resources(struct cam_hw_soc_info *soc_info);

int cam_a5_enable_soc_resources(struct cam_hw_soc_info *soc_info);

int cam_a5_disable_soc_resources(struct cam_hw_soc_info *soc_info);
Loading