From patchwork Mon Oct 29 11:46:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 149658 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4026316ljp; Mon, 29 Oct 2018 04:47:42 -0700 (PDT) X-Google-Smtp-Source: AJdET5djGHmskA8K1EH3OYQnUKAQ4jCXM1kmJTpgCl+3XizRDXrN7q35lJEV6+nn5Xbmo8ccEsiL X-Received: by 2002:a65:60c9:: with SMTP id r9-v6mr13376668pgv.285.1540813662275; Mon, 29 Oct 2018 04:47:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540813662; cv=none; d=google.com; s=arc-20160816; b=YbeRTGUHMqqzm0Q91DqAqxSNV2jbKsWyYr8QisGfeye0AWdsxVD4K3tOKSh7gLpOYk 5/koPgWlGklrC8D7/2hMfJqZgRkZsm9nuNnhX4s8pkn/siO12vyn90LO5IcW5NBgVdGZ b5t5PLfHGvbnvQcWXJCwuReFcDLQmT0bo1rMIsA4fz2Ni1g+akA7Km5mc1X7yhmiV7CV TLo2E88GH0N9t1IjO4rjP+wLVT7kfICBSE4lieko2/hrrO6pcj/U0xrcUlSoyWI9IGUr wwtxrtnuu3lX3Xb8eLUf23KeQAjUiXtO3kN2kWViHTGJNYQFk5ocqkPR+nkbmelzTu4w cJjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=MBqO2mPukTsDZqPW2QSxXOX+HcsETss74ZSSZYnBbvc=; b=pDUFSsPoXLxf/tblRfU86+KUZDuu8utMhV9v2pWQFPptLtUCxlKMI85fP4gN/aw9e8 Uv7sSJi5CIG0+ZF4ktTq387OCswJI9kfXZkR4pISys6Q/H6Y9p5X4WP58a2QcM4Z4+gd Lrfs1oeFIe1/DOglFxzwLNvZPIYyWDvxLuKCLbIk1Vye+RYkCQdjOf+7aQai0YGMVyLx P1Surgca/eMIxo2/AXlqgA2fu4hK4Bg+Hc1NfMQPHyg+t6tvC1Y1IqvZ6Z1oT4K0aRH4 H0PrkcpLiTlGlwY7b3xUDcQmN+92pSxBJHMA/DkJIqWT1gwSsxDeRaUNknhF+WR6VcYH t3Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d8-v6si21103555pgh.45.2018.10.29.04.47.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Oct 2018 04:47:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 516F389E15; Mon, 29 Oct 2018 11:47:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by gabe.freedesktop.org (Postfix) with ESMTPS id D021289E05 for ; Mon, 29 Oct 2018 11:47:24 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id w9TBlKU1016481; Mon, 29 Oct 2018 06:47:21 -0500 Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id w9TBlKI3093243 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 29 Oct 2018 06:47:20 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 29 Oct 2018 06:47:17 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 29 Oct 2018 06:47:17 -0500 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w9TBl70I007729; Mon, 29 Oct 2018 06:47:16 -0500 From: Tomi Valkeinen To: Archit Taneja , Andrzej Hajda , , Andrey Gusakov Subject: [PATCH 5/7] drm/bridge: tc358767: reject modes which require too much BW Date: Mon, 29 Oct 2018 13:46:59 +0200 Message-ID: <20181029114701.26409-6-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181029114701.26409-1-tomi.valkeinen@ti.com> References: <20181029114701.26409-1-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The current driver accepts any videomode with pclk < 154MHz. This is not correct, as with 1 lane and/or 1.62Mbps speed not all videomodes can be supported. Add code to reject modes that require more bandwidth that is available. Signed-off-by: Tomi Valkeinen Reviewed-by: Andrzej Hajda --- drivers/gpu/drm/bridge/tc358767.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index ab299f4debfa..b026b5ef7378 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1114,10 +1114,20 @@ static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, static enum drm_mode_status tc_connector_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) { + struct tc_data *tc = connector_to_tc(connector); + u32 req, avail; + u32 bits_per_pixel = 24; + /* DPI interface clock limitation: upto 154 MHz */ if (mode->clock > 154000) return MODE_CLOCK_HIGH; + req = mode->clock * bits_per_pixel / 8 / 1000; + avail = tc->link.base.num_lanes * tc->link.base.rate / 1000; + + if (req > avail) + return MODE_BAD; + return MODE_OK; }