/*
 * Driver for MT9M111 CMOS Image Sensor from Micron
 *
 * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/videodev2.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/log2.h>
#include <linux/gpio.h>
#include <linux/delay.h>

#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <media/soc_camera.h>

/*
 * mt9m111 i2c address is 0x5d or 0x48 (depending on SAddr pin)
 * The platform has to define i2c_board_info and call i2c_register_board_info()
 */

/* mt9m111: Sensor register addresses */
#define MT9M111_CHIP_VERSION		0x000
#define MT9M111_ROW_START		0x001
#define MT9M111_COLUMN_START		0x002
#define MT9M111_WINDOW_HEIGHT		0x003
#define MT9M111_WINDOW_WIDTH		0x004
#define MT9M111_HORIZONTAL_BLANKING_B	0x005
#define MT9M111_VERTICAL_BLANKING_B	0x006
#define MT9M111_HORIZONTAL_BLANKING_A	0x007
#define MT9M111_VERTICAL_BLANKING_A	0x008
#define MT9M111_SHUTTER_WIDTH		0x009
#define MT9M111_ROW_SPEED		0x00a
#define MT9M111_EXTRA_DELAY		0x00b
#define MT9M111_SHUTTER_DELAY		0x00c
#define MT9M111_RESET			0x00d
#define MT9M111_READ_MODE_B		0x020
#define MT9M111_READ_MODE_A		0x021
#define MT9M111_FLASH_CONTROL		0x023
#define MT9M111_GREEN1_GAIN		0x02b
#define MT9M111_BLUE_GAIN		0x02c
#define MT9M111_RED_GAIN		0x02d
#define MT9M111_GREEN2_GAIN		0x02e
#define MT9M111_GLOBAL_GAIN		0x02f
#define MT9M111_CONTEXT_CONTROL		0x0c8
#define MT9M111_PAGE_MAP		0x0f0
#define MT9M111_BYTE_WISE_ADDR		0x0f1

#define MT9M111_RESET_SYNC_CHANGES	(1 << 15)
#define MT9M111_RESET_RESTART_BAD_FRAME	(1 << 9)
#define MT9M111_RESET_SHOW_BAD_FRAMES	(1 << 8)
#define MT9M111_RESET_RESET_SOC		(1 << 5)
#define MT9M111_RESET_OUTPUT_DISABLE	(1 << 4)
#define MT9M111_RESET_CHIP_ENABLE	(1 << 3)
#define MT9M111_RESET_ANALOG_STANDBY	(1 << 2)
#define MT9M111_RESET_RESTART_FRAME	(1 << 1)
#define MT9M111_RESET_RESET_MODE	(1 << 0)

#define MT9M111_RMB_MIRROR_COLS		(1 << 1)
#define MT9M111_RMB_MIRROR_ROWS		(1 << 0)
#define MT9M111_CTXT_CTRL_RESTART	(1 << 15)
#define MT9M111_CTXT_CTRL_DEFECTCOR_B	(1 << 12)
#define MT9M111_CTXT_CTRL_RESIZE_B	(1 << 10)
#define MT9M111_CTXT_CTRL_CTRL2_B	(1 << 9)
#define MT9M111_CTXT_CTRL_GAMMA_B	(1 << 8)
#define MT9M111_CTXT_CTRL_XENON_EN	(1 << 7)
#define MT9M111_CTXT_CTRL_READ_MODE_B	(1 << 3)
#define MT9M111_CTXT_CTRL_LED_FLASH_EN	(1 << 2)
#define MT9M111_CTXT_CTRL_VBLANK_SEL_B	(1 << 1)
#define MT9M111_CTXT_CTRL_HBLANK_SEL_B	(1 << 0)
/*
 * mt9m111: Colorpipe register addresses (0x100..0x1ff)
 */
#define MT9M111_OPER_MODE_CTRL		0x106
#define MT9M111_OUTPUT_FORMAT_CTRL	0x108
#define MT9M111_REDUCER_XZOOM_B		0x1a0
#define MT9M111_REDUCER_XSIZE_B		0x1a1
#define MT9M111_REDUCER_YZOOM_B		0x1a3
#define MT9M111_REDUCER_YSIZE_B		0x1a4
#define MT9M111_REDUCER_XZOOM_A		0x1a6
#define MT9M111_REDUCER_XSIZE_A		0x1a7
#define MT9M111_REDUCER_YZOOM_A		0x1a9
#define MT9M111_REDUCER_YSIZE_A		0x1aa

