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

Commit e9b4f498 authored by Srikanth Uyyala's avatar Srikanth Uyyala
Browse files

msm: camera_v2: Enable camera on trinket



Add smmu and bandwidth voting changes to enable camera subsystem.

Change-Id: If798c2178c73e24666cb91a58549b7d495533eae
Signed-off-by: default avatarSrikanth Uyyala <suyyala@codeaurora.org>
parent a74cb474
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1049,13 +1049,13 @@ static int cam_smmu_map_buffer_and_add_to_list(int idx, int ion_fd,
	mapping_info->attach = attach;
	mapping_info->table = table;
	mapping_info->paddr = sg_dma_address(table->sgl);
	mapping_info->len = (size_t)sg_dma_len(table->sgl);
	mapping_info->len = (size_t)buf->size;
	mapping_info->dir = dma_dir;
	mapping_info->ref_count = 1;

	/* return paddr and len to client */
	*paddr_ptr = sg_dma_address(table->sgl);
	*len_ptr = (size_t)sg_dma_len(table->sgl);
	*len_ptr = (size_t)buf->size;

	if (!*paddr_ptr || !*len_ptr) {
		pr_err("Error: Space Allocation failed!\n");
+47 −5
Original line number Diff line number Diff line
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -360,7 +360,6 @@ int msm_camera_clk_enable(struct device *dev,

	if (enable) {
		for (i = 0; i < num_clk; i++) {
			CDBG("enable %s\n", clk_info[i].clk_name);
			if (clk_info[i].clk_rate > 0) {
				clk_rate = clk_round_rate(clk_ptr[i],
					clk_info[i].clk_rate);
@@ -411,8 +410,6 @@ int msm_camera_clk_enable(struct device *dev,
	} else {
		for (i = num_clk - 1; i >= 0; i--) {
			if (clk_ptr[i] != NULL) {
				CDBG("%s disable %s\n", __func__,
					clk_info[i].clk_name);
				clk_disable_unprepare(clk_ptr[i]);
			}
		}
@@ -429,6 +426,24 @@ int msm_camera_clk_enable(struct device *dev,
}
EXPORT_SYMBOL(msm_camera_clk_enable);


int msm_camera_cpp_clk_disable(struct device *dev,
		struct msm_cam_clk_info *clk_info,
		struct clk **clk_ptr, int num_clk, int enable)
{
	int i;
	int rc = 1;

	for (i = num_clk - 1; i >= 0; i--) {
		if (clk_ptr[i] != NULL) {
			rc = strcmp(clk_info[i].clk_name, "cpp_src_clk");
			if (rc == 0)
				continue;
			clk_disable_unprepare(clk_ptr[i]);
		}
	}
	return 0;
}
/* Set rate on a specific clock */
long msm_camera_clk_set_rate(struct device *dev,
			struct clk *clk,
@@ -662,7 +677,6 @@ int msm_camera_regulator_enable(struct msm_cam_regulator *vdd_info,

	for (i = 0; i < cnt; i++) {
		if (tmp && !IS_ERR_OR_NULL(tmp->vdd)) {
			CDBG("name : %s, enable : %d\n", tmp->name, enable);
			if (enable) {
				rc = regulator_enable(tmp->vdd);
				if (rc < 0) {
@@ -691,6 +705,34 @@ int msm_camera_regulator_enable(struct msm_cam_regulator *vdd_info,
}
EXPORT_SYMBOL(msm_camera_regulator_enable);

/* disable/Disable regulators */
int msm_camera_regulator_disable(struct msm_cam_regulator *vdd_info,
				int cnt, int disable)
{
	int i;
	int rc;
	struct msm_cam_regulator *tmp = vdd_info;

	if (!tmp) {
		pr_err("Invalid params");
		return -EINVAL;
	}

	for (i = cnt; i > 0; i--) {
		if (disable) {
			rc = regulator_disable(tmp[i-1].vdd);
			if (rc < 0) {
				pr_debug("%s: %s failed %d\n",
					__func__, tmp[i-1].name, i);
				return rc;
			}
		}
	}
	return 0;
}
EXPORT_SYMBOL(msm_camera_regulator_disable);


/* set regulator mode */
int msm_camera_regulator_set_mode(struct msm_cam_regulator *vdd_info,
				int cnt, bool mode)
+14 −5
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2016, 2018-2019, The Linux Foundation.
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -172,6 +173,11 @@ int msm_camera_clk_enable(struct device *dev,
		struct clk **clk_ptr,
		int num_clk,
		int enable);

int msm_camera_cpp_clk_disable(struct device *dev,
		struct msm_cam_clk_info *clk_info,
		struct clk **clk_ptr, int num_clk, int enable);

/**
 * @brief      : Set clock rate
 *
@@ -247,6 +253,9 @@ int msm_camera_get_regulator_info(struct platform_device *pdev,
int msm_camera_regulator_enable(struct msm_cam_regulator *vdd_info,
				int cnt, int enable);


int msm_camera_regulator_disable(struct msm_cam_regulator *vdd_info,
				int cnt, int disable);
/**
 * @brief      : set the regultors mode
 *
+8 −7
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -322,7 +322,7 @@ int msm_vfe47_init_hardware(struct vfe_device *vfe_dev)
								vfe_dev, 1);
	if (rc)
		goto enable_regulators_failed;

	msm_isp_update_bandwidth(vfe_dev->pdev->id, 0x1000, 0x1000);
	rc = vfe_dev->hw_info->vfe_ops.platform_ops.enable_clks(
							vfe_dev, 1);
	if (rc)
@@ -2010,8 +2010,6 @@ void msm_vfe47_update_ping_pong_addr(
	if (buf_size < 0)
		buf_size = 0;

	paddr32_max = (paddr + buf_size) & 0xFFFFFFE0;

	msm_camera_io_w(paddr32, vfe_base +
		VFE47_PING_PONG_BASE(wm_idx, pingpong_bit));
	msm_camera_io_w(paddr32_max, vfe_base +
@@ -2517,7 +2515,7 @@ void msm_vfe47_stats_update_ping_pong_addr(
	int vfe_idx = msm_isp_get_vfe_idx_for_stats_stream(vfe_dev,
			stream_info);
	uint32_t paddr32 = (paddr & 0xFFFFFFFF);
	uint32_t paddr32_max;
	uint32_t paddr32_max = 0;
	int stats_idx;

	stats_idx = STATS_IDX(stream_info->stream_handle[vfe_idx]);
@@ -2525,7 +2523,6 @@ void msm_vfe47_stats_update_ping_pong_addr(
	msm_camera_io_w(paddr32, vfe_base +
		VFE47_STATS_PING_PONG_BASE(stats_idx, pingpong_status));

	paddr32_max = (paddr + buf_size) & 0xFFFFFFE0;
	msm_camera_io_w(paddr32_max, vfe_base +
		VFE47_STATS_PING_PONG_BASE(stats_idx, pingpong_status) + 0x4);
}
@@ -2893,8 +2890,12 @@ int msm_vfe47_get_regulators(struct vfe_device *vfe_dev)

int msm_vfe47_enable_regulators(struct vfe_device *vfe_dev, int enable)
{
	if (enable)
		return msm_camera_regulator_enable(vfe_dev->regulator_info,
					vfe_dev->vfe_num_regulators, enable);
	else
		return msm_camera_regulator_disable(vfe_dev->regulator_info,
					vfe_dev->vfe_num_regulators, true);
}

int msm_vfe47_get_platform_data(struct vfe_device *vfe_dev)
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2016, 2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016, 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -22,7 +22,7 @@ enum msm_vfe_clk_rates {
	MSM_VFE_MAX_CLK_RATES = 3,
};

#define MSM_VFE48_HW_VERSION 0x8
#define MSM_VFE48_HW_VERSION 0x9
#define MSM_VFE48_HW_VERSION_SHIFT 28
#define MSM_VFE48_HW_VERSION_MASK 0xF

Loading