From patchwork Mon Jun 18 13:22:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 138939 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp3949331lji; Mon, 18 Jun 2018 06:23:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLX2aC74mA8TtHKvwUykyXslVzoKFe1R+/xLxrqa3NuQBN2fYhpDvhlj7GyaKhlM8Nr++gG X-Received: by 2002:a65:56c1:: with SMTP id w1-v6mr11191775pgs.227.1529328183761; Mon, 18 Jun 2018 06:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529328183; cv=none; d=google.com; s=arc-20160816; b=0+inYj64XwTrMkV7gRXsjGifc77+6g/Ce+y0eFycGCqp8dOQxYdnqHGS+D9XdyFS89 GOV+lfa/rPbWV7cJW+1joqL7ZOt9V4jmex6HFwJOYuP1CYR1EralvHVaK1wXq6BQYJl5 GTg9XpCHQZX/9treoCI/8tNNb+m4gYx5CoxKbFjgNHF9rBNXHkRiWUKctdL2IZBWWf4O XzTgVHpORZ3H8zrCEAEG6wFksf8yL0ZxJn72fAy9VMmI5RhefNa6FOD5GJRIu8wKAYgC sCAMxYVQfAUBaMDAH7UHvhLun8L5cwVU3ConnSV0k+zGaxdE6JNm8340mtiq5/ihiWcy oIxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=TyxR1bFkkr69KAhBs8t0z8NS0A1p2Pmu+3WXaOKqnhM=; b=vHvM89APwFCsgi1z+Qedsq7MCj8X5Z7Ciy1kf3kXO4wSH23a65SBezejdRywwkPeA4 NtnX15jdGeZC13SnEtaqs3UATURtvuN0PMgAM7/akzN2xUH8jIFeJF3vzD4Q793nc8V9 dDNjT7eH1wG0WOPibWLA9744eAbuOhqM6nJBEvVDGwKGzwX3xihJq+VB2F3FcdY/luOo wMTvUlM1t4izByI7USaRJQToPwbv1zVknEw/wEzyZUU8ZsA2libG1NAyEAIaI0liSw06 3zoEjsWZBdq5CEcRXUzlTI/8fGdKwvi/Mh9vJ1ulTG1pLi/Sq37NMXnsAPNrS3Wq9SIL P2kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=rg8n4wP2; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t66-v6si11868193pgc.6.2018.06.18.06.23.03; Mon, 18 Jun 2018 06:23:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=rg8n4wP2; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934068AbeFRNXB (ORCPT + 5 others); Mon, 18 Jun 2018 09:23:01 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:60740 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933738AbeFRNXA (ORCPT ); Mon, 18 Jun 2018 09:23:00 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w5IDMsbe022217; Mon, 18 Jun 2018 08:22:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1529328174; bh=c4tyg1jZv7fD6Yu781Q5C4k9qLVE9HTkhjdjP2HFWHc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=rg8n4wP2EVgcD+1g9wnONHRc4BxhEDyj2lzip4ytJvr9Y1eWFt2TJcjXtaupVzR4K YzUW6/367wJVCDMz/rFcZti8d9UeSK/x3jD5UCrel5sCE9X5Q1fG0opr87gCOOI31I IsFnwP9arK9Xz1c9sZ402ugK8cPICOZbPtc51VZU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5IDMsxd003429; Mon, 18 Jun 2018 08:22:54 -0500 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 18 Jun 2018 08:22:54 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 18 Jun 2018 08:22:54 -0500 Received: from deskari.lan (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w5IDMowo002369; Mon, 18 Jun 2018 08:22:52 -0500 From: Tomi Valkeinen To: , Laurent Pinchart , CC: Jyri Sarha , Peter Ujfalusi , Benoit Parrot , Tomi Valkeinen Subject: [RFC PATCHv2 1/9] drm: Add support for extracting sync signal drive edge from videomode Date: Mon, 18 Jun 2018 16:22:34 +0300 Message-ID: <20180618132242.8673-2-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618132242.8673-1-tomi.valkeinen@ti.com> References: <20180618132242.8673-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Peter Ujfalusi The sync in some panels needs to be driven by different edge of the pixel clock compared to data. This is reflected by the DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE in videmode flags. Add similar similar definitions for bus_flags and convert the sync drive edge via drm_bus_flags_from_videomode(). Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Signed-off-by: Jyri Sarha --- drivers/gpu/drm/drm_modes.c | 15 +++++++++++---- include/drm/drm_connector.h | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Laurent Pinchart diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index e82b61e08f8c..1661bfc55687 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -659,10 +659,12 @@ EXPORT_SYMBOL_GPL(drm_display_mode_to_videomode); * drm_bus_flags_from_videomode - extract information about pixelclk and * DE polarity from videomode and store it in a separate variable * @vm: videomode structure to use - * @bus_flags: information about pixelclk and DE polarity will be stored here + * @bus_flags: information about pixelclk, sync and DE polarity will be stored + * here * - * Sets DRM_BUS_FLAG_DE_(LOW|HIGH) and DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE - * in @bus_flags according to DISPLAY_FLAGS found in @vm + * Sets DRM_BUS_FLAG_DE_(LOW|HIGH), DRM_BUS_FLAG_PIXDATA_(POS|NEG)EDGE and + * DISPLAY_FLAGS_SYNC_(POS|NEG)EDGE in @bus_flags according to DISPLAY_FLAGS + * found in @vm */ void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags) { @@ -672,6 +674,11 @@ void drm_bus_flags_from_videomode(const struct videomode *vm, u32 *bus_flags) if (vm->flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) *bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE; + if (vm->flags & DISPLAY_FLAGS_SYNC_POSEDGE) + *bus_flags |= DRM_BUS_FLAG_SYNC_POSEDGE; + if (vm->flags & DISPLAY_FLAGS_SYNC_NEGEDGE) + *bus_flags |= DRM_BUS_FLAG_SYNC_NEGEDGE; + if (vm->flags & DISPLAY_FLAGS_DE_LOW) *bus_flags |= DRM_BUS_FLAG_DE_LOW; if (vm->flags & DISPLAY_FLAGS_DE_HIGH) @@ -684,7 +691,7 @@ EXPORT_SYMBOL_GPL(drm_bus_flags_from_videomode); * of_get_drm_display_mode - get a drm_display_mode from devicetree * @np: device_node with the timing specification * @dmode: will be set to the return value - * @bus_flags: information about pixelclk and DE polarity + * @bus_flags: information about pixelclk, sync and DE polarity * @index: index into the list of display timings in devicetree * * This function is expensive and should only be used, if only one mode is to be diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 675cc3f8cf85..8fa901637f00 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -290,6 +290,10 @@ struct drm_display_info { #define DRM_BUS_FLAG_DATA_MSB_TO_LSB (1<<4) /* data is transmitted LSB to MSB on the bus */ #define DRM_BUS_FLAG_DATA_LSB_TO_MSB (1<<5) +/* drive sync on pos. edge */ +#define DRM_BUS_FLAG_SYNC_POSEDGE (1<<6) +/* drive sync on neg. edge */ +#define DRM_BUS_FLAG_SYNC_NEGEDGE (1<<7) /** * @bus_flags: Additional information (like pixel signal polarity) for