#define MT9M111_OUTPUT_FORMAT_CTRL2_A	0x13a
#define MT9M111_OUTPUT_FORMAT_CTRL2_B	0x19b

#define MT9M111_OPMODE_AUTOEXPO_EN	(1 << 14)


#define MT9M111_OUTFMT_PROCESSED_BAYER	(1 << 14)
#define MT9M111_OUTFMT_BYPASS_IFP	(1 << 10)
#define MT9M111_OUTFMT_INV_PIX_CLOCK	(1 << 9)
#define MT9M111_OUTFMT_RGB		(1 << 8)
#define MT9M111_OUTFMT_RGB565		(0x0 << 6)
#define MT9M111_OUTFMT_RGB555		(0x1 << 6)
#define MT9M111_OUTFMT_RGB444x		(0x2 << 6)
#define MT9M111_OUTFMT_RGBx444		(0x3 << 6)
#define MT9M111_OUTFMT_TST_RAMP_OFF	(0x0 << 4)
#define MT9M111_OUTFMT_TST_RAMP_COL	(0x1 << 4)
#define MT9M111_OUTFMT_TST_RAMP_ROW	(0x2 << 4)
#define MT9M111_OUTFMT_TST_RAMP_FRAME	(0x3 << 4)
#define MT9M111_OUTFMT_SHIFT_3_UP	(1 << 3)
#define MT9M111_OUTFMT_AVG_CHROMA	(1 << 2)
#define MT9M111_OUTFMT_SWAP_YCbCr_C_Y	(1 << 1)
#define MT9M111_OUTFMT_SWAP_RGB_EVEN	(1 << 1)
#define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr	(1 << 0)
/*
 * mt9m111: Camera control register addresses (0x200..0x2ff not implemented)
 */

#define reg_read(reg) mt9m111_reg_read(icd, MT9M111_##reg)
#define reg_write(reg, val) mt9m111_reg_write(icd, MT9M111_##reg, (val))
#define reg_set(reg, val) mt9m111_reg_set(icd, MT9M111_##reg, (val))
#define reg_clear(reg, val) mt9m111_reg_clear(icd, MT9M111_##reg, (val))

#define MT9M111_MIN_DARK_ROWS	8
#define MT9M111_MIN_DARK_COLS	24
#define MT9M111_MAX_HEIGHT	1024
#define MT9M111_MAX_WIDTH	1280

#define COL_FMT(_name, _depth, _fourcc, _colorspace) \
	{ .name = _name, .depth = _depth, .fourcc = _fourcc, \
	.colorspace = _colorspace }
#define RGB_FMT(_name, _depth, _fourcc) \
	COL_FMT(_name, _depth, _fourcc, V4L2_COLORSPACE_SRGB)

static const struct soc_camera_data_format mt9m111_colour_formats[] = {
	COL_FMT("YCrYCb 8 bit", 8, V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_JPEG),
	RGB_FMT("RGB 565", 16, V4L2_PIX_FMT_RGB565),
	RGB_FMT("RGB 555", 16, V4L2_PIX_FMT_RGB555),
	RGB_FMT("Bayer (sRGB) 10 bit", 10, V4L2_PIX_FMT_SBGGR16),
	RGB_FMT("Bayer (sRGB) 8 bit", 8, V4L2_PIX_FMT_SBGGR8),
};

enum mt9m111_context {
	HIGHPOWER = 0,
	LOWPOWER,
};

struct mt9m111 {
	struct i2c_client *client;
	struct soc_camera_device icd;
	int model;	/* V4L2_IDENT_MT9M111* codes from v4l2-chip-ident.h */
	enum mt9m111_context context;
	unsigned int left, top, width, height;
	u32 pixfmt;
	unsigned char autoexposure;
	unsigned char datawidth;
	unsigned int powered:1;
	unsigned int hflip:1;
	unsigned int vflip:1;
	unsigned int swap_rgb_even_odd:1;
	unsigned int swap_rgb_red_blue:1;
	unsigned int swap_yuv_y_chromas:1;
	unsigned int swap_yuv_cb_cr:1;
};

