inst->width = format.fmt.pix_mp.width;
        inst->height = format.fmt.pix_mp.height;
+       inst->crop.top = 0;
+       inst->crop.left = 0;
+       inst->crop.width = inst->width;
+       inst->crop.height = inst->height;
 
        if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
                inst->fmt_out = fmt;
            s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
                return -EINVAL;
 
+       s->r.top = 0;
+       s->r.left = 0;
+
        switch (s->target) {
        case V4L2_SEL_TGT_CROP_BOUNDS:
        case V4L2_SEL_TGT_CROP_DEFAULT:
        case V4L2_SEL_TGT_COMPOSE:
                if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                        return -EINVAL;
-               s->r.width = inst->out_width;
-               s->r.height = inst->out_height;
+               s->r = inst->crop;
                break;
        default:
                return -EINVAL;
        }
 
-       s->r.top = 0;
-       s->r.left = 0;
-
        return 0;
 }
 
 
        inst->width = format.fmt.pix_mp.width;
        inst->height = format.fmt.pix_mp.height;
+       /*
+        * Some versions of the firmware do not report crop information for
+        * all codecs. For these cases, set the crop to the coded resolution.
+        */
+       if (ev_data->input_crop.width > 0 && ev_data->input_crop.height > 0) {
+               inst->crop.left = ev_data->input_crop.left;
+               inst->crop.top = ev_data->input_crop.top;
+               inst->crop.width = ev_data->input_crop.width;
+               inst->crop.height = ev_data->input_crop.height;
+       } else {
+               inst->crop.left = 0;
+               inst->crop.top = 0;
+               inst->crop.width = ev_data->width;
+               inst->crop.height = ev_data->height;
+       }
 
        inst->out_width = ev_data->width;
        inst->out_height = ev_data->height;
        inst->fmt_cap = &vdec_formats[0];
        inst->width = frame_width_min(inst);
        inst->height = ALIGN(frame_height_min(inst), 32);
+       inst->crop.left = 0;
+       inst->crop.top = 0;
+       inst->crop.width = inst->width;
+       inst->crop.height = inst->height;
        inst->out_width = frame_width_min(inst);
        inst->out_height = frame_height_min(inst);
        inst->fps = 30;