From patchwork Thu May 2 22:38:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 10927703 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6C0DC1395 for ; Thu, 2 May 2019 22:38:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 595531FF83 for ; Thu, 2 May 2019 22:38:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4CD822640A; Thu, 2 May 2019 22:38:42 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DF4071FF83 for ; Thu, 2 May 2019 22:38:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=2pN+Z1uglEfvohqyOBDlVm4Rb1A59h1K9imGIkUaeU8=; b=aDac3q73pUwikk D8LWnaaIMCXZmzaK8JoUm/lbDZDCb2S9dgoPG0Ul0YBv4vG5PIAzi2vcRK3bqQLvTmIe4OF4RyPsv GBzX/04LdlOadQYSZVtai1bxPsdnk4rI9GrgLTdgJjrMiAYw6QEdQXSOEwfiNeQVeB0mcEjdFI4ph 8iesyzmI2SdBW7wvS7ZcBnO88q7/JaFc9CbD+s/hejvbL1cYB/e9Ldnqd4yn5/4Wx4lnppMBsbHY+ hipPdV6UuRwSCGjqyTlJ+hIsO6aCvUefBU7InM+0BypZ1+axQMYhwY5SVRyGmb2l+pmUPrEsmzgn4 UocvU+7PRa1ALZ7kbj/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMKLc-0007i8-1n; Thu, 02 May 2019 22:38:36 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hMKLY-0007gt-5l for linux-rockchip@lists.infradead.org; Thu, 02 May 2019 22:38:33 +0000 Received: by mail-pf1-x443.google.com with SMTP id t87so1261197pfa.2 for ; Thu, 02 May 2019 15:38:31 -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:mime-version :content-transfer-encoding; bh=oGCfMQkKfqkKFZ8erX0b7VyU7ofDCnx2g9X0TKrb/HA=; b=DJKuaiHXmnpN5NHgJx3Ha85ILyIu0e1kfwt5qnKUaJz9o3ZLF8arJytmHtO7FqiFBV MBWtO7EXORv02Y2abZgYE36pxCrS+zMp4GRVryBr0oj3TWALLhx8FtS6V3FpEWfVdzdW 96PKjpxXBqXPpYBCEru2M2NeyILoFnAEQplI8= 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:mime-version :content-transfer-encoding; bh=oGCfMQkKfqkKFZ8erX0b7VyU7ofDCnx2g9X0TKrb/HA=; b=lvccxHGVvSgaTdiXRt9Ij0nDMnyygTz44Gk/1RIxHVE+0oeKA/+H6pmIR/TFmluqBk sXwknjN6D6fO4RaFci89SdlbipoBsuPVbEvT0y6aGt4bZKVGmjaBWNorntFcxk56xwAG JKwtWkOrLyWjz/GqdofSIXWcl43aSeBj13TiEwlo0sHhZ2OG6MT4Te1GV4X01dnpSO6k mUXnmynEzRKy9+zRnFPfcmJcSuLHQZUITfqhyHupLQe1sKcS0ziteYH9KWgYnpTtJx/N Is5OIRjMtB0139N8jJiT3ddSMriKfOLZyT0MjN9xQjUfhs48bu0/oxrWKc1EXvWIu/e0 fN3A== X-Gm-Message-State: APjAAAUArQRhjzkVakw83PVelX0eLAW0dUuOveoOVuqd2wzxQbNo5hgh c4CvbmR/AoMeabcboJozkT/lKw== X-Google-Smtp-Source: APXvYqzegNUKwWVFGK5+OSJGRGvk9lnvVlziVA8BSgZO2xFC57BLteuXPc+lxQ5gyK9oIUqE+P1Q3g== X-Received: by 2002:a63:cd15:: with SMTP id i21mr6626004pgg.269.1556836711151; Thu, 02 May 2019 15:38:31 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id k186sm244151pfc.137.2019.05.02.15.38.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 15:38:30 -0700 (PDT) From: Douglas Anderson To: Heiko Stuebner , Sandy Huang , Andrzej Hajda , Laurent Pinchart Subject: [PATCH 1/2] drm: bridge: dw-hdmi: Add hooks for suspend/resume Date: Thu, 2 May 2019 15:38:07 -0700 Message-Id: <20190502223808.185180-1-dianders@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190502_153832_244749_D8F96D22 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Neil Armstrong , David Airlie , Douglas Anderson , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, mka@chromium.org, Sean Paul , Daniel Vetter , Sam Ravnborg , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , Zheng Yang Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Rockchip rk3288-based Chromebooks when you do a suspend/resume cycle: 1. You lose the ability to detect an HDMI device being plugged in. 2. If you're using the i2c bus built in to dw_hdmi then it stops working. Let's add a hook to the core dw-hdmi driver so that we can call it in dw_hdmi-rockchip in the next commit. NOTE: the exact set of steps I've done here in resume come from looking at the normal dw_hdmi init sequence in upstream Linux plus the sequence that we did in downstream Chrome OS 3.14. Testing show that it seems to work, but if an extra step is needed or something here is not needed we could improve it. Signed-off-by: Douglas Anderson --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 21 +++++++++++++++++++++ include/drm/bridge/dw_hdmi.h | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index db761329a1e3..4b38bfd43e59 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2780,6 +2780,27 @@ void dw_hdmi_unbind(struct dw_hdmi *hdmi) } EXPORT_SYMBOL_GPL(dw_hdmi_unbind); +int dw_hdmi_suspend(struct dw_hdmi *hdmi) +{ + return 0; +} +EXPORT_SYMBOL_GPL(dw_hdmi_suspend); + +int dw_hdmi_resume(struct dw_hdmi *hdmi) +{ + initialize_hdmi_ih_mutes(hdmi); + + dw_hdmi_setup_i2c(hdmi); + if (hdmi->i2c) + dw_hdmi_i2c_init(hdmi); + + if (hdmi->phy.ops->setup_hpd) + hdmi->phy.ops->setup_hpd(hdmi, hdmi->phy.data); + + return 0; +} +EXPORT_SYMBOL_GPL(dw_hdmi_resume); + MODULE_AUTHOR("Sascha Hauer "); MODULE_AUTHOR("Andy Yan "); MODULE_AUTHOR("Yakir Yang "); diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h index 66e70770cce5..c4132e9a5ae3 100644 --- a/include/drm/bridge/dw_hdmi.h +++ b/include/drm/bridge/dw_hdmi.h @@ -154,6 +154,9 @@ struct dw_hdmi *dw_hdmi_bind(struct platform_device *pdev, struct drm_encoder *encoder, const struct dw_hdmi_plat_data *plat_data); +int dw_hdmi_suspend(struct dw_hdmi *hdmi); +int dw_hdmi_resume(struct dw_hdmi *hdmi); + void dw_hdmi_setup_rx_sense(struct dw_hdmi *hdmi, bool hpd, bool rx_sense); void dw_hdmi_set_sample_rate(struct dw_hdmi *hdmi, unsigned int rate);