static int reg_page_map_set(struct i2c_client *client, const u16 reg)
{
	int ret;
	u16 page;
	static int lastpage = -1;	/* PageMap cache value */

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

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

static int mt9m111_reg_read(struct soc_camera_device *icd, const u16 reg)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	struct i2c_client *client = mt9m111->client;
	int ret;

	ret = reg_page_map_set(client, reg);
	if (!ret)
		ret = swab16(i2c_smbus_read_word_data(client, (reg & 0xff)));

	dev_dbg(&icd->dev, "read  reg.%03x -> %04x\n", reg, ret);
	return ret;
}

static int mt9m111_reg_write(struct soc_camera_device *icd, const u16 reg,
			     const u16 data)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	struct i2c_client *client = mt9m111->client;
	int ret;

	ret = reg_page_map_set(client, reg);
	if (!ret)
		ret = i2c_smbus_write_word_data(mt9m111->client, (reg & 0xff),
						swab16(data));
	dev_dbg(&icd->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret);
	return ret;
}

static int mt9m111_reg_set(struct soc_camera_device *icd, const u16 reg,
			   const u16 data)
{
	int ret;

	ret = mt9m111_reg_read(icd, reg);
	if (ret >= 0)
		ret = mt9m111_reg_write(icd, reg, ret | data);
	return ret;
}

static int mt9m111_reg_clear(struct soc_camera_device *icd, const u16 reg,
			     const u16 data)
{
	int ret;

	ret = mt9m111_reg_read(icd, reg);
	return mt9m111_reg_write(icd, reg, ret & ~data);
}

static int mt9m111_set_context(struct soc_camera_device *icd,
			       enum mt9m111_context ctxt)
{
	int valB = MT9M111_CTXT_CTRL_RESTART | MT9M111_CTXT_CTRL_DEFECTCOR_B
		| MT9M111_CTXT_CTRL_RESIZE_B | MT9M111_CTXT_CTRL_CTRL2_B
		| MT9M111_CTXT_CTRL_GAMMA_B | MT9M111_CTXT_CTRL_READ_MODE_B
		| MT9M111_CTXT_CTRL_VBLANK_SEL_B
		| MT9M111_CTXT_CTRL_HBLANK_SEL_B;
	int valA = MT9M111_CTXT_CTRL_RESTART;

	if (ctxt == HIGHPOWER)
		return reg_write(CONTEXT_CONTROL, valB);
	else
		return reg_write(CONTEXT_CONTROL, valA);
}

static int mt9m111_setup_rect(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret, is_raw_format;
	int width = mt9m111->width;
	int height = mt9m111->height;

	if ((mt9m111->pixfmt == V4L2_PIX_FMT_SBGGR8)
	    || (mt9m111->pixfmt == V4L2_PIX_FMT_SBGGR16))
		is_raw_format = 1;
	else
		is_raw_format = 0;

	ret = reg_write(COLUMN_START, mt9m111->left);
	if (!ret)
		ret = reg_write(ROW_START, mt9m111->top);

	if (is_raw_format) {
		if (!ret)
			ret = reg_write(WINDOW_WIDTH, width);
		if (!ret)
			ret = reg_write(WINDOW_HEIGHT, height);
	} else {
		if (!ret)
			ret = reg_write(REDUCER_XZOOM_B, MT9M111_MAX_WIDTH);
		if (!ret)
			ret = reg_write(REDUCER_YZOOM_B, MT9M111_MAX_HEIGHT);
		if (!ret)
			ret = reg_write(REDUCER_XSIZE_B, width);
		if (!ret)
			ret = reg_write(REDUCER_YSIZE_B, height);
		if (!ret)
			ret = reg_write(REDUCER_XZOOM_A, MT9M111_MAX_WIDTH);
		if (!ret)
			ret = reg_write(REDUCER_YZOOM_A, MT9M111_MAX_HEIGHT);
		if (!ret)
			ret = reg_write(REDUCER_XSIZE_A, width);
		if (!ret)
			ret = reg_write(REDUCER_YSIZE_A, height);
	}

	return ret;
}

