From patchwork Tue Nov 22 15:52:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 9441389 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 ADB75605EE for ; Tue, 22 Nov 2016 15:53:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A351D285A1 for ; Tue, 22 Nov 2016 15:53:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97CD2285CA; Tue, 22 Nov 2016 15:53:08 +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 2168D285A1 for ; Tue, 22 Nov 2016 15:53:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755722AbcKVPwx (ORCPT ); Tue, 22 Nov 2016 10:52:53 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:33989 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755528AbcKVPwr (ORCPT ); Tue, 22 Nov 2016 10:52:47 -0500 Received: by mail-pf0-f178.google.com with SMTP id c4so4828566pfb.1 for ; Tue, 22 Nov 2016 07:52:47 -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=NU6VN49gWEpsQaXafb8KXPleAjkk87Zycpp22fkKeq5aLSZMdIsW58DR3lWHfnS+W8 ft4nd6pSiHYATzS0n5GaxpPJspcya1PEo5YsLnNEKSHtx4x8REsDlql7LnOgpLzIDsj8 EVoTT1je/LkOkzStQjzyVpv/iIrtwteLwVp0AceHkESxsiKVOkpRMmqMDn9EVlrKFbGH DWbT+388O88NJhgvfNC7dnqY0xhHEkfrDF9BmDoZ6WigQqZg+PoWut2fywzQQ9REVTXi VaeyeUTSfnNGW63fqmY3IJrRK1pAjN9UNGelK1u8UHwbVdaDQVknjZXJ3S5E4RZx9fmO 0zyQ== 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=OV78mycLUbYXKbWyfzw4oqqQlgRwotSBbFscIMKCAnAGVuo7iDaotpKlq3MBgUXgbd JV4nZhT2oJLiVAgkZe95ip7SASQsIMix8SSg0wrIWxeYDySqqlO0EBQYld7R5FAkS6EH NmLbxs7toH63ELehZ/3Ol80PgcqiEjlppxHcfqGTh9LbSs50dUatbZpNhy+clt+VbZcU jRYj8nWspcK+YjfBEenIOV4LBjzUp7ecqz9Dtc/C1u0o1EWQsFGfpNjrpTz21zn0Ov8F lEe2AwLLor2VjJq9IUVY5WeNz/ZTcLbjgqCraz6Ey4Mu1J5PGwFFyKHzzGbugPqFBaeT jCHA== X-Gm-Message-State: AKaTC02X0JPi/NhchlGZLkkJCHfxIArloLPX5NzqemBFt3RjiKAbtpbhkglCXZJjwkNY/eoo X-Received: by 10.99.94.194 with SMTP id s185mr45224765pgb.35.1479829967051; Tue, 22 Nov 2016 07:52:47 -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 t193sm28276787pgb.4.2016.11.22.07.52.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2016 07:52:46 -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 v3 1/4] [media] davinci: add support for DT init Date: Tue, 22 Nov 2016 07:52:41 -0800 Message-Id: <20161122155244.802-2-khilman@baylibre.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161122155244.802-1-khilman@baylibre.com> References: <20161122155244.802-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, },