Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp926612imj; Sat, 9 Feb 2019 10:59:04 -0800 (PST) X-Google-Smtp-Source: AHgI3IaXFHlEbwgVTwJsp45q15IqR4WvzQBzHPdQfboDpTXzoEcVjPskUvp0yx9OiDeJ8wg8axou X-Received: by 2002:a17:902:2a26:: with SMTP id i35mr25943512plb.321.1549738744329; Sat, 09 Feb 2019 10:59:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549738744; cv=none; d=google.com; s=arc-20160816; b=EkjQXiXPgCTGy+kWd7jww1qFDyDkZmkRlYB9Yk4KvBbxRwNpNQtBqXjjpvhOVq2AMY f2alQ+B3b6PnH5r4593BqfAdYBya4dwhbxkx3vufSx24PdhSmiceDlCHlRfUxJSMFyN8 wza3ymf1GEeKuautLkovpSMpNca/yToI5AftVMj+i77SQQjHJy6nA/33bDYEKr00JdYR 5+xmkg8cn+uRQ+QUoWsTLV7KZ6lHYovzgvQBFavyLKAkxQXlWOL3gUGLjKd9DVFW6U3h NTyC+c54EYEYDGgzr5gcKBBZKFBDyDcP4PMWTlN61Xs+8+F+Hex4Z5WzL0FzLUpIDDNr Voug== 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=qr42+MLwWtV5LxNfncf2qUAe3l93gTVKO8fb65DiuEU=; b=GhYCxbl6ylC8+YIIseRWT1bO6s1sU7pV4YTHmNVzg7dFuYWrErzc+Ka8p00KtY8CYA nwcQj9iaXhSq/aSOGRIdqnbS0dgU5fBb/+1S5CSMQlBnjIgVN0BN6n1fgq+vaKNdBrSV r/1C8gnoyDd0BONiCDARJ8FYcF57KmAq8MnvMLocPb8kThqWrVyBHWSmYsdm7SfQta4Y Ivzepp0rYr7d+hbTqXi7OviVCc4qVfEjM9g2W6KSlsvjSZfvqqp0Giq7nyJIyLtqPPgO fRZE57CcCJncMSaEACzzUVq46R1AJCYxNqfB1COD6znmKYd/W1zeQEKYlAwNl6asemSS 5kHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hpjCYVcl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 86si5043851pfl.46.2019.02.09.10.58.48; Sat, 09 Feb 2019 10:59:04 -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=@kernel.org header.s=default header.b=hpjCYVcl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727963AbfBIS4n (ORCPT + 99 others); Sat, 9 Feb 2019 13:56:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:60712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727464AbfBISr4 (ORCPT ); Sat, 9 Feb 2019 13:47:56 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 17AC72192C; Sat, 9 Feb 2019 18:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549738075; bh=vhSyGlSfNiaxv2u5D6pn5vHFf9zDklCeNazlJitckDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpjCYVcl+kj96DlzN16EilMJ016j26sD/TnL5LTPos1nz00hiGVlED4NX+hBjM3fY /kP/3lA8o+P0yXcmB7w0mYhXP+DTzOUjHmcPytnqx5C7Wv0KkTGpN5dj12M4jYKE9M pGBBjBEfiKBIwtkXzUh4s/EBHwa0AwulOUoJWkcA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tomi Valkeinen , Andrzej Hajda , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.20 19/42] drm/bridge: tc358767: reject modes which require too much BW Date: Sat, 9 Feb 2019 13:47:11 -0500 Message-Id: <20190209184734.125935-19-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190209184734.125935-1-sashal@kernel.org> References: <20190209184734.125935-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tomi Valkeinen [ Upstream commit 51b9e62eb6950c762162ab7eb8390990179be067 ] 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 Signed-off-by: Andrzej Hajda Link: https://patchwork.freedesktop.org/patch/msgid/20190103115954.12785-6-tomi.valkeinen@ti.com Signed-off-by: Sasha Levin --- 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..a1f3dd2afbb1 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; + avail = tc->link.base.num_lanes * tc->link.base.rate; + + if (req > avail) + return MODE_BAD; + return MODE_OK; } -- 2.19.1