static int mt9m111_setup_pixfmt(struct soc_camera_device *icd, u16 outfmt)
{
	int ret;

	ret = reg_write(OUTPUT_FORMAT_CTRL2_A, outfmt);
	if (!ret)
		ret = reg_write(OUTPUT_FORMAT_CTRL2_B, outfmt);
	return ret;
}

static int mt9m111_setfmt_bayer8(struct soc_camera_device *icd)
{
	return mt9m111_setup_pixfmt(icd, MT9M111_OUTFMT_PROCESSED_BAYER);
}

static int mt9m111_setfmt_bayer10(struct soc_camera_device *icd)
{
	return mt9m111_setup_pixfmt(icd, MT9M111_OUTFMT_BYPASS_IFP);
}

static int mt9m111_setfmt_rgb565(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int val = 0;

	if (mt9m111->swap_rgb_red_blue)
		val |= MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr;
	if (mt9m111->swap_rgb_even_odd)
		val |= MT9M111_OUTFMT_SWAP_RGB_EVEN;
	val |= MT9M111_OUTFMT_RGB | MT9M111_OUTFMT_RGB565;

	return mt9m111_setup_pixfmt(icd, val);
}

static int mt9m111_setfmt_rgb555(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int val = 0;

	if (mt9m111->swap_rgb_red_blue)
		val |= MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr;
	if (mt9m111->swap_rgb_even_odd)
		val |= MT9M111_OUTFMT_SWAP_RGB_EVEN;
	val |= MT9M111_OUTFMT_RGB | MT9M111_OUTFMT_RGB555;

	return mt9m111_setup_pixfmt(icd, val);
}

static int mt9m111_setfmt_yuv(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int val = 0;

	if (mt9m111->swap_yuv_cb_cr)
		val |= MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr;
	if (mt9m111->swap_yuv_y_chromas)
		val |= MT9M111_OUTFMT_SWAP_YCbCr_C_Y;

	return mt9m111_setup_pixfmt(icd, val);
}

static int mt9m111_enable(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	struct soc_camera_link *icl = mt9m111->client->dev.platform_data;
	int ret;

	if (icl->power) {
		ret = icl->power(&mt9m111->client->dev, 1);
		if (ret < 0) {
			dev_err(icd->vdev->parent,
				"Platform failed to power-on the camera.\n");
			return ret;
		}
	}

	ret = reg_set(RESET, MT9M111_RESET_CHIP_ENABLE);
	if (!ret)
		mt9m111->powered = 1;
	return ret;
}

static int mt9m111_disable(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	struct soc_camera_link *icl = mt9m111->client->dev.platform_data;
	int ret;

	ret = reg_clear(RESET, MT9M111_RESET_CHIP_ENABLE);
	if (!ret)
		mt9m111->powered = 0;

	if (icl->power)
		icl->power(&mt9m111->client->dev, 0);

	return ret;
}

static int mt9m111_reset(struct soc_camera_device *icd)
{
	int ret;

	ret = reg_set(RESET, MT9M111_RESET_RESET_MODE);
	if (!ret)
		ret = reg_set(RESET, MT9M111_RESET_RESET_SOC);
	if (!ret)
		ret = reg_clear(RESET, MT9M111_RESET_RESET_MODE
				| MT9M111_RESET_RESET_SOC);
	return ret;
}

static int mt9m111_start_capture(struct soc_camera_device *icd)
{
	return 0;
}

static int mt9m111_stop_capture(struct soc_camera_device *icd)
{
	return 0;
}

static unsigned long mt9m111_query_bus_param(struct soc_camera_device *icd)
{
	return SOCAM_MASTER | SOCAM_PCLK_SAMPLE_RISING |
		SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_VSYNC_ACTIVE_HIGH |
		SOCAM_DATAWIDTH_8;
}

static int mt9m111_set_bus_param(struct soc_camera_device *icd, unsigned long f)
{
	return 0;
}

