From patchwork Fri Feb 17 10:46:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 94148 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp106599qgi; Fri, 17 Feb 2017 02:47:07 -0800 (PST) X-Received: by 10.98.42.151 with SMTP id q145mr8429669pfq.175.1487328427133; Fri, 17 Feb 2017 02:47:07 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n83si9960273pfj.15.2017.02.17.02.47.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Feb 2017 02:47:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3976889B4D; Fri, 17 Feb 2017 10:47:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22a.google.com (mail-wm0-x22a.google.com [IPv6:2a00:1450:400c:c09::22a]) by gabe.freedesktop.org (Postfix) with ESMTPS id C632289B4D for ; Fri, 17 Feb 2017 10:47:03 +0000 (UTC) Received: by mail-wm0-x22a.google.com with SMTP id v77so7248295wmv.0 for ; Fri, 17 Feb 2017 02:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jv+yM6wOBDuKR/sFoCWm/UjFIegerDEmofTL7aaEyng=; b=bUzmntkZaKCvkj6tvfRDV3CZBB+zb/liBj2wMLe3JYagwcbzbc7qa8SY4r3tJZpR+G XrpU04K6O4Qoozt6KqVUN+S3N/VD8a0g5ltKx2X1Mx82WoDiM7R25fI1d7U4xsC82as5 6K6GD6mnaTYd1OVT9PNc803YjFHMYMBEJcUWQ= 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=Jv+yM6wOBDuKR/sFoCWm/UjFIegerDEmofTL7aaEyng=; b=MrtnXkteOPgqjN8QZfwx0FvzZXHvhyxw/4V+Secw418iNsfc3F+mLwgyaLvy1KCfyH /4rB+WKcwh1k3vdpncYD9LUrFwqt+J6A9gyaDlVzw+MyvDGKYEpblyWH3j/o7bed+yrS l7aP5fAVgzO/cYT2EBvOBmRrXs18upTdtWHrxqiQ42ojdjRX0V6p2/trNJfpP57McZ1i e3Yvmwkarl/0uCMeNomR2wN5OUsXPZDT+a5agn9142M4MBt/3+fT6o5V+M1+//L/BgrB FpmhOpZHZWE4rf+6+jpuEGvPkB/rf/y0hLSR7CteBYxrk5EEuYji3cO5LmwPteqtI8PB OpxA== X-Gm-Message-State: AMke39nOC9uU26FgzqXrK4VgJHb17tc23HnAVr49nDJTZLzRUVGtFrSVLPEXE1BHgDP/4gvh X-Received: by 10.28.69.17 with SMTP id s17mr1613942wma.60.1487328422436; Fri, 17 Feb 2017 02:47:02 -0800 (PST) Received: from lmenx321.st.com. ([80.215.199.19]) by smtp.gmail.com with ESMTPSA id u42sm12460346wrc.1.2017.02.17.02.47.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 02:47:01 -0800 (PST) From: Benjamin Gaignard To: hverkuil@xs4all.nl Subject: [PATCH v3 1/3] sti: hdmi: add HPD notifier support Date: Fri, 17 Feb 2017 11:46:50 +0100 Message-Id: <1487328412-8305-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487328412-8305-1-git-send-email-benjamin.gaignard@linaro.org> References: <1487328412-8305-1-git-send-email-benjamin.gaignard@linaro.org> Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux@armlinux.org.uk, krzk@kernel.org, javier@osg.samsung.com, hans.verkuil@cisco.com, dri-devel@lists.freedesktop.org, daniel.vetter@intel.com, linux-media@vger.kernel.org, m.szyprowski@samsung.com 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" Implement the HPD notifier support to allow CEC drivers to be informed when there is a new EDID and when a connect or disconnect happens. Signed-off-by: Benjamin Gaignard Signed-off-by: Hans Verkuil --- drivers/gpu/drm/sti/Kconfig | 1 + drivers/gpu/drm/sti/sti_hdmi.c | 14 ++++++++++++++ drivers/gpu/drm/sti/sti_hdmi.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig index acd7286..f5c9572 100644 --- a/drivers/gpu/drm/sti/Kconfig +++ b/drivers/gpu/drm/sti/Kconfig @@ -8,5 +8,6 @@ config DRM_STI select DRM_PANEL select FW_LOADER select SND_SOC_HDMI_CODEC if SND_SOC + select HPD_NOTIFIER help Choose this option to enable DRM on STM stiH4xx chipset diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 376b076..d32a383 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -786,6 +786,8 @@ static void sti_hdmi_disable(struct drm_bridge *bridge) clk_disable_unprepare(hdmi->clk_pix); hdmi->enabled = false; + + hpd_event_disconnect(hdmi->notifier); } static void sti_hdmi_pre_enable(struct drm_bridge *bridge) @@ -892,6 +894,9 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) if (!edid) goto fail; + hpd_event_new_edid(hdmi->notifier, edid, + EDID_LENGTH * (edid->extensions + 1)); + count = drm_add_edid_modes(connector, edid); drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); @@ -949,10 +954,12 @@ struct drm_connector_helper_funcs sti_hdmi_connector_helper_funcs = { if (hdmi->hpd) { DRM_DEBUG_DRIVER("hdmi cable connected\n"); + hpd_event_connect(hdmi->notifier); return connector_status_connected; } DRM_DEBUG_DRIVER("hdmi cable disconnected\n"); + hpd_event_disconnect(hdmi->notifier); return connector_status_disconnected; } @@ -1464,6 +1471,10 @@ static int sti_hdmi_probe(struct platform_device *pdev) goto release_adapter; } + hdmi->notifier = hpd_notifier_get(&pdev->dev); + if (!hdmi->notifier) + goto release_adapter; + hdmi->reset = devm_reset_control_get(dev, "hdmi"); /* Take hdmi out of reset */ if (!IS_ERR(hdmi->reset)) @@ -1483,11 +1494,14 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); + hpd_event_disconnect(hdmi->notifier); + i2c_put_adapter(hdmi->ddc_adapt); if (hdmi->audio_pdev) platform_device_unregister(hdmi->audio_pdev); component_del(&pdev->dev, &sti_hdmi_ops); + hpd_notifier_put(hdmi->notifier); return 0; } diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h index 119bc35..2109c97 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.h +++ b/drivers/gpu/drm/sti/sti_hdmi.h @@ -8,6 +8,7 @@ #define _STI_HDMI_H_ #include +#include #include #include @@ -77,6 +78,7 @@ enum sti_hdmi_modes { * @audio_pdev: ASoC hdmi-codec platform device * @audio: hdmi audio parameters. * @drm_connector: hdmi connector + * @notifier: hotplug detect notifier */ struct sti_hdmi { struct device dev; @@ -102,6 +104,7 @@ struct sti_hdmi { struct platform_device *audio_pdev; struct hdmi_audio_params audio; struct drm_connector *drm_connector; + struct hpd_notifier *notifier; }; u32 hdmi_read(struct sti_hdmi *hdmi, int offset);