Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3228957imu; Sat, 24 Nov 2018 00:35:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/VNE76HJQoXiFn8muVrE85j6cVKTheURfWYkQL+c3TQQHfjrdknucKXWPMAn4F0bSdnJoiq X-Received: by 2002:a17:902:848d:: with SMTP id c13mr8997427plo.257.1543048559948; Sat, 24 Nov 2018 00:35:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543048559; cv=none; d=google.com; s=arc-20160816; b=XVAHxe8IrbimMk2khYGqO1G11SXc4wTtZqB8poQ1kFCHiXS2oi8SC84htl1EL8fcv0 FJQ6xLbH1W/ePe9MJyY0g3K+bGXu1LrhsPSMzOZQX8ouESoo+gVqGfjdRA2L7/vk5VHj JnOqcLuSMm4ohuhqh30N/gzILTdGuXPY1r9LM2DKJWK7X00vZj6y6EBfi4AqE6HH2yrl RrGA/+RDGx/midx0hgt/Yx7ay5fNXdu3Y9/NSWKT8WOEzh4vNIai81hz80FGl07XfkBf YatNwPuU/WXqJz8VFawVQQX2X2HolnGvkqUwqgM692xIx8Fy/vAuO2wp/O/wBc1lWQBo Hupg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iPc6aKsyCR0rc8B9wZzKkKLvBDF8NLCBhUpLs1nYqDg=; b=v2ZTlHXkb8CIynofoAClzWOCJkLpRB4fg/S77jU0bEq/HluYBNfk4wenyxcq5ldEW2 /pPDtNYRBI6R+aH21AjvSRTJebxGr4kmMrwnrWoT3oIE853EtThJVsXDGrX2MK7UDkjo n+j6zB4JqIBZ2f4uVMVl+Cqr8T3jDqapI2jBWKmnJcl2sDhoofGVAM8YJ30cuBaZsU+V aSey3fCBBPA3EP2rdHaKUEvSDUzgOEp7BJ//ykaiK432e0DhFi+NTvVJPGgiMaGq/L3T kf/LwQBDpig40FmbeBZn7sN/eUcS5aaey8AWWqWDmc+TrziWWlO7kTiAD/Z62iXwjJd0 2JVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=EdLNJqxQ; 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 j14si42464729pfd.113.2018.11.24.00.35.45; Sat, 24 Nov 2018 00:35:59 -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=EdLNJqxQ; 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 S2504645AbeKXArA (ORCPT + 99 others); Fri, 23 Nov 2018 19:47:00 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41155 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2504623AbeKXAq6 (ORCPT ); Fri, 23 Nov 2018 19:46:58 -0500 Received: by mail-wr1-f67.google.com with SMTP id x10so12457530wrs.8 for ; Fri, 23 Nov 2018 06:02:38 -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=i5eYbuAtQmY02ujUVS3SiNHhCa5RmunuX37OBRUqyQ4wiWFKmqX1qXYUxRfKVSQY88 xwagbBOcEkvGdFQzPn2rA3dayP2turovq+aFk3x3lFL0boYpolVycAjS1yDDsKApSEIE SbOzCV5XAYS4VMete3pgNHYCOQug8eKzYpSjkflutn8PvGGc1faYK/CeS10EM8/urYW9 0fRVSOoNeWJ1NDk0c+kFtr8esCVEJfIxcl+h90/zt9OSXJFKGgtlTSzHPDVZ1mytXER9 Ie1IBksCKAkZwtsmBp8JqwUDREagNuNR81V2/I5qKS3Lz+XAAHSFQgrL8PlhEJRZgsMz w3BA== X-Gm-Message-State: AA+aEWa6GuDoiYJwfGgHojs8ymaLib4lJchfAl3z4rD3d074dmzbUEMj sCewc+/YyeqFka2Ai/uCHVbWQA== 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 Cc: Zheng Yang , dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Neil Armstrong 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 Content-Transfer-Encoding: 8bit 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 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, -- 2.19.1