From patchwork Wed Dec 14 12:57:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 9474133 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 71F66607EE for ; Wed, 14 Dec 2016 12:59:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6456128727 for ; Wed, 14 Dec 2016 12:59:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 587092872B; Wed, 14 Dec 2016 12:59:11 +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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE5C028727 for ; Wed, 14 Dec 2016 12:59:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1cH987-0007D1-OH; Wed, 14 Dec 2016 12:57:55 +0000 Received: from mail-wj0-x22f.google.com ([2a00:1450:400c:c01::22f]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1cH97s-00072w-Qb for linux-arm-kernel@lists.infradead.org; Wed, 14 Dec 2016 12:57:42 +0000 Received: by mail-wj0-x22f.google.com with SMTP id v7so32798384wjy.2 for ; Wed, 14 Dec 2016 04:57:20 -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=/b2m56HJBdqy6tCuql3khHT5B2byAAQxBkx672rRw+E=; b=ZcjAd4qB+5LOweea/DS/AOR+XblMUnjQ37FABDmsDlM1OCLDevIL/t2VZNoeRgN9/l oIonOO4Ar5JSbOmkWII1ScJI0nM0C7nEav04b+rGe6QXXmO3260fFiFG33GaIQ94MBPN 7x/GgygXmm9scNRCxUH63LMnrKSG2OKeWLGSE= 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=/b2m56HJBdqy6tCuql3khHT5B2byAAQxBkx672rRw+E=; b=TKmgb8lO/9+HfrAkrgcqFADLzxW1HEINj57c+rlR7c9EipuZKDHMA0AvHpcd0XaweO mLqxn1gssbl5mkukS0O8y+yfuDOamCobBl0+G6oGIsX8vCc78SWB7jHjzcHoZN4aBxiU y1SxIymE2/EF8iApO3qzGugJP+6TOXLTVn8wUZjpn/VLN/hPeWqn0kWXas0fGCHCCd8n C01qqYN60rf2Temwa4wTAqng+csrKpGpGLT/T0MmTaARTLT5+C1xISWx+RqMP89pnrgu x/Pw+IPywTQ5yHS23+r3oMuaEbUOZh6Sxr+YKCgSIRKrA3G3TELi9decALcMj49xld0g PyTQ== X-Gm-Message-State: AKaTC00WJ4YXfOT/xelX6CYnNFxgDy7H0mCHgS4c4j5l4cMH0nQXZBg+pdsKfJj77yu7bDfO X-Received: by 10.28.133.143 with SMTP id h137mr6828324wmd.58.1481720238766; Wed, 14 Dec 2016 04:57:18 -0800 (PST) Received: from lmenx321.st.com. ([80.214.114.255]) by smtp.gmail.com with ESMTPSA id j6sm67192579wjk.25.2016.12.14.04.57.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Dec 2016 04:57:18 -0800 (PST) From: Benjamin Gaignard To: linux-media@vger.kernel.org, hverkuil@xs4all.nl Subject: [PATCH 1/2] sti: hdmi: add HDMI notifier support Date: Wed, 14 Dec 2016 13:57:08 +0100 Message-Id: <1481720229-7587-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1481720229-7587-1-git-send-email-benjamin.gaignard@linaro.org> References: <1481720229-7587-1-git-send-email-benjamin.gaignard@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161214_045741_134276_A9254893 X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, linaro-kernel@lists.linaro.org, kernel@stlinux.com, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, Benjamin Gaignard , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Implement the HDMI 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 --- drivers/gpu/drm/sti/Kconfig | 1 + drivers/gpu/drm/sti/sti_hdmi.c | 15 +++++++++++++++ drivers/gpu/drm/sti/sti_hdmi.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig index acd7286..59ceffc 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 HDMI_NOTIFIERS 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..6667371 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; + + hdmi_event_disconnect(hdmi->notifier); } static void sti_hdmi_pre_enable(struct drm_bridge *bridge) @@ -892,6 +894,10 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) if (!edid) goto fail; + hdmi_event_connect(hdmi->notifier); + hdmi_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 +955,12 @@ struct drm_connector_helper_funcs sti_hdmi_connector_helper_funcs = { if (hdmi->hpd) { DRM_DEBUG_DRIVER("hdmi cable connected\n"); + hdmi_event_connect(hdmi->notifier); return connector_status_connected; } DRM_DEBUG_DRIVER("hdmi cable disconnected\n"); + hdmi_event_disconnect(hdmi->notifier); return connector_status_disconnected; } @@ -1464,6 +1472,10 @@ static int sti_hdmi_probe(struct platform_device *pdev) goto release_adapter; } + hdmi->notifier = hdmi_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 +1495,14 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); + hdmi_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); + hdmi_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..70aac98 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 @@ -102,6 +103,7 @@ struct sti_hdmi { struct platform_device *audio_pdev; struct hdmi_audio_params audio; struct drm_connector *drm_connector; + struct hdmi_notifier *notifier; }; u32 hdmi_read(struct sti_hdmi *hdmi, int offset);