Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3706826ybi; Sun, 2 Jun 2019 21:35:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMB2By4KIzwWyceonTxWRxPV0WRE97rEucdW0ohIhG6PtWgOck1vxIEHCDqCYymAEmbblw X-Received: by 2002:a63:a08:: with SMTP id 8mr26127520pgk.46.1559536518934; Sun, 02 Jun 2019 21:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559536518; cv=none; d=google.com; s=arc-20160816; b=o6Xu07CqorNKNc4SIO61kgkuJy8m8jWSXj9GCGCIK+2C+On4WGFLpzsxdzaulLBFAi 0s/y0MG96UFT6ercM/WloaIOUh/pLRRMz7seX+N1ap2yHH7KqTIerYdI/X5Ve4utPcSh WVRTRani0QSV4ChArCRW2DpQrtgEdZJ0e/xQu4NcJ8ZxYvny6ybbQWvHOtq1ndLX8CzD mYYdV85Hl97CYnhn0RSqMoDnIMiJ12qYHhE4Se0kXr+pwlXrDAm8CMmOQYg7oHC3W9eB eMUPPDYoZjvu22lbnAbe/TJF4tQcw7ZA8O6yiVeFDUyh+xQdce4Uw+xnVdoOj2roGmvs dIxg== 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=MaZJTXi3Kb+zP1LdC2+ckQjoA/4H+fjgGV1LvJAeRMw=; b=yw1fXnLe/nsBEvIVpby2wcyAieOwL2XFRhPORHc741KDGegtch4AmtF66p9Q/nRhDp PQcOwiA7PdtrkO+Y9vlnJVnzWD5xKkqjNbUF1f0RRAJdtllZpWZETIfXkIZWWFgtvMuG f5dBxTHb6FragXcK81kIFhfBYl77r7GZVNiJkwoaoNYDpgWwVo4jPW+fOWd31EGvAdmu OryZplIAdm+nOhHV0GAtIaqw9IOIDsBgpmnIfSBIKfkSa6G2MEOSvG+2o3j+azMWgShr 4yvXG2ioHC1hYlHliQ65lNmuozJ4RdHSRB0zaco6SDzHbc7w4Y9qsxEpGhNiORAb65Jk Zk3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kedjugWk; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j37si2907084plb.20.2019.06.02.21.35.02; Sun, 02 Jun 2019 21:35:18 -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=@chromium.org header.s=google header.b=kedjugWk; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbfFCEdq (ORCPT + 99 others); Mon, 3 Jun 2019 00:33:46 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34296 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbfFCEdp (ORCPT ); Mon, 3 Jun 2019 00:33:45 -0400 Received: by mail-pg1-f193.google.com with SMTP id h2so4277523pgg.1 for ; Sun, 02 Jun 2019 21:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MaZJTXi3Kb+zP1LdC2+ckQjoA/4H+fjgGV1LvJAeRMw=; b=kedjugWkJGjbZv4u3cVdp4XDkL/2UujV324hi4xDMTOTYbHYPbUnOtVV/E696ygI4t cYwfGz01X+eBCKlr5xigVC+q17FBxGkqMRIQmN2Tb9LkEM0x9vaOqC8GKJiYJv2aslY2 TItexnk2xcMcs/1c/Ex771hoN5UH0dq13eh48= 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:mime-version:content-transfer-encoding; bh=MaZJTXi3Kb+zP1LdC2+ckQjoA/4H+fjgGV1LvJAeRMw=; b=YTqiPmb+pAdlW2gLx7ZIC4b1efZAD8JISeHrHVK6+8Pux7U6jtJTViclPVlshVPVG8 tOUMgn3CDnIhaFXoVNzku9wjsFldb0OXzP/LPTK7mJjEJR4iSq02Oa9i+6vdTnlD8RrG McKE40WZ6L5PyqRXM0F0WQ++iXbvSRy4Id4GSEtlme52rgzU/ceSLxkvvrllmiXVn6Yo 6oIQyeUA45Q5PBhEt6xUOdsYXJyEvh0ENVkfXzhYcn19ljUBDWsjLvoZs1z0IEOn8Zl/ ZVsy5mJhovw5J7MDEjn0LRstJndZbJrAUfcnS56p76c6l9v5s+TG3hKIdTqxdtFi2uHT g8JA== X-Gm-Message-State: APjAAAXXvyLO6ceyJQ9z+VyZclQrrPkoUG7RrUKR2TSu2/0NSUGkHSPI fpm2Kw9QbAdPZzLvSzeu35YLnXr3ZeM= X-Received: by 2002:a17:90a:a789:: with SMTP id f9mr27039120pjq.20.1559536424466; Sun, 02 Jun 2019 21:33:44 -0700 (PDT) Received: from localhost ([2401:fa00:1:b:e688:dfd2:a1a7:2956]) by smtp.gmail.com with ESMTPSA id m11sm10827627pjv.21.2019.06.02.21.33.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jun 2019 21:33:43 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Cc: Hans Verkuil , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Philipp Zabel , Mark Brown , Liam Girdwood , Takashi Iwai , Jaroslav Kysela , Russell King , Andrzej Hajda , Laurent Pinchart , David Airlie , Daniel Vetter , Rob Herring , Heiko Stuebner , dianders@chromium.org, dgreid@chromium.org, tzungbi@chromium.org, linux-media@vger.kernel.org, alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, Cheng-Yi Chiang Subject: [PATCH 3/7] drm/bridge/synopsys: dw-hdmi: Add HDMI notifier support Date: Mon, 3 Jun 2019 12:32:47 +0800 Message-Id: <20190603043251.226549-4-cychiang@chromium.org> X-Mailer: git-send-email 2.22.0.rc1.257.g3120a18244-goog In-Reply-To: <20190603043251.226549-1-cychiang@chromium.org> References: <20190603043251.226549-1-cychiang@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use hdmi-notifier to notify codec driver that there is HDMI plug/unplug event. Signed-off-by: Cheng-Yi Chiang --- drivers/gpu/drm/bridge/synopsys/Kconfig | 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 28 +++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/bridge/synopsys/Kconfig index 3cc53b44186e..43192d9d7357 100644 --- a/drivers/gpu/drm/bridge/synopsys/Kconfig +++ b/drivers/gpu/drm/bridge/synopsys/Kconfig @@ -3,6 +3,7 @@ config DRM_DW_HDMI select DRM_KMS_HELPER select REGMAP_MMIO select CEC_CORE if CEC_NOTIFIER + select HDMI_NOTIFIERS 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 ab7968c8f6a2..53701921eb1f 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -190,6 +191,7 @@ struct dw_hdmi { void (*disable_audio)(struct dw_hdmi *hdmi); struct cec_notifier *cec_notifier; + struct hdmi_notifier *hdmi_notifier; }; #define HDMI_IH_PHY_STAT0_RX_SENSE \ @@ -2301,8 +2303,15 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) } if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { - dev_dbg(hdmi->dev, "EVENT=%s\n", - phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout"); + if (phy_int_pol & HDMI_PHY_HPD) { + dev_dbg(hdmi->dev, "EVENT=plugin\n"); + if (hdmi->hdmi_notifier) + hdmi_event_connect(hdmi->hdmi_notifier); + } else { + dev_dbg(hdmi->dev, "EVENT=plugout\n"); + if (hdmi->hdmi_notifier) + hdmi_event_disconnect(hdmi->hdmi_notifier); + } if (hdmi->bridge.dev) drm_helper_hpd_irq_event(hdmi->bridge.dev); } @@ -2606,6 +2615,12 @@ __dw_hdmi_probe(struct platform_device *pdev, goto err_iahb; } + hdmi->hdmi_notifier = hdmi_notifier_get(dev); + if (!hdmi->hdmi_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 @@ -2696,6 +2711,9 @@ __dw_hdmi_probe(struct platform_device *pdev, if (hdmi->cec_notifier) cec_notifier_put(hdmi->cec_notifier); + if (hdmi->hdmi_notifier) + hdmi_notifier_put(hdmi->hdmi_notifier); + clk_disable_unprepare(hdmi->iahb_clk); if (hdmi->cec_clk) clk_disable_unprepare(hdmi->cec_clk); @@ -2709,6 +2727,9 @@ __dw_hdmi_probe(struct platform_device *pdev, static void __dw_hdmi_remove(struct dw_hdmi *hdmi) { + if (hdmi->hdmi_notifier) + hdmi_event_disconnect(hdmi->hdmi_notifier); + if (hdmi->audio && !IS_ERR(hdmi->audio)) platform_device_unregister(hdmi->audio); if (!IS_ERR(hdmi->cec)) @@ -2720,6 +2741,9 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) if (hdmi->cec_notifier) cec_notifier_put(hdmi->cec_notifier); + if (hdmi->hdmi_notifier) + hdmi_notifier_put(hdmi->hdmi_notifier); + clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk); if (hdmi->cec_clk) -- 2.22.0.rc1.257.g3120a18244-goog