From patchwork Tue Jul 21 13:50:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6836541 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A314E9F380 for ; Tue, 21 Jul 2015 14:00:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CC228206A4 for ; Tue, 21 Jul 2015 14:00:49 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 3D5AD2069A for ; Tue, 21 Jul 2015 14:00:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHY4H-0003Ga-8a; Tue, 21 Jul 2015 13:58:49 +0000 Received: from merlin.infradead.org ([205.233.59.134]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHY2x-00023I-UG for linux-arm-kernel@bombadil.infradead.org; Tue, 21 Jul 2015 13:57:28 +0000 Received: from mail-wg0-f52.google.com ([74.125.82.52]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZHY0r-0000Li-0t for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2015 13:55:19 +0000 Received: by wgmn9 with SMTP id n9so157196096wgm.0 for ; Tue, 21 Jul 2015 06:52:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3OqxDtiXZh3FyjzVHshLqRUgd5pXPS5etKjspMPI1c8=; b=cGzHhmwYXy8RQg45zmhYZEtO9afviAVDX44WEcUIwGTu19EPEiVa0T27fc8K39Alj0 /HtARbydZ3d0WwFQToQJm20ewkR9yuTI7DoCQLMPdNESBL1NBnKcA3ifCYKgYyOgSGNB 3RMfZvB3/y0h4v1Eiw2f+yDgZ9oS3CPwhC8SELSHJIExpezjvEyp8tYz1qfUB2ifOZrt 6JmtvCR+bC+yPKsTlykG6Xq8XBjp5Kj9fvn5um4u4Rps+dmxFu4IGaetWQ1cVqOQtZYo +rklV8YlvIVWT+njttKF9EtR3SEvdMPsR1L43XHyMYntOHdqWXnChZ25g62PFRee6m5d 80yA== X-Received: by 10.194.187.51 with SMTP id fp19mr63775584wjc.67.1437486724631; Tue, 21 Jul 2015 06:52:04 -0700 (PDT) Received: from cizrna.lan ([109.72.12.178]) by smtp.gmail.com with ESMTPSA id pf4sm37172056wjb.23.2015.07.21.06.52.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Jul 2015 06:52:03 -0700 (PDT) From: Tomeu Vizoso To: linux-kernel@vger.kernel.org Subject: [RFC PATCH 11/16] Add DEVM_TEGRA_DPAUX() Date: Tue, 21 Jul 2015 15:50:53 +0200 Message-Id: <1437486658-28365-12-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> References: <1437486658-28365-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150721_095517_178017_7E55F732 X-CRM114-Status: GOOD ( 13.42 ) X-Spam-Score: -2.4 (--) 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: Arnd Bergmann , Tomeu Vizoso , Stephen Warren , "Rafael J. Wysocki" , Mark Brown , 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-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tomeu Vizoso --- drivers/gpu/drm/tegra/dpaux.c | 24 ++++++++++++++++++++++++ drivers/gpu/drm/tegra/drm.h | 9 +++++++++ 2 files changed, 33 insertions(+) diff --git a/drivers/gpu/drm/tegra/dpaux.c b/drivers/gpu/drm/tegra/dpaux.c index 07b26972f487..512322c58c43 100644 --- a/drivers/gpu/drm/tegra/dpaux.c +++ b/drivers/gpu/drm/tegra/dpaux.c @@ -569,3 +569,27 @@ int tegra_dpaux_train(struct tegra_dpaux *dpaux, struct drm_dp_link *link, return 0; } + +int devm_acquire_tegra_dpaux(struct device *dev, + const struct devm_resource *resource) +{ + struct device_node *np; + struct tegra_dpaux *dpaux, **dpauxp; + + np = of_parse_phandle(dev->of_node, resource->name, 0); + if (!np) + return 0; + + dpaux = tegra_dpaux_find_by_of_node(np); + of_node_put(np); + + dev_warn(dev, "dpaux device '%s' not probed yet\n", of_node_full_name(np)); + + if (!dpaux) + return -EPROBE_DEFER; + + dpauxp = dev_get_drvdata(dev) + resource->offset; + *dpauxp = dpaux; + + return 0; +} diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 659b2fcc986d..70930d262caf 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -250,6 +250,15 @@ int tegra_dpaux_prepare(struct tegra_dpaux *dpaux, u8 encoding); int tegra_dpaux_train(struct tegra_dpaux *dpaux, struct drm_dp_link *link, u8 pattern); +int devm_acquire_tegra_dpaux(struct device *dev, + const struct devm_resource *resource); + +#define DEVM_TEGRA_DPAUX(_struct, _member, _name) { \ + .initfunc = devm_acquire_tegra_dpaux, \ + .offset = offsetof_t(struct _struct, _member, struct tegra_dpaux *),\ + .name = _name, \ +} + /* from fb.c */ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer, unsigned int index);