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

Commit 87e45f2a authored by yungwenpeng's avatar yungwenpeng
Browse files

Merge branch mp into fairphone

* m/8901-fairphone-p-mp-release:
  2nd camera failed to suspend
  Revert "Camera Module Rear 2nd Source Backward Compatibility"
  msm_actuator masked out pr_err(..)
  Camera Module Rear 2nd Source Backward Compatibility
  msm: adsprpc: maintain local copy of rpra offloaded to DSP
  msm: adsprpc: Fix integer overflow in refcount of map
  msm: camera: eeprom: Release the mutex even though got error
  msm: camera: eeprom: Release the mutex even though got error
  staging: android: ashmem: Disallow ashmem memory from being remapped
  rtlwifi: Fix potential overflow on P2P code
  ALSA: core: Fix card races between register and disconnect
  block: blk_init_allocated_queue() set q->fq as NULL in the fail case

Change-Id: I851c727f34cacdf0aef8f4dc2cad6cb9b57eefa9
parents 29108d24 95ad42bf
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -867,6 +867,7 @@ blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn,


fail:
fail:
	blk_free_flush_queue(q->fq);
	blk_free_flush_queue(q->fq);
	q->fq = NULL;
	return NULL;
	return NULL;
}
}
EXPORT_SYMBOL(blk_init_allocated_queue);
EXPORT_SYMBOL(blk_init_allocated_queue);
+45 −18
Original line number Original line Diff line number Diff line
@@ -224,9 +224,11 @@ struct smq_invoke_ctx {
	int tgid;
	int tgid;
	remote_arg_t *lpra;
	remote_arg_t *lpra;
	remote_arg64_t *rpra;
	remote_arg64_t *rpra;
	remote_arg64_t *lrpra;		/* Local copy of rpra for put_args */
	int *fds;
	int *fds;
	struct fastrpc_mmap **maps;
	struct fastrpc_mmap **maps;
	struct fastrpc_buf *buf;
	struct fastrpc_buf *buf;
	struct fastrpc_buf *lbuf;
	size_t used;
	size_t used;
	struct fastrpc_file *fl;
	struct fastrpc_file *fl;
	uint32_t sc;
	uint32_t sc;
@@ -620,8 +622,13 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd,
			if (va >= map->va &&
			if (va >= map->va &&
				va + len <= map->va + map->len &&
				va + len <= map->va + map->len &&
				map->fd == fd) {
				map->fd == fd) {
				if (refs)
				if (refs) {
					if (map->refs + 1 == INT_MAX) {
						spin_unlock(&me->hlock);
						return -ETOOMANYREFS;
					}
					map->refs++;
					map->refs++;
				}
				match = map;
				match = map;
				break;
				break;
			}
			}
@@ -632,8 +639,11 @@ static int fastrpc_mmap_find(struct fastrpc_file *fl, int fd,
			if (va >= map->va &&
			if (va >= map->va &&
				va + len <= map->va + map->len &&
				va + len <= map->va + map->len &&
				map->fd == fd) {
				map->fd == fd) {
				if (refs)
				if (refs) {
					if (map->refs + 1 == INT_MAX)
						return -ETOOMANYREFS;
					map->refs++;
					map->refs++;
				}
				match = map;
				match = map;
				break;
				break;
			}
			}
@@ -1272,6 +1282,7 @@ static void context_free(struct smq_invoke_ctx *ctx)


	mutex_unlock(&ctx->fl->fl_map_mutex);
	mutex_unlock(&ctx->fl->fl_map_mutex);
	fastrpc_buf_free(ctx->buf, 1);
	fastrpc_buf_free(ctx->buf, 1);
	fastrpc_buf_free(ctx->lbuf, 1);
	ctx->magic = 0;
	ctx->magic = 0;
	ctx->ctxid = 0;
	ctx->ctxid = 0;


@@ -1418,7 +1429,7 @@ static void fastrpc_file_list_dtor(struct fastrpc_apps *me)
static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
{
{
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
	remote_arg64_t *rpra;
	remote_arg64_t *rpra, *lrpra;
	remote_arg_t *lpra = ctx->lpra;
	remote_arg_t *lpra = ctx->lpra;
	struct smq_invoke_buf *list;
	struct smq_invoke_buf *list;
	struct smq_phy_page *pages, *ipage;
	struct smq_phy_page *pages, *ipage;
@@ -1427,7 +1438,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
	int outbufs = REMOTE_SCALARS_OUTBUFS(sc);
	int outbufs = REMOTE_SCALARS_OUTBUFS(sc);
	int handles, bufs = inbufs + outbufs;
	int handles, bufs = inbufs + outbufs;
	uintptr_t args;
	uintptr_t args;
	size_t rlen = 0, copylen = 0, metalen = 0;
	size_t rlen = 0, copylen = 0, metalen = 0, lrpralen = 0;
	int i, oix;
	int i, oix;
	int err = 0;
	int err = 0;
	int mflags = 0;
	int mflags = 0;
@@ -1485,7 +1496,20 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		metalen = copylen = (size_t)&ipage[0];
		metalen = copylen = (size_t)&ipage[0];
	}
	}


	/* calculate len requreed for copying */
	/* allocate new local rpra buffer */
	lrpralen = (size_t)&list[0];
	if (lrpralen) {
		err = fastrpc_buf_alloc(ctx->fl, lrpralen, 0, 0, 0, &ctx->lbuf);
		if (err)
			goto bail;
	}
	if (ctx->lbuf->virt)
		memset(ctx->lbuf->virt, 0, lrpralen);

	lrpra = ctx->lbuf->virt;
	ctx->lrpra = lrpra;

	/* calculate len required for copying */
	for (oix = 0; oix < inbufs + outbufs; ++oix) {
	for (oix = 0; oix < inbufs + outbufs; ++oix) {
		int i = ctx->overps[oix]->raix;
		int i = ctx->overps[oix]->raix;
		uintptr_t mstart, mend;
		uintptr_t mstart, mend;
@@ -1536,13 +1560,13 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)


	/* map ion buffers */
	/* map ion buffers */
	PERF(ctx->fl->profile, GET_COUNTER(perf_counter, PERF_MAP),
	PERF(ctx->fl->profile, GET_COUNTER(perf_counter, PERF_MAP),
	for (i = 0; rpra && i < inbufs + outbufs; ++i) {
	for (i = 0; rpra && lrpra && i < inbufs + outbufs; ++i) {
		struct fastrpc_mmap *map = ctx->maps[i];
		struct fastrpc_mmap *map = ctx->maps[i];
		uint64_t buf = ptr_to_uint64(lpra[i].buf.pv);
		uint64_t buf = ptr_to_uint64(lpra[i].buf.pv);
		size_t len = lpra[i].buf.len;
		size_t len = lpra[i].buf.len;


		rpra[i].buf.pv = 0;
		rpra[i].buf.pv = lrpra[i].buf.pv = 0;
		rpra[i].buf.len = len;
		rpra[i].buf.len = lrpra[i].buf.len = len;
		if (!len)
		if (!len)
			continue;
			continue;
		if (map) {
		if (map) {
@@ -1570,7 +1594,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
			pages[idx].addr = map->phys + offset;
			pages[idx].addr = map->phys + offset;
			pages[idx].size = num << PAGE_SHIFT;
			pages[idx].size = num << PAGE_SHIFT;
		}
		}
		rpra[i].buf.pv = buf;
		rpra[i].buf.pv = lrpra[i].buf.pv = buf;
	}
	}
	PERF_END);
	PERF_END);
	for (i = bufs; i < bufs + handles; ++i) {
	for (i = bufs; i < bufs + handles; ++i) {
@@ -1590,7 +1614,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
	/* copy non ion buffers */
	/* copy non ion buffers */
	PERF(ctx->fl->profile, GET_COUNTER(perf_counter, PERF_COPY),
	PERF(ctx->fl->profile, GET_COUNTER(perf_counter, PERF_COPY),
	rlen = copylen - metalen;
	rlen = copylen - metalen;
	for (oix = 0; rpra && oix < inbufs + outbufs; ++oix) {
	for (oix = 0; rpra && lrpra && oix < inbufs + outbufs; ++oix) {
		int i = ctx->overps[oix]->raix;
		int i = ctx->overps[oix]->raix;
		struct fastrpc_mmap *map = ctx->maps[i];
		struct fastrpc_mmap *map = ctx->maps[i];
		size_t mlen;
		size_t mlen;
@@ -1609,7 +1633,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		VERIFY(err, rlen >= mlen);
		VERIFY(err, rlen >= mlen);
		if (err)
		if (err)
			goto bail;
			goto bail;
		rpra[i].buf.pv = (args - ctx->overps[oix]->offset);
		rpra[i].buf.pv = lrpra[i].buf.pv =
			 (args - ctx->overps[oix]->offset);
		pages[list[i].pgidx].addr = ctx->buf->phys -
		pages[list[i].pgidx].addr = ctx->buf->phys -
					    ctx->overps[oix]->offset +
					    ctx->overps[oix]->offset +
					    (copylen - rlen);
					    (copylen - rlen);
@@ -1641,7 +1666,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		if (map && (map->attr & FASTRPC_ATTR_COHERENT))
		if (map && (map->attr & FASTRPC_ATTR_COHERENT))
			continue;
			continue;


		if (rpra && rpra[i].buf.len && ctx->overps[oix]->mstart) {
		if (rpra && lrpra && rpra[i].buf.len &&
			ctx->overps[oix]->mstart) {
			if (map && map->handle)
			if (map && map->handle)
				msm_ion_do_cache_op(ctx->fl->apps->client,
				msm_ion_do_cache_op(ctx->fl->apps->client,
					map->handle,
					map->handle,
@@ -1655,10 +1681,11 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		}
		}
	}
	}
	PERF_END);
	PERF_END);
	for (i = bufs; rpra && i < bufs + handles; i++) {
	for (i = bufs; rpra && lrpra && i < bufs + handles; i++) {
		rpra[i].dma.fd = ctx->fds[i];
		rpra[i].dma.fd = lrpra[i].dma.fd = ctx->fds[i];
		rpra[i].dma.len = (uint32_t)lpra[i].buf.len;
		rpra[i].dma.len = lrpra[i].dma.len = (uint32_t)lpra[i].buf.len;
		rpra[i].dma.offset = (uint32_t)(uintptr_t)lpra[i].buf.pv;
		rpra[i].dma.offset = lrpra[i].dma.offset =
			 (uint32_t)(uintptr_t)lpra[i].buf.pv;
	}
	}


 bail:
 bail:
@@ -1676,7 +1703,7 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx,
	uint64_t *fdlist = NULL;
	uint64_t *fdlist = NULL;
	uint32_t *crclist = NULL;
	uint32_t *crclist = NULL;


	remote_arg64_t *rpra = ctx->rpra;
	remote_arg64_t *rpra = ctx->lrpra;
	int i, inbufs, outbufs, handles;
	int i, inbufs, outbufs, handles;
	int err = 0;
	int err = 0;


@@ -1783,7 +1810,7 @@ static void inv_args(struct smq_invoke_ctx *ctx)
{
{
	int i, inbufs, outbufs;
	int i, inbufs, outbufs;
	uint32_t sc = ctx->sc;
	uint32_t sc = ctx->sc;
	remote_arg64_t *rpra = ctx->rpra;
	remote_arg64_t *rpra = ctx->lrpra;


	inbufs = REMOTE_SCALARS_INBUFS(sc);
	inbufs = REMOTE_SCALARS_INBUFS(sc);
	outbufs = REMOTE_SCALARS_OUTBUFS(sc);
	outbufs = REMOTE_SCALARS_OUTBUFS(sc);
+1 −1
Original line number Original line Diff line number Diff line
@@ -954,7 +954,7 @@ int32_t cam_eeprom_driver_cmd(struct cam_eeprom_ctrl_t *e_ctrl, void *arg)
			&eeprom_cap,
			&eeprom_cap,
			sizeof(struct cam_eeprom_query_cap_t))) {
			sizeof(struct cam_eeprom_query_cap_t))) {
			CAM_ERR(CAM_EEPROM, "Failed Copy to User");
			CAM_ERR(CAM_EEPROM, "Failed Copy to User");
			return -EFAULT;
			rc = -EFAULT;
			goto release_mutex;
			goto release_mutex;
		}
		}
		CAM_DBG(CAM_EEPROM, "eeprom_cap: ID: %d", eeprom_cap.slot_info);
		CAM_DBG(CAM_EEPROM, "eeprom_cap: ID: %d", eeprom_cap.slot_info);
+28 −9
Original line number Original line Diff line number Diff line
@@ -31,6 +31,8 @@ DEFINE_MSM_MUTEX(msm_actuator_mutex);
#define PARK_LENS_SMALL_STEP 3
#define PARK_LENS_SMALL_STEP 3
#define MAX_QVALUE 4096
#define MAX_QVALUE 4096


extern int nActuatorAK7374;

static struct v4l2_file_operations msm_actuator_v4l2_subdev_fops;
static struct v4l2_file_operations msm_actuator_v4l2_subdev_fops;
static int32_t msm_actuator_power_up(struct msm_actuator_ctrl_t *a_ctrl);
static int32_t msm_actuator_power_up(struct msm_actuator_ctrl_t *a_ctrl);
static int32_t msm_actuator_power_down(struct msm_actuator_ctrl_t *a_ctrl);
static int32_t msm_actuator_power_down(struct msm_actuator_ctrl_t *a_ctrl);
@@ -119,7 +121,14 @@ static void msm_actuator_parse_i2c_params(struct msm_actuator_ctrl_t *a_ctrl,
				((hw_dword & write_arr[i].hw_mask) >>
				((hw_dword & write_arr[i].hw_mask) >>
				write_arr[i].hw_shift);
				write_arr[i].hw_shift);
//[Camera] Modify for IMX363 module AF Person Liu 20190509 S
//[Camera] Modify for IMX363 module AF Person Liu 20190509 S
				value = abs(1023-value);
//[Camera] Modify for IMX363 module AF Frank Cheng 20191225 S
				/*
				pr_err("%s:%d nActuatorAK7374: %d\n",
  				__func__, __LINE__,
  				nActuatorAK7374);
				*/
				if(nActuatorAK7374 == 0)value = abs(1023-value);
//[Camera] Modify for IMX363 module AF Frank Cheng 20191225 S
//[Camera] Modify for IMX363 module AF Person Liu 20190509 S
//[Camera] Modify for IMX363 module AF Person Liu 20190509 S
			if (write_arr[i].reg_addr != 0xFFFF) {
			if (write_arr[i].reg_addr != 0xFFFF) {
				i2c_byte1 = write_arr[i].reg_addr;
				i2c_byte1 = write_arr[i].reg_addr;
@@ -1578,6 +1587,14 @@ static int msm_actuator_close(struct v4l2_subdev *sd,
		return -EINVAL;
		return -EINVAL;
	}
	}
	mutex_lock(a_ctrl->actuator_mutex);
	mutex_lock(a_ctrl->actuator_mutex);
//[Camera] Modify for IMX363 module AF Frank Cheng 20191225 S
// temporary skip
//				pr_err("%s:%d nActuatorAK7374: %d\n",
//  				__func__, __LINE__,
//  				nActuatorAK7374);

				
///        if(nActuatorAK7374 == 0)
                if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE &&
                if (a_ctrl->act_device_type == MSM_CAMERA_PLATFORM_DEVICE &&
                        a_ctrl->actuator_state != ACT_DISABLE_STATE) {
                        a_ctrl->actuator_state != ACT_DISABLE_STATE) {
                        rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_util(
                        rc = a_ctrl->i2c_client.i2c_func_tbl->i2c_util(
@@ -1585,6 +1602,8 @@ static int msm_actuator_close(struct v4l2_subdev *sd,
                        if (rc < 0)
                        if (rc < 0)
                                pr_err("cci_init failed\n");
                                pr_err("cci_init failed\n");
                }
                }
        
//[Camera] Modify for IMX363 module AF Frank Cheng 20191225 S
	kfree(a_ctrl->i2c_reg_tbl);
	kfree(a_ctrl->i2c_reg_tbl);
	a_ctrl->i2c_reg_tbl = NULL;
	a_ctrl->i2c_reg_tbl = NULL;
	a_ctrl->actuator_state = ACT_DISABLE_STATE;
	a_ctrl->actuator_state = ACT_DISABLE_STATE;
+14 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
#include "msm_cci.h"
#include "msm_cci.h"
#include "msm_camera_dt_util.h"
#include "msm_camera_dt_util.h"
#include "msm_sensor_driver.h"
#include "msm_sensor_driver.h"
#include "../actuator/msm_actuator.h"


/* Logging macro */
/* Logging macro */
#undef CDBG
#undef CDBG
@@ -25,6 +26,8 @@


#define SENSOR_MAX_MOUNTANGLE (360)
#define SENSOR_MAX_MOUNTANGLE (360)


int nActuatorAK7374 = 0;

static struct v4l2_file_operations msm_sensor_v4l2_subdev_fops;
static struct v4l2_file_operations msm_sensor_v4l2_subdev_fops;
static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev);
static int32_t msm_sensor_driver_platform_probe(struct platform_device *pdev);


@@ -187,6 +190,7 @@ static int32_t msm_sensor_fill_eeprom_subdevid_by_name(
	if (eeprom_name_len >= MAX_SENSOR_NAME)
	if (eeprom_name_len >= MAX_SENSOR_NAME)
		return -EINVAL;
		return -EINVAL;



	sensor_info = s_ctrl->sensordata->sensor_info;
	sensor_info = s_ctrl->sensordata->sensor_info;
	eeprom_subdev_id = &sensor_info->subdev_id[SUB_MODULE_EEPROM];
	eeprom_subdev_id = &sensor_info->subdev_id[SUB_MODULE_EEPROM];
	/*
	/*
@@ -1136,7 +1140,16 @@ int32_t msm_sensor_driver_probe(void *setting,
		goto free_camera_info;
		goto free_camera_info;
	}
	}


	pr_err("%s:%d s_ctrl->sensordata->actuator_name: %s\n",
  				__func__, __LINE__,
  				s_ctrl->sensordata->actuator_name);
	if(strcmp(s_ctrl->sensordata->actuator_name, "ak7374") == 0)nActuatorAK7374 = 1;
				pr_err("%s:%d nActuatorAK7374: %d\n",
  				__func__, __LINE__,
  				nActuatorAK7374);
  
	pr_err("%s probe succeeded", slave_info->sensor_name);
	pr_err("%s probe succeeded", slave_info->sensor_name);
	if(strcmp(slave_info->sensor_name, "imx363") == 0)pr_err("imx363 compare success");


	s_ctrl->bypass_video_node_creation =
	s_ctrl->bypass_video_node_creation =
		slave_info->bypass_video_node_creation;
		slave_info->bypass_video_node_creation;
Loading