Received: by 10.223.176.46 with SMTP id f43csp284028wra; Thu, 25 Jan 2018 22:04:35 -0800 (PST) X-Google-Smtp-Source: AH8x224HTkDBzBxUYCP0YXg5GLROw3hnlwbNvyNdbC23dLa/P5Z1+3TxQxBUgHpAGOIJwNh1OeHs X-Received: by 10.101.64.67 with SMTP id h3mr14947901pgp.168.1516946674986; Thu, 25 Jan 2018 22:04:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516946674; cv=none; d=google.com; s=arc-20160816; b=0M+bL89GdznU6wWMjWgpxU1kxBJLYZ3fVXtMoWuzJ3YwWbwit9YSmk+Bvf7y5/RTtM krKS4tmbGTnJl6lx8+YRgjRmKLfFcWEhyi6AVZ2A4ps7MhBg9I69fISzwtv/iZDTmCJN 0LuoLEMFtGD0tAgn9xgpRMJDY1s/zh3bj0km91xKw5D1LDSUvwQn9dM+kxzIyZANX4OV L51rs8Qo3nrJAmQN2JEcD/zJ4GvGd6Tdn4I/PBWUdj+7cAkf4uN/pr9sK1VtFYfVNsuK 6yMdwNZZexp30BXo71KYa95yO2U7dZ/5y/N3mAqlIrgSLnW9Fkah2MMXgiTfEiN+q7Z+ OwMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oWke56S/5eP9lT0m0wjB5WEuLHVNv/UjkvIh1D0YIPI=; b=lE7X83IRs4kOhXfoEEnjb2Tj1UesbGB6Kz8qFHZoDMeVgZJpvggLz/rgydhk2dFRE3 FTBrTCk6JElqIpGDi0CGiPD+9BMipK3JCBjrTSNkN+IJiGxs13+n0oeKxDz4AvVIhMo9 fqIKxrRRLYQfjNQqUuRDzw00RCaEkoNr2+VjGDZ8hCZFqMtB3bx4ZnEaq/Rkd7cXfwoj Znb8A3hubQWHgImOb97sDE36BOv8j/bjYalFxB+xLT67sdezAwfU9tungcxdDTGZz1IA 7sTG2KO1Pc7PHh9HzD2mrMGPyNR6TamgLtiZZyFyZnFLptFlSqbd0tPTL+yaqzlZE/AS VqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Rko+QtAI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s80si5833387pfg.322.2018.01.25.22.04.20; Thu, 25 Jan 2018 22:04:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Rko+QtAI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751993AbeAZGDf (ORCPT + 99 others); Fri, 26 Jan 2018 01:03:35 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:40365 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751925AbeAZGDB (ORCPT ); Fri, 26 Jan 2018 01:03:01 -0500 Received: by mail-pg0-f68.google.com with SMTP id g16so6619403pgn.7 for ; Thu, 25 Jan 2018 22:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oWke56S/5eP9lT0m0wjB5WEuLHVNv/UjkvIh1D0YIPI=; b=Rko+QtAI+u1+W5V724yIx+OuxaFhyOl+WoF4dxcIksYrXbZN9zjctvrgNzK1BtGk32 zezXHIIv+5ECD9Lz1vUy9e1fyK1n8RheLsww/rBNd8BYYjcm52N/576VahSrr/zFxOEg BtQbSkSKMttE7jRbk6YUO6xMhdFefPo3Ex/A0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oWke56S/5eP9lT0m0wjB5WEuLHVNv/UjkvIh1D0YIPI=; b=Jn3GBu4pi/MuS7XZO3eX0iaCQHK4JdOPqdwYkwCjvcia+edmeom+3M1vwKxCjQpARx TGpNm8SvaUDJ/8ZuWC39TsDL9c+12ZI5bQuMwp1/GEKMKegzrEbTGJTFty4kpO+KfrRS Cd6rhBkPDAVHAvXQOD0ThFzx/GYZ2NaowPhipQULm5C4z19OWxyrRloqZKGuA1CM5N72 +F5OuVeQdT0b4E2lHfbK1HJ4T8ot6hXBLOOjeqqLWVcgjw4gESjeApw2kD+/UnkeJN43 oldPnIvivAKycnRJk5lUF2u3UJD2YFIpeuEA00eL5Vb0cy0uqBIy1ocgtdjd5SmDLGYp zkWQ== X-Gm-Message-State: AKwxytdMJtc2ZftRKQ57RhtnQB0F8IpYG8MW9a/qAyjtthxxG6tbcCuv 46iSFz1HgZUoqwtbEkEQR5ymYg== X-Received: by 10.98.65.13 with SMTP id o13mr17941479pfa.97.1516946581236; Thu, 25 Jan 2018 22:03:01 -0800 (PST) Received: from acourbot.tok.corp.google.com ([2401:fa00:4:1002:a6cd:a898:e07b:a331]) by smtp.gmail.com with ESMTPSA id j3sm14543201pfh.39.2018.01.25.22.02.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 22:03:00 -0800 (PST) From: Alexandre Courbot To: Mauro Carvalho Chehab , Hans Verkuil , Laurent Pinchart , Pawel Osciak , Marek Szyprowski , Tomasz Figa , Sakari Ailus , Gustavo Padovan Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Alexandre Courbot Subject: [RFC PATCH 7/8] media: vim2m: add media device Date: Fri, 26 Jan 2018 15:02:15 +0900 Message-Id: <20180126060216.147918-8-acourbot@chromium.org> X-Mailer: git-send-email 2.16.0.rc1.238.g530d649a79-goog In-Reply-To: <20180126060216.147918-1-acourbot@chromium.org> References: <20180126060216.147918-1-acourbot@chromium.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Request API requires a media node. Add one to the vim2m driver so we can use requests with it. Signed-off-by: Alexandre Courbot --- drivers/media/platform/vim2m.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index b01fba020d5f..a32e8a7950eb 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -140,6 +140,9 @@ static struct vim2m_fmt *find_format(struct v4l2_format *f) struct vim2m_dev { struct v4l2_device v4l2_dev; struct video_device vfd; +#ifdef CONFIG_MEDIA_CONTROLLER + struct media_device mdev; +#endif atomic_t num_inst; struct mutex dev_mutex; @@ -1001,6 +1004,13 @@ static int vim2m_probe(struct platform_device *pdev) spin_lock_init(&dev->irqlock); +#ifdef CONFIG_MEDIA_CONTROLLER + dev->mdev.dev = &pdev->dev; + strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model)); + media_device_init(&dev->mdev); + dev->v4l2_dev.mdev = &dev->mdev; +#endif + ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); if (ret) return ret; @@ -1034,6 +1044,13 @@ static int vim2m_probe(struct platform_device *pdev) goto err_m2m; } +#ifdef CONFIG_MEDIA_CONTROLLER + /* Register the media device node */ + ret = media_device_register(&dev->mdev); + if (ret) + goto err_m2m; +#endif + return 0; err_m2m: @@ -1050,6 +1067,13 @@ static int vim2m_remove(struct platform_device *pdev) struct vim2m_dev *dev = platform_get_drvdata(pdev); v4l2_info(&dev->v4l2_dev, "Removing " MEM2MEM_NAME); + +#ifdef CONFIG_MEDIA_CONTROLLER + if (media_devnode_is_registered(dev->mdev.devnode)) + media_device_unregister(&dev->mdev); + media_device_cleanup(&dev->mdev); +#endif + v4l2_m2m_release(dev->m2m_dev); del_timer_sync(&dev->timer); video_unregister_device(&dev->vfd); -- 2.16.0.rc1.238.g530d649a79-goog