From patchwork Thu Jul 4 13:52:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1127546 X-Patchwork-Delegate: agust@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="S/C+Qlab"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45ffYt22vfz9sBp for ; Thu, 4 Jul 2019 23:52:50 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E17D0C21C6A; Thu, 4 Jul 2019 13:52:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5E389C21DDC; Thu, 4 Jul 2019 13:52:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6CC99C21DD3; Thu, 4 Jul 2019 13:52:19 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by lists.denx.de (Postfix) with ESMTPS id 88FD7C21DA1 for ; Thu, 4 Jul 2019 13:52:16 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id n9so6764459wru.0 for ; Thu, 04 Jul 2019 06:52:16 -0700 (PDT) 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=VwiGuXU951s4yt+UxjjQdhtHcFPb7/GYOeJp+XiRbmI=; b=S/C+Qlab+NCiVDgr4iJ5rVf3eGln4oEdQzvkUgECT83O0pr3KE9WYlmgRsLQqt+qAE sZNAOLjUu9yMXqJ7u5tjecQuvGMg9ROHO+nXYxI4iZJYarTw9h68mlAx9aQH4QgM14iz cJarC84tqlTlVb/rWPjmF7fUoO357JWKo8Tmj66JtIxmWB7G68JjJEhT5VezvfxLZ0pS jqEnDuKemVXj9fGzTPbK/5Cbv0OMwm0CMod2oh2mMge/DUCVpp5jyGoUwCouxDBOwN4H bnTjnx3Bq98SdYVzAzOdKXu6xhaCLsq8zG0+k+DqXkWQUaF7NCCmPNq3UjtIFr5W+jvB 6GWQ== 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=VwiGuXU951s4yt+UxjjQdhtHcFPb7/GYOeJp+XiRbmI=; b=DDXJvYXi3bxnk6zOCh5WMOhMzr9M1L2kxaowfN8CoCpv6UWpSYFjlgzfJCpnrfVS5t slb350j7ZVcHkKpNV4qfgBvDT8Ojsumdb2Woh0d6AwDzu5Mfqa2XRnWkoGzoWLn8RIu5 3aJmW/QhOtEqknDOZv8PA6qEPphJUB4TjNCOT3Uc54ls2LDThqPyfi/WMDDC3XPMNjWz egbQucSyt5S3eAReZm+HfLq7NJlilx17kNnRzcidL3E4kuamcaN9YRwD6AqylO9HPh6Z FoKyPLemzmbN72tcy3cNvo9DQD6UTbG3E/hrrKiT6rlWbmOaJJm3HDDPBNXL2MRpZ54u 2CrQ== X-Gm-Message-State: APjAAAXuKq8Ns3P6+bG536ybG8hS0KIZji/dSxCWob+PRkFF6tUDAUTH G5MbZM0ADps3BAeaYqf4r309bg== X-Google-Smtp-Source: APXvYqyvq45B5DCMTeqxvARsdJetIykUf09oJZi0WnBT/cXpyvSLqgqiN0GLcGnQCcJW6OnYHo6mHQ== X-Received: by 2002:adf:fe09:: with SMTP id n9mr2688066wrr.41.1562248335954; Thu, 04 Jul 2019 06:52:15 -0700 (PDT) Received: from localhost.localdomain (176-150-251-154.abo.bbox.fr. [176.150.251.154]) by smtp.gmail.com with ESMTPSA id x11sm4793199wmi.26.2019.07.04.06.52.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jul 2019 06:52:15 -0700 (PDT) From: Neil Armstrong To: agust@denx.de Date: Thu, 4 Jul 2019 15:52:07 +0200 Message-Id: <20190704135208.32104-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190704135208.32104-1-narmstrong@baylibre.com> References: <20190704135208.32104-1-narmstrong@baylibre.com> MIME-Version: 1.0 Cc: u-boot@lists.denx.de, u-boot-amlogic@groups.io Subject: [U-Boot] [PATCH 2/3] video: display: use edid_get_timing_validate() variant to filter supported EDID modes X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Introduce a new display op, mode_valid() to be used with the newly introduced edid_get_timing_validate() function, to filter supported monitor timings if handled by the display driver. Signed-off-by: Neil Armstrong --- drivers/video/display-uclass.c | 15 ++++++++++++++- include/display.h | 10 ++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/video/display-uclass.c b/drivers/video/display-uclass.c index 99ef5e76f5..1a29ce5d85 100644 --- a/drivers/video/display-uclass.c +++ b/drivers/video/display-uclass.c @@ -37,6 +37,17 @@ int display_enable(struct udevice *dev, int panel_bpp, return 0; } +static bool display_mode_valid(void *priv, const struct display_timing *timing) +{ + struct udevice *dev = priv; + struct dm_display_ops *ops = display_get_ops(dev); + + if (ops && ops->mode_valid) + return ops->mode_valid(dev, timing); + + return true; +} + int display_read_timing(struct udevice *dev, struct display_timing *timing) { struct dm_display_ops *ops = display_get_ops(dev); @@ -53,7 +64,9 @@ int display_read_timing(struct udevice *dev, struct display_timing *timing) if (ret < 0) return ret; - return edid_get_timing(buf, ret, timing, &panel_bits_per_colour); + return edid_get_timing_validate(buf, ret, timing, + &panel_bits_per_colour, + display_mode_valid, dev); } bool display_in_use(struct udevice *dev) diff --git a/include/display.h b/include/display.h index 16f317c9c8..66294616ea 100644 --- a/include/display.h +++ b/include/display.h @@ -80,6 +80,16 @@ struct dm_display_ops { */ int (*enable)(struct udevice *dev, int panel_bpp, const struct display_timing *timing); + + /** + * mode_valid() - Check if mode is supported + * + * @dev: Device to enable + * @timing: Display timings + * @return true if supported, false if not + */ + bool (*mode_valid)(struct udevice *dev, + const struct display_timing *timing); }; #define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops)