From patchwork Wed Oct 2 19:44:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 11171841 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81FCE1599 for ; Wed, 2 Oct 2019 19:44:18 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6961F206BB for ; Wed, 2 Oct 2019 19:44:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6961F206BB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D05D86E19B; Wed, 2 Oct 2019 19:44:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8E8416E19B for ; Wed, 2 Oct 2019 19:44:14 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id c17so141171pgg.4 for ; Wed, 02 Oct 2019 12:44:14 -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=5RG+TGpIbWGK66ii3aX/c/mLwtrL9t7Co+9YPIDroe0=; b=H6hg9gfkZH7u0+tyeKLXRcdUQBnT19xA5J2FNUGgkvdF+N64OuZE8wjK9ADk8Hebus Tc0paYFCYDwNIYGh7lUPuExVX08kXe3U8RpsWJOCD1viIpbx3Ir/ChtfsmALZDEwzw4p jdkAzxgDg7rv4LAlYn/Vd39bWwYfdO7XFXQ3kzYMGIPaJRe6092kN9VqjR6u5d87RElW ZFuvZfGegjVbNGSUKqR1DPyuBgVjzo3BXRSs4mr54AX6c1Fh67uHhoRtIM/amnmow5y5 tYKa0kOZEzCCBpnYC7X1ItkVnM6Cer4ZuQLSDzw/jH7AFNg3G01NRNWi3bE4FCun339D 91xA== X-Gm-Message-State: APjAAAXtEnxANu0F9GQgLCD4Xo4sApcSjQkzfxCTyO/McAyXzZgLwpDR ruM86WPqa5HmeVuAIbXJE4mkQQ== X-Google-Smtp-Source: APXvYqwCRR5aDz75Ce/P5Hmy07jPu4Aqvt3K38tktyiDQ8tJemrn+5jUTMbbw8q6Rh4bGgQCLaXTIw== X-Received: by 2002:a63:6803:: with SMTP id d3mr5361330pgc.183.1570045453990; Wed, 02 Oct 2019 12:44:13 -0700 (PDT) Received: from localhost ([2620:15c:202:1:4fff:7a6b:a335:8fde]) by smtp.gmail.com with ESMTPSA id b4sm68127pju.16.2019.10.02.12.44.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 12:44:13 -0700 (PDT) From: Matthias Kaehlcke To: Archit Taneja , Andrzej Hajda , Laurent Pinchart , David Airlie Subject: [PATCH v2] drm/bridge: dw-hdmi: Refuse DDC/CI transfers on the internal I2C controller Date: Wed, 2 Oct 2019 12:44:06 -0700 Message-Id: <20191002124354.v2.1.I709dfec496f5f0b44a7b61dcd4937924da8d8382@changeid> X-Mailer: git-send-email 2.23.0.444.g18eeb5a265-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=5RG+TGpIbWGK66ii3aX/c/mLwtrL9t7Co+9YPIDroe0=; b=BDeT9Q2rS460oUk++puZT/bURg9A9s+tehyWG6BTR4fBXjpn6dnc+y/qwlxbuUmlDM EXy+7jMvhu5+8Eg5lHgfSj6UqA8SYT8vNKZQLBcRyAfLAJN6KXBB3/xFFn4vg88dzkEa 7hB0jLtDHVB7YYKgwEl5/peZADD5F5ENUBB5k= 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: Jernej Skrabec , Tzung-Bi Shih , Neil Armstrong , Sean Paul , Douglas Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Matthias Kaehlcke , Cheng-Yi Chiang , Yakir Yang , Jerome Brunet Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Acked-by: Neil Armstrong --- Sorry for the delay with sending v2, I completely forgot about this patch ... Changes in v2: - updated comment with 'TOFIX' entry as requested by Neil - added Neil's 'Acked-by' tag drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 52d220a70362..ac24bceaf415 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -41,6 +41,7 @@ #include +#define DDC_CI_ADDR 0x37 #define DDC_SEGMENT_ADDR 0x30 #define HDMI_EDID_LEN 512 @@ -439,6 +440,15 @@ 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. + * TOFIX: Blacklist the DDC/CI address until we filter out + * unsupported I2C operations. + */ + return -EOPNOTSUPP; + dev_dbg(hdmi->dev, "xfer: num: %d, addr: %#x\n", num, addr); for (i = 0; i < num; i++) {