Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1885093pxb; Mon, 13 Sep 2021 07:31:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpJ6tpQJL5Lw7bQbdJ39PTtR6s5SC+i4D87IWmbzWuHrUFzjtY5beSbSLnV2QH1kH5NTgg X-Received: by 2002:a50:d713:: with SMTP id t19mr13475483edi.2.1631543489725; Mon, 13 Sep 2021 07:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631543489; cv=none; d=google.com; s=arc-20160816; b=PngwaMoPgzAuoFOpBPSrzyUnEBl6vXTa1zYME6U2cOjS3eA+x6lRFkY5cmvm1g/lS6 gXW/F1bYUGJrzJDs8G2l5JKV0qAlJ+sPh4GeMNfvF29hlVnSiiaVP5mxFphRt6fcp1gV Qc2qoyTlPVUfDL91S8z5m9yiHkBvWJGo/69uWMB0mulDpMh3oQ/P7o/iW0zbs7fkAdFX oDXBoGng4LUllDWhuCDjIppKoMyIs0L5s3PbuTVHFecBcxh2MAOAmbUmiUiehnB+yGTf uDnFPvia+vwaWY1efTZQIlVgxRrJtefPjWzjCb2SgmQ5Diu3QgWMkabp4FhiZCAD3vAv C17w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=F0NbJAyx+uVEmPD0iNEjh6IDClSjITTx12D1pSudpKk=; b=pHMED7FxTczvtTwfb/4PMGDgxpTKvrRkh+oKyABZqzIR4bHszbLymOo229FTo3Wkcd LOWukxpTyL54gzkr7LbWtvM+XmmgvkGsqPEvOBbiRFSC5346Z/ihjl6/FCmZYTuLZEEI tvS/FjfjWAuxQjEEI9TY7mjtXHzzBHoCgnILb41G6to9MGexpbhbtDydpy3g7X92BvOm ROrUuOlmRUY0Zf9ldMk8rK6R6QIIf/IHyAbm4L2m4cymoEcGBprbTrI3nYmi2iUqi6Vi LlEDuxZh9aytfN76nGIR/zyJsPuXry1QWTMLgXezmdOgKeBVJXGwPf+/79km0UPKBLwL vTpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FCKvIPOc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk18si7504298ejb.238.2021.09.13.07.31.03; Mon, 13 Sep 2021 07:31:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FCKvIPOc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346762AbhIMO3e (ORCPT + 99 others); Mon, 13 Sep 2021 10:29:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:45414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346548AbhIMOYq (ORCPT ); Mon, 13 Sep 2021 10:24:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2DBCC61355; Mon, 13 Sep 2021 13:48:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631540916; bh=YJS5Wy8/sijmVmuKAM7B0Tftv6Exk+3vKC0Al8tvrYA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCKvIPOcb4UqCfF5IbASWmlbJzTJRjjrJOBJqWy+ee8+qSzsEbCSnD5tYr7DF0BTR /+iV308Kl3XrluqTFmx0szp4cUwue5KA5bq7ACvn9uynxoH/3IPJAmXfYutyES1s+v QRHXJ0XRWAmfdHkvtEz1sL1xbMqmrGjdQpSGPzeA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.14 087/334] media: atmel: atmel-sama5d2-isc: fix YUYV format Date: Mon, 13 Sep 2021 15:12:21 +0200 Message-Id: <20210913131116.326785210@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131113.390368911@linuxfoundation.org> References: <20210913131113.390368911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eugen Hristev [ Upstream commit 123aaf816b952e5b6ee754335596b01ba1f6c830 ] SAMA5D2 does not have the YCYC field for the RLP (rounding, limiting, packaging) module. The YCYC field is supposed to work with interleaved YUV formats like YUYV. In SAMA5D2, we have to use YYCC field, which is used for both planar formats like YUV420 and interleaved formats like YUYV. Fix the according rlp callback to replace the generic YCYC field (which makes more sense from a logical point of view) with the required YYCC field. Fixes: debfa496871c ("media: atmel: atmel-isc-base: add support for more formats and additional pipeline modules") Signed-off-by: Eugen Hristev Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- .../media/platform/atmel/atmel-sama5d2-isc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/media/platform/atmel/atmel-sama5d2-isc.c b/drivers/media/platform/atmel/atmel-sama5d2-isc.c index 925aa80a139b..b66f1d174e9d 100644 --- a/drivers/media/platform/atmel/atmel-sama5d2-isc.c +++ b/drivers/media/platform/atmel/atmel-sama5d2-isc.c @@ -255,6 +255,23 @@ static void isc_sama5d2_config_rlp(struct isc_device *isc) struct regmap *regmap = isc->regmap; u32 rlp_mode = isc->config.rlp_cfg_mode; + /* + * In sama5d2, the YUV planar modes and the YUYV modes are treated + * in the same way in RLP register. + * Normally, YYCC mode should be Luma(n) - Color B(n) - Color R (n) + * and YCYC should be Luma(n + 1) - Color B (n) - Luma (n) - Color R (n) + * but in sama5d2, the YCYC mode does not exist, and YYCC must be + * selected for both planar and interleaved modes, as in fact + * both modes are supported. + * + * Thus, if the YCYC mode is selected, replace it with the + * sama5d2-compliant mode which is YYCC . + */ + if ((rlp_mode & ISC_RLP_CFG_MODE_YCYC) == ISC_RLP_CFG_MODE_YCYC) { + rlp_mode &= ~ISC_RLP_CFG_MODE_MASK; + rlp_mode |= ISC_RLP_CFG_MODE_YYCC; + } + regmap_update_bits(regmap, ISC_RLP_CFG + isc->offsets.rlp, ISC_RLP_CFG_MODE_MASK, rlp_mode); } -- 2.30.2