Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp336835ima; Fri, 1 Feb 2019 04:12:09 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia7uts2H0gtDuQ0WhmaAc8ZPwpE7K1FhI8TaorYQthQ4L9p/0XYG1aFvYxOvqV11WJTzenJ X-Received: by 2002:a63:6f0d:: with SMTP id k13mr2017397pgc.42.1549023129877; Fri, 01 Feb 2019 04:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549023129; cv=none; d=google.com; s=arc-20160816; b=JTHrVoiea4pu0CEYHDSvQbZR6CzKRsQva1c84qyhbwmKCon+eDAJijTiqv8KAxgvCY yPBTa8qMN3KYoUn4PqY2E9h7GPYTDChL9ZshWDLawlEHaA3soHnV8eZnJqx8UionVANK PbiTBCfI/u5pUG2vfPt706WbejegSpmn+oc1NlkDqaXlSAOjg39E9dIjbzBunbStaLG0 CV9jNT7f3B3DsWq2YGGb3aa42mmHJAnKeZVk49Gv1pgxBVpwqi/6FRW5ASlp+lfXwLSm WshQqymEzrW4Pz8AOe7onAo0Txg7tytHzW/zuYmcPxuTTapAP5pF1/ePfG4MgIuBLTKE 395Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=U8D4EMqbdrTzMxFbP2TPfoDUUlIzjOUqwmRCaEDL1aI=; b=iNYpEvj7T09ZgqIdIatdYenv+AFv0XpIp+8asvE/yL1Xmqk+cu5QoG1khcS7POXfCi hN+wz5E/um6qhLBuW+vf1d1eOQIfhAdQ5LdCFF57qAZM7HWN5FKshDIaFQQbT/8bfupP xTyb7CvQHgLrcHsx35XpFuXoGDJDvw7UQx8J5oZxk5WUOJf1Qrombn4LMl0fJAIwoRY4 l/HafhVCeu04NxRMMlQjt1Hg8CuczJzVB7zt1IxnXxJoTUmQGuhmMK8lk17f8CkO/1lL qvNo1ZZZHe7EZq4w1kPBwZzmX/9iNZ5qY/09CA6MqRb3L11cJBay76XZic3i7UWaay1/ Uahg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=oQm704RC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u25si6834224pgm.532.2019.02.01.04.11.53; Fri, 01 Feb 2019 04:12:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=oQm704RC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729685AbfBAMI1 (ORCPT + 99 others); Fri, 1 Feb 2019 07:08:27 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45903 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729419AbfBAMIE (ORCPT ); Fri, 1 Feb 2019 07:08:04 -0500 Received: by mail-wr1-f65.google.com with SMTP id t6so6763233wrr.12 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=Sei/piJQ3ChzrqKdr2/0P9/0l/eBD4Ofx0LOFnCmIU/JsuxgJGpLgczlHVvJNbz5ig FHqZUlkg4ZocWz0rv9e7MnKrkCy9DNEuOooa+LrfzMQ8g/WMzEr75SpdPb2qg8jUgds/ EjDTVGEb7zJB5ji3bY2lIkJc2y0MRRwdP37xTs9IwIFQkZJLsqwu5u4yrBG6mF0lDT8n cE4N4N5/99xIhDd4lJI4mKkqQs9ErFJ8cCtQTHogQvnC5r4l6EcmnAYzuopQ2NokscmD tUPe5kKph8oeBfIRt/2x8V9KEUCV6w9aaLfMkHLfW5PtrkAOIsycNrwMe/ZTr1ukRJwj zZ4Q== X-Gm-Message-State: AJcUukerJ2P32aRcjsDHJajxJCsXJdlTbhiNoMs+XzWTirr8utjn8L2u rtx90wYfzFw1PyFj52fD983ljg== 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 Cc: Zheng Yang , Neil Armstrong , dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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