Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1131852imm; Fri, 29 Jun 2018 11:58:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdZlpDa1Qfrku3fhX+oZLWEK8heWVslAQEB2EBKWCFHERAM8fD2UPRG1L/00iBZrZDr8UgE X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr15779397pfa.227.1530298722730; Fri, 29 Jun 2018 11:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530298722; cv=none; d=google.com; s=arc-20160816; b=IIwRLBV083AqrTBSJBLq3IwU5MMYpu7LZVVrCLsFuMM67rFqcu4GAoAGqbPV91RLuu PvPLdj8UfUQpdDax5yGatZqua8WsJjzxSpl55otsw98zO+B/ipRy2YzKaEpjNTOR7OmP 2k5eGdfBjxYWOeJ1N4JR9yJZRvmC4bBhnQQDwipjkMNLzJNBQ/sChdZt4+AqqQBIze61 BgKUdn3c5GVQHAyMgS2/7t60LEul1OhJceAasGCn9HNUuZXFw3Mu3z1f7kt7ftisR1jU 4DAPpKHC8Hj2dQTbopvoW8l7hltCbyPa9Q0cT79TzXPtqvLhwlu5/FfjpKky11ukub5c HUAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=+9GEaWjteuxF7tJ1y+LTDDA6cZ/9EUrUTXOCa4Eze0o=; b=j+lyn6dxoNGE1gS8yLkXusxOXVUjXF0U3KivEFsTli09pfY3rnXMv25ICXUsBfRSYV +3Y7howaGCOOg5Mm03cmUl7RgzaRgMllsfxPa1qrXgOVHB9kS5ifhHt5FRYOQWDuvRAU 7efVFVo1V56fzSuYH28ZzN7Ww37wldYAB/k4maPGOA4D7zQHsqXhhLdQqFSgi+XNUSHC 1Jtk8SuRpqP5BBz+jZI0CqASILH7ED3weydrIkewbtwLT5vkR0maLq5Xx/UPg+Koc9Rm Ityefx5psBcyYa0j/ozRAuVoFXvheSrQK6+j0omxsOE7JPpoSTTdVDeZ9I5hLorz9oF8 kO3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AGznIgvO; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2-v6si9894886plz.118.2018.06.29.11.58.28; Fri, 29 Jun 2018 11:58:42 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=AGznIgvO; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936553AbeF2Sue (ORCPT + 99 others); Fri, 29 Jun 2018 14:50:34 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46947 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751757AbeF2Suc (ORCPT ); Fri, 29 Jun 2018 14:50:32 -0400 Received: by mail-pl0-f66.google.com with SMTP id 30-v6so4859514pld.13; Fri, 29 Jun 2018 11:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=+9GEaWjteuxF7tJ1y+LTDDA6cZ/9EUrUTXOCa4Eze0o=; b=AGznIgvOh7Li5c4fQJLLzcDytu/osWz4T2wouYouDLescHJd8RlnZ3llSU4WVwl8sl PqPEH/pZL+OZwfsA/LvBnsVfusweahZuCQP36X5YD6EGt8Fzl5q6tJ1UdSkYE0wzl4Gu J/pzMwn20+G6kyOZay15H80ujhs9IxNXbZnmgkAsOiEZ8S1mXXMbvks/kD3l6AJDG4Hs 7KNyrVyOBZQlR2vy3BCj3rjopHR/m81QnCNDfaeXamSXdlIv/vSLwhXNlItLn6B+i9sg zgR2lAjIdpm5yPQvRvfyqwS9A4voSScqvlwirELbhW2EEtAwvH/HdKYo6FnsytTcklu0 syXg== 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; bh=+9GEaWjteuxF7tJ1y+LTDDA6cZ/9EUrUTXOCa4Eze0o=; b=Co95HEgHOa+i5NSUttxyZLAr2aSQd9EzM7LWH7cjfSk3Kzw/XHsf11DeTnn1v1r1xD HTm7Lz96Hw2UwkDvDmmxW8qGTeZoNF6QQSmFXhdbApXLbp3uSdUnonbs+jX9/gll0tKi CAae3dpd4eJEBgR+fa/vTXtj/H8ZRLL/gSM5+Fk+FPFqurDhw3w0jy4azckp7OjAhPda sjCpnvUcbj2iFRswpPgcqp/v1gLGnmYd+YKFeGG9lJ8GsnTjd4Kyp664ol7tXijjKHgi NWNVvvAcGv+KbG0JpxCUnh7T/AZ7KOHtG/jsIg82ZVVDFQCRXKYNMzGggCrW8HqPs9zS pcWA== X-Gm-Message-State: APt69E3p/OFSJZwtmIk+FOQWuTASPgPjCZWVivioNx8U0VIoZXfy64hf 5Y80KBJjDWBIycb/27pEyI1KkQ== X-Received: by 2002:a17:902:4381:: with SMTP id j1-v6mr16103013pld.104.1530298231952; Fri, 29 Jun 2018 11:50:31 -0700 (PDT) Received: from mappy.world.mentorg.com ([2602:306:cc3b:f020:7cd8:9ad7:a375:e853]) by smtp.googlemail.com with ESMTPSA id k13-v6sm27672308pfg.130.2018.06.29.11.50.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 29 Jun 2018 11:50:31 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam , linux-kernel@vger.kernel.org Subject: [PATCH v5 00/17] media: imx: Switch to subdev notifiers Date: Fri, 29 Jun 2018 11:49:44 -0700 Message-Id: <1530298220-5097-1-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset converts the imx-media driver and its dependent subdevs to use subdev notifiers. There are a couple shortcomings in v4l2-core that prevented subdev notifiers from working correctly in imx-media: 1. v4l2_async_notifier_fwnode_parse_endpoint() treats a fwnode endpoint that is not connected to a remote device as an error. But in the case of the video-mux subdev, this is not an error, it is OK if some of the mux inputs have no connection. Also, Documentation/devicetree/bindings/media/video-interfaces.txt explicitly states that the 'remote-endpoint' property is optional. So the first patch is a small modification to ignore empty endpoints in v4l2_async_notifier_fwnode_parse_endpoint() and allow __v4l2_async_notifier_parse_fwnode_endpoints() to continue to parse the remaining port endpoints of the device. 2. In the imx-media graph, multiple subdevs will encounter the same upstream subdev (such as the imx6-mipi-csi2 receiver), and so v4l2_async_notifier_parse_fwnode_endpoints() will add imx6-mipi-csi2 multiple times. This is treated as an error by v4l2_async_notifier_register() later. To get around this problem, add an v4l2_async_notifier_add_subdev() which first verifies the provided asd does not already exist in the given notifier asd list or in other registered notifiers. If the asd exists, the function returns -EEXIST and it's up to the caller to decide if that is an error (in imx-media case it is never an error). Patches 2-5 deal with adding that support. 3. Patch 6 adds v4l2_async_register_fwnode_subdev(), which is a convenience function for parsing a subdev's fwnode port endpoints for connected remote subdevs, registering a subdev notifier, and then registering the sub-device itself. 4. Patches 7-14 update the subdev drivers to register a subdev notifier with endpoint parsing, and the changes to imx-media to support that. 5. Finally, the last 3 patches endeavor to completely remove support for the notifier->subdevs[] array in platform drivers and v4l2 core. All platform drivers are modified to make use of v4l2_async_notifier_add_subdev() and its related convenience functions to add asd's to the notifier @asd_list, and any allocation or reference to the notifier->subdevs[] array removed. After that large patch, notifier->subdevs[] array is stripped from v4l2-async and v4l2-subdev docs are updated to reflect the new method of adding asd's to notifiers. Signed-off-by: Steve Longerbeam Patches 07-14 (video-mux and the imx patches) are Reviewed-by: Philipp Zabel Patches 01-14 are Tested-by: Philipp Zabel on i.MX6 with Toshiba TC358743 connected via MIPI CSI-2. History: v5: - see point 5 above. v4: - small non-functional code cleanup in video-mux.c. - strip TODO for comparing custom asd's for equivalence. - add three more convenience functions: v4l2_async_notifier_add_fwnode_subdev, v4l2_async_notifier_add_i2c_subdev, v4l2_async_notifier_add_devname_subdev. - strip support in v4l2_async_register_fwnode_subdev for sub-devices that register from port nodes. v3: - code optimization in asd_equal(), and remove unneeded braces, suggested by Sakari Ailus. - add a NULL asd pointer check to v4l2_async_notifier_asd_valid(). - fix an error-out path in v4l2_async_register_fwnode_subdev() that forgot to put device. v2: - don't pass an empty endpoint to the parse_endpoint callback, v4l2_async_notifier_fwnode_parse_endpoint() now just ignores them and returns success. - Fix a couple compile warnings and errors seen in i386 and sh archs. Steve Longerbeam (17): media: v4l2-fwnode: ignore endpoints that have no remote port parent media: v4l2: async: Allow searching for asd of any type media: v4l2: async: Add v4l2_async_notifier_add_subdev media: v4l2: async: Add convenience functions to allocate and add asd's media: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers media: platform: video-mux: Register a subdev notifier media: imx: csi: Register a subdev notifier media: imx: mipi csi-2: Register a subdev notifier media: staging/imx: of: Remove recursive graph walk media: staging/imx: Loop through all registered subdevs for media links media: staging/imx: Rename root notifier media: staging/imx: Switch to v4l2_async_notifier_add_*_subdev media: staging/imx: TODO: Remove one assumption about OF graph parsing media: platform: Switch to v4l2_async_notifier_add_subdev media: v4l2: async: Remove notifier subdevs array [media] v4l2-subdev.rst: Update doc regarding subdev descriptors Documentation/media/kapi/v4l2-subdev.rst | 28 ++- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 10 +- drivers/media/platform/am437x/am437x-vpfe.c | 80 ++++--- drivers/media/platform/atmel/atmel-isc.c | 13 +- drivers/media/platform/atmel/atmel-isi.c | 15 +- drivers/media/platform/cadence/cdns-csi2rx.c | 26 +- drivers/media/platform/davinci/vpif_capture.c | 47 ++-- drivers/media/platform/davinci/vpif_display.c | 23 +- drivers/media/platform/exynos4-is/media-dev.c | 30 ++- drivers/media/platform/exynos4-is/media-dev.h | 1 - drivers/media/platform/pxa_camera.c | 23 +- drivers/media/platform/qcom/camss-8x16/camss.c | 74 +++--- drivers/media/platform/qcom/camss-8x16/camss.h | 2 +- drivers/media/platform/rcar-vin/rcar-csi2.c | 20 +- drivers/media/platform/rcar_drif.c | 18 +- drivers/media/platform/renesas-ceu.c | 51 ++-- drivers/media/platform/soc_camera/soc_camera.c | 31 ++- drivers/media/platform/stm32/stm32-dcmi.c | 22 +- drivers/media/platform/ti-vpe/cal.c | 34 ++- drivers/media/platform/video-mux.c | 36 ++- drivers/media/platform/xilinx/xilinx-vipp.c | 154 ++++++------ drivers/media/platform/xilinx/xilinx-vipp.h | 4 - drivers/media/v4l2-core/v4l2-async.c | 276 +++++++++++++++++----- drivers/media/v4l2-core/v4l2-fwnode.c | 194 +++++++-------- drivers/staging/media/imx/TODO | 29 +-- drivers/staging/media/imx/imx-media-csi.c | 55 ++++- drivers/staging/media/imx/imx-media-dev.c | 143 +++-------- drivers/staging/media/imx/imx-media-internal-sd.c | 5 +- drivers/staging/media/imx/imx-media-of.c | 106 +-------- drivers/staging/media/imx/imx-media.h | 6 +- drivers/staging/media/imx/imx6-mipi-csi2.c | 31 ++- include/media/v4l2-async.h | 90 ++++++- include/media/v4l2-fwnode.h | 58 ++++- 33 files changed, 966 insertions(+), 769 deletions(-) -- 2.7.4