From patchwork Thu Oct 26 18:19:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Hugues Husson X-Patchwork-Id: 10028681 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 BE54460375 for ; Thu, 26 Oct 2017 18:20:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B625D28E0B for ; Thu, 26 Oct 2017 18:20:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A96D628E77; Thu, 26 Oct 2017 18:20:31 +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.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 44BB028E0B for ; Thu, 26 Oct 2017 18:20:31 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=0rSMAmOX8A5zqIIIt1Aa1Sem/+aCkXy5SdMOL5ffFzk=; b=K04 Hqj0cuW+uSxVLltWr7ijAYxXHJKodzX/jHVgA83LMNco+SjLVS1xt6wYdP9NPOlP5PLrkC58bCKvs 6cdF6FMGWJscVUoTCXdAb0oROCIj8DPWDDrinzok4LtPw5FhY/pubc70aMHkHIiriaS538r5qpUn+ KhNgePnG3rusgkNYkbNuIS94olMwmInG9CIsIFvLq18ZhVRW+rBTpm+LwA8cIyGQWcE818DE9TZWD iotrVwolub23mPqzFTE05IMUS2DOH8eAghmSS4xzvWP/qco4azYIIPdLkl+/KSYmzDN8P7EQZQPm8 FnJazHkeRy9p0ri1X+Ld6rS4DNXJoQw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e7mlZ-0006V0-Sa; Thu, 26 Oct 2017 18:20:29 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e7mlW-0005MB-Pj; Thu, 26 Oct 2017 18:20:29 +0000 Received: by mail-wr0-x244.google.com with SMTP id k62so4031670wrc.9; Thu, 26 Oct 2017 11:20:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=v8w5GCaykxc4Z3ZFplgNOHxHNuvqwiV14z0iTGK6PBk=; b=HSwZbvyaY+EvWbDT3zhevkL3sPL2yeQx3nlx4AIV1Wvi0dRQgl02kElwvIDrSrZcol wUbPjrbqqkF47F7049pxc5Qpit18cjaYcH3/E1We3PBq5rm2CgTTg7UQQ1dArhvoxUk0 SHVAoFEvgfHG+W/Rd70VD7SiG3sYhNmn6GsyVq6Snk1kOAr9oYYxwzfH+qjf5IM5r+oy 6QEm5vJOz8PWuFL2Izp6kCPy3bJgO7j0yZ5k5E4blzFaZcWQyx6GyVSU4KOhZ7bvcr2L KD+4a5aY9WDj1bd1oHGLJoi4khc0weUne3zko7wiUzK8/XYMJenKU4/l3qbJPGiy1ogO FfiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=v8w5GCaykxc4Z3ZFplgNOHxHNuvqwiV14z0iTGK6PBk=; b=sYYXV5CGsU/qE0dzhxeRT1P3Dnq/s+Q5OpYWXJKU/Z8g5EGZ5b3lxV9AAz50cWfu/w eojRc2smkIdGw8Vvbn9qgG2Y1XwzVmuSzGJh6eK4uHGVtdDx/s45oOliFuhmaPdBK8sm 3HQD7Yo2nz5EOWTIwZNBZszY2sffcdq4FnGheLSNwNb8vUVZaTTIwVLS5l3Ow5uICOCu gi25Q99o/BihVhAFePsySXBHPjSJNdCJoFMWm1DPHmbuPkqssd8ehPfSQU7DySvTUfEN L5ofZdxANYG11wDLxC0hx/D9ATWrtC+FfEssBEF+Su76TOi8dSTUzDAL786VXGMnV/rC lEaQ== X-Gm-Message-State: AMCzsaVa50VuoocHk1AdDtpWcwyw0TaFEslvCifzhi23+ToxzU07eAGr rH6p9jO3pEFJzlzN410pgKQsynWF X-Google-Smtp-Source: ABhQp+QKZSBYd5D8CGfIkf6gnfAljogfRQdtnY1NxESrj01Ey43V9oZpiBR+Wo9jgVhTq7k0kXGMKg== X-Received: by 10.223.190.132 with SMTP id i4mr6640036wrh.123.1509042004273; Thu, 26 Oct 2017 11:20:04 -0700 (PDT) Received: from phh-desktop.home (2a01cb000a08d500a554de3a52fe8259.ipv6.abo.wanadoo.fr. [2a01:cb00:a08:d500:a554:de3a:52fe:8259]) by smtp.gmail.com with ESMTPSA id l130sm2493048wmd.47.2017.10.26.11.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 11:20:03 -0700 (PDT) From: Pierre-Hugues Husson To: linux-rockchip@lists.infradead.org Subject: [PATCH v3] drm: bridge: synopsys/dw-hdmi: Enable cec clock Date: Thu, 26 Oct 2017 20:19:42 +0200 Message-Id: <20171026181942.9516-1-phh@phh.me> X-Mailer: git-send-email 2.14.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171026_112027_000406_F4577995 X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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: Archit Taneja , heiko@sntech.de, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Andrzej Hajda , Pierre-Hugues Husson , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The documentation already mentions "cec" optional clock, but currently the driver doesn't enable it. Changes: v3: - Drop useless braces v2: - Separate ENOENT errors from others - Propagate other errors (especially -EPROBE_DEFER) Signed-off-by: Pierre-Hugues Husson --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bf14214fa464..d82b9747a979 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -138,6 +138,7 @@ struct dw_hdmi { struct device *dev; struct clk *isfr_clk; struct clk *iahb_clk; + struct clk *cec_clk; struct dw_hdmi_i2c *i2c; struct hdmi_data_info hdmi_data; @@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev, goto err_isfr; } + hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec"); + if (PTR_ERR(hdmi->cec_clk) == -ENOENT) { + hdmi->cec_clk = NULL; + } else if (IS_ERR(hdmi->cec_clk)) { + ret = PTR_ERR(hdmi->cec_clk); + if (ret != -EPROBE_DEFER) + dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n", + ret); + + hdmi->cec_clk = NULL; + goto err_iahb; + } else { + ret = clk_prepare_enable(hdmi->cec_clk); + if (ret) { + dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n", + ret); + goto err_iahb; + } + } + /* Product and revision IDs */ hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0); @@ -2518,6 +2539,8 @@ __dw_hdmi_probe(struct platform_device *pdev, cec_notifier_put(hdmi->cec_notifier); clk_disable_unprepare(hdmi->iahb_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); err_isfr: clk_disable_unprepare(hdmi->isfr_clk); err_res: @@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); if (hdmi->i2c) i2c_del_adapter(&hdmi->i2c->adap);