From patchwork Mon Jul 22 18:19:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 11053239 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B24C413A4 for ; Mon, 22 Jul 2019 18:19:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1ABB26E76 for ; Mon, 22 Jul 2019 18:19:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93C2C2821F; Mon, 22 Jul 2019 18:19:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 491DB26E76 for ; Mon, 22 Jul 2019 18:19:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7507189D8E; Mon, 22 Jul 2019 18:19:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA0EA89D8E for ; Mon, 22 Jul 2019 18:19:50 +0000 (UTC) Received: by mail-pf1-x441.google.com with SMTP id c73so17757420pfb.13 for ; Mon, 22 Jul 2019 11:19:50 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=ZEY3bYOzp3RlSizWjVehuryQ18nF3wYfUG0Q8twJJZM=; b=gP4jRiJSWRfI6U5aT/7OAXKfwfqFFwP4Jw3cqfwlVUCmWqNESHr/8Q0bQeoQB/NIIz EDVUj2LoEkG3Fqq8sOWg6od8TAlOtu+Oc7eMjhRDC+RjK7+TKAJBPz6rZ3UOt8O9Mpf2 VY0Cy+RA4fDFDPjsGsOPvAZo8T2hY73HUiZY0BPWyYrPa+pqLznGJzGyNgumpGFj6zXk NX+XcrQmEkxAzuWv/+sQnBgaTPdlG7TtpuY9D9olzeKbs56z2DsfYPJ9Kydx3ah9et9S 6uwrax5pPkoHLVwKNXBLgAkgA17/uCKWK96D94FOEuw9zCpq2TrRa5mZTHSp0XWpiq3Y ceJQ== X-Gm-Message-State: APjAAAU6UpINH+oAIZ5GSgNFKzghzyVy2g2HAuFY1t3R7nxS4BFqYTVR /EI5ABOo2oo3BjbA4RAzZpOe+w== X-Google-Smtp-Source: APXvYqzcCvGl88snNa9+grlHY4RHCbVeyINhZTleoFs/SYk/vhYy08CTLaQNOJJrxO9skTUVFTtHJw== X-Received: by 2002:a63:6c02:: with SMTP id h2mr71668487pgc.61.1563819590479; Mon, 22 Jul 2019 11:19:50 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id v10sm41283234pfe.163.2019.07.22.11.19.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jul 2019 11:19:49 -0700 (PDT) From: Matthias Kaehlcke To: Andrzej Hajda , Laurent Pinchart , David Airlie , Daniel Vetter Subject: [PATCH v2] drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller Date: Mon, 22 Jul 2019 11:19:45 -0700 Message-Id: <20190722181945.244395-1-mka@chromium.org> X-Mailer: git-send-email 2.22.0.657.g960e92d24f-goog MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZEY3bYOzp3RlSizWjVehuryQ18nF3wYfUG0Q8twJJZM=; b=MURvjPXpQv5UN7mAWkHfdQhSjEwS47X0WVij4lXD6DFvDLOxfR9xyMTRP16hP5J4eJ RPGo+ay9cCo0tGH8itIzhdtsLIADAq2Wk8JgklQ9PW1rEW7SJvZ0B0eztFO8ExaQLn/C DTGohGh7GIxojqBTtmb63srZUTv7lTEhhtuTA= 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: Jose Abreu , Neil Armstrong , Douglas Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The DDC/CI protocol involves sending a multi-byte request to the display via I2C, which is typically followed by a multi-byte response. The internal I2C controller only allows single byte reads/writes or reads of 8 sequential bytes, hence DDC/CI is not supported when the internal I2C controller is used. The I2C transfers complete without errors, however the data in the response is garbage. Abort transfers to/from slave address 0x37 (DDC) with -EOPNOTSUPP, to make it evident that the communication is failing. Signed-off-by: Matthias Kaehlcke Reviewed-by: Douglas Anderson Reviewed-by: Sean Paul --- Changes in v2: - changed DDC_I2C_ADDR to DDC_CI_ADDR --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 045b1b13fd0e..28933629f3c7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -35,6 +35,7 @@ #include +#define DDC_CI_ADDR 0x37 #define DDC_SEGMENT_ADDR 0x30 #define HDMI_EDID_LEN 512 @@ -322,6 +323,13 @@ static int dw_hdmi_i2c_xfer(struct i2c_adapter *adap, u8 addr = msgs[0].addr; int i, ret = 0; + if (addr == DDC_CI_ADDR) + /* + * The internal I2C controller does not support the multi-byte + * read and write operations needed for DDC/CI. + */ + return -EOPNOTSUPP; + dev_dbg(hdmi->dev, "xfer: num: %d, addr: %#x\n", num, addr); for (i = 0; i < num; i++) {