@@ -472,11 +472,19 @@ static int mt9m111_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a)
struct mt9m111 *mt9m111 = to_mt9m111(client);
struct mt9m111_format format;
struct v4l2_mbus_framefmt *mf = &format.mf;
+ s32 rectwidth = mt9m111->format.rect.width;
+ s32 rectheight = mt9m111->format.rect.height;
+ u32 pixwidth = mt9m111->format.mf.width;
+ u32 pixheight = mt9m111->format.mf.height;
int ret;
format.rect = a->c;
format.mf = mt9m111->format.mf;
+ /* calculate output size, maintain current scaling factors */
+ format.mf.width = pixwidth / rectwidth * format.mf.width;
+ format.mf.height = pixheight / rectheight * format.mf.height;
+
dev_dbg(&client->dev, "%s: rect: left=%d top=%d width=%d height=%d\n",
__func__, a->c.left, a->c.top, a->c.width, a->c.height);
dev_dbg(&client->dev, "%s: mf: width=%d height=%d pixelcode=%d "