 +		else
 +			val &= ~0x3;
 +		ret = maxim_reg16_write(client, 0x381d, val);
++		/* when mirror mode is on, register 0x6900[0] needs to be set to 0x01 in order to ensure correct color output */
++		ret = maxim_reg16_read(client, 0x6900, &val);
++		if (ret < 0)
++			return ret;
++		if (ctrl->val)
++			val |= 0x1;
++		else
++			val &= ~0x1;
++		ret = maxim_reg16_write(client, 0x6900, val);
 +		break;
 +	case V4L2_CID_VFLIP:
 +		ret = maxim_reg16_read(client, 0x381c, &val);

+		goto cleanup;
+	}
+
+	return 0;
+
+cleanup:

+	int				height;
+	char				is_fixed_sensor;
+	int				dvp_width;
+	int				init_complete;
+	int				exposure;
+	int				gain;
+	int				autogain;
+};
+
+static inline struct ov490_priv *to_ov490(const struct i2c_client *client)