static int mt9m111_set_pixfmt(struct soc_camera_device *icd, u32 pixfmt)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret;

	switch (pixfmt) {
	case V4L2_PIX_FMT_SBGGR8:
		ret = mt9m111_setfmt_bayer8(icd);
		break;
	case V4L2_PIX_FMT_SBGGR16:
		ret = mt9m111_setfmt_bayer10(icd);
		break;
	case V4L2_PIX_FMT_RGB555:
		ret = mt9m111_setfmt_rgb555(icd);
		break;
	case V4L2_PIX_FMT_RGB565:
		ret = mt9m111_setfmt_rgb565(icd);
		break;
	case V4L2_PIX_FMT_YUYV:
		ret = mt9m111_setfmt_yuv(icd);
		break;
	default:
		dev_err(&icd->dev, "Pixel format not handled : %x\n", pixfmt);
		ret = -EINVAL;
	}

	if (!ret)
		mt9m111->pixfmt = pixfmt;

	return ret;
}

static int mt9m111_set_fmt_cap(struct soc_camera_device *icd,
			       __u32 pixfmt, struct v4l2_rect *rect)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret;

	mt9m111->left = rect->left;
	mt9m111->top = rect->top;
	mt9m111->width = rect->width;
	mt9m111->height = rect->height;

	dev_dbg(&icd->dev, "%s fmt=%x left=%d, top=%d, width=%d, height=%d\n",
		__func__, pixfmt, mt9m111->left, mt9m111->top, mt9m111->width,
		mt9m111->height);

	ret = mt9m111_setup_rect(icd);
	if (!ret)
		ret = mt9m111_set_pixfmt(icd, pixfmt);
	return ret;
}

static int mt9m111_try_fmt_cap(struct soc_camera_device *icd,
			       struct v4l2_format *f)
{
	if (f->fmt.pix.height > MT9M111_MAX_HEIGHT)
		f->fmt.pix.height = MT9M111_MAX_HEIGHT;
	if (f->fmt.pix.width > MT9M111_MAX_WIDTH)
		f->fmt.pix.width = MT9M111_MAX_WIDTH;

	return 0;
}

static int mt9m111_get_chip_id(struct soc_camera_device *icd,
			       struct v4l2_chip_ident *id)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);

	if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR)
		return -EINVAL;

	if (id->match_chip != mt9m111->client->addr)
		return -ENODEV;

	id->ident	= mt9m111->model;
	id->revision	= 0;

	return 0;
}

#ifdef CONFIG_VIDEO_ADV_DEBUG
static int mt9m111_get_register(struct soc_camera_device *icd,
				struct v4l2_register *reg)
{
	int val;

	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);

	if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
		return -EINVAL;
	if (reg->match_chip != mt9m111->client->addr)
		return -ENODEV;

	val = mt9m111_reg_read(icd, reg->reg);
	reg->val = (u64)val;

	if (reg->val > 0xffff)
		return -EIO;

	return 0;
}

static int mt9m111_set_register(struct soc_camera_device *icd,
				struct v4l2_register *reg)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);

	if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff)
		return -EINVAL;

	if (reg->match_chip != mt9m111->client->addr)
		return -ENODEV;

	if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
		return -EIO;

	return 0;
}
#endif

static const struct v4l2_queryctrl mt9m111_controls[] = {
	{
		.id		= V4L2_CID_VFLIP,
		.type		= V4L2_CTRL_TYPE_BOOLEAN,
		.name		= "Flip Verticaly",
		.minimum	= 0,
		.maximum	= 1,
		.step		= 1,
		.default_value	= 0,
	}, {
		.id		= V4L2_CID_HFLIP,
		.type		= V4L2_CTRL_TYPE_BOOLEAN,
		.name		= "Flip Horizontaly",
		.minimum	= 0,
		.maximum	= 1,
		.step		= 1,
		.default_value	= 0,
	}, {	/* gain = 1/32*val (=>gain=1 if val==32) */
		.id		= V4L2_CID_GAIN,
		.type		= V4L2_CTRL_TYPE_INTEGER,
		.name		= "Gain",
		.minimum	= 0,
		.maximum	= 63 * 2 * 2,
		.step		= 1,
		.default_value	= 32,
		.flags		= V4L2_CTRL_FLAG_SLIDER,
	}, {
		.id		= V4L2_CID_EXPOSURE_AUTO,
		.type		= V4L2_CTRL_TYPE_BOOLEAN,
		.name		= "Auto Exposure",
		.minimum	= 0,
		.maximum	= 1,
		.step		= 1,
		.default_value	= 1,
	}
};

