From patchwork Fri Mar 25 10:43:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 8670261 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 104709F44D for ; Fri, 25 Mar 2016 10:46:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FD68203A1 for ; Fri, 25 Mar 2016 10:46:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 987AE20394 for ; Fri, 25 Mar 2016 10:46:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbcCYKon (ORCPT ); Fri, 25 Mar 2016 06:44:43 -0400 Received: from galahad.ideasonboard.com ([185.26.127.97]:40677 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbcCYKol (ORCPT ); Fri, 25 Mar 2016 06:44:41 -0400 Received: from avalon.bb.dnainternet.fi (85-23-193-79.bb.dnainternet.fi [85.23.193.79]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id CC8192009B; Fri, 25 Mar 2016 11:43:52 +0100 (CET) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 14/54] v4l: vsp1: bru: Don't program background color in control set handler Date: Fri, 25 Mar 2016 12:43:48 +0200 Message-Id: <1458902668-1141-15-git-send-email-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1458902668-1141-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> References: <1458902668-1141-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/media/platform/vsp1/vsp1_bru.c | 15 +++++++++------ drivers/media/platform/vsp1/vsp1_bru.h | 2 ++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/vsp1/vsp1_bru.c b/drivers/media/platform/vsp1/vsp1_bru.c index 565c8b2edf19..16345ec66870 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.c +++ b/drivers/media/platform/vsp1/vsp1_bru.c @@ -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. @@ -440,6 +441,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) { diff --git a/drivers/media/platform/vsp1/vsp1_bru.h b/drivers/media/platform/vsp1/vsp1_bru.h index dbac9686ea69..4e7d2e79b940 100644 --- a/drivers/media/platform/vsp1/vsp1_bru.h +++ b/drivers/media/platform/vsp1/vsp1_bru.h @@ -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)