From patchwork Sat Nov 19 00:32: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: 9437699 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 8B90660469 for ; Sat, 19 Nov 2016 00:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7923429A6D for ; Sat, 19 Nov 2016 00:32:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C4BC29A70; Sat, 19 Nov 2016 00:32:19 +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 A36E229A6D for ; Sat, 19 Nov 2016 00:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752885AbcKSAcL (ORCPT ); Fri, 18 Nov 2016 19:32:11 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:33732 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752652AbcKSAcL (ORCPT ); Fri, 18 Nov 2016 19:32:11 -0500 Received: by mail-pf0-f169.google.com with SMTP id d2so56765256pfd.0 for ; Fri, 18 Nov 2016 16:32:10 -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:mime-version :content-transfer-encoding; bh=sUwilCc33afBUyfQPyd0lrfNxS/vXZ5OjMXgCMWoEnM=; b=lX8Sm0XMc3LCo7jbEW6diN/Uq4mZ4wqkGXTVwvYrBXwkKBZp0pQvihaqj+43Am300Z Si6QKiJe7pfB05uvAblGWT/NcLZyvLiRW1tjpfGfVoSz5czzgU2Y3qae+06mZJHEjeLU T2aikKPh0gTRBNi5wE2U9wGhvLa+yBWo0vwj7VSJDcCnaVCWtqkuOMAgMpU9e1flm2Z1 vRB5x6I4hgrf6ZLX06ot1X3WT+c6oRY8Gpml37RgSzd+IYKUzOA1yPsR/8BMJ4Bo20Cz iNC6EhUkTDgTe1ixJxQODoRnaOGiz+6JnAMpcJBSOS7eAvny5buxEYUv+ysuSDV2no8b khtQ== 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:mime-version :content-transfer-encoding; bh=sUwilCc33afBUyfQPyd0lrfNxS/vXZ5OjMXgCMWoEnM=; b=eNVvJbkbxbFQglDQHrUkKfDgBa2yPn6a1Y7fvDBQ02IhJjiS8E1EW7lOyBINTWbl3f wEqit23KGQeqYf7oWipXOJCIDpD3lxMK1eZc1kbG/3wQln3ymwENatYcrLUNkTl0Pnz+ JLX2iOtndFnuPtmgnWR9IPNYMfK0ILhFNmfG72sCiSinWdW/3lpsDepE+5QeMNNEEnwI yDA0wvH7kkcyK22jTBZhhdDal1BsZ5ymy5ui1HAuo3aTu6dBBGvK/jkQSdU2EBw1F42b gbWx6WVU1iYP8Iwdicg0CKAevfzfAqchqnFl+fcuFOHlx2ptmUOXZr2S7N1LvQ+T2DIX TSXQ== X-Gm-Message-State: AKaTC03wzIKeJAyLWVqlP7kv9zjj3PgdK3j04vGqbZ6w4hzkzJ2ZWJadmUsE/4M4p7AwgVT8 X-Received: by 10.99.174.4 with SMTP id q4mr4983188pgf.178.1479515530227; Fri, 18 Nov 2016 16:32:10 -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 w24sm20505544pfa.9.2016.11.18.16.32.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Nov 2016 16:32:09 -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 1/4] [media] davinci: add support for DT init Date: Fri, 18 Nov 2016 16:32:05 -0800 Message-Id: <20161119003208.10550-1-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 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, },