From patchwork Mon Jul 31 12:53:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9871789 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C953D603F4 for ; Mon, 31 Jul 2017 12:54:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B045228426 for ; Mon, 31 Jul 2017 12:54:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A350A285C6; Mon, 31 Jul 2017 12:54:26 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 AECD6285CD for ; Mon, 31 Jul 2017 12:54:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE0596E62D; Mon, 31 Jul 2017 12:53:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC0006E62D for ; Mon, 31 Jul 2017 12:53:31 +0000 (UTC) Received: by mail-wm0-x229.google.com with SMTP id t201so48477834wmt.0 for ; Mon, 31 Jul 2017 05:53:31 -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; bh=DxBsxX3mDbOZCTz3EH9GGw0LctOYXR14bFlg/GgNIyQ=; b=RSJvBPF8x7iLfrM8+cVjPFkxtKiv+MJRW/JBd1/xoe9ytHnjih/zhD2iXv0U58KL4j +0cI8zt3ubULnz08PDQwxSqNHwRYb9whtmgwDdCHVhVHk5EiJlbZis7ncoRKTyvP+wyM lgizmm9kkx48AbmIMDOM7tH12RfwP3qshf/gFbH+f6QienOgjNuQu/Nx0nohAbYHr/dL e0MB76Z4QH+aOw3WHj2OMxgT50CJLa9yCMeY0hFQw8mt5C2DRSsbC4OpRU3vcmm62+ho JzIx9PDcsTh6IYlbajTG/D6mv3OHIh67Hgr6Wjzl6wJ6pLSxFavZwoqN7p5kOPb/SfD+ FSZQ== 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; bh=DxBsxX3mDbOZCTz3EH9GGw0LctOYXR14bFlg/GgNIyQ=; b=MAZDoirA1bedcSqJGbvN1dOCy4bWJ+52zKU0bXyR88H2ty7O4IpXIS8FcuzehUVODD hWhSKu39uXSaTp55PkOpDYVqedgV4vrdB5+CpShlZJ6U/pZpodKZ3bKtM3JLBbXqtzRO Al+jXSI0/LFHzQsoujr8ImhLd2JbByBFcQvgPzQRR/YsT7hu5WDbYbM8bBDnz3tpsueG EpQaZe4N2scqhBJ14ao7mWou4vx+d6dmqOYoFsmCpHTPEW7odQCvwmBcRgBMCtVeqOtV 0AXIPV4qnaARMHW0IBO7ae0Ofmtxb+JkoKnu81Vn0QfNlgKxaEM6j+eDQsbZnoSE2stX 9Krw== X-Gm-Message-State: AIVw110KckuiL1vCpMvqRL+Gq8Z0sW7bKZ+hm7KnLl0W02trZt+oISq5 2jIUy0i4iVxZmE4s X-Received: by 10.28.2.84 with SMTP id 81mr10812888wmc.1.1501505609967; Mon, 31 Jul 2017 05:53:29 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id p45sm31088250wrb.75.2017.07.31.05.53.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 31 Jul 2017 05:53:29 -0700 (PDT) From: Neil Armstrong To: architt@codeaurora.org, a.hajda@samsung.com Subject: [PATCH] drm/bridge: dw_hdmi: add cec notifier support Date: Mon, 31 Jul 2017 14:53:24 +0200 Message-Id: <1501505604-20273-1-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 Cc: Neil Armstrong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Russell King , hans.verkuil@cisco.com, linux-amlogic@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King Add CEC notifier support to the HDMI bridge driver, so that the CEC part of the IP can receive its physical address. Tested-by: Neil Armstrong Acked-by: Neil Armstrong Acked-by: Hans Verkuil Signed-off-by: Russell King [narmstrong: added kconfig tweak to get the right modules dependencies] Signed-off-by: Neil Armstrong --- drivers/gpu/drm/bridge/synopsys/Kconfig | 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) Hi Archit, Hans, This is second repost of Russell's patch from his dw-hdmi CEC patchset. Latest russell's thread : https://lkml.kernel.org/r/E1dFi3E-0004lh-Pu@rmk-PC.armlinux.org.uk Previous repost : https://lkml.kernel.org/r/1499337186-24429-1-git-send-email-narmstrong@baylibre.com It includes the Kconfig tweak to ensure the correct modules dependencies. Neil diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/bridge/synopsys/Kconfig index 53e78d0..351db00 100644 --- a/drivers/gpu/drm/bridge/synopsys/Kconfig +++ b/drivers/gpu/drm/bridge/synopsys/Kconfig @@ -2,6 +2,7 @@ config DRM_DW_HDMI tristate select DRM_KMS_HELPER select REGMAP_MMIO + select CEC_CORE if CEC_NOTIFIER config DRM_DW_HDMI_AHB_AUDIO tristate "Synopsys Designware AHB Audio interface" diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index ead1124..9c03846 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -33,6 +33,8 @@ #include #include +#include + #include "dw-hdmi.h" #include "dw-hdmi-audio.h" @@ -175,6 +177,8 @@ struct dw_hdmi { struct regmap *regm; void (*enable_audio)(struct dw_hdmi *hdmi); void (*disable_audio)(struct dw_hdmi *hdmi); + + struct cec_notifier *cec_notifier; }; #define HDMI_IH_PHY_STAT0_RX_SENSE \ @@ -1896,6 +1900,7 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->sink_has_audio = drm_detect_monitor_audio(edid); drm_mode_connector_update_edid_property(connector, edid); + cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); ret = drm_add_edid_modes(connector, edid); /* Store the ELD */ drm_edid_to_eld(connector, edid); @@ -2077,6 +2082,10 @@ void __dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense) dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); + + if (!rx_sense && !hpd) + cec_notifier_set_phys_addr(hdmi->cec_notifier, + CEC_PHYS_ADDR_INVALID); } void dw_hdmi_setup_rx_sense(struct device *dev, bool hpd, bool rx_sense) @@ -2376,6 +2385,12 @@ static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) if (ret) goto err_iahb; + hdmi->cec_notifier = cec_notifier_get(dev); + if (!hdmi->cec_notifier) { + ret = -ENOMEM; + goto err_iahb; + } + /* * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator * N and cts values before enabling phy @@ -2452,6 +2467,9 @@ static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) hdmi->ddc = NULL; } + if (hdmi->cec_notifier) + cec_notifier_put(hdmi->cec_notifier); + clk_disable_unprepare(hdmi->iahb_clk); err_isfr: clk_disable_unprepare(hdmi->isfr_clk);