From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F01C282DD for ; Fri, 1 Feb 2019 12:08:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C071D218AC for ; Fri, 1 Feb 2019 12:08:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="p3EJx5Pb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="oQm704RC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C071D218AC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org 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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=iVHB97L6r+PfGF8nz7DzKP3SVQ/bqMOOqCxwDJQAbhY=; b=p3EJx5Pbv+e6ewTAGUhcMKXLCB 6Z6oXTjDll2dbBZXn3RNM1bT8L/fKj8m685fBwZiDV5O0SgQ5q+XlmaiNl37VcuNKUJPSr9uOrvdY 4PME5mfFaVEpzHk2svygEIU8nVvkUZqcq9+NVDyHw4Kq4rORYgun6T9puTBxM145VqoEjlAK6MB8J sH6ChH46puqQdzn0DeUGFsl2LYM8rCC5bcTZknBzdoCbtnTKWhysNatVe2xNu7CR+TWj1u5PHFHiP 4H/aqoJXnlbZX17nH32A39Lblio2GpP1/tge2oEhSJRz3tBs+gneHzdGy3vZBec306ucYv5WGs1xJ Z5luTWxg==; 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 1gpXcD-0007go-2J; Fri, 01 Feb 2019 12:08:13 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gpXc3-0007Ue-TT for linux-amlogic@lists.infradead.org; Fri, 01 Feb 2019 12:08:07 +0000 Received: by mail-wr1-x443.google.com with SMTP id p4so6806409wrt.7 for ; Fri, 01 Feb 2019 04:08:02 -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; bh=U8D4EMqbdrTzMxFbP2TPfoDUUlIzjOUqwmRCaEDL1aI=; b=oQm704RCZtUrJJLIzY3UT6NQVrASndtwgpj7x5PHMZ8EhpthGJCgNF1/P1Dnk/Ix8I /US0g/nS7nx1l7s7fXo1C2TTnGl+wm3cUvSipzmeCCiN3qioHmKB3IPPhvbhIw5bMIpM Iyn20HuVgacnQ80b8gTZFnofKgtTbYrC//05JETctOmOAIxLpRGwwCrvA4abcMGRH0BB +YUXExv2aUjb+q54bQr5paQqKu7B2W001a6GmT/EMXM6Wa28ZBuvJhIH2Z4N7CKhX9FV FEapsZRaSGoWCM/YkEAJfOTdQai3hB3yHw/c6Pbvd7C1G5q35QjgJNvQYAWRNhsCK4VX CgJA== 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; bh=U8D4EMqbdrTzMxFbP2TPfoDUUlIzjOUqwmRCaEDL1aI=; b=horzqQJUqE1bo7VATNPpMCaFXJm4dc3bqdvz0i8omuydXFLCsGEIfpvMvvClJAMmyH qZleD1/B/Cp+DB4EiQS1l0hJhPbaQU/IQN3uiMvz3rV1llZ92J0wyy1a+/ZW+YeTM7bN sY6HZaJYN2msr+xnfEJ78H/ZnJxpLatX5Su0qSpEWUfxUc+Bzku0Ji/NS6j1bYMxNT6Q o7fQjYBv/I0bDm69u+8d6V0v0w71WCsvFro55dOemQUXR6IGcS6YaaLW+0A9DxuJDw9O P6eQ9pJJVfSx4DB2CG7nR4P8Y4XWAuqyu/Rjop4xCQ23flISPH9LNPT91AGu0ckLNw53 RnsQ== X-Gm-Message-State: AJcUukdTDKWlDYsDOjY8pO106xN0yijrobS4bZtZzGJ+n+dW28PkjJl2 +Dk1cYvSs8OGZOzOv5z5/jnRZQ== X-Google-Smtp-Source: ALg8bN7XUHxYZxVvm11k9DeDTcDHKBeThuvU2vXysmFx9rud3MJVL7Z5eDp/opAonYQ+hJaFVGW0OA== X-Received: by 2002:a5d:6105:: with SMTP id v5mr37384238wrt.63.1549022881479; Fri, 01 Feb 2019 04:08:01 -0800 (PST) Received: from localhost.localdomain ([51.15.160.169]) by smtp.gmail.com with ESMTPSA id m13sm2577103wmd.6.2019.02.01.04.08.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Feb 2019 04:08:00 -0800 (PST) From: Neil Armstrong To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, p.zabel@pengutronix.de, Sandy Huang , heiko@sntech.de, maxime.ripard@bootlin.com Subject: [PATCH v2 5/8] drm/bridge: dw-hdmi: support dynamically get input/out color info Date: Fri, 1 Feb 2019 12:07:50 +0000 Message-Id: <1549022873-40549-6-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549022873-40549-1-git-send-email-narmstrong@baylibre.com> References: <1549022873-40549-1-git-send-email-narmstrong@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190201_040804_238550_DCBEC8DF X-CRM114-Status: GOOD ( 14.55 ) 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 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: Zheng Yang To get input/output bus_format/enc_format dynamically, this patch introduce following functions 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 Tested-by: Heiko Stuebner --- 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 a63e5f0..3634bbd 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1807,6 +1807,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); @@ -1818,10 +1819,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; @@ -1830,21 +1834,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 66e7077..d506df2 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -144,6 +144,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, -- 2.7.4 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic