]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] v4l: vsp1: bru: Don't program background color in control set handler
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sun, 1 Nov 2015 14:19:42 +0000 (12:19 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 13 Apr 2016 20:36:38 +0000 (17:36 -0300)
The datasheet clearly states that all but a few registers can't be
modified when the device is running. Programming the background color
in the control set handler is thus prohibited. Program it when starting
the module instead.

This requires storing the background color value internally as the
module can be started from the frame completion interrupt handler, and
accessing control values requires taking a mutex.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/vsp1/vsp1_bru.c
drivers/media/platform/vsp1/vsp1_bru.h

index cb0dbc15ddadfa67270158158242171856c92681..4c1bd0419e1266bf9820812bf76a06b5ded24e2e 100644 (file)
@@ -42,13 +42,9 @@ static int bru_s_ctrl(struct v4l2_ctrl *ctrl)
        struct vsp1_bru *bru =
                container_of(ctrl->handler, struct vsp1_bru, ctrls);
 
-       if (!vsp1_entity_is_streaming(&bru->entity))
-               return 0;
-
        switch (ctrl->id) {
        case V4L2_CID_BG_COLOR:
-               vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL, ctrl->val |
-                              (0xff << VI6_BRU_VIRRPF_COL_A_SHIFT));
+               bru->bgcolor = ctrl->val;
                break;
        }
 
@@ -95,12 +91,17 @@ static int bru_s_stream(struct v4l2_subdev *subdev, int enable)
                       flags & V4L2_PIX_FMT_FLAG_PREMUL_ALPHA ?
                       0 : VI6_BRU_INCTRL_NRM);
 
-       /* Set the background position to cover the whole output image. */
+       /* Set the background position to cover the whole output image and
+        * configure its color.
+        */
        vsp1_bru_write(bru, VI6_BRU_VIRRPF_SIZE,
                       (format->width << VI6_BRU_VIRRPF_SIZE_HSIZE_SHIFT) |
                       (format->height << VI6_BRU_VIRRPF_SIZE_VSIZE_SHIFT));
        vsp1_bru_write(bru, VI6_BRU_VIRRPF_LOC, 0);
 
+       vsp1_bru_write(bru, VI6_BRU_VIRRPF_COL, bru->bgcolor |
+                      (0xff << VI6_BRU_VIRRPF_COL_A_SHIFT));
+
        /* Route BRU input 1 as SRC input to the ROP unit and configure the ROP
         * unit with a NOP operation to make BRU input 1 available as the
         * Blend/ROP unit B SRC input.
@@ -438,6 +439,8 @@ struct vsp1_bru *vsp1_bru_create(struct vsp1_device *vsp1)
        v4l2_ctrl_new_std(&bru->ctrls, &bru_ctrl_ops, V4L2_CID_BG_COLOR,
                          0, 0xffffff, 1, 0);
 
+       bru->bgcolor = 0;
+
        bru->entity.subdev.ctrl_handler = &bru->ctrls;
 
        if (bru->ctrls.error) {
index dbac9686ea69be03f1ef70ecb2396ee38fa41217..4e7d2e79b9404db863e902af95ce2ab8bfd7cfd9 100644 (file)
@@ -33,6 +33,8 @@ struct vsp1_bru {
                struct vsp1_rwpf *rpf;
                struct v4l2_rect compose;
        } inputs[VSP1_MAX_RPF];
+
+       u32 bgcolor;
 };
 
 static inline struct vsp1_bru *to_bru(struct v4l2_subdev *subdev)