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

Commit 096b703f authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Mauro Carvalho Chehab
Browse files

[media] mt9m111: move lastpage to struct mt9m111 for multi instances

parent e553000a
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ struct mt9m111 {
	struct mutex power_lock; /* lock to protect power_count */
	int power_count;
	const struct mt9m111_datafmt *fmt;
	int lastpage;	/* PageMap cache value */
	unsigned int gain;
	unsigned char autoexposure;
	unsigned char datawidth;
@@ -202,17 +203,17 @@ static int reg_page_map_set(struct i2c_client *client, const u16 reg)
{
	int ret;
	u16 page;
	static int lastpage = -1;	/* PageMap cache value */
	struct mt9m111 *mt9m111 = to_mt9m111(client);

	page = (reg >> 8);
	if (page == lastpage)
	if (page == mt9m111->lastpage)
		return 0;
	if (page > 2)
		return -EINVAL;

	ret = i2c_smbus_write_word_data(client, MT9M111_PAGE_MAP, swab16(page));
	if (!ret)
		lastpage = page;
		mt9m111->lastpage = page;
	return ret;
}

@@ -932,6 +933,8 @@ static int mt9m111_video_probe(struct soc_camera_device *icd,
	BUG_ON(!icd->parent ||
	       to_soc_camera_host(icd->parent)->nr != icd->iface);

	mt9m111->lastpage = -1;

	mt9m111->autoexposure = 1;
	mt9m111->autowhitebalance = 1;