Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp782163pxb; Wed, 6 Oct 2021 15:29:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU+6h8pFex3F9x6Alk9y8mHH8/Qgv8LWi7fiM63DgCIwvfVMMREr+fPgaYvwGOgID2QPlv X-Received: by 2002:a17:907:7f8e:: with SMTP id qk14mr1049973ejc.91.1633559353752; Wed, 06 Oct 2021 15:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633559353; cv=none; d=google.com; s=arc-20160816; b=ZNXH9z1nMJhZmDQ0U0tB7HOGd6GcBQt05TV6nOOQ+VS/P+xpjXKLmLsMe4t7Pm/FLg Wk95GSi8JR0S5Mv6smnLp5EobElbYA2zpWYU1VEe2iInrdyfjRWHLi8mOjZdV5bNnRIM 3xguq0D/nUppFmCSurrS/Yg7iwCwW01wbCmk1QmVKAkThyGqUCuwao1FcQeioZkwjf5p b5Jm//Yn2aIdn0EO2fGupDiBLWCYviOllhvlQ4B+YR4ZAmVMc3c3KovQLJ68Q2mBNXfU XTh7G/7CTBdQe5xiKWo1PAQXifgOjkaiotcHHI/0s509T5vuMdzq8AwnfnZvE0I4Xk50 5Cmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+GAqRrRgfCmg5VJFrf6IVD13H9dq3bTFFa5kv2zrRe4=; b=YzmK8JUC3JE7P3k5I8WE1TNicJwwZf79QkU/m3+XnxvStoUcA03wovLPBC5hA8zOHM jGWi1N4efxB9NYS1xSkaD6ku9ZKVvaVWRhyyPa/HydheitLLHvRf0La3nEjmTjnRa4GO mWySHq4aZVZb9GZdw6KNb2JmqJBsZli2n4qRCDDduUMoGAKUUSOBKNlp7l4mPmPgknTp 0bZTMHF7fe5e78hzCvx4TdMDCIpbTt6ffYxv7vx9mdqsJ5rUyRKS+X7O+He3WrrVwJ6l rASn9+orTJ9f3igSqXMi6V+Y0TkyPO/mK7k9koWOLvEIsUoKEe65uvgbXvHaEg8O2BGl vFbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bvlPI2gR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id di10si6084457edb.413.2021.10.06.15.28.50; Wed, 06 Oct 2021 15:29:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=bvlPI2gR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S239844AbhJFW2g (ORCPT + 99 others); Wed, 6 Oct 2021 18:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239828AbhJFW2Y (ORCPT ); Wed, 6 Oct 2021 18:28:24 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20277C061766 for ; Wed, 6 Oct 2021 15:26:32 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id l7so15644638edq.3 for ; Wed, 06 Oct 2021 15:26:32 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=+GAqRrRgfCmg5VJFrf6IVD13H9dq3bTFFa5kv2zrRe4=; b=bvlPI2gRvkjvwcwkL4bBmOrmjqdd8qAo3ovF5i67qPbB47pt3ICCDKk8dOdIen30t3 ly+9PndPZiU8pn0oKdJ6t1CoudZISEW6+90v2U3FtwInDWpl1nCX67H4WlFUC1kx26CC BMxJPuy4Gh2K+W2TdE6I8jSIPF4DYtDj/8lPU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+GAqRrRgfCmg5VJFrf6IVD13H9dq3bTFFa5kv2zrRe4=; b=njVIUmWDKdo7ZbtbZwZsl1yIERLi0tw8Ud0NbDkUlZu0nkB9CS7R8xv58SGzl4j33w ByGNjXM+SSn2+F6o6t5gBYA+zalxA5br5oPGlBu2xmDiMvqoR9/l9C3JpWVaruALhXD0 WjIToNiuOCLykQ5TZTx8y5PGyF8T+iFMY0Yh2mlCsnL7M/s6To9aoCRjMTsGlq0APx5p UwSJKoJ4q71Xk1/HZspFVhkY81fMgHElchRQ8kik/5TEEJQfKxvYFVUn2BfO0X2eCr9D COOG/TsvwnXkUI7L1hb9ES8BZK4xnHaqBzSPEyZnAJ0jAan1W9zmIuv6fBq7OgOGTLTm bB+g== X-Gm-Message-State: AOAM533gk+Uv+lqWkh8cYMEKRQRWTSrI6zfPHb3DAqDQCTP3X0SJWuIa YVZZn3Ivuu8uk24Rprry4ukgeA== X-Received: by 2002:a17:906:ecf6:: with SMTP id qt22mr1083272ejb.292.1633559190777; Wed, 06 Oct 2021 15:26:30 -0700 (PDT) Received: from alco.lan (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id h7sm10557906edt.37.2021.10.06.15.26.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 15:26:30 -0700 (PDT) From: Ricardo Ribalda To: Mauro Carvalho Chehab , Yong Zhi , Bingbu Cao , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Chiranjeevi Rapolu , Sakari Ailus Cc: Ricardo Ribalda Subject: [PATCH v4 6/8] media: dw9714: Add implementation for events Date: Thu, 7 Oct 2021 00:26:23 +0200 Message-Id: <20211006222625.401122-7-ribalda@chromium.org> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog In-Reply-To: <20211006222625.401122-1-ribalda@chromium.org> References: <20211006222625.401122-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use v4l2 control API helpers to support the events. Fixes v4l2-compliance: test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL Signed-off-by: Ricardo Ribalda --- drivers/media/i2c/dw9714.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c index c8b4292512dc..3863dfeb8293 100644 --- a/drivers/media/i2c/dw9714.c +++ b/drivers/media/i2c/dw9714.c @@ -7,6 +7,7 @@ #include #include #include +#include #define DW9714_NAME "dw9714" #define DW9714_MAX_FOCUS_POS 1023 @@ -100,7 +101,15 @@ static const struct v4l2_subdev_internal_ops dw9714_int_ops = { .close = dw9714_close, }; -static const struct v4l2_subdev_ops dw9714_ops = { }; +static const struct v4l2_subdev_core_ops dw9714_core_ops = { + .log_status = v4l2_ctrl_subdev_log_status, + .subscribe_event = v4l2_ctrl_subdev_subscribe_event, + .unsubscribe_event = v4l2_event_subdev_unsubscribe, +}; + +static const struct v4l2_subdev_ops dw9714_ops = { + .core = &dw9714_core_ops, +}; static void dw9714_subdev_cleanup(struct dw9714_device *dw9714_dev) { @@ -137,7 +146,8 @@ static int dw9714_probe(struct i2c_client *client) return -ENOMEM; v4l2_i2c_subdev_init(&dw9714_dev->sd, client, &dw9714_ops); - dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; + dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | + V4L2_SUBDEV_FL_HAS_EVENTS; dw9714_dev->sd.internal_ops = &dw9714_int_ops; rval = dw9714_init_controls(dw9714_dev); -- 2.33.0.800.g4c38ced690-goog