summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/i2c/adv7481.c17
-rw-r--r--drivers/media/i2c/adv7481_reg.h5
-rw-r--r--drivers/media/platform/msm/ais/isp/msm_isp.h19
-rw-r--r--drivers/media/platform/msm/ais/isp/msm_isp47.c32
-rw-r--r--drivers/media/platform/msm/ais/isp/msm_isp_axi_util.c14
-rw-r--r--drivers/media/platform/msm/ais/isp/msm_isp_util.c182
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.h4
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp.c70
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp.h6
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp47.c2
-rw-r--r--drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c138
-rw-r--r--drivers/scsi/sg.c28
-rw-r--r--drivers/soc/qcom/qdsp6v2/msm_audio_ion_vm.c3
-rw-r--r--drivers/usb/core/hub.c6
-rw-r--r--drivers/usb/dwc3/ep0.c2
-rw-r--r--drivers/usb/dwc3/gadget.c9
-rw-r--r--drivers/usb/dwc3/gadget.h1
-rw-r--r--drivers/video/msm/ba/msm_ba.c23
18 files changed, 225 insertions, 336 deletions
diff --git a/drivers/media/i2c/adv7481.c b/drivers/media/i2c/adv7481.c
index b6b89a9eefe2..74d7b9584827 100644
--- a/drivers/media/i2c/adv7481.c
+++ b/drivers/media/i2c/adv7481.c
@@ -1005,7 +1005,6 @@ static long adv7481_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct adv7481_state *state = to_state(sd);
int *ret_val = arg;
- uint8_t status = 0;
long ret = 0;
int param = 0;
@@ -1040,22 +1039,6 @@ static long adv7481_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
case VIDIOC_HDMI_RX_CEC_S_ENABLE:
ret = adv7481_cec_powerup(state, arg);
break;
- case VIDIOC_CVBS_G_FIELD_STATUS:
- /* Select SDP read-only Map 1 */
- adv7481_wr_byte(&state->i2c_client, state->i2c_sdp_addr,
- SDP_RW_MAP_REG, 0x02);
- status = adv7481_rd_byte(&state->i2c_client,
- state->i2c_sdp_addr, SDP_RO_MAP_1_FIELD_ADDR);
- adv7481_wr_byte(&state->i2c_client, state->i2c_sdp_addr,
- SDP_RW_MAP_REG, 0x00);
- if (ret_val) {
- *ret_val = ADV_REG_GETFIELD(status,
- SDP_RO_MAP_1_EVEN_FIELD);
- } else {
- pr_err("%s: NULL pointer provided\n", __func__);
- ret = -EINVAL;
- }
- break;
default:
pr_err("Not a typewriter! Command: 0x%x", cmd);
ret = -ENOTTY;
diff --git a/drivers/media/i2c/adv7481_reg.h b/drivers/media/i2c/adv7481_reg.h
index 96f0a5df10c0..b0bb5784d2ef 100644
--- a/drivers/media/i2c/adv7481_reg.h
+++ b/drivers/media/i2c/adv7481_reg.h
@@ -411,11 +411,6 @@
#define SDP_RO_MAIN_IN_LOCK_BMSK 0x0001
#define SDP_RO_MAIN_IN_LOCK_SHFT 0
-/* SDP R/O Map 1 Registers */
-#define SDP_RO_MAP_1_FIELD_ADDR 0x45
-#define SDP_RO_MAP_1_EVEN_FIELD_BMSK 0x10
-#define SDP_RO_MAP_1_EVEN_FIELD_SHFT 4
-
/*
* CSI Map Registers
diff --git a/drivers/media/platform/msm/ais/isp/msm_isp.h b/drivers/media/platform/msm/ais/isp/msm_isp.h
index d4c6eba78b78..86974eeb4a32 100644
--- a/drivers/media/platform/msm/ais/isp/msm_isp.h
+++ b/drivers/media/platform/msm/ais/isp/msm_isp.h
@@ -164,8 +164,6 @@ struct msm_vfe_irq_ops {
void (*config_irq)(struct vfe_device *vfe_dev,
uint32_t irq_status0, uint32_t irq_status1,
enum msm_isp_irq_operation);
- void (*process_sof_irq)(struct vfe_device *vfe_dev,
- uint32_t irq_status0, uint32_t irq_status1);
void (*process_eof_irq)(struct vfe_device *vfe_dev,
uint32_t irq_status0);
};
@@ -413,12 +411,6 @@ struct msm_vfe_frame_request_queue {
#define MSM_VFE_REQUESTQ_SIZE 8
-struct msm_vfe_fields_info {
- bool even_field;
- struct timeval sof_ts;
- struct timeval field_ts;
-};
-
struct msm_vfe_axi_stream {
uint32_t frame_id;
enum msm_vfe_axi_state state;
@@ -465,11 +457,6 @@ struct msm_vfe_axi_stream {
enum msm_stream_memory_input_t memory_input;
struct msm_isp_sw_framskip sw_skip;
uint8_t sw_ping_pong_bit;
-
- bool interlaced;
- struct msm_vfe_fields_info field_info[2];
- uint32_t field_index;
- uint32_t field_type;
};
struct msm_vfe_axi_composite_info {
@@ -811,12 +798,6 @@ struct vfe_device {
/* before halt irq info */
uint32_t recovery_irq0_mask;
uint32_t recovery_irq1_mask;
-
- /* interlaced field info */
- void *ba_inst_hdl;
- struct task_struct *field_thread_id;
- wait_queue_head_t field_waitqueue;
- bool wakeupflag;
};
struct vfe_parent_device {
diff --git a/drivers/media/platform/msm/ais/isp/msm_isp47.c b/drivers/media/platform/msm/ais/isp/msm_isp47.c
index 9da7dee59064..04e879fc3bcf 100644
--- a/drivers/media/platform/msm/ais/isp/msm_isp47.c
+++ b/drivers/media/platform/msm/ais/isp/msm_isp47.c
@@ -662,37 +662,6 @@ void msm_vfe47_process_epoch_irq(struct vfe_device *vfe_dev,
}
}
-static void msm_isp47_process_sof_irq(struct vfe_device *vfe_dev,
- uint32_t irq_status0, uint32_t irq_status1)
-{
- int i, axi_src_idx[4], src_count = 0;
- struct msm_vfe_axi_stream *pstream_info;
- struct msm_vfe_axi_shared_data *axi_data = &vfe_dev->axi_data;
-
- if (irq_status0 & BIT(0))
- axi_src_idx[src_count++] = CAMIF_RAW;
- if (irq_status1 & BIT(29))
- axi_src_idx[src_count++] = RDI_INTF_0;
- if (irq_status1 & BIT(30))
- axi_src_idx[src_count++] = RDI_INTF_1;
- if (irq_status1 & BIT(31))
- axi_src_idx[src_count++] = RDI_INTF_2;
-
- if (src_count == 0)
- return;
-
- for (i = 0; i < src_count; i++) {
- pstream_info = &axi_data->stream_info[axi_src_idx[i]];
-
- if (pstream_info->interlaced) {
- vfe_dev->wakeupflag = true;
- wake_up_interruptible(&vfe_dev->field_waitqueue);
- /* currently we support only 1 interlaced instance */
- break;
- }
- }
-}
-
void msm_isp47_process_eof_irq(struct vfe_device *vfe_dev,
uint32_t irq_status0)
{
@@ -2749,7 +2718,6 @@ struct msm_vfe_hardware_info vfe47_hw_info = {
.process_stats_irq = msm_isp_process_stats_irq,
.process_epoch_irq = msm_vfe47_process_epoch_irq,
.config_irq = msm_vfe47_config_irq,
- .process_sof_irq = msm_isp47_process_sof_irq,
.process_eof_irq = msm_isp47_process_eof_irq,
},
.axi_ops = {
diff --git a/drivers/media/platform/msm/ais/isp/msm_isp_axi_util.c b/drivers/media/platform/msm/ais/isp/msm_isp_axi_util.c
index 9c06ee3b2687..a85ee30769c4 100644
--- a/drivers/media/platform/msm/ais/isp/msm_isp_axi_util.c
+++ b/drivers/media/platform/msm/ais/isp/msm_isp_axi_util.c
@@ -2042,12 +2042,6 @@ static int msm_isp_process_done_buf(struct vfe_device *vfe_dev,
buf_event.u.buf_done.buf_idx = buf->buf_idx;
buf_event.u.buf_done.output_format =
stream_info->runtime_output_format;
-
- if (stream_info->interlaced)
- buf_event.u.buf_done.field_type = stream_info->field_type;
- else
- buf_event.u.buf_done.field_type = 0;
-
if (vfe_dev->fetch_engine_info.is_busy &&
SRC_TO_INTF(stream_info->stream_src) == VFE_PIX_0) {
vfe_dev->fetch_engine_info.is_busy = 0;
@@ -3138,7 +3132,6 @@ static int msm_isp_stop_axi_stream(struct vfe_device *vfe_dev,
}
}
- stream_info->interlaced = false;
vfe_dev->reg_update_requested &=
~(BIT(SRC_TO_INTF(stream_info->stream_src)));
}
@@ -3551,18 +3544,13 @@ int msm_isp_axi_output_cfg(struct vfe_device *vfe_dev, void *arg)
INIT_LIST_HEAD(&pstream_info->request_q);
pstream_info->frame_based =
- pCmd->output_path_cfg[axi_src_idx].frame_based & BIT(0);
- pstream_info->interlaced =
- (pCmd->output_path_cfg[axi_src_idx].frame_based
- & BIT(INTERLACE_OFFSET)) ? true : false;
+ pCmd->output_path_cfg[axi_src_idx].frame_based;
/* send buffers to user through vfe dev node */
pstream_info->buf_divert = 1;
pstream_info->output_format =
pCmd->output_path_cfg[axi_src_idx].format;
- pstream_info->field_index = 0;
-
msm_isp_axi_get_num_planes(
pCmd->output_path_cfg[axi_src_idx].format,
pstream_info);
diff --git a/drivers/media/platform/msm/ais/isp/msm_isp_util.c b/drivers/media/platform/msm/ais/isp/msm_isp_util.c
index 2401ff645057..9e5317eb2920 100644
--- a/drivers/media/platform/msm/ais/isp/msm_isp_util.c
+++ b/drivers/media/platform/msm/ais/isp/msm_isp_util.c
@@ -14,8 +14,6 @@
#include <linux/io.h>
#include <media/v4l2-subdev.h>
#include <linux/ratelimit.h>
-#include <linux/kthread.h>
-#include <linux/sched.h>
#include "msm.h"
#include "msm_isp_util.h"
@@ -25,7 +23,6 @@
#include "cam_smmu_api.h"
#define CREATE_TRACE_POINTS
#include "trace/events/msm_cam.h"
-#include "media/msm_ba.h"
#define MAX_ISP_V4l2_EVENTS 100
#define MAX_ISP_REG_LIST 100
@@ -1977,166 +1974,6 @@ void msm_isp_reset_burst_count_and_frame_drop(
msm_isp_reset_framedrop(vfe_dev, stream_info);
}
-static void msm_isp_field_type_read_thread(void *data)
-{
- int ret = 0;
- uint8_t i, j = 0;
- bool even_field = 0;
- uint64_t timestamp_us[4];
- struct msm_isp_timestamp ts;
- struct msm_vfe_axi_stream *stream_info = NULL;
- struct vfe_device *vfe_dev = (struct vfe_device *)data;
-
- pr_debug("Enter field_type_read_thread\n");
-
- vfe_dev->ba_inst_hdl = msm_ba_open(NULL);
- if (vfe_dev->ba_inst_hdl == NULL) {
- pr_err("%s: ba open failed\n", __func__);
- return;
- }
-
- while (!kthread_should_stop()) {
- ret = 0;
- wait_event_interruptible(vfe_dev->field_waitqueue,
- vfe_dev->wakeupflag == true);
- if (kthread_should_stop()) {
- pr_debug("%s: field thread has stopped\n", __func__);
- goto bs_close;
- }
-
- for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
- if (vfe_dev->axi_data.stream_info[i].interlaced)
- break;
- }
- if (i == VFE_AXI_SRC_MAX) {
- vfe_dev->wakeupflag = false;
- continue;
- }
-
- stream_info = &vfe_dev->axi_data.stream_info[i];
- j = stream_info->field_index;
-
- /* Detect field status from bridge chip */
- ret = msm_ba_private_ioctl(vfe_dev->ba_inst_hdl,
- VIDIOC_CVBS_G_FIELD_STATUS, &even_field);
- if (ret) {
- pr_err("%s: get field status failed: %d\n",
- __func__, ret);
- } else {
- msm_isp_get_timestamp(&ts, vfe_dev);
- stream_info->field_info[j%2].even_field = even_field;
- stream_info->field_info[j%2].field_ts.tv_sec =
- ts.buf_time.tv_sec;
- stream_info->field_info[j%2].field_ts.tv_usec =
- ts.buf_time.tv_usec;
- }
-
- stream_info->field_index++;
-
- /* once 2 fields info getting done, do the verification */
- if (stream_info->field_index%2 == 0) {
- timestamp_us[0] =
- stream_info->field_info[0].sof_ts.tv_sec
- * 1000 * 1000
- + stream_info->field_info[0].sof_ts.tv_usec;
- timestamp_us[1] =
- stream_info->field_info[0].field_ts.tv_sec
- * 1000 * 1000
- + stream_info->field_info[0].field_ts.tv_usec;
- timestamp_us[2] =
- stream_info->field_info[1].sof_ts.tv_sec
- * 1000 * 1000
- + stream_info->field_info[1].sof_ts.tv_usec;
- timestamp_us[3] =
- stream_info->field_info[1].field_ts.tv_sec
- * 1000 * 1000
- + stream_info->field_info[1].field_ts.tv_usec;
-
- /*
- * Expected timing:
- * field 0 SOF -> field 0 type read ->
- * field 1 SOF -> field 1 type read
- */
- if ((timestamp_us[0] < timestamp_us[1]) &&
- (timestamp_us[2] < timestamp_us[3]) &&
- (timestamp_us[1] < timestamp_us[2]) &&
- (stream_info->field_info[0].even_field !=
- stream_info->field_info[1].even_field)) {
- /*
- * Field type:
- * 0 - unknown
- * 1 - odd first
- * 2 - even first
- */
- stream_info->field_type =
- stream_info->field_info[0].even_field ?
- 2 : 1;
- } else {
- stream_info->field_type = 0;
- pr_err("Field: %llu %llu %llu %llu %d %d\n",
- timestamp_us[0], timestamp_us[1],
- timestamp_us[2], timestamp_us[3],
- stream_info->field_info[0].even_field,
- stream_info->field_info[1].even_field);
- }
- }
-
- vfe_dev->wakeupflag = false;
- }
-
-bs_close:
- ret = msm_ba_close(vfe_dev->ba_inst_hdl);
- if (ret)
- pr_err("%s: msm ba close failed\n", __func__);
- vfe_dev->ba_inst_hdl = NULL;
-}
-
-static int msm_isp_init_field_type_kthread(struct vfe_device *vfe_dev)
-{
- init_waitqueue_head(&vfe_dev->field_waitqueue);
-
- ISP_DBG("%s: Queue initialized\n", __func__);
- vfe_dev->field_thread_id = kthread_run(
- (void *)msm_isp_field_type_read_thread,
- (void *)vfe_dev, "field_type_kthread");
- if (IS_ERR(vfe_dev->field_thread_id)) {
- pr_err("%s: Unable to run the thread\n", __func__);
- return -ENOMEM;
- }
-
- return 0;
-}
-
-static void msm_isp_field_timestamp(struct vfe_device *vfe_dev,
- uint32_t irq_status0, uint32_t irq_status1,
- struct timeval *timestamp)
-{
- uint8_t i, j = 0;
- struct msm_vfe_axi_stream *stream_info = NULL;
-
- for (i = 0; i < VFE_AXI_SRC_MAX; i++) {
- if (vfe_dev->axi_data.stream_info[i].interlaced)
- break;
- }
-
- if (i == VFE_AXI_SRC_MAX)
- return;
-
- stream_info = &vfe_dev->axi_data.stream_info[i];
-
- /* SOF timestamp */
- if (((i == CAMIF_RAW) && (irq_status0 & BIT(0)))
- || ((i == RDI_INTF_0) && (irq_status1 & BIT(29)))
- || ((i == RDI_INTF_1) && (irq_status1 & BIT(30)))
- || ((i == RDI_INTF_2) && (irq_status1 & BIT(31)))) {
- j = stream_info->field_index;
- stream_info->field_info[j%2].sof_ts.tv_sec =
- timestamp->tv_sec;
- stream_info->field_info[j%2].sof_ts.tv_usec =
- timestamp->tv_usec;
- }
-}
-
static void msm_isp_enqueue_tasklet_cmd(struct vfe_device *vfe_dev,
uint32_t irq_status0, uint32_t irq_status1,
uint32_t ping_pong_status)
@@ -2162,10 +1999,6 @@ static void msm_isp_enqueue_tasklet_cmd(struct vfe_device *vfe_dev,
MSM_VFE_TASKLETQ_SIZE;
list_add_tail(&queue_cmd->list, &vfe_dev->tasklet_q);
spin_unlock_irqrestore(&vfe_dev->tasklet_lock, flags);
-
- msm_isp_field_timestamp(vfe_dev, irq_status0, irq_status1,
- &queue_cmd->ts.buf_time);
-
tasklet_schedule(&vfe_dev->vfe_tasklet);
}
@@ -2288,7 +2121,6 @@ void msm_isp_do_tasklet(unsigned long data)
spin_unlock_irqrestore(&vfe_dev->tasklet_lock, flags);
ISP_DBG("%s: vfe_id %d status0: 0x%x status1: 0x%x\n",
__func__, vfe_dev->pdev->id, irq_status0, irq_status1);
-
if (vfe_dev->is_split) {
spin_lock(&dump_tasklet_lock);
tasklet_data.arr[tasklet_data.first].
@@ -2307,8 +2139,6 @@ void msm_isp_do_tasklet(unsigned long data)
(tasklet_data.first + 1) % MAX_ISP_PING_PONG_DUMP_SIZE;
spin_unlock(&dump_tasklet_lock);
}
- irq_ops->process_sof_irq(vfe_dev,
- irq_status0, irq_status1);
irq_ops->process_reset_irq(vfe_dev,
irq_status0, irq_status1);
irq_ops->process_halt_irq(vfe_dev,
@@ -2461,17 +2291,8 @@ int msm_isp_open_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
cam_smmu_reg_client_page_fault_handler(
vfe_dev->buf_mgr->iommu_hdl,
msm_vfe_iommu_fault_handler, vfe_dev);
-
- /* to detect interlaced frame type through ba driver */
- rc = msm_isp_init_field_type_kthread(vfe_dev);
- if (rc) {
- pr_err("%s: init field thread failed\n", __func__);
- return rc;
- }
-
mutex_unlock(&vfe_dev->core_mutex);
mutex_unlock(&vfe_dev->realtime_mutex);
-
return 0;
}
@@ -2540,9 +2361,6 @@ int msm_isp_close_node(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
}
vfe_dev->is_split = 0;
- vfe_dev->wakeupflag = true;
- kthread_stop(vfe_dev->field_thread_id);
-
mutex_unlock(&vfe_dev->core_mutex);
mutex_unlock(&vfe_dev->realtime_mutex);
return 0;
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.h b/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.h
index 21fab0590b55..34cac9daea89 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.h
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_buf_mgr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2013-2017, 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
@@ -98,6 +98,8 @@ struct msm_isp_buffer {
struct timeval *tv;
/* Indicates whether buffer is used as ping ot pong buffer */
uint32_t pingpong_bit;
+ /* Indicates buffer is reconfig due to drop frame */
+ uint32_t is_drop_reconfig;
/*Native buffer*/
struct list_head list;
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp.c
index 22eb86f4f875..23e27e1179d1 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.c
@@ -453,11 +453,69 @@ static long msm_isp_v4l2_fops_ioctl(struct file *file, unsigned int cmd,
return video_usercopy(file, cmd, arg, msm_isp_subdev_do_ioctl);
}
+static void isp_vma_open(struct vm_area_struct *vma)
+{
+ pr_debug("%s: open called\n", __func__);
+}
+
+static void isp_vma_close(struct vm_area_struct *vma)
+{
+ pr_debug("%s: close called\n", __func__);
+}
+
+static int isp_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+{
+ struct page *page;
+ struct vfe_device *vfe_dev = vma->vm_private_data;
+ struct isp_proc *isp_page = NULL;
+
+ isp_page = vfe_dev->isp_page;
+
+ pr_debug("%s: vfeid:%d u_virt_addr:0x%lx k_virt_addr:%pK\n",
+ __func__, vfe_dev->pdev->id, vma->vm_start,
+ (void *)isp_page);
+ if (isp_page != NULL) {
+ page = virt_to_page(isp_page);
+ get_page(page);
+ vmf->page = page;
+ isp_page->kernel_sofid =
+ vfe_dev->axi_data.src_info[VFE_PIX_0].frame_id;
+ isp_page->vfeid = vfe_dev->pdev->id;
+ }
+ return 0;
+}
+
+static const struct vm_operations_struct isp_vm_ops = {
+ .open = isp_vma_open,
+ .close = isp_vma_close,
+ .fault = isp_vma_fault,
+};
+
+static int msm_isp_v4l2_fops_mmap(struct file *filep,
+ struct vm_area_struct *vma)
+{
+ int ret = -EINVAL;
+ struct video_device *vdev = video_devdata(filep);
+ struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+ struct vfe_device *vfe_dev = v4l2_get_subdevdata(sd);
+
+ vma->vm_ops = &isp_vm_ops;
+ vma->vm_flags |=
+ (unsigned long)(VM_DONTEXPAND | VM_DONTDUMP);
+ vma->vm_private_data = vfe_dev;
+ isp_vma_open(vma);
+ ret = 0;
+ pr_debug("%s: isp mmap is called vm_start: 0x%lx\n",
+ __func__, vma->vm_start);
+ return ret;
+}
+
static struct v4l2_file_operations msm_isp_v4l2_fops = {
#ifdef CONFIG_COMPAT
.compat_ioctl32 = msm_isp_v4l2_fops_ioctl,
#endif
- .unlocked_ioctl = msm_isp_v4l2_fops_ioctl
+ .unlocked_ioctl = msm_isp_v4l2_fops_ioctl,
+ .mmap = msm_isp_v4l2_fops_mmap
};
static int vfe_set_common_data(struct platform_device *pdev)
@@ -671,6 +729,8 @@ int vfe_hw_probe(struct platform_device *pdev)
msm_isp_v4l2_fops.compat_ioctl32 =
msm_isp_v4l2_fops_ioctl;
#endif
+ msm_isp_v4l2_fops.mmap = msm_isp_v4l2_fops_mmap;
+
vfe_dev->subdev.sd.devnode->fops = &msm_isp_v4l2_fops;
vfe_dev->buf_mgr = &vfe_buf_mgr;
@@ -687,6 +747,14 @@ int vfe_hw_probe(struct platform_device *pdev)
msm_isp_enable_debugfs(vfe_dev, msm_isp_bw_request_history);
vfe_dev->buf_mgr->init_done = 1;
vfe_dev->vfe_open_cnt = 0;
+ /*Allocate a page in kernel and map it to camera user process*/
+ vfe_dev->isp_page = (struct isp_proc *)get_zeroed_page(GFP_KERNEL);
+ if (vfe_dev->isp_page == NULL) {
+ pr_err("%s: no enough memory\n", __func__);
+ rc = -ENOMEM;
+ goto probe_fail3;
+ }
+ vfe_dev->isp_page->vfeid = vfe_dev->pdev->id;
return rc;
probe_fail3:
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h
index b2d152bf4ef0..d336e1ef1bd7 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp.h
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp.h
@@ -759,6 +759,11 @@ struct msm_vfe_common_subdev {
struct msm_vfe_common_dev_data *common_data;
};
+struct isp_proc {
+ uint32_t kernel_sofid;
+ uint32_t vfeid;
+};
+
struct vfe_device {
/* Driver private data */
struct platform_device *pdev;
@@ -842,6 +847,7 @@ struct vfe_device {
uint32_t recovery_irq1_mask;
/* total bandwidth per vfe */
uint64_t total_bandwidth;
+ struct isp_proc *isp_page;
};
struct vfe_parent_device {
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c
index 70950a88fc66..812027f3e539 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp47.c
@@ -788,7 +788,7 @@ long msm_vfe47_reset_hardware(struct vfe_device *vfe_dev,
msm_camera_io_w(0xFFFFFEFF, vfe_dev->vfe_base + 0x68);
msm_camera_io_w(0x1, vfe_dev->vfe_base + 0x58);
vfe_dev->hw_info->vfe_ops.axi_ops.
- reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0031FFFF);
+ reload_wm(vfe_dev, vfe_dev->vfe_base, 0x0011FFFF);
}
if (blocking_call) {
diff --git a/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c b/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
index 5bcb3034b82a..15f8061b9919 100644
--- a/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
+++ b/drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
@@ -719,13 +719,7 @@ void msm_isp_check_for_output_error(struct vfe_device *vfe_dev,
sof_info->stream_get_buf_fail_mask = 0;
axi_data = &vfe_dev->axi_data;
- /* report that registers are not updated and return empty buffer for
- * controllable outputs
- */
- if (!vfe_dev->reg_updated) {
- sof_info->regs_not_updated =
- vfe_dev->reg_update_requested;
- }
+
for (i = 0; i < RDI_INTF_0; i++) {
stream_info = msm_isp_get_stream_common_data(vfe_dev,
i);
@@ -747,6 +741,12 @@ void msm_isp_check_for_output_error(struct vfe_device *vfe_dev,
if (stream_info->controllable_output &&
!vfe_dev->reg_updated) {
if (stream_info->undelivered_request_cnt) {
+ /*report that registers are not updated
+ * and return empty buffer for controllable
+ * outputs
+ */
+ sof_info->regs_not_updated =
+ !vfe_dev->reg_updated;
pr_err("Drop frame no reg update\n");
if (msm_isp_drop_frame(vfe_dev, stream_info, ts,
sof_info)) {
@@ -933,6 +933,8 @@ void msm_isp_increment_frame_id(struct vfe_device *vfe_dev,
}
if (frame_src == VFE_PIX_0) {
+ vfe_dev->isp_page->kernel_sofid =
+ vfe_dev->axi_data.src_info[frame_src].frame_id;
if (!src_info->frame_id &&
!src_info->reg_update_frame_id &&
((src_info->frame_id -
@@ -1646,23 +1648,30 @@ static void msm_isp_reload_ping_pong_offset(
}
static int msm_isp_update_deliver_count(struct vfe_device *vfe_dev,
- struct msm_vfe_axi_stream *stream_info, uint32_t pingpong_bit)
+ struct msm_vfe_axi_stream *stream_info, uint32_t pingpong_bit,
+ struct msm_isp_buffer *done_buf)
{
int rc = 0;
if (!stream_info->controllable_output)
goto done;
- if (!stream_info->undelivered_request_cnt) {
+ if (!stream_info->undelivered_request_cnt ||
+ (done_buf == NULL)) {
pr_err_ratelimited("%s:%d error undelivered_request_cnt 0\n",
__func__, __LINE__);
rc = -EINVAL;
goto done;
} else {
+ if ((done_buf->is_drop_reconfig == 1) &&
+ (stream_info->sw_ping_pong_bit == -1)) {
+ goto done;
+ }
/*After wm reload, we get bufdone for ping buffer*/
if (stream_info->sw_ping_pong_bit == -1)
stream_info->sw_ping_pong_bit = 0;
- stream_info->undelivered_request_cnt--;
+ if (done_buf->is_drop_reconfig != 1)
+ stream_info->undelivered_request_cnt--;
if (pingpong_bit != stream_info->sw_ping_pong_bit) {
pr_err("%s:%d ping pong bit actual %d sw %d\n",
__func__, __LINE__, pingpong_bit,
@@ -1908,7 +1917,8 @@ int msm_isp_cfg_offline_ping_pong_address(struct vfe_device *vfe_dev,
}
static int msm_isp_cfg_ping_pong_address(
- struct msm_vfe_axi_stream *stream_info, uint32_t pingpong_status)
+ struct msm_vfe_axi_stream *stream_info, uint32_t pingpong_status,
+ struct msm_isp_buffer *buf)
{
int i;
int j;
@@ -1917,7 +1927,6 @@ static int msm_isp_cfg_ping_pong_address(
uint32_t buffer_size_byte = 0;
int32_t word_per_line = 0;
dma_addr_t paddr;
- struct msm_isp_buffer *buf = NULL;
/* Isolate pingpong_bit from pingpong_status */
@@ -1928,10 +1937,11 @@ static int msm_isp_cfg_ping_pong_address(
if (stream_info->buf[!pingpong_bit]) {
pr_err("stream %x buffer already set for pingpong %d\n",
stream_info->stream_src, !pingpong_bit);
- return 0;
+ return 1;
}
- buf = msm_isp_get_stream_buffer(vfe_dev, stream_info);
+ if (buf == NULL)
+ buf = msm_isp_get_stream_buffer(vfe_dev, stream_info);
if (!buf) {
msm_isp_cfg_stream_scratch(stream_info, pingpong_status);
@@ -2165,6 +2175,7 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
struct msm_isp_bufq *bufq = NULL;
uint32_t pingpong_bit;
int vfe_idx;
+ int rc = -1;
if (!vfe_dev || !stream_info || !ts || !sof_info) {
pr_err("%s %d vfe_dev %pK stream_info %pK ts %pK op_info %pK\n",
@@ -2181,17 +2192,42 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
pingpong_bit =
(~(pingpong_status >> stream_info->wm[vfe_idx][0]) & 0x1);
done_buf = stream_info->buf[pingpong_bit];
- if (done_buf) {
- bufq = vfe_dev->buf_mgr->ops->get_bufq(vfe_dev->buf_mgr,
- done_buf->bufq_handle);
- if (!bufq) {
- spin_unlock_irqrestore(&stream_info->lock, flags);
- pr_err("%s: Invalid bufq buf_handle %x\n",
- __func__, done_buf->bufq_handle);
- return -EINVAL;
+ if (done_buf &&
+ (stream_info->composite_irq[MSM_ISP_COMP_IRQ_EPOCH] == 0)) {
+ if ((stream_info->sw_ping_pong_bit != -1) &&
+ !vfe_dev->reg_updated) {
+ rc = msm_isp_cfg_ping_pong_address(
+ stream_info, ~pingpong_status, done_buf);
+ if (rc < 0) {
+ ISP_DBG("%s: Error configuring ping_pong\n",
+ __func__);
+ bufq = vfe_dev->buf_mgr->ops->get_bufq(
+ vfe_dev->buf_mgr,
+ done_buf->bufq_handle);
+ if (!bufq) {
+ spin_unlock_irqrestore(
+ &stream_info->lock,
+ flags);
+ pr_err("%s: Invalid bufq buf_handle %x\n",
+ __func__,
+ done_buf->bufq_handle);
+ return -EINVAL;
+ }
+ sof_info->reg_update_fail_mask_ext |=
+ (bufq->bufq_handle & 0xFF);
+ }
+ }
+ /*Avoid Drop Frame and re-issue pingpong cfg*/
+ /*this notify is per ping and pong buffer*/
+ done_buf->is_drop_reconfig = 1;
+ stream_info->current_framedrop_period = 1;
+ /*Avoid Multiple request frames for single SOF*/
+ vfe_dev->axi_data.src_info[VFE_PIX_0].accept_frame = false;
+
+ if (stream_info->current_framedrop_period !=
+ stream_info->requested_framedrop_period) {
+ msm_isp_cfg_framedrop_reg(stream_info);
}
- sof_info->reg_update_fail_mask_ext |=
- (bufq->bufq_handle & 0xFF);
}
spin_unlock_irqrestore(&stream_info->lock, flags);
@@ -2201,6 +2237,8 @@ int msm_isp_drop_frame(struct vfe_device *vfe_dev,
/* no buf done come */
msm_isp_process_axi_irq_stream(vfe_dev, stream_info,
pingpong_status, ts);
+ if (done_buf)
+ done_buf->is_drop_reconfig = 0;
}
return 0;
}
@@ -2505,7 +2543,7 @@ static int msm_isp_init_stream_ping_pong_reg(
/* Set address for both PING & PO NG register */
rc = msm_isp_cfg_ping_pong_address(
- stream_info, VFE_PING_FLAG);
+ stream_info, VFE_PING_FLAG, NULL);
/* No buffer available on start is not error */
if (rc == -ENOMEM && stream_info->stream_type != BURST_STREAM)
return 0;
@@ -2517,7 +2555,7 @@ static int msm_isp_init_stream_ping_pong_reg(
if (stream_info->stream_type != BURST_STREAM ||
stream_info->runtime_num_burst_capture > 1) {
rc = msm_isp_cfg_ping_pong_address(
- stream_info, VFE_PONG_FLAG);
+ stream_info, VFE_PONG_FLAG, NULL);
/* No buffer available on start is not error */
if (rc == -ENOMEM)
return 0;
@@ -3516,7 +3554,7 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
if (stream_info->undelivered_request_cnt == 1) {
rc = msm_isp_cfg_ping_pong_address(stream_info,
- VFE_PING_FLAG);
+ VFE_PING_FLAG, NULL);
if (rc) {
spin_unlock_irqrestore(&stream_info->lock, flags);
stream_info->undelivered_request_cnt--;
@@ -3549,10 +3587,10 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
* now.
*/
rc = msm_isp_cfg_ping_pong_address(stream_info,
- VFE_PONG_FLAG);
+ VFE_PONG_FLAG, NULL);
} else {
rc = msm_isp_cfg_ping_pong_address(
- stream_info, pingpong_status);
+ stream_info, pingpong_status, NULL);
}
if (rc) {
stream_info->undelivered_request_cnt--;
@@ -3574,6 +3612,9 @@ static int msm_isp_request_frame(struct vfe_device *vfe_dev,
if (0 == rc)
msm_isp_reset_framedrop(vfe_dev, stream_info);
+ /*Avoid Multiple request frames for single SOF*/
+ vfe_dev->axi_data.src_info[frame_src].accept_frame = false;
+
spin_unlock_irqrestore(&stream_info->lock, flags);
return rc;
@@ -4057,6 +4098,10 @@ void msm_isp_process_axi_irq_stream(struct vfe_device *vfe_dev,
done_buf = stream_info->buf[pingpong_bit];
if (vfe_dev->buf_mgr->frameId_mismatch_recovery == 1) {
+ if (done_buf) {
+ if (done_buf->is_drop_reconfig == 1)
+ done_buf->is_drop_reconfig = 0;
+ }
pr_err_ratelimited("%s: Mismatch Recovery in progress, drop frame!\n",
__func__);
spin_unlock_irqrestore(&stream_info->lock, flags);
@@ -4076,14 +4121,26 @@ void msm_isp_process_axi_irq_stream(struct vfe_device *vfe_dev,
stream_info->frame_id++;
stream_info->buf[pingpong_bit] = NULL;
+ if (stream_info->controllable_output &&
+ (done_buf != NULL) &&
+ (stream_info->sw_ping_pong_bit == -1) &&
+ (done_buf->is_drop_reconfig == 1)) {
+ /*When wm reloaded and corresponding reg_update fail
+ * then buffer is reconfig as PING buffer. so, avoid
+ * NULL assignment to PING buffer and eventually
+ * next AXI_DONE or buf_done can be successful
+ */
+ stream_info->buf[pingpong_bit] = done_buf;
+ }
+
if (stream_info->stream_type == CONTINUOUS_STREAM ||
stream_info->runtime_num_burst_capture > 1) {
rc = msm_isp_cfg_ping_pong_address(
- stream_info, pingpong_status);
+ stream_info, pingpong_status, NULL);
if (rc < 0)
ISP_DBG("%s: Error configuring ping_pong\n",
__func__);
- } else if (done_buf) {
+ } else if (done_buf && (done_buf->is_drop_reconfig != 1)) {
msm_isp_cfg_stream_scratch(stream_info, pingpong_status);
}
@@ -4107,8 +4164,10 @@ void msm_isp_process_axi_irq_stream(struct vfe_device *vfe_dev,
}
rc = msm_isp_update_deliver_count(vfe_dev, stream_info,
- pingpong_bit);
+ pingpong_bit, done_buf);
if (rc) {
+ if (done_buf->is_drop_reconfig == 1)
+ done_buf->is_drop_reconfig = 0;
spin_unlock_irqrestore(&stream_info->lock, flags);
pr_err_ratelimited("%s:VFE%d get done buf fail\n",
__func__, vfe_dev->pdev->id);
@@ -4117,17 +4176,28 @@ void msm_isp_process_axi_irq_stream(struct vfe_device *vfe_dev,
return;
}
- spin_unlock_irqrestore(&stream_info->lock, flags);
if ((done_buf->frame_id != frame_id) &&
vfe_dev->axi_data.enable_frameid_recovery) {
+ if (done_buf->is_drop_reconfig == 1)
+ done_buf->is_drop_reconfig = 0;
+ spin_unlock_irqrestore(&stream_info->lock, flags);
msm_isp_handle_done_buf_frame_id_mismatch(vfe_dev,
stream_info, done_buf, time_stamp, frame_id);
return;
}
- msm_isp_process_done_buf(vfe_dev, stream_info,
+ if (done_buf->is_drop_reconfig == 1) {
+ /*When ping/pong buf is already reconfigured
+ * then dont issue buf-done for current buffer
+ */
+ done_buf->is_drop_reconfig = 0;
+ spin_unlock_irqrestore(&stream_info->lock, flags);
+ } else {
+ spin_unlock_irqrestore(&stream_info->lock, flags);
+ msm_isp_process_done_buf(vfe_dev, stream_info,
done_buf, time_stamp, frame_id);
+ }
}
void msm_isp_process_axi_irq(struct vfe_device *vfe_dev,
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b0e2e292e3cb..bb6518159d12 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -510,7 +510,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
old_hdr->result = EIO;
break;
case DID_ERROR:
- old_hdr->result = (srp->sense_b[0] == 0 &&
+ old_hdr->result = (srp->sense_b[0] == 0 &&
hp->masked_status == GOOD) ? 0 : EIO;
break;
default:
@@ -898,8 +898,10 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
return -ENXIO;
if (!access_ok(VERIFY_WRITE, p, SZ_SG_IO_HDR))
return -EFAULT;
+ mutex_lock(&sfp->parentdp->open_rel_lock);
result = sg_new_write(sfp, filp, p, SZ_SG_IO_HDR,
1, read_only, 1, &srp);
+ mutex_unlock(&sfp->parentdp->open_rel_lock);
if (result < 0)
return result;
result = wait_event_interruptible(sfp->read_wait,
@@ -939,8 +941,10 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
sfp->low_dma = 1;
if ((0 == sfp->low_dma) && !sfp->res_in_use) {
val = (int) sfp->reserve.bufflen;
+ mutex_lock(&sfp->parentdp->open_rel_lock);
sg_remove_scat(sfp, &sfp->reserve);
sg_build_reserve(sfp, val);
+ mutex_unlock(&sfp->parentdp->open_rel_lock);
}
} else {
if (atomic_read(&sdp->detaching))
@@ -1009,8 +1013,8 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
result = get_user(val, ip);
if (result)
return result;
- if (val < 0)
- return -EINVAL;
+ if (val < 0)
+ return -EINVAL;
val = min_t(int, val,
max_sectors_bytes(sdp->device->request_queue));
mutex_lock(&sfp->f_mutex);
@@ -1020,9 +1024,10 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
mutex_unlock(&sfp->f_mutex);
return -EBUSY;
}
-
+ mutex_lock(&sfp->parentdp->open_rel_lock);
sg_remove_scat(sfp, &sfp->reserve);
sg_build_reserve(sfp, val);
+ mutex_unlock(&sfp->parentdp->open_rel_lock);
}
mutex_unlock(&sfp->f_mutex);
return 0;
@@ -1149,14 +1154,14 @@ static long sg_compat_ioctl(struct file *filp, unsigned int cmd_in, unsigned lon
return -ENXIO;
sdev = sdp->device;
- if (sdev->host->hostt->compat_ioctl) {
+ if (sdev->host->hostt->compat_ioctl) {
int ret;
ret = sdev->host->hostt->compat_ioctl(sdev, cmd_in, (void __user *)arg);
return ret;
}
-
+
return -ENOIOCTLCMD;
}
#endif
@@ -1646,7 +1651,7 @@ init_sg(void)
else
def_reserved_size = sg_big_buff;
- rc = register_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0),
+ rc = register_chrdev_region(MKDEV(SCSI_GENERIC_MAJOR, 0),
SG_MAX_DEVS, "sg");
if (rc)
return rc;
@@ -2304,7 +2309,7 @@ static const struct file_operations adio_fops = {
};
static int sg_proc_single_open_dressz(struct inode *inode, struct file *file);
-static ssize_t sg_proc_write_dressz(struct file *filp,
+static ssize_t sg_proc_write_dressz(struct file *filp,
const char __user *buffer, size_t count, loff_t *off);
static const struct file_operations dressz_fops = {
.owner = THIS_MODULE,
@@ -2444,7 +2449,7 @@ static int sg_proc_single_open_adio(struct inode *inode, struct file *file)
return single_open(file, sg_proc_seq_show_int, &sg_allow_dio);
}
-static ssize_t
+static ssize_t
sg_proc_write_adio(struct file *filp, const char __user *buffer,
size_t count, loff_t *off)
{
@@ -2465,7 +2470,7 @@ static int sg_proc_single_open_dressz(struct inode *inode, struct file *file)
return single_open(file, sg_proc_seq_show_int, &sg_big_buff);
}
-static ssize_t
+static ssize_t
sg_proc_write_dressz(struct file *filp, const char __user *buffer,
size_t count, loff_t *off)
{
@@ -2640,6 +2645,9 @@ static void sg_proc_debug_helper(struct seq_file *s, Sg_device * sdp)
seq_puts(s, srp->done ?
((1 == srp->done) ? "rcv:" : "fin:")
: "act:");
+ seq_printf(s, srp->done ?
+ ((1 == srp->done) ? "rcv:" : "fin:")
+ : "act:");
seq_printf(s, " id=%d blen=%d",
srp->header.pack_id, blen);
if (srp->done)
diff --git a/drivers/soc/qcom/qdsp6v2/msm_audio_ion_vm.c b/drivers/soc/qcom/qdsp6v2/msm_audio_ion_vm.c
index a3aa8823d8ce..afc40461e8e8 100644
--- a/drivers/soc/qcom/qdsp6v2/msm_audio_ion_vm.c
+++ b/drivers/soc/qcom/qdsp6v2/msm_audio_ion_vm.c
@@ -22,7 +22,6 @@
#include <linux/msm_audio_ion.h>
#include <linux/habmm.h>
#include "../../../staging/android/ion/ion_priv.h"
-#include "../../../staging/android/ion/ion_hvenv_driver.h"
#define MSM_AUDIO_ION_PROBED (1 << 0)
@@ -628,7 +627,7 @@ struct ion_client *msm_audio_ion_client_create(const char *name)
{
struct ion_client *pclient = NULL;
- pclient = hvenv_ion_client_create(name);
+ pclient = msm_ion_client_create(name);
return pclient;
}
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c08a524f3dab..5644051b4010 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4294,6 +4294,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
enum usb_device_speed oldspeed = udev->speed;
const char *speed;
int devnum = udev->devnum;
+ char *error_event[] = {
+ "USB_DEVICE_ERROR=Device_No_Response", NULL };
/* root hub ports have a slightly longer reset period
* (from USB 2.0 spec, section 7.1.7.5)
@@ -4467,6 +4469,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
if (r != -ENODEV)
dev_err(&udev->dev, "device descriptor read/64, error %d\n",
r);
+ kobject_uevent_env(&udev->parent->dev.kobj,
+ KOBJ_CHANGE, error_event);
retval = -EMSGSIZE;
continue;
}
@@ -4519,6 +4523,8 @@ hub_port_init(struct usb_hub *hub, struct usb_device *udev, int port1,
dev_err(&udev->dev,
"device descriptor read/8, error %d\n",
retval);
+ kobject_uevent_env(&udev->parent->dev.kobj,
+ KOBJ_CHANGE, error_event);
if (retval >= 0)
retval = -EMSGSIZE;
} else {
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index c244d908fa4f..24ecbc469eb6 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -282,7 +282,7 @@ out:
return ret;
}
-static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
+void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
{
struct dwc3_ep *dep;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 94709587f238..f108aecbfe52 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2882,6 +2882,15 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
dwc->test_mode = false;
+ /*
+ * From SNPS databook section 8.1.2
+ * the EP0 should be in setup phase. So ensure
+ * that EP0 is in setup phase by issuing a stall
+ * and restart if EP0 is not in setup phase.
+ */
+ if (dwc->ep0state != EP0_SETUP_PHASE)
+ dwc3_ep0_stall_and_restart(dwc);
+
dwc3_stop_active_transfers(dwc);
dwc3_clear_stall_all_ep(dwc);
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h
index baa83cf9638b..5b3ffbe3056d 100644
--- a/drivers/usb/dwc3/gadget.h
+++ b/drivers/usb/dwc3/gadget.h
@@ -98,6 +98,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
void dwc3_ep0_interrupt(struct dwc3 *dwc,
const struct dwc3_event_depevt *event);
void dwc3_ep0_out_start(struct dwc3 *dwc);
+void dwc3_ep0_stall_and_restart(struct dwc3 *dwc);
int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value);
int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
diff --git a/drivers/video/msm/ba/msm_ba.c b/drivers/video/msm/ba/msm_ba.c
index 0fc251f026b1..4200b8f20073 100644
--- a/drivers/video/msm/ba/msm_ba.c
+++ b/drivers/video/msm/ba/msm_ba.c
@@ -555,24 +555,6 @@ long msm_ba_private_ioctl(void *instance, int cmd, void *arg)
}
}
break;
- case VIDIOC_CVBS_G_FIELD_STATUS: {
- dprintk(BA_DBG, "VIDIOC_CVBS_G_FIELD_STATUS");
- sd = inst->sd;
- if (!sd) {
- dprintk(BA_ERR, "No sd registered");
- return -EINVAL;
- }
- if (s_ioctl) {
- rc = v4l2_subdev_call(sd, core, ioctl, cmd, s_ioctl);
- if (rc)
- dprintk(BA_ERR, "%s failed: %ld on cmd: 0x%x",
- __func__, rc, cmd);
- } else {
- dprintk(BA_ERR, "%s: NULL argument provided", __func__);
- rc = -EINVAL;
- }
- }
- break;
default:
dprintk(BA_WARN, "Not a typewriter! Command: 0x%x", cmd);
rc = -ENOTTY;
@@ -830,6 +812,11 @@ void *msm_ba_open(const struct msm_ba_ext_ops *ext_ops)
dev_ctxt = get_ba_dev();
+ if (!dev_ctxt) {
+ dprintk(BA_ERR, "Failed to get ba dev");
+ return NULL;
+ }
+
inst = kzalloc(sizeof(*inst), GFP_KERNEL);
if (!inst) {