static int mt9m111_video_probe(struct soc_camera_device *);
static void mt9m111_video_remove(struct soc_camera_device *);
static int mt9m111_get_control(struct soc_camera_device *,
			       struct v4l2_control *);
static int mt9m111_set_control(struct soc_camera_device *,
			       struct v4l2_control *);
static int mt9m111_resume(struct soc_camera_device *icd);
static int mt9m111_init(struct soc_camera_device *icd);
static int mt9m111_release(struct soc_camera_device *icd);

static struct soc_camera_ops mt9m111_ops = {
	.owner			= THIS_MODULE,
	.probe			= mt9m111_video_probe,
	.remove			= mt9m111_video_remove,
	.init			= mt9m111_init,
	.resume			= mt9m111_resume,
	.release		= mt9m111_release,
	.start_capture		= mt9m111_start_capture,
	.stop_capture		= mt9m111_stop_capture,
	.set_fmt_cap		= mt9m111_set_fmt_cap,
	.try_fmt_cap		= mt9m111_try_fmt_cap,
	.query_bus_param	= mt9m111_query_bus_param,
	.set_bus_param		= mt9m111_set_bus_param,
	.controls		= mt9m111_controls,
	.num_controls		= ARRAY_SIZE(mt9m111_controls),
	.get_control		= mt9m111_get_control,
	.set_control		= mt9m111_set_control,
	.get_chip_id		= mt9m111_get_chip_id,
#ifdef CONFIG_VIDEO_ADV_DEBUG
	.get_register		= mt9m111_get_register,
	.set_register		= mt9m111_set_register,
#endif
};

static int mt9m111_set_flip(struct soc_camera_device *icd, int flip, int mask)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret;

	if (mt9m111->context == HIGHPOWER) {
		if (flip)
			ret = reg_set(READ_MODE_B, mask);
		else
			ret = reg_clear(READ_MODE_B, mask);
	} else {
		if (flip)
			ret = reg_set(READ_MODE_A, mask);
		else
			ret = reg_clear(READ_MODE_A, mask);
	}

	return ret;
}

static int mt9m111_get_global_gain(struct soc_camera_device *icd)
{
	unsigned int data, gain;

	data = reg_read(GLOBAL_GAIN);
	if (data >= 0)
		gain = ((data & (1 << 10)) * 2)
			| ((data & (1 << 9)) * 2)
			| (data & 0x2f);
	else
		gain = data;

	return gain;
}
static int mt9m111_set_global_gain(struct soc_camera_device *icd, int gain)
{
	u16 val;

	if (gain > 63 * 2 * 2)
		return -EINVAL;

	icd->gain = gain;
	if ((gain >= 64 * 2) && (gain < 63 * 2 * 2))
		val = (1 << 10) | (1 << 9) | (gain / 4);
	else if ((gain >= 64) && (gain < 64 * 2))
		val = (1 << 9) | (gain / 2);
	else
		val = gain;

	return reg_write(GLOBAL_GAIN, val);
}

