From patchwork Sat Oct 13 18:02:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10640431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FCD5933 for ; Sat, 13 Oct 2018 18:03:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 138092AAED for ; Sat, 13 Oct 2018 18:03:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01D5F2AB0F; Sat, 13 Oct 2018 18:02:59 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 690662AAED for ; Sat, 13 Oct 2018 18:02:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726718AbeJNBlC (ORCPT ); Sat, 13 Oct 2018 21:41:02 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43329 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726668AbeJNBlC (ORCPT ); Sat, 13 Oct 2018 21:41:02 -0400 Received: by mail-pg1-f196.google.com with SMTP id 80-v6so7267426pgh.10 for ; Sat, 13 Oct 2018 11:02:56 -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=XC5/WsQuIvMEu4D451mUwaDBjD2+VqMrlu2u1BXp8lg=; b=GG8RDeWnzXGgKOMTbZW2Fp0kQTN7V+zr9Mofwcw11tbuHPhd9WIrwRlS66zRF0Horb zRjqB7Xm9X37ZeCNeA7bweZZFjZMv5fGb42ATMaxmNvsjIem8HPLqNcIYpx9hg3WSVVl KksgPfRSsdr4Mwr75WMia48LcapkO9AXRgltvkQlI4E0p9Lj3/PcMFTMTDAyJS26WBCI r4QXNQmrEPXIDbwUh3cb7pw3ZyQKq0ajYi2B3dcBfh0D/mIg2O47AfoDa1FDfWMnyUlg wJSTZNaRrvVw+uHf3Y/Y3nR8a3UShDf36qXSjqIrovst2doGFt17s2VBDuQIZZLz7H57 oGqg== 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=XC5/WsQuIvMEu4D451mUwaDBjD2+VqMrlu2u1BXp8lg=; b=N3Ok+1oACws2baQRSmT940TlBneYgUDxsrsgNvfcQ9IQVMKlP94aL13LqStkG+e5hI /6jA+fcqreUdcHXtSeCUbnUoVwjb7IvZUmFJR23t9ZacLbTDBZgz5B7jFPAP97+Kytzi tFobFixAcb7cI1gdPA9kUfN6acTCuxWN+enApT9NmGcds2mjoCU/53KLbetItisidURF 0KlJgxEU5N8x39gNVA0dm23JEKADYQIegluGqKIv57QJ0gVR5E9b1wbNwsfH55ddRYYl bNswAbta3o13YaWIa8OxECuk9FRiZYjvmFnp31Za2mBIBtyy4b8xRCk2KfRaVjOTN9Kz xnpg== X-Gm-Message-State: ABuFfohtxVM0qssqJ+jh58xvldN+4reMaCcYzHfWp2Q8pctYu7RX9Ijd cXBeNJ4BrkEfcfPF8+xZvksxSASf X-Google-Smtp-Source: ACcGV605EbE9P7Oc5Zd4Gn4cAqGg9/K83xE5CJdETlwWdy7MlNA5ugvuLVsQKdtsZB1iKmtP/WUUeg== X-Received: by 2002:a63:f848:: with SMTP id v8-v6mr9930359pgj.82.1539453775644; Sat, 13 Oct 2018 11:02:55 -0700 (PDT) Received: from localhost.localdomain ([240f:34:212d:1:40bf:70f3:985:17ed]) by smtp.gmail.com with ESMTPSA id w187-v6sm2513858pfw.3.2018.10.13.11.02.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 13 Oct 2018 11:02:54 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , Matt Ranostay , Sakari Ailus , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH v3 0/6] media: video-i2c: support changing frame interval and runtime PM Date: Sun, 14 Oct 2018 03:02:33 +0900 Message-Id: <1539453759-29976-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 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 This patchset adds support for changing frame interval and runtime PM for video-i2c driver. This also adds an helper macro to v4l2 common internal API that is used to to find a suitable frame interval. There are a couple of unrelated changes that are included for simplifying driver initialization code and register accesses. * v3 - Append result of v4l2-compliance in cover-letter - Move the code causing use-after-free from video_i2c_remove() to the video device release() callback. - Use regmap_init_i2c() instead of devm_regmap_init_i2c() and call regmap_exit_i2c() in video device release() callback in order to avoid releasing regmap when the driver is unbound. - Add Acked-by lines * v2 - Add Acked-by and Reviewed-by tags - Update commit log to clarify the use after free - Add thermistor and termperature register address definisions - Stop adding v4l2_find_closest_fract() in v4l2 common internal API - Add V4L2_FRACT_COMPARE() macro in v4l2 common internal API - Use V4L2_FRACT_COMPARE() to find suitable frame interval instead of v4l2_find_closest_fract() - Add comment for register address definisions Akinobu Mita (6): media: video-i2c: avoid accessing released memory area when removing driver media: video-i2c: use i2c regmap media: v4l2-common: add V4L2_FRACT_COMPARE media: vivid: use V4L2_FRACT_COMPARE media: video-i2c: support changing frame interval media: video-i2c: support runtime PM drivers/media/i2c/video-i2c.c | 286 +++++++++++++++++++++++---- drivers/media/platform/vivid/vivid-vid-cap.c | 9 +- include/media/v4l2-common.h | 5 + 3 files changed, 254 insertions(+), 46 deletions(-) v4l2-compliance SHA: 7bde5ef172bd4a09b9544788ba9c5dbb1aa9994a, 32 bits Compliance test for device /dev/video2: Driver Info: Driver name : video-i2c Card type : I2C 1-104 Transport Video Bus info : I2C:1-104 Driver version : 4.19.0 Capabilities : 0x85200001 Video Capture Read/Write Streaming Extended Pix Format Device Capabilities Device Caps : 0x05200001 Video Capture Read/Write Streaming Extended Pix Format Required ioctls: test VIDIOC_QUERYCAP: OK Allow for multiple opens: test second /dev/video2 open: OK test VIDIOC_QUERYCAP: OK test VIDIOC_G/S_PRIORITY: OK test for unlimited opens: OK Debug ioctls: test VIDIOC_DBG_G/S_REGISTER: OK test VIDIOC_LOG_STATUS: OK (Not Supported) Input ioctls: test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported) test VIDIOC_G/S/ENUMINPUT: OK test VIDIOC_G/S_AUDIO: OK (Not Supported) Inputs: 1 Audio Inputs: 0 Tuners: 0 Output ioctls: test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported) Outputs: 0 Audio Outputs: 0 Modulators: 0 Input/Output configuration ioctls: test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported) Control ioctls (Input 0): 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 Format ioctls (Input 0): test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK test VIDIOC_TRY_FMT: OK test VIDIOC_S_FMT: OK test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported) test Composing: OK (Not Supported) test Scaling: OK (Not Supported) Codec ioctls (Input 0): test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported) Buffer ioctls (Input 0): test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test VIDIOC_EXPBUF: OK (Not Supported) Total: 43, Succeeded: 43, Failed: 0, Warnings: 0 Cc: Matt Ranostay Cc: Sakari Ailus Cc: Hans Verkuil Cc: Mauro Carvalho Chehab