From patchwork Tue Nov 22 01:44:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9440421 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 A783560235 for ; Tue, 22 Nov 2016 01:44:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AAEF228384 for ; Tue, 22 Nov 2016 01:44:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FE7C28AEC; Tue, 22 Nov 2016 01:44:29 +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 9BEB228509 for ; Tue, 22 Nov 2016 01:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754603AbcKVBoW (ORCPT ); Mon, 21 Nov 2016 20:44:22 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35809 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754303AbcKVBoT (ORCPT ); Mon, 21 Nov 2016 20:44:19 -0500 Received: by mail-pg0-f51.google.com with SMTP id p66so1562806pga.2 for ; Mon, 21 Nov 2016 17:44:12 -0800 (PST) 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=eN+BXv5e2JheDN25uLUR9SxkiZVbyUdsg5DjYsjb4c0=; b=lH1RWV5SjQZsnPx0osUDJFAYDDJEHbsUhMBZ3XJiRH196yl9N9Tx/ILI6Z+99jrT+w sqd/CratTPXZZsqJd2HROz88J3HinzTTVy9pTy0jg3977tRc8CHfUj4LOKAe6F6WIRD9 BQU7Q4sTx0olw1LUfgaxhceY2ANTH0SPV/Vc7IDdPLnFMrp1b0ph/5vJBBRvSgBoxixm lhQ98zmbuKT28knlhaTp64+zqiYqJW97TiSZ5HcuWZrxScbQ3tCBWvLXdhbEBFyfczpY VQg45ntly6DRgc9W019ldD3s3wCIA90/k8vd6uylQCELLWV4YUGp+zMHjrCHKhLE4c6t +mAA== 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=eN+BXv5e2JheDN25uLUR9SxkiZVbyUdsg5DjYsjb4c0=; b=I5O5tgMfXZbowt3QUDhmWwsnxJJG/xUhHnzWhK3WWnRDXpvZZ1Q5iayCOWu2djTEHu NIlL/5B7c9RDko4FasBV3HM73+9CkCFmzvfCRh/es48f+T1KVpWvQZkLEAKqNd353bzu Zb+uo+vDs7un/HFYW805NoR1YykMjvRm8LuDQLHmTw6mPWTqH+5GvDWGdlGYHVALBN0g JtUpZI/9VigRQTZMAabnoayfJdAbRth0iN0NWUTarSxNGRbTql+Bo+eNFATUuj/eiBP0 S/OmaL3mnlWKN768fY2aWQstGsE/muw7sUZ5gSTZZgvkz8Q2ziPP0AJWbrqjvBQVuBMu dqcQ== X-Gm-Message-State: AKaTC00cTYmP4tZEUAJrsmbLxlAFZ5Evgx/L6VOeL2CbHEHy6rUCtitSOy5u7ycTxB6i0CWa X-Received: by 10.99.173.68 with SMTP id y4mr38029043pgo.54.1479779051446; Mon, 21 Nov 2016 17:44:11 -0800 (PST) Received: from localhost (c-98-203-232-209.hsd1.wa.comcast.net. [98.203.232.209]) by smtp.gmail.com with ESMTPSA id 1sm12610654pgp.1.2016.11.21.17.44.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Nov 2016 17:44:11 -0800 (PST) From: Kevin Hilman To: linux-media@vger.kernel.org, Hans Verkuil Cc: devicetree@vger.kernel.org, Sekhar Nori , Axel Haslam , =?UTF-8?q?Bartosz=20Go=C5=82aszewski?= , Alexandre Bailon , David Lechner Subject: [PATCH v2 1/4] [media] davinci: add support for DT init Date: Mon, 21 Nov 2016 17:44:05 -0800 Message-Id: <20161122014408.22388-2-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161122014408.22388-1-khilman@baylibre.com> References: <20161122014408.22388-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..d4434f614141 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,da850-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..87ee1e2c3864 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,da850-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, },