From patchwork Tue Feb 6 23:29:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 10204319 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 9AD0260327 for ; Tue, 6 Feb 2018 23:29:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93DCD28CEC for ; Tue, 6 Feb 2018 23:29:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8849628D40; Tue, 6 Feb 2018 23:29:28 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable 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 EB45E28CEC for ; Tue, 6 Feb 2018 23:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753817AbeBFX3N (ORCPT ); Tue, 6 Feb 2018 18:29:13 -0500 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35186 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753785AbeBFX3L (ORCPT ); Tue, 6 Feb 2018 18:29:11 -0500 Received: by mail-wr0-f194.google.com with SMTP id w50so3753220wrc.2 for ; Tue, 06 Feb 2018 15:29:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=csGGfruOHMF6+Y3fmh3Gwa+XnLGRxvNjHlXScRYkR2g=; b=RxWmXw5lAg/qWo/SagnvNNcGWI03yTqkbIGdE/894eSCigLJeknCM5mwfzNL/0NsWs Ay42aMfGhgIYVrFwbcICFmjwRVNVhDyaFgS2PPFsoG/YPwrqR2o3tOkdhJzcXx3/QoG6 c57Ubhp5LDGgqL89zIQuoKTmA8jjLEiUqllts8i4y5Asbx/Obtw+u2OltAhIeZ2Hfb2Q PM/6PPTRDaAkEwTkIoo0Y7CIthTp7HT8TuD3xJ4zzgy7ZUFl/YmDrrRjg5OLb+3VFqZp k6gJi+G0a10Ij3MmQU+OWUfweCGgRkSWCMoq4JN464vISV/YWZLsLPiv63QsnK94TlbB 26KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=csGGfruOHMF6+Y3fmh3Gwa+XnLGRxvNjHlXScRYkR2g=; b=hvfQveynqqrNaVP/yatxZPwWvIercn9FkEfAc7QVx2Y9Es9Deu+4+yb0mIIZUFh48u /HyiknGA2NZiFNrVea74SvJhsXhYKxgHvNdz9lEX9EtrhjY+oIxMbKwWI9olcHzvpJEJ eXUfVXWWgQbKU+o19BKT/3IrTO9CYVUhVCkIk6itBriEoieRs6aoZCH1i7fahqPAbi8U 86zW2tkksl6kIWMa7UE3Ruu8kEcPcS0H+j0dur+j+DNA212Bd+yDPA2rzD5dEHMOsDPw d3rkipG98IOWcvvD1bzRMRdx9FdTBexkic3Q6MGzPXxUfK1pZEBpGcuv1VAIF4bv2q4e 2KEg== X-Gm-Message-State: APf1xPAxASyBDbpcULNjiwqZ7iJODXqVkEeHQ9LOXC997cY4q720L0Sz ZZ7o3ycmn2ZutHW5QrrT0TfJi8AF9qULNsCxod1Ldw== X-Google-Smtp-Source: AH8x2269Mg3T4jORDSR/eJREE/1qG9ooRrQ1YEsuAzCiMQMOninX414o2ElKbeVK4we4Kv129mO6PTaq5uqZpssR/H4= X-Received: by 10.223.158.132 with SMTP id a4mr3631294wrf.236.1517959750268; Tue, 06 Feb 2018 15:29:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.66.74 with HTTP; Tue, 6 Feb 2018 15:29:09 -0800 (PST) In-Reply-To: References: <1517948874-21681-1-git-send-email-tharvey@gateworks.com> From: Tim Harvey Date: Tue, 6 Feb 2018 15:29:09 -0800 Message-ID: Subject: Re: [PATCH v8 0/7] TDA1997x HDMI video reciver To: Hans Verkuil Cc: linux-media , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Shawn Guo , Steve Longerbeam , Philipp Zabel , Hans Verkuil , Mauro Carvalho Chehab 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 On Tue, Feb 6, 2018 at 1:21 PM, Hans Verkuil wrote: > On 02/06/2018 09:27 PM, Tim Harvey wrote: > > > >> v4l2-compliance test results: >> - with the following kernel patches: >> v4l2-subdev: clear reserved fields >> . v4l2-subdev: without controls return -ENOTTY >> >> v4l2-compliance SHA : b2f8f9049056eb6f9e028927dacb2c715a062df8 >> Media Driver Info: >> Driver name : imx-media >> Model : imx-media >> Serial : >> Bus info : >> Media version : 4.15.0 >> Hardware revision: 0x00000000 (0) >> Driver version : 4.15.0 >> Interface Info: >> ID : 0x0300008f >> Type : V4L Sub-Device >> Entity Info: >> ID : 0x00000003 (3) >> Name : tda19971 2-0048 >> Function : Unknown > > This is missing. It should be one of these: > > https://hverkuil.home.xs4all.nl/spec/uapi/mediactl/media-types.html#media-entity-type > > However, we don't have a proper function defined. > > I would suggest adding a new MEDIA_ENT_F_DTV_DECODER analogous to MEDIA_ENT_F_ATV_DECODER. > > It would be a new patch adding this + documentation. Hows this look for adding to my next series: Author: Tim Harvey Date: Tue Feb 6 14:12:52 2018 -0800 [media] add digital video decoder video interface entity functions Add a new media entity function definition for digital TV decoders: MEDIA_ENT_F_DTV_DECODER Signed-off-by: Tim Harvey root@ventana:~# v4l2-ctl -d /dev/v4l-subdev1 --list-ctrls Digital Video Controls power_present 0x00a00964 (bitmask): max=0x00000001 default=0x00000000 value=0x00000000 flags=read-only rx_rgb_quantization_range 0x00a00965 (menu) : min=0 max=2 default=0 value=2 rx_it_content_type 0x00a00966 (menu) : min=0 max=4 default=4 value=0 flags=read-only, volatile And various sets/gets appear to work as designed (found that I wasn't updating the csc when quantiation range was changed via ctrl and fixed it). Regards, Tim --- a/Documentation/media/uapi/mediactl/media-types.rst +++ b/Documentation/media/uapi/mediactl/media-types.rst @@ -321,6 +321,17 @@ Types and flags used to represent the media graph elements MIPI CSI-2, ...), and outputs them on its source pad to an output video bus of another type (eDP, MIPI CSI-2, parallel, ...). + - .. row 31 + + .. _MEDIA-ENT-F-DTV-DECODER: + + - ``MEDIA_ENT_F_DTV_DECODER`` + + - Digital video decoder. The basic function of the video decoder is + to accept digital video from a wide variety of sources + and output it in some digital video standard, with appropriate + timing signals. + .. tabularcolumns:: |p{5.5cm}|p{12.0cm}| .. _media-entity-flag: diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h index b9b9446..6653e88 100644 --- a/include/uapi/linux/media.h +++ b/include/uapi/linux/media.h @@ -152,6 +152,7 @@ struct media_device_info { * MEDIA_ENT_F_IF_VID_DECODER and/or MEDIA_ENT_F_IF_AUD_DECODER. */ #define MEDIA_ENT_F_TUNER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 5) +#define MEDIA_ENT_F_DTV_DECODER (MEDIA_ENT_F_OLD_SUBDEV_BASE + 6) #define MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN MEDIA_ENT_F_OLD_SUBDEV_BASE Assigning this now shows a function but does not resolve the media compliance results: --- a/drivers/media/i2c/tda1997x.c +++ b/drivers/media/i2c/tda1997x.c @@ -2586,6 +2586,7 @@ static int tda1997x_probe(struct i2c_client *client, id->name, i2c_adapter_id(client->adapter), client->addr); sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; + sd->entity.function = MEDIA_ENT_F_DTV_DECODER; sd->entity.ops = &tda1997x_media_ops; /* set allowed mbus modes based on chip, bus-type, and bus-width */ root@ventana:~# v4l2-compliance -u1 v4l2-compliance SHA : b2f8f9049056eb6f9e028927dacb2c715a062df8 Media Driver Info: Driver name : imx-media Model : imx-media Serial : Bus info : Media version : 4.15.0 Hardware revision: 0x00000000 (0) Driver version : 4.15.0 Interface Info: ID : 0x0300008f Type : V4L Sub-Device Entity Info: ID : 0x00000003 (3) Name : tda19971 2-0048 Function : Unknown (00020006) Pad 0x01000004 : Source Link 0x0200006f: to remote pad 0x1000063 of entity 'ipu1_csi0_mux': Data ... root@ventana:~# v4l2-compliance -m0 -M v4l2-compliance SHA : b2f8f9049056eb6f9e028927dacb2c715a062df8 Media Driver Info: Driver name : imx-media Model : imx-media Serial : Bus info : Media version : 4.15.0 Hardware revision: 0x00000000 (0) Driver version : 4.15.0 Compliance test for device /dev/media0: Required ioctls: test MEDIA_IOC_DEVICE_INFO: OK Allow for multiple opens: test second /dev/media0 open: OK test MEDIA_IOC_DEVICE_INFO: OK test for unlimited opens: OK Media Controller ioctls: fail: v4l2-test-media.cpp(141): ent.function == MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN test MEDIA_IOC_G_TOPOLOGY: FAIL fail: v4l2-test-media.cpp(256): v2_entities_set.find(ent.id) == v2_entities_set.end() test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL test MEDIA_IOC_SETUP_LINK: OK Total: 7, Succeeded: 5, Failed: 2, Warnings: 0 > >> >> Sub-Device ioctls (Source Pad 0): >> test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK >> test Try VIDIOC_SUBDEV_G/S_FMT: OK >> test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) >> test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK >> test Active VIDIOC_SUBDEV_G/S_FMT: OK >> test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) >> test VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported) >> >> Control ioctls: >> test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) >> test VIDIOC_QUERYCTRL: OK (Not Supported) >> test VIDIOC_G/S_CTRL: OK (Not Supported) >> test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) >> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) >> test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) >> Standard Controls: 0 Private Controls: 0 > > Why doesn't this show anything? You have at least one control, so this should > reflect that. Does 'v4l2-ctl -d /dev/v4l-subdev1 -l' show any controls? > > I think sd->ctrl_handler is never set to the v4l2_ctrl_handler pointer. > > Have you ever tested the controls? > > Looking closer I also notice that the control handler is never freed. Or > checked for errors when it is created in the probe function. Hmm, I should > have caught that earlier. > Yes thanks - I missed this also: --- a/drivers/media/i2c/tda1997x.c +++ b/drivers/media/i2c/tda1997x.c @@ -2726,6 +2726,12 @@ static int tda1997x_probe(struct i2c_client *client, &tda1997x_ctrl_ops, V4L2_CID_DV_RX_RGB_RANGE, V4L2_DV_RGB_RANGE_FULL, 0, V4L2_DV_RGB_RANGE_AUTO); + state->sd.ctrl_handler = hdl; + if (hdl->error) { + ret = hdl->error; + goto err_free_handler; + } + v4l2_ctrl_handler_setup(hdl); /* initialize source pads */ state->pads[TDA1997X_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE; @@ -2774,6 +2780,8 @@ static int tda1997x_probe(struct i2c_client *client, err_free_media: media_entity_cleanup(&sd->entity); +err_free_handler: + v4l2_ctrl_handler_free(&state->hdl); err_free_mutex: cancel_delayed_work(&state->delayed_work_enable_hpd); mutex_destroy(&state->page_lock); @@ -2801,6 +2809,7 @@ static int tda1997x_remove(struct i2c_client *client) v4l2_async_unregister_subdev(sd); media_entity_cleanup(&sd->entity); + v4l2_ctrl_handler_free(&state->hdl); regulator_bulk_disable(TDA1997X_NUM_SUPPLIES, state->supplies); i2c_unregister_device(state->client_cec); cancel_delayed_work(&state->delayed_work_enable_hpd);