static int mt9m111_set_autoexposure(struct soc_camera_device *icd, int on)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret;

	if (on)
		ret = reg_set(OPER_MODE_CTRL, MT9M111_OPMODE_AUTOEXPO_EN);
	else
		ret = reg_clear(OPER_MODE_CTRL, MT9M111_OPMODE_AUTOEXPO_EN);

	if (!ret)
		mt9m111->autoexposure = on;

	return ret;
}
static int mt9m111_get_control(struct soc_camera_device *icd,
			       struct v4l2_control *ctrl)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int data;

	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
		if (mt9m111->context == HIGHPOWER)
			data = reg_read(READ_MODE_B);
		else
			data = reg_read(READ_MODE_A);

		if (data < 0)
			return -EIO;
		ctrl->value = !!(data & MT9M111_RMB_MIRROR_ROWS);
		break;
	case V4L2_CID_HFLIP:
		if (mt9m111->context == HIGHPOWER)
			data = reg_read(READ_MODE_B);
		else
			data = reg_read(READ_MODE_A);

		if (data < 0)
			return -EIO;
		ctrl->value = !!(data & MT9M111_RMB_MIRROR_COLS);
		break;
	case V4L2_CID_GAIN:
		data = mt9m111_get_global_gain(icd);
		if (data < 0)
			return data;
		ctrl->value = data;
		break;
	case V4L2_CID_EXPOSURE_AUTO:
		ctrl->value = mt9m111->autoexposure;
		break;
	}
	return 0;
}

static int mt9m111_set_control(struct soc_camera_device *icd,
			       struct v4l2_control *ctrl)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	const struct v4l2_queryctrl *qctrl;
	int ret;

	qctrl = soc_camera_find_qctrl(&mt9m111_ops, ctrl->id);

	if (!qctrl)
		return -EINVAL;

	switch (ctrl->id) {
	case V4L2_CID_VFLIP:
		mt9m111->vflip = ctrl->value;
		ret = mt9m111_set_flip(icd, ctrl->value,
					MT9M111_RMB_MIRROR_ROWS);
		break;
	case V4L2_CID_HFLIP:
		mt9m111->hflip = ctrl->value;
		ret = mt9m111_set_flip(icd, ctrl->value,
					MT9M111_RMB_MIRROR_COLS);
		break;
	case V4L2_CID_GAIN:
		ret = mt9m111_set_global_gain(icd, ctrl->value);
		break;
	case V4L2_CID_EXPOSURE_AUTO:
		ret =  mt9m111_set_autoexposure(icd, ctrl->value);
		break;
	default:
		ret = -EINVAL;
	}

	return ret;
}

static int mt9m111_restore_state(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);

	mt9m111_set_context(icd, mt9m111->context);
	mt9m111_set_pixfmt(icd, mt9m111->pixfmt);
	mt9m111_setup_rect(icd);
	mt9m111_set_flip(icd, mt9m111->hflip, MT9M111_RMB_MIRROR_COLS);
	mt9m111_set_flip(icd, mt9m111->vflip, MT9M111_RMB_MIRROR_ROWS);
	mt9m111_set_global_gain(icd, icd->gain);
	mt9m111_set_autoexposure(icd, mt9m111->autoexposure);
	return 0;
}

static int mt9m111_resume(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret = 0;

	if (mt9m111->powered) {
		ret = mt9m111_enable(icd);
		if (!ret)
			ret = mt9m111_reset(icd);
		if (!ret)
			ret = mt9m111_restore_state(icd);
	}
	return ret;
}

static int mt9m111_init(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	int ret;

	mt9m111->context = HIGHPOWER;
	ret = mt9m111_enable(icd);
	if (!ret)
		ret = mt9m111_reset(icd);
	if (!ret)
		ret = mt9m111_set_context(icd, mt9m111->context);
	if (!ret)
		ret = mt9m111_set_autoexposure(icd, mt9m111->autoexposure);
	if (ret)
		dev_err(&icd->dev, "mt9m111 init failed: %d\n", ret);
	return ret;
}

static int mt9m111_release(struct soc_camera_device *icd)
{
	int ret;

	ret = mt9m111_disable(icd);
	if (ret < 0)
		dev_err(&icd->dev, "mt9m111 release failed: %d\n", ret);

	return ret;
}

/*
 * Interface active, can use i2c. If it fails, it can indeed mean, that
 * this wasn't our capture interface, so, we wait for the right one
 */
