From patchwork Fri Nov 23 14:02:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10695817 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7B67515A7 for ; Fri, 23 Nov 2018 14:02:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6978C2C265 for ; Fri, 23 Nov 2018 14:02:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D4262C270; Fri, 23 Nov 2018 14:02:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id ED5692C265 for ; Fri, 23 Nov 2018 14:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=pkjnn6naJUiqDS9f5C6vD+39+xHY9nr1FBMTOXWWJ0o=; b=EUKeRhDYJY57Oa gEQUdIhRwUGit32eaFyG8HCn5vDVCfG1BDOBdDJtq2i/fr+pPOECGsjlttYSqr4WR3P6MTYry7f1k hZpQBul8aoltxpcuBjWAqlXbwc9A+CL7p3HsLixNyh9rA/1WVfSPVn6J+xde3dc0B/alo7PyV4EfU aFkQsAe7168Z4OapX1jcBGGgPsQdncSX+2Wxo1Pta+B5o30JYws3qMWJb0jwRVv3cSh4zvt2MN91j 6r8wca5yehnuLTtBFHbN8Rgwim3cPKlSBNUIkQpvCGsE8uBC5n0skXtnaNeB1R38sCjL0Wt+xX9TM 6Tp49a72+LaYj1XgGY6g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQC2o-0003bx-R8; Fri, 23 Nov 2018 14:02:54 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQC2j-0003PY-KA for linux-amlogic@lists.infradead.org; Fri, 23 Nov 2018 14:02:51 +0000 Received: by mail-wr1-x441.google.com with SMTP id j2so12476721wrw.1 for ; Fri, 23 Nov 2018 06:02:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iPc6aKsyCR0rc8B9wZzKkKLvBDF8NLCBhUpLs1nYqDg=; b=EdLNJqxQn+UHQvkoE2Z2vHzP8UE0eEyVegRHgBaj4qfgKFP7nQMVtge56C0cXXIPEx dZyey0gPKicEVvJ2twwkAHJECJB0l6VCDNuO+0UL/tiqUJ0uFGrXEb9biKKZ9tEx8Bp5 hGLyYR6iaKsq5eWUO5f2D1uJ68s2fctCQSohhm4dRjeH/WMoH9+7Gb79YnxfqmfM4Vdt 1qY/k8h4rJGnVuvx3alITg7P1MXxoGZ7lk3nt/n3dWSCXvFpM/cm9Bx1Dsz3tKl3Gr+W ihSJgoq0nv6YO/II0xSzMwzcDwNMweGqiW/VUHDLQGdZ39UiibBkIaVvlqmoQH45Zm/V Ws9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iPc6aKsyCR0rc8B9wZzKkKLvBDF8NLCBhUpLs1nYqDg=; b=STXsSsMf5GeeJzCWlXsyR5ZA1jpl9LVLWZZL5I2Zjz2TGNOii9gGURwDUjNuCY9oIB 1LE9lYvm4MRNZEjaJ0NsowPriNF+Vd3oBEqtby+4ONyUn9VACrW15sOJ/EhoYjIDae6N 3g1HSeDJMfpCxZ9jymW2ksjpe5eQVpAcOH72SRWbjJhsid+wjh2W2YQo9yU/FmuwE2XN 84GD1G0z3jPK6hsMfLx8BLT2u2/08GgUNeHlAfetA4/wxVTF3tilSgpYg+vOHnMALO0c XDXp089TcJ2eQHU/aBDvUBH9jm4YEv6EN3fc99GsCMHf7IjaXs96Odwv8ezsCInGL/Is 3igQ== X-Gm-Message-State: AA+aEWZ9w792YKr7llMWzrzZAaxA+lGQ99PVChZrxEGHaZ98a4AQ3/VM XGWQWjdwZdZ9HaDpBgkHtrhAYg== X-Google-Smtp-Source: AFSGD/XD/kWmctMwWudcg/z8r8sppGMWUEEGLUHWWvfRsI0xXVIORdak4C5esaKEHXfYSx0SpW23yw== X-Received: by 2002:adf:8342:: with SMTP id 60mr13449251wrd.212.1542981757541; Fri, 23 Nov 2018 06:02:37 -0800 (PST) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id x8sm15172185wrd.53.2018.11.23.06.02.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Nov 2018 06:02:36 -0800 (PST) From: Neil Armstrong To: architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com Subject: [PATCH RFC 5/8] drm/bridge: dw-hdmi: support dynamically get input/out color info Date: Fri, 23 Nov 2018 15:02:18 +0100 Message-Id: <20181123140221.15700-6-narmstrong@baylibre.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123140221.15700-1-narmstrong@baylibre.com> References: <20181123140221.15700-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181123_060249_664882_E5040C54 X-CRM114-Status: GOOD ( 12.78 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, Neil Armstrong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Zheng Yang Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Zheng Yang To get input/output bus_format/enc_format dynamically, this patch introduce following funstion in plat_data: - get_input_bus_format - get_output_bus_format - get_enc_in_encoding - get_enc_out_encoding Signed-off-by: Zheng Yang Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 28 +++++++++++++++++------ include/drm/bridge/dw_hdmi.h | 5 ++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 0b07bda73ffd..b38ec1d775aa 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1763,6 +1763,7 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) { int ret; + void *data = hdmi->plat_data->phy_data; hdmi_disable_overflow_interrupts(hdmi); @@ -1774,10 +1775,13 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); } - if ((hdmi->vic == 6) || (hdmi->vic == 7) || - (hdmi->vic == 21) || (hdmi->vic == 22) || - (hdmi->vic == 2) || (hdmi->vic == 3) || - (hdmi->vic == 17) || (hdmi->vic == 18)) + if (hdmi->plat_data->get_enc_out_encoding) + hdmi->hdmi_data.enc_out_encoding = + hdmi->plat_data->get_enc_out_encoding(data); + else if ((hdmi->vic == 6) || (hdmi->vic == 7) || + (hdmi->vic == 21) || (hdmi->vic == 22) || + (hdmi->vic == 2) || (hdmi->vic == 3) || + (hdmi->vic == 17) || (hdmi->vic == 18)) hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_601; else hdmi->hdmi_data.enc_out_encoding = V4L2_YCBCR_ENC_709; @@ -1786,21 +1790,31 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; /* TOFIX: Get input format from plat data or fallback to RGB888 */ - if (hdmi->plat_data->input_bus_format) + if (hdmi->plat_data->get_input_bus_format) + hdmi->hdmi_data.enc_in_bus_format = + hdmi->plat_data->get_input_bus_format(data); + else if (hdmi->plat_data->input_bus_format) hdmi->hdmi_data.enc_in_bus_format = hdmi->plat_data->input_bus_format; else hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; /* TOFIX: Get input encoding from plat data or fallback to none */ - if (hdmi->plat_data->input_bus_encoding) + if (hdmi->plat_data->get_enc_in_encoding) + hdmi->hdmi_data.enc_in_encoding = + hdmi->plat_data->get_enc_in_encoding(data); + else if (hdmi->plat_data->input_bus_encoding) hdmi->hdmi_data.enc_in_encoding = hdmi->plat_data->input_bus_encoding; else hdmi->hdmi_data.enc_in_encoding = V4L2_YCBCR_ENC_DEFAULT; /* TOFIX: Default to RGB888 output format */ - hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; + if (hdmi->plat_data->get_output_bus_format) + hdmi->hdmi_data.enc_out_bus_format = + hdmi->plat_data->get_output_bus_format(data); + else + hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; hdmi->hdmi_data.pix_repet_factor = 0; hdmi->hdmi_data.hdcp_enable = 0; diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index d7cc5d094270..27f9cce66b6a 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -141,6 +141,11 @@ struct dw_hdmi_plat_data { int (*configure_phy)(struct dw_hdmi *hdmi, const struct dw_hdmi_plat_data *pdata, unsigned long mpixelclock); + + unsigned long (*get_input_bus_format)(void *data); + unsigned long (*get_output_bus_format)(void *data); + unsigned long (*get_enc_in_encoding)(void *data); + unsigned long (*get_enc_out_encoding)(void *data); }; struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,