Merge "msm: ais: Move wait for early camera handoff"
This commit is contained in:
commit
08a391fbb9
4 changed files with 29 additions and 20 deletions
|
@ -23,6 +23,7 @@
|
||||||
#include "cam_smmu_api.h"
|
#include "cam_smmu_api.h"
|
||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include "trace/events/msm_cam.h"
|
#include "trace/events/msm_cam.h"
|
||||||
|
#include "sensor/cci/msm_early_cam.h"
|
||||||
|
|
||||||
#define MAX_ISP_V4l2_EVENTS 100
|
#define MAX_ISP_V4l2_EVENTS 100
|
||||||
#define MAX_ISP_REG_LIST 100
|
#define MAX_ISP_REG_LIST 100
|
||||||
|
@ -2290,6 +2291,9 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
|
||||||
vfe_dev->isp_raw1_debug = 0;
|
vfe_dev->isp_raw1_debug = 0;
|
||||||
vfe_dev->isp_raw2_debug = 0;
|
vfe_dev->isp_raw2_debug = 0;
|
||||||
|
|
||||||
|
/* Postpone hardware changes until early camera is complete */
|
||||||
|
msm_early_camera_wait();
|
||||||
|
|
||||||
if (vfe_dev->hw_info->vfe_ops.core_ops.init_hw(vfe_dev) < 0) {
|
if (vfe_dev->hw_info->vfe_ops.core_ops.init_hw(vfe_dev) < 0) {
|
||||||
pr_err("%s: init hardware failed\n", __func__);
|
pr_err("%s: init hardware failed\n", __func__);
|
||||||
vfe_dev->vfe_open_cnt--;
|
vfe_dev->vfe_open_cnt--;
|
||||||
|
@ -2302,7 +2306,6 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
|
||||||
atomic_set(&vfe_dev->error_info.overflow_state, NO_OVERFLOW);
|
atomic_set(&vfe_dev->error_info.overflow_state, NO_OVERFLOW);
|
||||||
|
|
||||||
vfe_dev->hw_info->vfe_ops.core_ops.clear_status_reg(vfe_dev);
|
vfe_dev->hw_info->vfe_ops.core_ops.clear_status_reg(vfe_dev);
|
||||||
|
|
||||||
vfe_dev->vfe_hw_version = msm_camera_io_r(vfe_dev->vfe_base);
|
vfe_dev->vfe_hw_version = msm_camera_io_r(vfe_dev->vfe_base);
|
||||||
ISP_DBG("%s: HW Version: 0x%x\n", __func__, vfe_dev->vfe_hw_version);
|
ISP_DBG("%s: HW Version: 0x%x\n", __func__, vfe_dev->vfe_hw_version);
|
||||||
rc = vfe_dev->hw_info->vfe_ops.core_ops.reset_hw(vfe_dev, 1, 1);
|
rc = vfe_dev->hw_info->vfe_ops.core_ops.reset_hw(vfe_dev, 1, 1);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_gpio.h>
|
#include <linux/of_gpio.h>
|
||||||
#include <linux/of_platform.h>
|
#include <linux/of_platform.h>
|
||||||
|
#include <linux/iopoll.h>
|
||||||
#include "msm_sd.h"
|
#include "msm_sd.h"
|
||||||
#include "msm_early_cam.h"
|
#include "msm_early_cam.h"
|
||||||
#include "msm_cam_cci_hwreg.h"
|
#include "msm_cam_cci_hwreg.h"
|
||||||
|
@ -38,6 +39,12 @@
|
||||||
static struct platform_driver msm_early_camera_driver;
|
static struct platform_driver msm_early_camera_driver;
|
||||||
static struct early_cam_device *new_early_cam_dev;
|
static struct early_cam_device *new_early_cam_dev;
|
||||||
|
|
||||||
|
#define MMSS_A_VFE_0_BASE 0x00A10000
|
||||||
|
#define MMSS_A_VFE_0_SIZE 0x1000
|
||||||
|
#define EARLY_CAMERA_SIGNAL_DONE 0xa5a5a5a5
|
||||||
|
#define EARLY_CAMERA_SIGNAL_DISABLED 0
|
||||||
|
#define MMSS_A_VFE_0_SPARE 0xC84
|
||||||
|
|
||||||
int msm_early_cam_disable_clocks(void)
|
int msm_early_cam_disable_clocks(void)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
@ -253,6 +260,19 @@ int msm_ais_disable_clocks(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void msm_early_camera_wait(void)
|
||||||
|
{
|
||||||
|
u32 val = 0;
|
||||||
|
void __iomem *base;
|
||||||
|
|
||||||
|
base = ioremap(MMSS_A_VFE_0_BASE, MMSS_A_VFE_0_SIZE);
|
||||||
|
readl_poll_timeout(base + MMSS_A_VFE_0_SPARE, val,
|
||||||
|
((val == EARLY_CAMERA_SIGNAL_DONE)
|
||||||
|
|| (val == EARLY_CAMERA_SIGNAL_DISABLED)), 0, 0);
|
||||||
|
iounmap(base);
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_early_cam_probe(struct platform_device *pdev)
|
static int msm_early_cam_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
|
@ -53,4 +53,5 @@ struct early_cam_device {
|
||||||
int msm_early_cam_disable_clocks(void);
|
int msm_early_cam_disable_clocks(void);
|
||||||
int msm_ais_enable_clocks(void);
|
int msm_ais_enable_clocks(void);
|
||||||
int msm_ais_disable_clocks(void);
|
int msm_ais_disable_clocks(void);
|
||||||
|
void msm_early_camera_wait(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -23,9 +23,6 @@
|
||||||
#undef CDBG
|
#undef CDBG
|
||||||
#define CDBG(fmt, args...) pr_debug(fmt, ##args)
|
#define CDBG(fmt, args...) pr_debug(fmt, ##args)
|
||||||
|
|
||||||
#define EARLY_CAMERA_SIGNAL_DONE 0xa5a5a5a5
|
|
||||||
#define EARLY_CAMERA_SIGNAL_DISABLED 0
|
|
||||||
|
|
||||||
static bool early_camera_clock_off;
|
static bool early_camera_clock_off;
|
||||||
static struct msm_sensor_init_t *s_init;
|
static struct msm_sensor_init_t *s_init;
|
||||||
|
|
||||||
|
@ -48,14 +45,10 @@ static int msm_sensor_wait_for_probe_done(struct msm_sensor_init_t *s_init)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MMSS_A_VFE_0_SPARE 0xC84
|
|
||||||
|
|
||||||
/* Static function definition */
|
/* Static function definition */
|
||||||
int32_t msm_sensor_driver_cmd(struct msm_sensor_init_t *s_init, void *arg)
|
int32_t msm_sensor_driver_cmd(struct msm_sensor_init_t *s_init, void *arg)
|
||||||
{
|
{
|
||||||
int32_t rc = 0;
|
int32_t rc = 0;
|
||||||
u32 val = 0;
|
|
||||||
void __iomem *base;
|
|
||||||
struct sensor_init_cfg_data *cfg = (struct sensor_init_cfg_data *)arg;
|
struct sensor_init_cfg_data *cfg = (struct sensor_init_cfg_data *)arg;
|
||||||
|
|
||||||
/* Validate input parameters */
|
/* Validate input parameters */
|
||||||
|
@ -64,6 +57,8 @@ int32_t msm_sensor_driver_cmd(struct msm_sensor_init_t *s_init, void *arg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Postpone hardware changes until early camera is complete */
|
||||||
|
msm_early_camera_wait();
|
||||||
pr_debug("%s : %d", __func__, cfg->cfgtype);
|
pr_debug("%s : %d", __func__, cfg->cfgtype);
|
||||||
switch (cfg->cfgtype) {
|
switch (cfg->cfgtype) {
|
||||||
case CFG_SINIT_PROBE:
|
case CFG_SINIT_PROBE:
|
||||||
|
@ -79,17 +74,7 @@ int32_t msm_sensor_driver_cmd(struct msm_sensor_init_t *s_init, void *arg)
|
||||||
|
|
||||||
case CFG_SINIT_PROBE_DONE:
|
case CFG_SINIT_PROBE_DONE:
|
||||||
if (early_camera_clock_off == false) {
|
if (early_camera_clock_off == false) {
|
||||||
base = ioremap(0x00A10000, 0x1000);
|
msm_early_camera_wait();
|
||||||
val = msm_camera_io_r_mb(base + MMSS_A_VFE_0_SPARE);
|
|
||||||
while (val != EARLY_CAMERA_SIGNAL_DONE) {
|
|
||||||
if (val == EARLY_CAMERA_SIGNAL_DISABLED)
|
|
||||||
break;
|
|
||||||
msleep(1000);
|
|
||||||
val = msm_camera_io_r_mb(
|
|
||||||
base + MMSS_A_VFE_0_SPARE);
|
|
||||||
pr_err("Waiting for signal from LK val = %u\n",
|
|
||||||
val);
|
|
||||||
}
|
|
||||||
rc = msm_early_cam_disable_clocks();
|
rc = msm_early_cam_disable_clocks();
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
pr_err("Failed to disable early camera :%d\n",
|
pr_err("Failed to disable early camera :%d\n",
|
||||||
|
|
Loading…
Add table
Reference in a new issue