static int mt9m111_video_probe(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);
	s32 data;
	int ret;

	/*
	 * We must have a parent by now. And it cannot be a wrong one.
	 * So this entire test is completely redundant.
	 */
	if (!icd->dev.parent ||
	    to_soc_camera_host(icd->dev.parent)->nr != icd->iface)
		return -ENODEV;

	ret = mt9m111_enable(icd);
	if (ret)
		goto ei2c;
	ret = mt9m111_reset(icd);
	if (ret)
		goto ei2c;

	data = reg_read(CHIP_VERSION);

	switch (data) {
	case 0x143a:
		mt9m111->model = V4L2_IDENT_MT9M111;
		icd->formats = mt9m111_colour_formats;
		icd->num_formats = ARRAY_SIZE(mt9m111_colour_formats);
		break;
	default:
		ret = -ENODEV;
		dev_err(&icd->dev,
			"No MT9M111 chip detected, register read %x\n", data);
		goto ei2c;
	}

	dev_info(&icd->dev, "Detected a MT9M111 chip ID 0x143a\n");

	ret = soc_camera_video_start(icd);
	if (ret)
		goto eisis;

	mt9m111->autoexposure = 1;

	mt9m111->swap_rgb_even_odd = 1;
	mt9m111->swap_rgb_red_blue = 1;

	return 0;
eisis:
ei2c:
	return ret;
}

static void mt9m111_video_remove(struct soc_camera_device *icd)
{
	struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd);

	dev_dbg(&icd->dev, "Video %x removed: %p, %p\n", mt9m111->client->addr,
		mt9m111->icd.dev.parent, mt9m111->icd.vdev);
	soc_camera_video_stop(&mt9m111->icd);
}

static int mt9m111_probe(struct i2c_client *client,
			 const struct i2c_device_id *did)
{
	struct mt9m111 *mt9m111;
	struct soc_camera_device *icd;
	struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
	struct soc_camera_link *icl = client->dev.platform_data;
	int ret;

	if (!icl) {
		dev_err(&client->dev, "MT9M111 driver needs platform data\n");
		return -EINVAL;
	}

	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA)) {
		dev_warn(&adapter->dev,
			 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n");
		return -EIO;
	}

	mt9m111 = kzalloc(sizeof(struct mt9m111), GFP_KERNEL);
	if (!mt9m111)
		return -ENOMEM;

	mt9m111->client = client;
	i2c_set_clientdata(client, mt9m111);

	/* Second stage probe - when a capture adapter is there */
	icd 		= &mt9m111->icd;
	icd->ops	= &mt9m111_ops;
	icd->control	= &client->dev;
	icd->x_min	= MT9M111_MIN_DARK_COLS;
	icd->y_min	= MT9M111_MIN_DARK_ROWS;
	icd->x_current	= icd->x_min;
	icd->y_current	= icd->y_min;
	icd->width_min	= MT9M111_MIN_DARK_ROWS;
	icd->width_max	= MT9M111_MAX_WIDTH;
	icd->height_min	= MT9M111_MIN_DARK_COLS;
	icd->height_max	= MT9M111_MAX_HEIGHT;
	icd->y_skip_top	= 0;
	icd->iface	= icl->bus_id;

	ret = soc_camera_device_register(icd);
	if (ret)
		goto eisdr;
	return 0;

eisdr:
	kfree(mt9m111);
	return ret;
}

static int mt9m111_remove(struct i2c_client *client)
{
	struct mt9m111 *mt9m111 = i2c_get_clientdata(client);
	soc_camera_device_unregister(&mt9m111->icd);
	kfree(mt9m111);

	return 0;
}

static const struct i2c_device_id mt9m111_id[] = {
	{ "mt9m111", 0 },
	{ }
};
MODULE_DEVICE_TABLE(i2c, mt9m111_id);

static struct i2c_driver mt9m111_i2c_driver = {
	.driver = {
		.name = "mt9m111",
	},
	.probe		= mt9m111_probe,
	.remove		= mt9m111_remove,
	.id_table	= mt9m111_id,
};

static int __init mt9m111_mod_init(void)
{
	return i2c_add_driver(&mt9m111_i2c_driver);
}

static void __exit mt9m111_mod_exit(void)
{
	i2c_del_driver(&mt9m111_i2c_driver);
}

module_init(mt9m111_mod_init);
module_exit(mt9m111_mod_exit);

MODULE_DESCRIPTION("Micron MT9M111 Camera driver");
MODULE_AUTHOR("Robert Jarzmik");
MODULE_LICENSE("GPL");
