Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp653041rwe; Fri, 26 Aug 2022 11:36:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4gcrqjeXfomaMc6YN5H3EhQKcjT9zVu5MQ6zhxeY5CT4Om4AiFV/SlL9VQNA7Sg5AFHsEl X-Received: by 2002:a17:90b:14d2:b0:1fb:acff:998 with SMTP id jz18-20020a17090b14d200b001fbacff0998mr5776113pjb.70.1661539009238; Fri, 26 Aug 2022 11:36:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661539009; cv=none; d=google.com; s=arc-20160816; b=PijOPZf3nDvTXzeHqBATRGU7d2KY6/pYUsPhMOvhr+NNJcXeIJIxmdRCJCPHBcvdxB 3y+gAdLtD5DQxfpbOGlOCFZT2HFt3pr5OXX03q/+bC3K4xAErAYnmEx5oVW/H7/k3/tF wfC9P8Rzp+cR8N4hfMA6R/FPYXhaN2Jgvea2OW2MWpziScTHgxPSUXBtt3NMmW4v9ro7 wqWiJiI8pW1tOBScenKw/jWAJp0udG3L1al+7y9EX1P9RIkbodmn2WSSmvqbuPr916N+ ue7sRYFA1nfdX17rtvKFb7d4qfEnPKaMY8MlpbywNrTTZRwOh8AQKJnbGR9Pk1dlfYHI DeSg== 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=OgLbVt95IswN57OD3YbDIdTcpan29K7wlu0knN7p7nY=; b=DtYAcZ4LTCiOfXht5rb0RX5xXB7O1Edr23Wh6aYAgBpAjAHJcglJ4FmxvwRJj5Xybk y+V+KPDOJCNiVlBYI94oPv+/pMXOCqSjE+XOwkq7dxFZkqVqCk4j6QOQ4sd21lriajIX OGfNqz4fqTyPmN/bb4IHKTnGKN88u7pdAd1T+xTsj2cDoUpLwhOIFIqxe6hdDkNAYpux 3LLp57JTsmTR4AwIVmCc8tVWRcWx7oyy3SCxxop+oxqG0XwZlU2nq60ILVd7ev9VsAW/ 17T76luLgvjI2sb0vVPqZgWngQY5ni+87Ja35vtD33nEBSM7i5MBThJAjv7mu7AUb89S 4+Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LRlT4AXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a63fc54000000b004231ae0167dsi1862227pgk.69.2022.08.26.11.36.36; Fri, 26 Aug 2022 11:36:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=LRlT4AXW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344865AbiHZSeQ (ORCPT + 99 others); Fri, 26 Aug 2022 14:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344205AbiHZSdg (ORCPT ); Fri, 26 Aug 2022 14:33:36 -0400 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A09E3C03; Fri, 26 Aug 2022 11:33:23 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 36BD0FF809; Fri, 26 Aug 2022 18:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1661538802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OgLbVt95IswN57OD3YbDIdTcpan29K7wlu0knN7p7nY=; b=LRlT4AXWb0ovaSKo4ELb2Pfw8HkFLh8sjBPS1gwwZyhXoSptFrJ/Nx92YmBHyVJSAUN/8b lnHlZ9jP70rblinW37OSYOJDNKcuXShGcvbc/P54gx1zWKm4KMEdDH6ZVOHvG3Bis0+py0 OgHHA2Nf5H4RluGw5gW5OrURfNLlUWAK83HgxIv/JLQjzWWZ7ynzHNcTmORAIbMpsDhGvx woOtqk5V837OzB+iCdDkqugiQRLbGzfQmlP2kPXX+GVAFQlnguod2gkkwjWDgVkULACxsd OY6y/tlM/5SyFizzw1yQn106Lk7p4QuaAQWxjXap9LM8O67FEk7o0W8l1A2WEg== From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Cc: Yong Deng , Paul Kocialkowski , Mauro Carvalho Chehab , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Laurent Pinchart , Maxime Ripard , Thomas Petazzoni Subject: [PATCH v6 13/43] media: sun6i-csi: Add media ops with link notify callback Date: Fri, 26 Aug 2022 20:32:10 +0200 Message-Id: <20220826183240.604834-14-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220826183240.604834-1-paul.kocialkowski@bootlin.com> References: <20220826183240.604834-1-paul.kocialkowski@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to keep the power use count fields balanced when link changes happen between v4l2_pipeline_pm_get/set calls (in open/close), the link_notify media operation callback needs to be registered. Signed-off-by: Paul Kocialkowski Acked-by: Jernej Skrabec --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index d74eaa3132d6..8b99c17e8403 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "sun6i_csi.h" #include "sun6i_csi_reg.h" @@ -574,6 +575,12 @@ void sun6i_csi_set_stream(struct sun6i_csi_device *csi_dev, bool enable) CSI_CAP_CH0_VCAP_ON); } +/* Media */ + +static const struct media_device_ops sun6i_csi_media_ops = { + .link_notify = v4l2_pipeline_link_notify, +}; + /* V4L2 */ static int sun6i_csi_link_entity(struct sun6i_csi_device *csi_dev, @@ -681,6 +688,7 @@ static int sun6i_csi_v4l2_setup(struct sun6i_csi_device *csi_dev) strscpy(media_dev->model, SUN6I_CSI_DESCRIPTION, sizeof(media_dev->model)); media_dev->hw_revision = 0; + media_dev->ops = &sun6i_csi_media_ops; media_dev->dev = dev; media_device_init(media_dev); -- 2.37.1