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

Commit d72aa00c authored by Darshan Kumsi Srinivasa's avatar Darshan Kumsi Srinivasa
Browse files

msm: camera: isp: add support for avtimer



Use AVtimer for Video telephony usecase, and system time for
other usecases.

Change-Id: I4c97600cc85250f301d412ef517b9e2746574cd1
Signed-off-by: default avatarDarshan Kumsi Srinivasa <darssr@codeaurora.org>
parent 022a680d
Loading
Loading
Loading
Loading
+46 −17
Original line number Diff line number Diff line
/* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2020, 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
@@ -21,6 +21,10 @@

#define HANDLE_TO_IDX(handle) (handle & 0xFF)

#ifdef CONFIG_MSM_AVTIMER
static struct avtimer_fptr_t avtimer_func;
#endif

int msm_isp_axi_create_stream(
	struct msm_vfe_axi_shared_data *axi_data,
	struct msm_vfe32_axi_stream_request_cmd *stream_cfg_cmd)
@@ -614,22 +618,46 @@ static void msm_isp_calculate_bandwidth(
}

#ifdef CONFIG_MSM_AVTIMER
/**
 * msm_isp_set_avtimer_fptr() - Set avtimer function pointer
 * @avtimer: struct of type avtimer_fptr_t to hold function pointer.
 *
 * Initialize the function pointers sent by the avtimer driver
 *
 */
void msm_isp_set_avtimer_fptr(struct avtimer_fptr_t avtimer)
{
	avtimer_func.fptr_avtimer_open   = avtimer.fptr_avtimer_open;
	avtimer_func.fptr_avtimer_enable = avtimer.fptr_avtimer_enable;
	avtimer_func.fptr_avtimer_get_time = avtimer.fptr_avtimer_get_time;
}
EXPORT_SYMBOL(msm_isp_set_avtimer_fptr);

void msm_isp_start_avtimer(void)
{
	avcs_core_open();
	avcs_core_disable_power_collapse(1);
	if (avtimer_func.fptr_avtimer_open &&
			avtimer_func.fptr_avtimer_enable) {
		avtimer_func.fptr_avtimer_open();
		avtimer_func.fptr_avtimer_enable(1);
	}
}
void msm_isp_stop_avtimer(void)
{
	if (avtimer_func.fptr_avtimer_enable)
		avtimer_func.fptr_avtimer_enable(0);
}

static inline void msm_isp_get_avtimer_ts(
void msm_isp_get_avtimer_ts(
		struct msm_isp_timestamp *time_stamp)
{
	int rc = 0;
	uint32_t avtimer_usec = 0;
	uint64_t avtimer_tick = 0;

	rc = avcs_core_query_timer(&avtimer_tick);
	if (avtimer_func.fptr_avtimer_get_time) {
		rc = avtimer_func.fptr_avtimer_get_time(&avtimer_tick);
		if (rc < 0) {
		pr_err("%s: Error: Invalid AVTimer Tick, rc=%d\n",
			pr_err_ratelimited("%s: Error: Invalid AVTimer Tick, rc=%d\n",
				   __func__, rc);
			/* In case of error return zero AVTimer Tick Value */
			time_stamp->vt_time.tv_sec = 0;
@@ -642,6 +670,7 @@ static inline void msm_isp_get_avtimer_ts(
				(uint32_t)(avtimer_tick), avtimer_usec);
		}
	}
}
#else
void msm_isp_start_avtimer(void)
{
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2020, 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
@@ -44,6 +44,8 @@ void msm_isp_reset_framedrop(struct vfe_device *vfe_dev,
	struct msm_vfe_axi_stream *stream_info);

void msm_isp_start_avtimer(void);
void msm_isp_stop_avtimer(void);
void msm_isp_get_avtimer_ts(struct msm_isp_timestamp *time_stamp);
int msm_isp_request_axi_stream(struct vfe_device *vfe_dev, void *arg);
int msm_isp_cfg_axi_stream(struct vfe_device *vfe_dev, void *arg);
int msm_isp_release_axi_stream(struct vfe_device *vfe_dev, void *arg);
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2020, 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
@@ -1886,7 +1886,7 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
#ifdef CONFIG_MSM_AVTIMER
static void msm_isp_end_avtimer(void)
{
	avcs_core_disable_power_collapse(0);
	msm_isp_stop_avtimer();
}
#else
static void msm_isp_end_avtimer(void)