From patchwork Tue Oct 25 23:55:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9395719 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 3B08D60233 for ; Tue, 25 Oct 2016 23:55:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5BF92957C for ; Tue, 25 Oct 2016 23:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7DB129591; Tue, 25 Oct 2016 23:55:43 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FBD62957C for ; Tue, 25 Oct 2016 23:55:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753665AbcJYXzk (ORCPT ); Tue, 25 Oct 2016 19:55:40 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:35736 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752165AbcJYXzj (ORCPT ); Tue, 25 Oct 2016 19:55:39 -0400 Received: by mail-pf0-f170.google.com with SMTP id s8so127627360pfj.2 for ; Tue, 25 Oct 2016 16:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sUwilCc33afBUyfQPyd0lrfNxS/vXZ5OjMXgCMWoEnM=; b=g4LnSFSPWfrT3leeverluS7+kKWwCVxC8PttZAEBwrUzKy1LCX360xozjwiuYAUYjR QMArCGSFBn9cK/xJQHGAJkKZxJWvwLgbFZgslRtiixH7JdzDlnM9WZSy+hfQVAluXxF8 SohLy62CORnyBjqtjrGVuVAmLuFjv96z/L9eLeLBgSc8ePYsO+r4GsErPPa9uJ1Ll4k4 Tt5kvV+WfT34X8jLjCFuLVaOsOEBoaDCxeu3BwOt45g9rl3DJNxfNszj3MJbKEk07+Dr mT0wCbt5pnA7DIqDg0lOy+QYOAsZIJwy2wUwfJcNhHzFO1Em1x8MIPCdUMy3qey/b24j hr0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sUwilCc33afBUyfQPyd0lrfNxS/vXZ5OjMXgCMWoEnM=; b=Vm7SPXbOQLwEaDvC7QlbkbtrjbFGBNCRoN2von8SjDKX3Sg8R1rEO3/VTitLUcmyzR 06/hlcwG42gBRnuUw/pIXafbhnJ4ZTc7K0wxje2wZNYKNxgcdOzMdBTQ7IUQ5IlfwMlH NWa525rzKnREN8PyilHjSwSr5DsrVW1GwCmjPbPeUjgUDtg/RAb/fnRakauGZKAtc0OD f/lN1n5mLU2zhuurWpidkdgYoc+987U+pmhf4Zxsc7hRuw2o3PIaXH2/rROv4ZjiSEYs b+Iy5IRJ31lPGYH/Dt5KjgH9rWXmTgfaTCSWsLVYZfarP5ClwFxwsC1XjBIJdU61dQtm yPAQ== X-Gm-Message-State: ABUngvc70imeyBx0FDs0a6+tr36T1Yfs1v2y/IEiEI9H5EwWKMiItFY73/ioYTxrC/ptEknu X-Received: by 10.98.75.152 with SMTP id d24mr43834088pfj.97.1477439738591; Tue, 25 Oct 2016 16:55:38 -0700 (PDT) Received: from localhost (c-98-203-232-209.hsd1.wa.comcast.net. [98.203.232.209]) by smtp.gmail.com with ESMTPSA id c62sm35898012pfe.42.2016.10.25.16.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Oct 2016 16:55:38 -0700 (PDT) From: Kevin Hilman To: Hans Verkuil , Laurent Pinchart , linux-media@vger.kernel.org Cc: Sekhar Nori , Axel Haslam , =?UTF-8?q?Bartosz=20Go=C5=82aszewski?= , Alexandre Bailon , David Lechner , linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH 1/6] [media] davinci: add support for DT init Date: Tue, 25 Oct 2016 16:55:31 -0700 Message-Id: <20161025235536.7342-2-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161025235536.7342-1-khilman@baylibre.com> References: <20161025235536.7342-1-khilman@baylibre.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add basic support for initialization via DT. Signed-off-by: Kevin Hilman --- drivers/media/platform/davinci/vpif.c | 9 +++++++++ drivers/media/platform/davinci/vpif_capture.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 0380cf2e5775..077e328e0281 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -464,8 +464,17 @@ static const struct dev_pm_ops vpif_pm = { #define vpif_pm_ops NULL #endif +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id vpif_of_match[] = { + { .compatible = "ti,vpif", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, vpif_of_match); +#endif + static struct platform_driver vpif_driver = { .driver = { + .of_match_table = of_match_ptr(vpif_of_match), .name = "vpif", .pm = vpif_pm_ops, }, diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 5104cc0ee40e..79cef74e164f 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -1435,6 +1435,11 @@ static __init int vpif_probe(struct platform_device *pdev) int res_idx = 0; int i, err; + if (!pdev->dev.platform_data) { + dev_warn(&pdev->dev, "Missing platform data. Giving up.\n"); + return -EINVAL; + } + vpif_dev = &pdev->dev; err = initialize_vpif(); @@ -1618,8 +1623,17 @@ static int vpif_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(vpif_pm_ops, vpif_suspend, vpif_resume); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id vpif_capture_of_match[] = { + { .compatible = "ti,vpif-capture", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, vpif_capture_of_match); +#endif + static __refdata struct platform_driver vpif_driver = { .driver = { + .of_match_table = of_match_ptr(vpif_capture_of_match), .name = VPIF_DRIVER_NAME, .pm = &vpif_pm_ops, },