Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4493750imm; Fri, 18 May 2018 06:07:19 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpcrb4aLjhRjE6tXap78pPQc2y4dH/7mXNldxsyl35IdJFRVlV30eto5NJ/nKOBe07BUSlv X-Received: by 2002:a63:bf44:: with SMTP id i4-v6mr7255425pgo.295.1526648839507; Fri, 18 May 2018 06:07:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526648839; cv=none; d=google.com; s=arc-20160816; b=NbnsrJcGyX38qMcyr/PL/OpkT4S/q6BKbHYE7VR8i6PZ1uV1CdHhlkAvOZp3dIYghO 7ltaCDiV9ZTPTXIUDVGXJrBt9utSJmyIJVbE0bfDkA8xmYEPrtFz4+W0xrPMVOkMQIbL MPLEvtsAmqVe7B0ORzrOUTbXF4OInN/FExciTye+H8xJviu9zCauwg7VcR82DNTTtVP9 wd08PljGzLlwRJTbzvBcZqmxI3yD5cWqFDQgsBM/D058MNx0S8nZVl4BG6u6DibzZPBr E5dKbX02iD1CIdAC6Glt+KK2nz1YAqwcghl6RIEOxx3bg4LU1rK3+MikRcXK627YUKNc tZsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=kow7G+cw1LVL0J1ntRSTWMEgg2qvG4wq16Ws8EeoIxA=; b=z6ohY42WDnc78dfotxChRdd3/EAlyZyt2A/ZfxhesND/49XtnwLlMCkDFE6oz/y0M7 vDmi840U8TED7mx7PrpqxxvgutYOb4K+/dz7kq144r7kZLqu3pJOWc/oWiVo7y1j6JNR lzpU2oWdE1xQUMFqsI2tiCk0dXekqZvmsXhD0XJVLys4d6b92RBb6qk4EQEWV5z5JSUN EIUbOtKOhFhFt2qUQQMzuUQ4rSULQJ0GGlIRuqL0du1pTEX1fAdb4ms2gxrA2mYXVWOd Q5dt+lfZKI1gcJFi8xYJYvKWvyY79LBylSHMNzVtyYTnXage1IxPmJ+WkKRur1nB5r0W PdYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=F5cMbYt4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6-v6si5938508pgp.534.2018.05.18.06.07.05; Fri, 18 May 2018 06:07:19 -0700 (PDT) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=F5cMbYt4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752629AbeERNFm (ORCPT + 99 others); Fri, 18 May 2018 09:05:42 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38571 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752130AbeERNFO (ORCPT ); Fri, 18 May 2018 09:05:14 -0400 Received: by mail-wr0-f194.google.com with SMTP id 94-v6so9138504wrf.5 for ; Fri, 18 May 2018 06:05:13 -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; bh=kow7G+cw1LVL0J1ntRSTWMEgg2qvG4wq16Ws8EeoIxA=; b=F5cMbYt46AKNK/WDoY+HDzr8BRnY++T33xFvaHII9nSKc6PEzaEzareP9QpoVQE/G3 hXxdRSaZS7jhnyin/a1777YkDhhmII6uiFmq+/V8HlD2pJZhmctiXXeSd3fD1SKpbNJN mCzKKIN4RKqW/q6ERazWeT9FHSzwLmM/JPxL+ycv0t/cMGtJ5SZ3vhs5z9fSjr1HDxfr VFKPtkFBUCDl4yhqS4FgXGYHASekwoU5FEDHILJddnoXCv+XzoPClFGO2iMo7ihpLoJj +wvlMqUkCbZwR1ZxUXkQhba6JbsP1v8eYsNpbGbQXRgonExcMbKloKAUXFK4qIG67k93 16XQ== 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; bh=kow7G+cw1LVL0J1ntRSTWMEgg2qvG4wq16Ws8EeoIxA=; b=aF8Lp/fdw7jlYtusQofSxDzG+pjrVldHLaJwjnZ5FgLBpak3SxkNhjh/ROPaP/2nKR /cSahoqEZl2zIRhVYJOCWhn41VZTJZLNwJr/+ySspNAEhQUOUhGhStGBXxM22QQwlusz IdqVBbwLpc28m+uDUEFKXPaJij/6X54HyQVy6HnjBmphQExpRAMeCHLWAbQwQjhcEhoi sam4hW5Aa1ykC310V/3uzUXEHvFIwnnzfF3IGvUhjl4QoJWKKgXvZ/nNcLZx2nsldoX4 Qqe8aAYAD0p/43N3ZwKLoXBfXdOOyVfp5tu0wHjdDlw9xnrk/D903L7jffnBV09ogofN wjVQ== X-Gm-Message-State: ALKqPweSR56yZ5Yd/jw0DYRb30/DlU+pcCGipJbtYiMB5XELR2G5Tyxi Vy9fF+BQSVNtO8kU2pg6nlWRCQ== X-Received: by 2002:adf:85f4:: with SMTP id 49-v6mr7547732wru.33.1526648712271; Fri, 18 May 2018 06:05:12 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 131-v6sm11928052wms.34.2018.05.18.06.05.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 06:05:11 -0700 (PDT) From: Neil Armstrong To: airlied@linux.ie, hans.verkuil@cisco.com, lee.jones@linaro.org, olof@lixom.net, seanpaul@google.com Cc: Neil Armstrong , sadolfsson@google.com, felixe@google.com, bleung@google.com, darekm@google.com, marcheu@chromium.org, fparent@baylibre.com, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] drm/i915: hdmi: add CEC notifier to intel_hdmi Date: Fri, 18 May 2018 15:05:01 +0200 Message-Id: <1526648704-16873-3-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526648704-16873-1-git-send-email-narmstrong@baylibre.com> References: <1526648704-16873-1-git-send-email-narmstrong@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchs adds the cec_notifier feature to the intel_hdmi part of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports. The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_display.h | 20 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 13 +++++++++++++ 4 files changed, 36 insertions(+) diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig index dfd9588..2d65d56 100644 --- a/drivers/gpu/drm/i915/Kconfig +++ b/drivers/gpu/drm/i915/Kconfig @@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select CEC_CORE if CEC_NOTIFIER help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics, diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h index 4e7418b..c68d1c8 100644 --- a/drivers/gpu/drm/i915/intel_display.h +++ b/drivers/gpu/drm/i915/intel_display.h @@ -126,6 +126,26 @@ enum port { #define port_name(p) ((p) + 'A') +static inline const char *port_identifier(enum port port) +{ + switch (port) { + case PORT_A: + return "Port A"; + case PORT_B: + return "Port B"; + case PORT_C: + return "Port C"; + case PORT_D: + return "Port D"; + case PORT_E: + return "Port E"; + case PORT_F: + return "Port F"; + default: + return ""; + } +} + enum dpio_channel { DPIO_CH0, DPIO_CH1 diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index d436858..b50e51b 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -39,6 +39,7 @@ #include #include #include +#include /** * __wait_for - magic wait macro @@ -1001,6 +1002,7 @@ struct intel_hdmi { bool has_audio; bool rgb_quant_range_selectable; struct intel_connector *attached_connector; + struct cec_notifier *notifier; }; struct intel_dp_mst_encoder; diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 1baef4a..d522b5b 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector) connected = true; } + cec_notifier_set_phys_addr_from_edid(intel_hdmi->notifier, edid); + return connected; } @@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) { enum drm_connector_status status; struct drm_i915_private *dev_priv = to_i915(connector->dev); + struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector); DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", connector->base.id, connector->name); @@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS); + if (status != connector_status_connected) + cec_notifier_phys_addr_invalidate(intel_hdmi->notifier); + return status; } @@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder, static void intel_hdmi_destroy(struct drm_connector *connector) { + if (intel_attached_hdmi(connector)->notifier) + cec_notifier_put(intel_attached_hdmi(connector)->notifier); kfree(to_intel_connector(connector)->detect_edid); drm_connector_cleanup(connector); kfree(connector); @@ -2358,6 +2366,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port, u32 temp = I915_READ(PEG_BAND_GAP_DATA); I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd); } + + intel_hdmi->notifier = cec_notifier_get_conn(dev->dev, + port_identifier(port)); + if (!intel_hdmi->notifier) + DRM_DEBUG_KMS("CEC notifier get failed\n"); } void intel_hdmi_init(struct drm_i915_private *dev_priv, -- 2.7.4