From patchwork Mon Sep 21 10:19:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3BDDC43466 for ; Mon, 21 Sep 2020 10:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4DCC620EDD for ; Mon, 21 Sep 2020 10:24:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ERaArSVn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726532AbgIUKYm (ORCPT ); Mon, 21 Sep 2020 06:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726755AbgIUKUf (ORCPT ); Mon, 21 Sep 2020 06:20:35 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54BC5C061755 for ; Mon, 21 Sep 2020 03:20:35 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id t10so12132450wrv.1 for ; Mon, 21 Sep 2020 03:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FAfzGDJNkDiJ14AHNIUhDwhIpLlD543otONzFuTYMfQ=; b=ERaArSVnusIZhh3BpFKhA0YH7Rj3lF6LCWbq+jqxKQnP+9MFEZh1E4yg5l15aO/SH0 e5e9FkbM8T+nBXr70hn4TRSMMkyAqrK2EvTVKzFR6BFdaN0pykgjpnAQvlhD3xx7Smjm hHNyTpdVIwexCovVJDNdKDXac0xAD8tfA2ThaDvsIr8VLhW+AyAV/B58n3MG/w0CLP9D hWlyEyXqjFnM8M6wGw9DzDPsAe2pupXq7BeOJ2DJ8T/DnDWEJT7zChK5qPyK0uEcOjGo 65DikEPIE+20NVDUZpV0wcsHFQ/WVol4ufFxvbz3uaRjLfnIF/qoKTe3uvuaqssVIQnu o3Gg== 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:in-reply-to :references; bh=FAfzGDJNkDiJ14AHNIUhDwhIpLlD543otONzFuTYMfQ=; b=EdvIaU/9PnZeqzAWQTtGZ8L1lQPZ89IO5GP9qcl1vVCd4AiH1pYXY3ITEJ9ocVeco0 5HFDshCpL2nU+5TTHsfdorN3VdCFsltQ8SAYAsUL6CiZDeRHD3BBuwSrcbfVqqQRxtS2 Y1hxFMOTB19lj68J/D0koYzxgfMkR1ov6cGSiY6h+PV3vo8xc2AnXVZtDanI6vVTkXak QLFcaTGcSplWyVPrYaxXy9haAgd4ZrsdPFqvhYvQypfocbZhQiJuK++IB5fqEnm8NGeN 2gfIRSVUSjQKTLoJwTuGBmW/myEngmUASF0fMTQXjpQW8Cdmw9kEIzGznPCZ59QZrofR c01Q== X-Gm-Message-State: AOAM530h1t2PdFDFp2PXb/ds9z64V8ERU5lPnsM3i0RehnwLlv+d3qB8 iw5577g4yMalSEFWUIvIRkYoUw== X-Google-Smtp-Source: ABdhPJwRp8fa0HmGYgcCS7nKvEdN1zyxKC4UrtLKMKxQZ5icXeLaTxukOPBl8Aw2G4MO2Lu2ST4EHg== X-Received: by 2002:adf:f852:: with SMTP id d18mr51733075wrq.245.1600683634013; Mon, 21 Sep 2020 03:20:34 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:33 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 02/49] MAINTAINERS: change maintainer of the zoran driver Date: Mon, 21 Sep 2020 10:19:37 +0000 Message-Id: <1600683624-5863-3-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add myself as maintainer. Signed-off-by: Corentin Labbe --- Documentation/media/v4l-drivers/zoran.rst | 22 +++++++--------------- MAINTAINERS | 10 ++++++++++ drivers/staging/media/zoran/zoran_card.c | 5 ----- drivers/staging/media/zoran/zoran_card.h | 5 ----- drivers/staging/media/zoran/zoran_device.c | 5 ----- drivers/staging/media/zoran/zoran_device.h | 5 ----- 6 files changed, 17 insertions(+), 35 deletions(-) diff --git a/Documentation/media/v4l-drivers/zoran.rst b/Documentation/media/v4l-drivers/zoran.rst index d2724a863d1d..a0586514cd8a 100644 --- a/Documentation/media/v4l-drivers/zoran.rst +++ b/Documentation/media/v4l-drivers/zoran.rst @@ -549,21 +549,13 @@ at high verbosity. See 'Contacting' on how to contact the developers. Maintainers/Contacting ---------------------- -The driver is currently maintained by Laurent Pinchart and Ronald Bultje -( and ). For bug -reports or questions, please contact the mailinglist instead of the developers -individually. For user questions (i.e. bug reports or how-to questions), send -an email to , for developers (i.e. if you want to -help programming), send an email to . See -http://www.sf.net/projects/mjpeg/ for subscription information. - -For bug reports, be sure to include all the information as described in -the section 'It hangs/crashes/fails/whatevers! Help!'. Please make sure -you're using the latest version (http://mjpeg.sf.net/driver-zoran/). - -Previous maintainers/developers of this driver include Serguei Miridonov -, Wolfgang Scherr , Dave Perks - and Rainer Johanni . +Previous maintainers/developers of this driver are +- Laurent Pinchart +- Ronald Bultje rbultje@ronald.bitfreak.net +- Serguei Miridonov +- Wolfgang Scherr +- Dave Perks +- Rainer Johanni Driver's License ---------------- diff --git a/MAINTAINERS b/MAINTAINERS index d3126fc2cca2..f2ece9826be3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -19233,6 +19233,16 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs.git F: Documentation/filesystems/zonefs.rst F: fs/zonefs/ +ZR36067 VIDEO FOR LINUX DRIVER +M: Corentin Labbe +L: mjpeg-users@lists.sourceforge.net +L: linux-media@vger.kernel.org +S: Maintained +W: http://mjpeg.sourceforge.net/driver-zoran/ +Q: https://patchwork.linuxtv.org/project/linux-media/list/ +F: drivers/staging/media/zoran/ +F: Documentation/media/v4l-drivers/zoran.rst + ZPOOL COMPRESSED PAGE STORAGE API M: Dan Streetman L: linux-mm@kvack.org diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index ea10523194e8..d2f82894e8ee 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -7,11 +7,6 @@ * * Copyright (C) 2000 Serguei Miridonov * - * Currently maintained by: - * Ronald Bultje - * Laurent Pinchart - * Mailinglist - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/drivers/staging/media/zoran/zoran_card.h b/drivers/staging/media/zoran/zoran_card.h index 0cdb7d34926d..53ed511ce546 100644 --- a/drivers/staging/media/zoran/zoran_card.h +++ b/drivers/staging/media/zoran/zoran_card.h @@ -7,11 +7,6 @@ * * Copyright (C) 2000 Serguei Miridonov * - * Currently maintained by: - * Ronald Bultje - * Laurent Pinchart - * Mailinglist - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 22b27632762d..04162be80420 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -7,11 +7,6 @@ * * Copyright (C) 2000 Serguei Miridonov * - * Currently maintained by: - * Ronald Bultje - * Laurent Pinchart - * Mailinglist - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or diff --git a/drivers/staging/media/zoran/zoran_device.h b/drivers/staging/media/zoran/zoran_device.h index a507aaad4ebb..816d48b09be9 100644 --- a/drivers/staging/media/zoran/zoran_device.h +++ b/drivers/staging/media/zoran/zoran_device.h @@ -7,11 +7,6 @@ * * Copyright (C) 2000 Serguei Miridonov * - * Currently maintained by: - * Ronald Bultje - * Laurent Pinchart - * Mailinglist - * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or From patchwork Mon Sep 21 10:19:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87A3FC43465 for ; Mon, 21 Sep 2020 10:20:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 54CFD218AC for ; Mon, 21 Sep 2020 10:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="I5VTjG3a" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbgIUKUi (ORCPT ); Mon, 21 Sep 2020 06:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726756AbgIUKUg (ORCPT ); Mon, 21 Sep 2020 06:20:36 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69F05C0613D2 for ; Mon, 21 Sep 2020 03:20:36 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id k15so12115007wrn.10 for ; Mon, 21 Sep 2020 03:20:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z5xy1HmEK3Cb2cGuOZNBEue37qSrHj+Vnq/OwfaPORg=; b=I5VTjG3a3ViBXraLZbIZjAF4w3IjxazcKPBR8RM9zZISWgHD9OAAW/k6SSohJYhPNG A5YpvNK36e4G+9BFnfqnxMw1ClkJlY0mfrV41zlhv06gFtYecYAE+trrq+eIDf77q/X6 yJ9A8CxIZkIE7MofTCSiuH14CNxFd1GOFLd0QPPHX1l5Pz9e9RJSOfW1EZPYdHwFYh3n /85ZsSW7M2mpjF8Yzi14whkUIf8DbmA6nOCwjNK9GhrXL+3c8xwcyiWIXyZxS1B26ilp /1uB7h0HAi7DX/gQsZce7RHc+1uONcDNT/4FfiDSZ1HxaKtJR1mEhMWmguiXrcYTJARi o/UA== 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:in-reply-to :references; bh=Z5xy1HmEK3Cb2cGuOZNBEue37qSrHj+Vnq/OwfaPORg=; b=o3q5uvunfPK2F90J/Ym5dw7hBrnJ2RXOclE85IuwO9oU34x5e9wr7whY8i7/t6wIvX dNYA1DmG29q7GHQZtHxdj6ahvkhlElEp3rGlOAXzeMwhcj/2rOcq5Q2hpxc+LvaF50VH 9wCiF+hmyE+A//acTr7AsOPJY3HM+KA7+63fLyK8dbaMpVKyUfVZghokgPyGIvJBW3zO km6meRTHoe+l3cwPV51uxXGcXpCQA4+ZTpeJJbUxoElCR4a6ZS3DzjhmUUjl3oTssfax cMoNzB9ZV5P+DWYCYj+ffUMTXL+mmyZWapkUHGwMNif+i6xB8Esy+Y5beQDf3hcMCI6L +VBg== X-Gm-Message-State: AOAM533mm1rTPT7NFxGHnyswiCpL2l5Tq4mXERA4mirgZ8mFPsz7tKuT XdPcDgmORvpWEr+39XhEBHX7JQ== X-Google-Smtp-Source: ABdhPJxN1Spb10RxJRxY4y67Y7+C7S5d68x0Ru3WpjlUuQNHdi07Ix7g79gisaT5NE8Ke2Dq5/yb2Q== X-Received: by 2002:adf:f78f:: with SMTP id q15mr43195277wrp.206.1600683635053; Mon, 21 Sep 2020 03:20:35 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:34 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 03/49] staging: media: zoran: datasheet is no longer available from zoran.com Date: Mon, 21 Sep 2020 10:19:38 +0000 Message-Id: <1600683624-5863-4-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Simply remove this broken reference Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_device.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 04162be80420..79da964c678b 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -265,9 +265,6 @@ jpeg_codec_reset (struct zoran *zr) * Set the registers for the size we have specified. Don't bother * trying to understand this without the ZR36057 manual in front of * you [AC]. - * - * PS: The manual is free for download in .pdf format from - * www.zoran.com - nicely done those folks. */ static void From patchwork Mon Sep 21 10:19:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE83C43465 for ; Mon, 21 Sep 2020 10:24:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC7AF20EDD for ; Mon, 21 Sep 2020 10:24:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="RzKgSVZT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726543AbgIUKY1 (ORCPT ); Mon, 21 Sep 2020 06:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726550AbgIUKUm (ORCPT ); Mon, 21 Sep 2020 06:20:42 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF95AC0613D2 for ; Mon, 21 Sep 2020 03:20:41 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id q9so11566147wmj.2 for ; Mon, 21 Sep 2020 03:20:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WRTqzJJg+xeFyFfTXb9h4oMkZlErrKKNyHHvPxytCac=; b=RzKgSVZTveGcrrBbh8a6VsUhN0pP15oopH+ApSNB4qnhDAHzNnhZKNFvaMQntZGQoS o1c3O0Rr8gtG/Vh3IXzjwF/LnR6UyHUdPFRTrdDH4X7cyIFAu4ACBaUaiU6NJg7UC4w4 Ofc5dMYaIwXsk9HkT0K7fCGn3I/RGbH46THQ1IG1VhxDnaDLY4HBqqV12mh/+03+kVLY /XiV4ZL8Iq9GR7Xe3iuiLmZekW9Fqcw0tZuVV5gWhRC0RyIX+9zBVV/VZh4X/RJzzMf4 V26VOvHITXLuQ3dOjC1ziJjeHGnPfAZLjnLLW0wrlIY/Btp8GIhMGB9eYwqR8jOPq8BE kD1A== 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:in-reply-to :references; bh=WRTqzJJg+xeFyFfTXb9h4oMkZlErrKKNyHHvPxytCac=; b=WDcQMn/LOKMtYejjV2PdJf+SSkV7kqwQ+ri1nvY+QnUOETwJzx7KCYS/Mwxnn5Kz2n /nv/8ymbFeQNbB8TVbmB/s9d0Zydcf/g6TR/EjJzxorXkZ8wksen4Q54N4WSxphhkteb UTErmcOfqDNk2dLGtBCuy1Sv50yzVi1twG3c8XpTUQ57EntLVpuUX9rE/KtGC7jltKWq y9s8klSkDzhb0MJox6gWDMy3mZ1n5u7rNVhQQjWX1u7qdRAa6ilElzFB8ocHrg1wIIxZ TT3jQZ3KoJ9qWAF3tCz/PJ/+wwmpJw8MfkPs9kf0Oc6Rk0I3bRF1lKwvA5qYcuW9k+co OCEg== X-Gm-Message-State: AOAM531FqbtccKRYw4LP8Gyc0P89Apd4oKs0FR26+9bw4QFlhXz09eJC xHO/WtyfQHdWHdgPODCkMQ+/yA== X-Google-Smtp-Source: ABdhPJwCJZI3UAhS+JWbjghgWyntvCGr+4ArmwyqnRNGZMHH7YOzuyNrfFOi0+FOJEceyEH/QNID/w== X-Received: by 2002:a7b:ca4a:: with SMTP id m10mr23069041wml.11.1600683640193; Mon, 21 Sep 2020 03:20:40 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:39 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 08/49] staging: media: zoran: convert all error dprintk to pci_err/pr_err Date: Mon, 21 Sep 2020 10:19:43 +0000 Message-Id: <1600683624-5863-9-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch converts all errors dprintk to pci_err/pr_err. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/videocodec.c | 39 +-- drivers/staging/media/zoran/zoran_card.c | 96 ++---- drivers/staging/media/zoran/zoran_device.c | 28 +- drivers/staging/media/zoran/zoran_driver.c | 334 +++++---------------- drivers/staging/media/zoran/zoran_procfs.c | 4 +- drivers/staging/media/zoran/zr36016.c | 39 +-- drivers/staging/media/zoran/zr36050.c | 10 +- drivers/staging/media/zoran/zr36060.c | 24 +- 8 files changed, 145 insertions(+), 429 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c index 3a2f0c450a44..28031d3fd757 100644 --- a/drivers/staging/media/zoran/videocodec.c +++ b/drivers/staging/media/zoran/videocodec.c @@ -62,7 +62,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) int res; if (!master) { - dprintk(1, KERN_ERR "videocodec_attach: no data\n"); + pr_err("%s: no data\n", __func__); return NULL; } @@ -70,9 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) master->name, master->flags, master->magic); if (!h) { - dprintk(1, - KERN_ERR - "videocodec_attach: no device available\n"); + pr_err("%s: no device available\n", __func__); return NULL; } @@ -120,7 +118,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) h = h->next; } - dprintk(1, KERN_ERR "videocodec_attach: no codec found!\n"); + pr_err("%s: no codec found!\n", __func__); return NULL; out_module_put: @@ -138,7 +136,7 @@ int videocodec_detach(struct videocodec *codec) int res; if (!codec) { - dprintk(1, KERN_ERR "videocodec_detach: no data\n"); + pr_err("%s: no data\n", __func__); return -EINVAL; } @@ -146,8 +144,7 @@ int videocodec_detach(struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic); if (!h) { - dprintk(1, - KERN_ERR "videocodec_detach: no device left...\n"); + pr_err("%s: no device left...\n", __func__); return -ENXIO; } @@ -161,10 +158,7 @@ int videocodec_detach(struct videocodec *codec) dprintk(3, "%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } else { - dprintk(1, - KERN_ERR - "videocodec_detach: '%s'\n", - a->codec->name); + pr_err("%s: '%s'\n", __func__, a->codec->name); a->codec->master_data = NULL; } if (!prev) { @@ -186,7 +180,7 @@ int videocodec_detach(struct videocodec *codec) h = h->next; } - dprintk(1, KERN_ERR "videocodec_detach: given codec not found!\n"); + pr_err("%s: given codec not found!\n", __func__); return -EINVAL; } EXPORT_SYMBOL(videocodec_detach); @@ -196,7 +190,7 @@ int videocodec_register(const struct videocodec *codec) struct codec_list *ptr, *h = codeclist_top; if (!codec) { - dprintk(1, KERN_ERR "videocodec_register: no data!\n"); + pr_err("%s: no data!\n", __func__); return -EINVAL; } @@ -229,7 +223,7 @@ int videocodec_unregister(const struct videocodec *codec) struct codec_list *prev = NULL, *h = codeclist_top; if (!codec) { - dprintk(1, KERN_ERR "videocodec_unregister: no data!\n"); + pr_err("%s: no data!\n", __func__); return -EINVAL; } @@ -238,19 +232,14 @@ int videocodec_unregister(const struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic); if (!h) { - dprintk(1, - KERN_ERR - "videocodec_unregister: no device left...\n"); + pr_err("%s: no device left...\n", __func__); return -ENXIO; } while (h) { if (codec == h->codec) { if (h->attached) { - dprintk(1, - KERN_ERR - "videocodec: '%s' is used\n", - h->codec->name); + pr_err("videocodec: '%s' is used\n", h->codec->name); return -EBUSY; } dprintk(3, "videocodec: unregister '%s' is ok.\n", @@ -271,9 +260,7 @@ int videocodec_unregister(const struct videocodec *codec) h = h->next; } - dprintk(1, - KERN_ERR - "videocodec_unregister: given codec not found!\n"); + pr_err("%s: given codec not found!\n", __func__); return -EINVAL; } EXPORT_SYMBOL(videocodec_unregister); @@ -322,7 +309,7 @@ static int __init videocodec_init(void) #ifdef CONFIG_PROC_FS videocodec_proc_entry = proc_create_single("videocodecs", 0, NULL, proc_videocodecs_show); if (!videocodec_proc_entry) - dprintk(1, KERN_ERR "videocodec: can't init procfs.\n"); + pr_err("videocodec: can't init procfs.\n"); #endif return 0; } diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index fcf58d69de31..006f209c40ea 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -785,18 +785,13 @@ int zoran_check_jpg_settings(struct zoran *zr, struct zoran_jpg_settings *settin } if (!try && err0) { - dprintk(1, - KERN_ERR - "%s: %s - error in params for decimation = 0\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - error in params for decimation = 0\n", __func__); err++; } break; default: - dprintk(1, - KERN_ERR - "%s: %s - decimation = %d, must be 0, 1, 2 or 4\n", - ZR_DEVNAME(zr), __func__, settings->decimation); + pci_err(zr->pci_dev, "%s - decimation = %d, must be 0, 1, 2 or 4\n", + __func__, settings->decimation); err++; break; } @@ -870,8 +865,7 @@ void zoran_open_init_params(struct zoran *zr) zr->jpg_settings.jpg_comp.jpeg_markers = V4L2_JPEG_MARKER_DHT | V4L2_JPEG_MARKER_DQT; i = zoran_check_jpg_settings(zr, &zr->jpg_settings, 0); if (i) - dprintk(1, KERN_ERR "%s: %s internal error\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s internal error\n", __func__); clear_interrupt_counters(zr); zr->testing = 0; @@ -963,10 +957,6 @@ static int zr36057_init(struct zoran *zr) zr->stat_com = kzalloc(BUZ_NUM_STAT_COM * 4, GFP_KERNEL); zr->video_dev = video_device_alloc(); if (!zr->stat_com || !zr->video_dev) { - dprintk(1, - KERN_ERR - "%s: %s - kmalloc (STAT_COM) failed\n", - ZR_DEVNAME(zr), __func__); err = -ENOMEM; goto exit_free; } @@ -1126,8 +1116,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) nr = zoran_num++; if (nr >= BUZ_MAX) { - dprintk(1, KERN_ERR "%s: driver limited to %d card(s) maximum\n", - ZORAN_NAME, BUZ_MAX); + pci_err(pdev, "driver limited to %d card(s) maximum\n", BUZ_MAX); return -ENOENT; } @@ -1166,23 +1155,14 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* Use auto-detected card type? */ if (card[nr] == -1) { if (zr->revision < 2) { - dprintk(1, - KERN_ERR - "%s: No card type specified, please use the card=X module parameter\n", - ZR_DEVNAME(zr)); - dprintk(1, - KERN_ERR - "%s: It is not possible to auto-detect ZR36057 based cards\n", - ZR_DEVNAME(zr)); + pci_err(pdev, "No card type specified, please use the card=X module parameter\n"); + pci_err(pdev, "It is not possible to auto-detect ZR36057 based cards\n"); goto zr_unreg; } card_num = ent->driver_data; if (card_num >= NUM_CARDS) { - dprintk(1, - KERN_ERR - "%s: Unknown card, try specifying card=X module parameter\n", - ZR_DEVNAME(zr)); + pci_err(pdev, "Unknown card, try specifying card=X module parameter\n"); goto zr_unreg; } dprintk(3, @@ -1192,10 +1172,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } else { card_num = card[nr]; if (card_num >= NUM_CARDS || card_num < 0) { - dprintk(1, - KERN_ERR - "%s: User specified card type %d out of range (0 .. %d)\n", - ZR_DEVNAME(zr), card_num, NUM_CARDS - 1); + pci_err(pdev, "User specified card type %d out of range (0 .. %d)\n", + card_num, NUM_CARDS - 1); goto zr_unreg; } } @@ -1212,8 +1190,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->zr36057_mem = pci_ioremap_bar(zr->pci_dev, 0); if (!zr->zr36057_mem) { - dprintk(1, KERN_ERR "%s: %s() - ioremap failed\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s() - ioremap failed\n", __func__); goto zr_unreg; } @@ -1221,20 +1198,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) IRQF_SHARED, ZR_DEVNAME(zr), zr); if (result < 0) { if (result == -EINVAL) { - dprintk(1, - KERN_ERR - "%s: %s - bad irq number or handler\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s - bad IRQ number or handler\n", __func__); } else if (result == -EBUSY) { - dprintk(1, - KERN_ERR - "%s: %s - IRQ %d busy, change your PnP config in BIOS\n", - ZR_DEVNAME(zr), __func__, zr->pci_dev->irq); + pci_err(pdev, "%s - IRQ %d busy, change your PnP config in BIOS\n", + __func__, zr->pci_dev->irq); } else { - dprintk(1, - KERN_ERR - "%s: %s - can't assign irq, error code %d\n", - ZR_DEVNAME(zr), __func__, result); + pci_err(pdev, "%s - cannot assign IRQ, error code %d\n", __func__, result); } goto zr_unmap; } @@ -1254,8 +1223,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dprintk(2, KERN_INFO "%s: Initializing i2c bus...\n", ZR_DEVNAME(zr)); if (zoran_register_i2c(zr) < 0) { - dprintk(1, KERN_ERR "%s: %s - can't initialize i2c bus\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s - can't initialize i2c bus\n", __func__); goto zr_free_irq; } @@ -1272,24 +1240,16 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) codec_name = codecid_to_modulename(zr->card.video_codec); if (codec_name) { result = request_module(codec_name); - if (result) { - dprintk(1, - KERN_ERR - "%s: failed to load modules %s: %d\n", - ZR_DEVNAME(zr), codec_name, result); - } + if (result) + pci_err(pdev, "failed to load modules %s: %d\n", codec_name, result); } } if (zr->card.video_vfe) { vfe_name = codecid_to_modulename(zr->card.video_vfe); if (vfe_name) { result = request_module(vfe_name); - if (result < 0) { - dprintk(1, - KERN_ERR - "%s: failed to load modules %s: %d\n", - ZR_DEVNAME(zr), vfe_name, result); - } + if (result < 0) + pci_err(pdev, "failed to load modules %s: %d\n", vfe_name, result); } } @@ -1304,13 +1264,11 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_unreg_i2c; zr->codec = videocodec_attach(master_codec); if (!zr->codec) { - dprintk(1, KERN_ERR "%s: %s - no codec found\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s - no codec found\n", __func__); goto zr_free_codec; } if (zr->codec->type != zr->card.video_codec) { - dprintk(1, KERN_ERR "%s: %s - wrong codec\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s - wrong codec\n", __func__); goto zr_detach_codec; } } @@ -1320,13 +1278,11 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_detach_codec; zr->vfe = videocodec_attach(master_vfe); if (!zr->vfe) { - dprintk(1, KERN_ERR "%s: %s - no VFE found\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s - no VFE found\n", __func__); goto zr_free_vfe; } if (zr->vfe->type != zr->card.video_vfe) { - dprintk(1, KERN_ERR "%s: %s = wrong VFE\n", - ZR_DEVNAME(zr), __func__); + pci_err(pdev, "%s = wrong VFE\n", __func__); goto zr_detach_vfe; } } @@ -1421,9 +1377,7 @@ static int __init zoran_init(void) res = pci_register_driver(&zoran_driver); if (res) { - dprintk(1, - KERN_ERR - "%s: Unable to register ZR36057 driver\n", ZORAN_NAME); + pr_err("Unable to register ZR36057 driver\n"); return res; } diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 0985b16d5a55..d7c85787e9c0 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -315,8 +315,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height, if (video_width < BUZ_MIN_WIDTH || video_height < BUZ_MIN_HEIGHT || video_width > Wa || video_height > Ha) { - dprintk(1, KERN_ERR "%s: set_vfe: w=%d h=%d not valid\n", - ZR_DEVNAME(zr), video_width, video_height); + pci_err(zr->pci_dev, "set_vfe: w=%d h=%d not valid\n", video_width, video_height); return; } @@ -451,10 +450,7 @@ void zr36057_overlay(struct zoran *zr, int on) zr->vbuf_bytesperline; btwrite(reg, ZR36057_VDTR); if (reg & 3) - dprintk(1, - KERN_ERR - "%s: zr36057_overlay() - video_address not aligned\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "zr36057_overlay() - video_address not aligned\n"); if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2) reg += zr->vbuf_bytesperline; btwrite(reg, ZR36057_VDBR); @@ -466,10 +462,7 @@ void zr36057_overlay(struct zoran *zr, int on) if (zr->overlay_settings.height > BUZ_MAX_HEIGHT / 2) reg += zr->vbuf_bytesperline; if (reg & 3) - dprintk(1, - KERN_ERR - "%s: zr36057_overlay() - video_stride not aligned\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "zr36057_overlay() - video_stride not aligned\n"); reg = (reg << ZR36057_VSSFGR_DispStride); reg |= ZR36057_VSSFGR_VidOvf; /* clear overflow status */ btwrite(reg, ZR36057_VSSFGR); @@ -1187,8 +1180,8 @@ static void error_handler(struct zoran *zr, u32 astat, u32 stat) int j; frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; - pr_err("%s: JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ", - ZR_DEVNAME(zr), stat, zr->last_isr, + pci_err(zr->pci_dev, "JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ", + stat, zr->last_isr, zr->jpg_que_tail, zr->jpg_dma_tail, zr->jpg_dma_head, zr->jpg_que_head, zr->jpg_seq_num, frame); @@ -1256,10 +1249,8 @@ irqreturn_t zoran_irq(int irq, void *dev_id) while ((stat = count_reset_interrupt(zr))) { if (count++ > 100) { btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); - dprintk(1, - KERN_ERR - "%s: IRQ lockup while testing, isr=0x%08x, cleared int mask\n", - ZR_DEVNAME(zr), stat); + pci_err(zr->pci_dev, "IRQ lockup while testing, isr=0x%08x, cleared int mask\n", + stat); wake_up_interruptible(&zr->test_q); } } @@ -1419,10 +1410,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id) ZR_DEVNAME(zr), count); if (count > 20) { btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); - dprintk(2, - KERN_ERR - "%s: IRQ lockup, cleared int mask\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "IRQ lockup, cleared int mask\n"); break; } } diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index cd8198183e6a..4082d5e53a24 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -218,10 +218,7 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh) //udelay(20); mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL | __GFP_NOWARN); if (!mem) { - dprintk(1, - KERN_ERR - "%s: %s - kmalloc for V4L buf %d failed\n", - ZR_DEVNAME(zr), __func__, i); + pci_err(zr->pci_dev, "%s - kmalloc for V4L buf %d failed\n", __func__, i); v4l_fbuffer_free(fh); return -ENOBUFS; } @@ -312,10 +309,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) mem = (void *)get_zeroed_page(GFP_KERNEL); if (!mem) { - dprintk(1, - KERN_ERR - "%s: %s - get_zeroed_page (frag_tab) failed for buffer %d\n", - ZR_DEVNAME(zr), __func__, i); + pci_err(zr->pci_dev, "%s - get_zeroed_page (frag_tab) failed for buffer %d\n", __func__, i); jpg_fbuffer_free(fh); return -ENOBUFS; } @@ -325,10 +319,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) if (fh->buffers.need_contiguous) { mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL); if (!mem) { - dprintk(1, - KERN_ERR - "%s: %s - kmalloc failed for buffer %d\n", - ZR_DEVNAME(zr), __func__, i); + pci_err(zr->pci_dev, "%s - kmalloc failed for buffer %d\n", __func__, i); jpg_fbuffer_free(fh); return -ENOBUFS; } @@ -343,10 +334,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) for (j = 0; j < fh->buffers.buffer_size / PAGE_SIZE; j++) { mem = (void *)get_zeroed_page(GFP_KERNEL); if (!mem) { - dprintk(1, - KERN_ERR - "%s: %s - get_zeroed_page failed for buffer %d\n", - ZR_DEVNAME(zr), __func__, i); + pci_err(zr->pci_dev, "%s - get_zeroed_page failed for buffer %d\n", __func__, i); jpg_fbuffer_free(fh); return -ENOBUFS; } @@ -433,10 +421,7 @@ static int zoran_v4l_set_format(struct zoran_fh *fh, int width, int height, if (height < BUZ_MIN_HEIGHT || width < BUZ_MIN_WIDTH || height > BUZ_MAX_HEIGHT || width > BUZ_MAX_WIDTH) { - dprintk(1, - KERN_ERR - "%s: %s - wrong frame size (%dx%d)\n", - ZR_DEVNAME(zr), __func__, width, height); + pci_err(zr->pci_dev, "%s - wrong frame size (%dx%d)\n", __func__, width, height); return -EINVAL; } @@ -444,20 +429,15 @@ static int zoran_v4l_set_format(struct zoran_fh *fh, int width, int height, /* Check against available buffer size */ if (height * width * bpp > fh->buffers.buffer_size) { - dprintk(1, - KERN_ERR - "%s: %s - video buffer size (%d kB) is too small\n", - ZR_DEVNAME(zr), __func__, fh->buffers.buffer_size >> 10); + pci_err(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n", + __func__, fh->buffers.buffer_size >> 10); return -EINVAL; } /* The video front end needs 4-byte alinged line sizes */ if ((bpp == 2 && (width & 1)) || (bpp == 3 && (width & 3))) { - dprintk(1, - KERN_ERR - "%s: %s - wrong frame alignment\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - wrong frame alignment\n", __func__); return -EINVAL; } @@ -476,19 +456,13 @@ static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) int res = 0; if (!fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: %s - buffers not yet allocated\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - buffers not yet allocated\n", __func__); res = -ENOMEM; } /* No grabbing outside the buffer range! */ if (num >= fh->buffers.num_buffers || num < 0) { - dprintk(1, - KERN_ERR - "%s: %s - buffer %d is out of range\n", - ZR_DEVNAME(zr), __func__, num); + pci_err(zr->pci_dev, "%s - buffer %d is out of range\n", __func__, num); res = -EINVAL; } @@ -499,10 +473,7 @@ static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) zr->v4l_buffers = fh->buffers; fh->buffers.active = ZORAN_ACTIVE; } else { - dprintk(1, - KERN_ERR - "%s: %s - another session is already capturing\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - another session is already capturing\n", __func__); res = -EBUSY; } } @@ -555,27 +526,19 @@ static int v4l_sync(struct zoran_fh *fh, int frame) unsigned long flags; if (fh->buffers.active == ZORAN_FREE) { - dprintk(1, - KERN_ERR - "%s: %s - no grab active for this session\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - no grab active for this session\n", __func__); return -EINVAL; } /* check passed-in frame number */ if (frame >= fh->buffers.num_buffers || frame < 0) { - dprintk(1, - KERN_ERR "%s: %s - frame %d is invalid\n", - ZR_DEVNAME(zr), __func__, frame); + pci_err(zr->pci_dev, "%s - frame %d is invalid\n", __func__, frame); return -EINVAL; } /* Check if is buffer was queued at all */ if (zr->v4l_buffers.buffer[frame].state == BUZ_STATE_USER) { - dprintk(1, - KERN_ERR - "%s: %s - attempt to sync on a buffer which was not queued?\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - attempt to sync on a buffer which was not queued?\n", __func__); return -EPROTO; } @@ -592,9 +555,7 @@ static int v4l_sync(struct zoran_fh *fh, int frame) /* buffer should now be in BUZ_STATE_DONE */ if (zr->v4l_buffers.buffer[frame].state != BUZ_STATE_DONE) - dprintk(2, - KERN_ERR "%s: %s - internal state error\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - internal state error\n", __func__); zr->v4l_buffers.buffer[frame].state = BUZ_STATE_USER; fh->buffers.buffer[frame] = zr->v4l_buffers.buffer[frame]; @@ -627,19 +588,13 @@ static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num, /* Check if buffers are allocated */ if (!fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: %s - buffers not yet allocated\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - buffers not yet allocated\n", __func__); return -ENOMEM; } /* No grabbing outside the buffer range! */ if (num >= fh->buffers.num_buffers || num < 0) { - dprintk(1, - KERN_ERR - "%s: %s - buffer %d out of range\n", - ZR_DEVNAME(zr), __func__, num); + pci_err(zr->pci_dev, "%s - buffer %d out of range\n", __func__, num); return -EINVAL; } @@ -648,10 +603,7 @@ static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num, zr->jpg_settings = fh->jpg_settings; } else if (zr->codec_mode != mode) { /* wrong codec mode active - invalid */ - dprintk(1, - KERN_ERR - "%s: %s - codec in wrong mode\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - codec in wrong mode\n", __func__); return -EINVAL; } @@ -660,10 +612,7 @@ static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num, zr->jpg_buffers = fh->buffers; fh->buffers.active = ZORAN_ACTIVE; } else { - dprintk(1, - KERN_ERR - "%s: %s - another session is already capturing\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - another session is already capturing\n", __func__); res = -EBUSY; } } @@ -720,10 +669,7 @@ static int jpg_qbuf(struct zoran_fh *fh, int frame, enum zoran_codec_mode mode) if (frame < 0) { if (zr->codec_mode == mode) { if (fh->buffers.active == ZORAN_FREE) { - dprintk(1, - KERN_ERR - "%s: %s(-1) - session not active\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s(-1) - session not active\n", __func__); return -EINVAL; } fh->buffers.active = zr->jpg_buffers.active = ZORAN_FREE; @@ -731,10 +677,7 @@ static int jpg_qbuf(struct zoran_fh *fh, int frame, enum zoran_codec_mode mode) zr36057_enable_jpg(zr, BUZ_MODE_IDLE); return 0; } else { - dprintk(1, - KERN_ERR - "%s: %s - stop streaming but not in streaming mode\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - stop streaming but not in streaming mode\n", __func__); return -EINVAL; } } @@ -761,18 +704,12 @@ static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs) int frame; if (fh->buffers.active == ZORAN_FREE) { - dprintk(1, - KERN_ERR - "%s: %s - capture is not currently active\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - capture is not currently active\n", __func__); return -EINVAL; } if (zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS && zr->codec_mode != BUZ_MODE_MOTION_COMPRESS) { - dprintk(1, - KERN_ERR - "%s: %s - codec not in streaming mode\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - codec not in streaming mode\n", __func__); return -EINVAL; } mutex_unlock(&zr->lock); @@ -786,10 +723,7 @@ static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs) udelay(1); zr->codec->control(zr->codec, CODEC_G_STATUS, sizeof(isr), &isr); mutex_lock(&zr->lock); - dprintk(1, - KERN_ERR - "%s: %s - timeout: codec isr=0x%02x\n", - ZR_DEVNAME(zr), __func__, isr); + pci_err(zr->pci_dev, "%s - timeout: codec isr=0x%02x\n", __func__, isr); return -ETIME; } @@ -806,9 +740,7 @@ static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs) /* buffer should now be in BUZ_STATE_DONE */ if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE) - dprintk(2, - KERN_ERR "%s: %s - internal state error\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - internal state error\n", __func__); *bs = zr->jpg_buffers.buffer[frame].bs; bs->frame = frame; @@ -906,8 +838,7 @@ static int zoran_open(struct file *file) mutex_lock(&zr->lock); if (zr->user >= 2048) { - dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", - ZR_DEVNAME(zr), zr->user); + pci_err(zr->pci_dev, "too many users (%d) on device\n", zr->user); res = -EBUSY; goto fail_unlock; } @@ -915,10 +846,6 @@ static int zoran_open(struct file *file) /* now, create the open()-specific file_ops struct */ fh = kzalloc(sizeof(*fh), GFP_KERNEL); if (!fh) { - dprintk(1, - KERN_ERR - "%s: %s - allocation of zoran_fh failed\n", - ZR_DEVNAME(zr), __func__); res = -ENOMEM; goto fail_unlock; } @@ -930,10 +857,6 @@ static int zoran_open(struct file *file) */ fh->overlay_mask = kmalloc(array3_size((768 + 31) / 32, 576, 4), GFP_KERNEL); if (!fh->overlay_mask) { - dprintk(1, - KERN_ERR - "%s: %s - allocation of overlay_mask failed\n", - ZR_DEVNAME(zr), __func__); res = -ENOMEM; goto fail_fh; } @@ -1066,24 +989,17 @@ static int setup_fbuffer(struct zoran_fh *fh, void *base, const struct zoran_for #endif if (!(fmt->flags & ZORAN_FORMAT_OVERLAY)) { - dprintk(1, - KERN_ERR - "%s: %s - no valid overlay format given\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - no valid overlay format given\n", __func__); return -EINVAL; } if (height <= 0 || width <= 0 || bytesperline <= 0) { - dprintk(1, - KERN_ERR - "%s: %s - invalid height/width/bpl value (%d|%d|%d)\n", - ZR_DEVNAME(zr), __func__, width, height, bytesperline); + pci_err(zr->pci_dev, "%s - invalid height/width/bpl value (%d|%d|%d)\n", + __func__, width, height, bytesperline); return -EINVAL; } if (bytesperline & 3) { - dprintk(1, - KERN_ERR - "%s: %s - bytesperline (%d) must be 4-byte aligned\n", - ZR_DEVNAME(zr), __func__, bytesperline); + pci_err(zr->pci_dev, "%s - bytesperline (%d) must be 4-byte aligned\n", + __func__, bytesperline); return -EINVAL; } @@ -1108,26 +1024,17 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height int on, end; if (!zr->vbuf_base) { - dprintk(1, - KERN_ERR - "%s: %s - frame buffer has to be set first\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - frame buffer has to be set first\n", __func__); return -EINVAL; } if (!fh->overlay_settings.format) { - dprintk(1, - KERN_ERR - "%s: %s - no overlay format set\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__); return -EINVAL; } if (clipcount > 2048) { - dprintk(1, - KERN_ERR - "%s: %s - invalid clipcount\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - invalid clipcount\n", __func__); return -EINVAL; } @@ -1155,10 +1062,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height /* Check for invalid parameters */ if (width < BUZ_MIN_WIDTH || height < BUZ_MIN_HEIGHT || width > BUZ_MAX_WIDTH || height > BUZ_MAX_HEIGHT) { - dprintk(1, - KERN_ERR - "%s: %s - width = %d or height = %d invalid\n", - ZR_DEVNAME(zr), __func__, width, height); + pci_err(zr->pci_dev, "%s - width = %d or height = %d invalid\n", __func__, width, height); return -EINVAL; } @@ -1199,10 +1103,6 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height vcp = vmalloc(array_size(sizeof(struct v4l2_clip), clipcount + 4)); if (!vcp) { - dprintk(1, - KERN_ERR - "%s: %s - Alloc of clip mask failed\n", - ZR_DEVNAME(zr), __func__); return -ENOMEM; } if (copy_from_user @@ -1238,18 +1138,12 @@ static int setup_overlay(struct zoran_fh *fh, int on) /* check whether we're touching someone else's overlay */ if (on && zr->overlay_active != ZORAN_FREE && fh->overlay_active == ZORAN_FREE) { - dprintk(1, - KERN_ERR - "%s: %s - overlay is already active for another session\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - overlay is already active for another session\n", __func__); return -EBUSY; } if (!on && zr->overlay_active != ZORAN_FREE && fh->overlay_active == ZORAN_FREE) { - dprintk(1, - KERN_ERR - "%s: %s - you cannot cancel someone else's session\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - you cannot cancel someone else's session\n", __func__); return -EPERM; } @@ -1265,17 +1159,11 @@ static int setup_overlay(struct zoran_fh *fh, int on) zr->overlay_mask = NULL; } else { if (!zr->vbuf_base || !fh->overlay_settings.is_set) { - dprintk(1, - KERN_ERR - "%s: %s - buffer or window not set\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - buffer or window not set\n", __func__); return -EINVAL; } if (!fh->overlay_settings.format) { - dprintk(1, - KERN_ERR - "%s: %s - no overlay format set\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__); return -EINVAL; } zr->overlay_active = fh->overlay_active = ZORAN_LOCKED; @@ -1308,10 +1196,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, /* check range */ if (num < 0 || num >= fh->buffers.num_buffers || !fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: %s - wrong number or buffers not allocated\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - wrong number or buffers not allocated\n", __func__); return -EINVAL; } @@ -1352,10 +1237,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, /* check range */ if (num < 0 || num >= fh->buffers.num_buffers || !fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: %s - wrong number or buffers not allocated\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - wrong number or buffers not allocated\n", __func__); return -EINVAL; } @@ -1387,10 +1269,8 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, default: - dprintk(5, - KERN_ERR - "%s: %s - invalid buffer type|map_mode (%d|%d)\n", - ZR_DEVNAME(zr), __func__, buf->type, fh->map_mode); + pci_err(zr->pci_dev, "%s - invalid buffer type|map_mode (%d|%d)\n", + __func__, buf->type, fh->map_mode); return -EINVAL; } @@ -1407,17 +1287,12 @@ static int zoran_set_norm(struct zoran *zr, v4l2_std_id norm) if (zr->v4l_buffers.active != ZORAN_FREE || zr->jpg_buffers.active != ZORAN_FREE) { - dprintk(1, - KERN_WARNING - "%s: %s called while in playback/capture mode\n", - ZR_DEVNAME(zr), __func__); + pr_warn("%s: %s called while in playback/capture mode\n", ZR_DEVNAME(zr), __func__); return -EBUSY; } if (!(norm & zr->card.norms)) { - dprintk(1, - KERN_ERR "%s: %s - unsupported norm %llx\n", - ZR_DEVNAME(zr), __func__, norm); + pci_err(zr->pci_dev, "%s - unsupported norm %llx\n", __func__, norm); return -EINVAL; } @@ -1463,10 +1338,7 @@ static int zoran_set_input(struct zoran *zr, int input) } if (input < 0 || input >= zr->card.inputs) { - dprintk(1, - KERN_ERR - "%s: %s - unsupported input %d\n", - ZR_DEVNAME(zr), __func__, input); + pci_err(zr->pci_dev, "%s - unsupported input %d\n", __func__, input); return -EINVAL; } @@ -1741,8 +1613,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format return -EINVAL; if (fh->buffers.allocated) { - dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "VIDIOC_S_FMT - cannot change capture mode\n"); res = -EBUSY; return res; } @@ -1818,15 +1689,14 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc) break; if (i == NUM_FORMATS) { - dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", - ZR_DEVNAME(zr), fmt->fmt.pix.pixelformat); + pci_err(zr->pci_dev, "VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", + fmt->fmt.pix.pixelformat); return -EINVAL; } if ((fh->map_mode != ZORAN_MAP_MODE_RAW && fh->buffers.allocated) || fh->buffers.active != ZORAN_FREE) { - dprintk(1, KERN_ERR "%s: VIDIOC_S_FMT - cannot change capture mode\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "VIDIOC_S_FMT - cannot change capture mode\n"); res = -EBUSY; return res; } @@ -1884,8 +1754,8 @@ static int zoran_s_fbuf(struct file *file, void *__fh, if (zoran_formats[i].fourcc == fb->fmt.pixelformat) break; if (i == NUM_FORMATS) { - dprintk(1, KERN_ERR "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", - ZR_DEVNAME(zr), fb->fmt.pixelformat, + pci_err(zr->pci_dev, "VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", + fb->fmt.pixelformat, (char *)&printformat); return -EINVAL; } @@ -1912,10 +1782,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe int res = 0; if (req->memory != V4L2_MEMORY_MMAP) { - dprintk(2, - KERN_ERR - "%s: only MEMORY_MMAP capture is supported, not %d\n", - ZR_DEVNAME(zr), req->memory); + pci_err(zr->pci_dev, "only MEMORY_MMAP capture is supported, not %d\n", req->memory); return -EINVAL; } @@ -1923,10 +1790,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe return zoran_streamoff(file, fh, req->type); if (fh->buffers.allocated) { - dprintk(2, - KERN_ERR - "%s: VIDIOC_REQBUFS - buffers already allocated\n", - ZR_DEVNAME(zr)); + pr_warn("%s: VIDIOC_REQBUFS - buffers already allocated\n", ZR_DEVNAME(zr)); res = -EBUSY; return res; } @@ -1965,10 +1829,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe return res; } } else { - dprintk(1, - KERN_ERR - "%s: VIDIOC_REQBUFS - unknown type %d\n", - ZR_DEVNAME(zr), req->type); + pci_err(zr->pci_dev, "VIDIOC_REQBUFS - unknown type %d\n", req->type); res = -EINVAL; return res; } @@ -1991,9 +1852,8 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) switch (fh->map_mode) { case ZORAN_MAP_MODE_RAW: if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dprintk(1, KERN_ERR - "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - ZR_DEVNAME(zr), buf->type, fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", + buf->type, fh->map_mode); res = -EINVAL; return res; } @@ -2016,9 +1876,8 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) } if (buf->type != buf_type) { - dprintk(1, KERN_ERR - "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - ZR_DEVNAME(zr), buf->type, fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", + buf->type, fh->map_mode); res = -EINVAL; return res; } @@ -2033,9 +1892,7 @@ static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) break; default: - dprintk(1, KERN_ERR - "%s: VIDIOC_QBUF - unsupported type %d\n", - ZR_DEVNAME(zr), buf->type); + pci_err(zr->pci_dev, "VIDIOC_QBUF - unsupported type %d\n", buf->type); res = -EINVAL; break; } @@ -2051,9 +1908,8 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) switch (fh->map_mode) { case ZORAN_MAP_MODE_RAW: if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - dprintk(1, KERN_ERR - "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - ZR_DEVNAME(zr), buf->type, fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", + buf->type, fh->map_mode); res = -EINVAL; return res; } @@ -2082,9 +1938,8 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (buf->type != buf_type) { - dprintk(1, KERN_ERR - "%s: VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - ZR_DEVNAME(zr), buf->type, fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", + buf->type, fh->map_mode); res = -EINVAL; return res; } @@ -2105,9 +1960,7 @@ static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) } default: - dprintk(1, KERN_ERR - "%s: VIDIOC_DQBUF - unsupported type %d\n", - ZR_DEVNAME(zr), buf->type); + pci_err(zr->pci_dev, "VIDIOC_DQBUF - unsupported type %d\n", buf->type); res = -EINVAL; break; } @@ -2156,10 +2009,7 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type break; default: - dprintk(1, - KERN_ERR - "%s: VIDIOC_STREAMON - invalid map mode %d\n", - ZR_DEVNAME(zr), fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_STREAMON - invalid map mode %d\n", fh->map_mode); res = -EINVAL; break; } @@ -2220,9 +2070,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ return res; break; default: - dprintk(1, KERN_ERR - "%s: VIDIOC_STREAMOFF - invalid map mode %d\n", - ZR_DEVNAME(zr), fh->map_mode); + pci_err(zr->pci_dev, "VIDIOC_STREAMOFF - invalid map mode %d\n", fh->map_mode); res = -EINVAL; break; } @@ -2333,9 +2181,7 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio return -EINVAL; if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - dprintk(1, KERN_ERR - "%s: VIDIOC_G_SELECTION - subcapture only supported for compressed capture\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "VIDIOC_G_SELECTION - subcapture only supported for compressed capture\n"); return -EINVAL; } @@ -2377,18 +2223,14 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio return -EINVAL; if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - dprintk(1, KERN_ERR - "%s: VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n"); return -EINVAL; } settings = fh->jpg_settings; if (fh->buffers.allocated) { - dprintk(1, KERN_ERR - "%s: VIDIOC_S_SELECTION - cannot change settings while active\n", - ZR_DEVNAME(zr)); + pci_err(zr->pci_dev, "VIDIOC_S_SELECTION - cannot change settings while active\n"); return -EBUSY; } @@ -2523,10 +2365,7 @@ static __poll_t zoran_poll(struct file *file, poll_table *wait) break; default: - dprintk(1, - KERN_ERR - "%s: %s - internal error, unknown map_mode=%d\n", - ZR_DEVNAME(zr), __func__, fh->map_mode); + pci_err(zr->pci_dev, "%s - internal error, unknown map_mode=%d\n", __func__, fh->map_mode); res |= EPOLLERR; } @@ -2622,18 +2461,12 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) if (!(vma->vm_flags & VM_SHARED) || !(vma->vm_flags & VM_READ) || !(vma->vm_flags & VM_WRITE)) { - dprintk(1, - KERN_ERR - "%s: %s - no MAP_SHARED/PROT_{READ,WRITE} given\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s - no MAP_SHARED/PROT_{READ,WRITE} given\n", __func__); return -EINVAL; } if (!fh->buffers.allocated) { - dprintk(1, - KERN_ERR - "%s: %s(%s) - buffers not yet allocated\n", - ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode)); + pci_err(zr->pci_dev, "%s(%s) - buffers not yet allocated\n", __func__, mode_name(fh->map_mode)); res = -ENOMEM; return res; } @@ -2644,10 +2477,8 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) size % fh->buffers.buffer_size != 0 || first < 0 || last < 0 || first >= fh->buffers.num_buffers || last >= fh->buffers.buffer_size) { - dprintk(1, - KERN_ERR - "%s: %s(%s) - offset=%lu or size=%lu invalid for bufsize=%d and numbufs=%d\n", - ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), offset, size, + pci_err(zr->pci_dev, "%s(%s) - offset=%lu or size=%lu invalid for bufsize=%d and numbufs=%d\n", + __func__, mode_name(fh->map_mode), offset, size, fh->buffers.buffer_size, fh->buffers.num_buffers); res = -EINVAL; @@ -2657,10 +2488,7 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) /* Check if any buffers are already mapped */ for (i = first; i <= last; i++) { if (fh->buffers.buffer[i].map) { - dprintk(1, - KERN_ERR - "%s: %s(%s) - buffer %d already mapped\n", - ZR_DEVNAME(zr), __func__, mode_name(fh->map_mode), i); + pci_err(zr->pci_dev, "%s(%s) - buffer %d already mapped\n", __func__, mode_name(fh->map_mode), i); res = -EBUSY; return res; } @@ -2687,10 +2515,7 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) page = fh->buffers.buffer[i].v4l.fbuffer_phys; if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, todo, PAGE_SHARED)) { - dprintk(1, - KERN_ERR - "%s: %s(V4L) - remap_pfn_range failed\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s(V4L) - remap_pfn_range failed\n", __func__); res = -EAGAIN; return res; } @@ -2719,10 +2544,7 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) >> PAGE_SHIFT; if (remap_pfn_range(vma, start, page, todo, PAGE_SHARED)) { - dprintk(1, - KERN_ERR - "%s: %s(V4L) - remap_pfn_range failed\n", - ZR_DEVNAME(zr), __func__); + pci_err(zr->pci_dev, "%s(V4L) - remap_pfn_range failed\n", __func__); res = -EAGAIN; return res; } diff --git a/drivers/staging/media/zoran/zoran_procfs.c b/drivers/staging/media/zoran/zoran_procfs.c index 13367e6f6620..98f9e0103d83 100644 --- a/drivers/staging/media/zoran/zoran_procfs.c +++ b/drivers/staging/media/zoran/zoran_procfs.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -192,8 +193,7 @@ int zoran_proc_init(struct zoran *zr) "%s: procfs entry /proc/%s allocated. data=%p\n", ZR_DEVNAME(zr), name, zr); } else { - dprintk(1, KERN_ERR "%s: Unable to initialise /proc/%s\n", - ZR_DEVNAME(zr), name); + pr_err("%s: Unable to initialise /proc/%s\n", ZR_DEVNAME(zr), name); return 1; } #endif diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index 3219b63d6f72..a8190005bc4d 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -48,9 +48,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg) if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF; else - dprintk(1, - KERN_ERR "%s: invalid I/O setup, nothing read!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value); @@ -65,10 +63,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value) if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing written!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); } /* indirect read and write functions */ @@ -83,10 +78,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR value = (ptr->codec->master_data->readreg(ptr->codec, ZR016_IDATA)) & 0xFF; // DATA } else { - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing read (i)!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing read (i)!\n", ptr->name); } dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value); @@ -103,10 +95,7 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) ptr->codec->master_data->writereg(ptr->codec, ZR016_IADDR, reg & 0x0F); // ADDR ptr->codec->master_data->writereg(ptr->codec, ZR016_IDATA, value & 0x0FF); // DATA } else { - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing written (i)!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing written (i)!\n", ptr->name); } } @@ -144,27 +133,19 @@ static int zr36016_basic_test(struct zr36016 *ptr) // it back in both cases zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to vfe processor!\n", - ptr->name); + pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } zr36016_writei(ptr, ZR016I_PAX_LO, 0x0d0); if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0d0) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to vfe processor!\n", - ptr->name); + pr_err("%s: attach failed, can't connect to vfe processor!\n", ptr->name); return -ENXIO; } // we allow version numbers from 0-3, should be enough, though zr36016_read_version(ptr); if (ptr->version & 0x0c) { - dprintk(1, - KERN_ERR - "%s: attach failed, suspicious version %d found...\n", - ptr->name, ptr->version); + pr_err("%s: attach failed, suspicious version %d found...\n", ptr->name, + ptr->version); return -ENXIO; } @@ -376,12 +357,12 @@ static int zr36016_setup(struct videocodec *codec) dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs); if (zr36016_codecs == MAX_CODECS) { - dprintk(1, KERN_ERR "zr36016: Can't attach more codecs!\n"); + pr_err("zr36016: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init codec->data = ptr = kzalloc(sizeof(struct zr36016), GFP_KERNEL); - if (!ptr) { + if (!ptr) return -ENOMEM; snprintf(ptr->name, sizeof(ptr->name), "zr36016[%d]", zr36016_codecs); diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index dc7928d88099..f551631c18cd 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -448,8 +448,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - dprintk(1, KERN_ERR "%s: init aborted!\n", - ptr->name); + pr_err("%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } @@ -518,8 +517,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1); if ((ptr->status1 & 0x4) == 0) { - dprintk(1, KERN_ERR "%s: init aborted!\n", - ptr->name); + pr_err("%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } @@ -757,10 +755,8 @@ static int zr36050_setup(struct videocodec *codec) } //mem structure init codec->data = ptr = kzalloc(sizeof(struct zr36050), GFP_KERNEL); - if (!ptr) { - dprintk(1, KERN_ERR "zr36050: Can't get enough memory!\n"); + if (!ptr) return -ENOMEM; - } snprintf(ptr->name, sizeof(ptr->name), "zr36050[%d]", zr36050_codecs); diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index c04054f1306b..0a0916f5f8cd 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -59,9 +59,7 @@ static u8 zr36060_read(struct zr36060 *ptr, u16 reg) if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xff; else - dprintk(1, - KERN_ERR "%s: invalid I/O setup, nothing read!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing read!\n", ptr->name); return value; } @@ -74,10 +72,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value) if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg(ptr->codec, reg, value); else - dprintk(1, - KERN_ERR - "%s: invalid I/O setup, nothing written!\n", - ptr->name); + pr_err("%s: invalid I/O setup, nothing written!\n", ptr->name); } /* ========================================================================= @@ -127,19 +122,13 @@ static int zr36060_basic_test(struct zr36060 *ptr) { if ((zr36060_read(ptr, ZR060_IDR_DEV) != 0x33) && (zr36060_read(ptr, ZR060_IDR_REV) != 0x01)) { - dprintk(1, - KERN_ERR - "%s: attach failed, can't connect to jpeg processor!\n", - ptr->name); + pr_err("%s: attach failed, can't connect to jpeg processor!\n", ptr->name); return -ENXIO; } zr36060_wait_end(ptr); if (ptr->status & ZR060_CFSR_Busy) { - dprintk(1, - KERN_ERR - "%s: attach failed, jpeg processor failed (end flag)!\n", - ptr->name); + pr_err("%s: attach failed, jpeg processor failed (end flag)!\n", ptr->name); return -EBUSY; } @@ -458,7 +447,7 @@ static void zr36060_init(struct zr36060 *ptr) dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status); if (ptr->status & ZR060_CFSR_Busy) { - dprintk(1, KERN_ERR "%s: init aborted!\n", ptr->name); + pr_err("%s: init aborted!\n", ptr->name); return; // something is wrong, its timed out!!!! } } @@ -797,8 +786,7 @@ static int zr36060_setup(struct videocodec *codec) dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs); if (zr36060_codecs == MAX_CODECS) { - dprintk(1, - KERN_ERR "zr36060: Can't attach more codecs!\n"); + pr_err("zr36060: Can't attach more codecs!\n"); return -ENOSPC; } //mem structure init From patchwork Mon Sep 21 10:19:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255714 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F013C43464 for ; Mon, 21 Sep 2020 10:23:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 21823205F4 for ; Mon, 21 Sep 2020 10:23:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="j1b3of5h" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbgIUKUt (ORCPT ); Mon, 21 Sep 2020 06:20:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbgIUKUs (ORCPT ); Mon, 21 Sep 2020 06:20:48 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 736D7C0613D5 for ; Mon, 21 Sep 2020 03:20:42 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id q9so11566177wmj.2 for ; Mon, 21 Sep 2020 03:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hrN3Tazs/CNvILE5Bj2raDzS8EMF0Eei2YZ/frmZsTs=; b=j1b3of5hWSLdhH7uMP0cnSDMUCCK9GHQoWeW933WF24UvLG10n9eZJyyCCiFjvy23L DzYGssX3rxCzRNxlfbtomUWVhwL+RAduaO7DUU8d6beNjROvb3NmwHPQGGhVJidWKXbL ws07Klo5s51H6WpjISDCqtyhyZQW/ndgKy41fTPqY9hf9CGGuXRx9eMn2VvvMmSEly2C SsJCwy6cFIByEOtcr1EwgTa3fU89ekIAWKHaOuLIoHhc1ECHBeGO4J2E8Lu9nqSLftDu slV24OpAv92KbjWTz3iR63DnaUDh3O7IaOG9vdXCZfNXNoneZWqAjBbWFfCAH1i638K2 7rgg== 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:in-reply-to :references; bh=hrN3Tazs/CNvILE5Bj2raDzS8EMF0Eei2YZ/frmZsTs=; b=q3E+716NNkGN/zzo2yUtkKp2BcofSwdXbhzVQOfW/VILb5aC8eknplCCTNhj3i95lC 3U4DCmhYKhsGeToqL6Osp0FP72hwvv9VBe6nA84BJZhVYfcgSSwnD1Bm7TjhHBx5K8dL sun81XJ7JcXTWTf1HHGXmPDArnsOh+eihEfwFRlr9H/VJCFyVEmhpOq1xUNaJvfbn8Wk CVHbAk4jmfRBQXBMFCNznzzw2IohMbzF9tHZsZNUJgEkWYfhdypM8T1X2alg2SlkaG+8 r3qm116y0S4tk8tRkyFW1buydi9sM6pZJSjXxEMQ4VlzFa0Y28kmu+30zjL0/mzQK0JP Y3MQ== X-Gm-Message-State: AOAM531ECDypb5uSAK4mObkxDPsCE62PQYTh4gS0hQbqe+DNaoZMZIj/ HrUTAk1Wrol4LvGdNAQL+HSckg== X-Google-Smtp-Source: ABdhPJwJvmN7W2B1ePJdoM966nluFYhO59lhl4DS5OGBPJwWsiseNY+NXKBLe6Knq9Y3M8Q4YoDP3g== X-Received: by 2002:a1c:bdc4:: with SMTP id n187mr29264694wmf.109.1600683641133; Mon, 21 Sep 2020 03:20:41 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:40 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 09/49] staging: media: zoran: convert dprintk warn Date: Mon, 21 Sep 2020 10:19:44 +0000 Message-Id: <1600683624-5863-10-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch convert dprintk(warn) to pci_warn. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 18 ++++---------- drivers/staging/media/zoran/zoran_device.c | 13 +++------- drivers/staging/media/zoran/zoran_driver.c | 29 +++++----------------- 3 files changed, 14 insertions(+), 46 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 006f209c40ea..26f58e687333 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -933,19 +933,14 @@ static int zr36057_init(struct zoran *zr) zr->timing = zr->card.tvn[2]; } if (!zr->timing) { - dprintk(1, - KERN_WARNING - "%s: %s - default TV standard not supported by hardware. PAL will be used.\n", - ZR_DEVNAME(zr), __func__); + pci_warn(zr->pci_dev, "%s - default TV standard not supported by hardware. PAL will be used.\n", __func__); zr->norm = V4L2_STD_PAL; zr->timing = zr->card.tvn[0]; } if (default_input > zr->card.inputs - 1) { - dprintk(1, - KERN_WARNING - "%s: default_input value %d out of range (0-%d)\n", - ZR_DEVNAME(zr), default_input, zr->card.inputs - 1); + pci_warn(zr->pci_dev, "default_input value %d out of range (0-%d)\n", + default_input, zr->card.inputs - 1); default_input = 0; } zr->input = default_input; @@ -1369,11 +1364,8 @@ static int __init zoran_init(void) } /* some mainboards might not do PCI-PCI data transfer well */ - if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) { - dprintk(1, - KERN_WARNING - "%s: chipset does not support reliable PCI-PCI DMA\n", ZORAN_NAME); - } + if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) + pr_warn("%s: chipset does not support reliable PCI-PCI DMA\n", ZORAN_NAME); res = pci_register_driver(&zoran_driver); if (res) { diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index d7c85787e9c0..a04fbae30745 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -547,10 +547,7 @@ void zr36057_set_memgrab(struct zoran *zr, int mode) * will be stuck at 1 until capturing is turned back on. */ if (btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) - dprintk(1, - KERN_WARNING - "%s: zr36057_set_memgrab(1) with SnapShot on!?\n", - ZR_DEVNAME(zr)); + pci_warn(zr->pci_dev, "zr36057_set_memgrab(1) with SnapShot on!?\n"); /* switch on VSync interrupts */ btwrite(IRQ_MASK, ZR36057_ISR); // Clear Interrupts @@ -1284,10 +1281,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id) if (zr->v4l_memgrab_active) { /* A lot more checks should be here ... */ if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) == 0) - dprintk(1, - KERN_WARNING - "%s: BuzIRQ with SnapShot off ???\n", - ZR_DEVNAME(zr)); + pci_warn(zr->pci_dev, "BuzIRQ with SnapShot off ???\n"); if (zr->v4l_grab_frame != NO_GRAB_ACTIVE) { /* There is a grab on a frame going on, check if it has finished */ @@ -1406,8 +1400,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id) count++; if (count > 10) { - dprintk(2, KERN_WARNING "%s: irq loop %d\n", - ZR_DEVNAME(zr), count); + pci_warn(zr->pci_dev, "irq loop %d\n", count); if (count > 20) { btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); pci_err(zr->pci_dev, "IRQ lockup, cleared int mask\n"); diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 4082d5e53a24..3b061c3e4a82 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -210,10 +210,7 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh) for (i = 0; i < fh->buffers.num_buffers; i++) { if (fh->buffers.buffer[i].v4l.fbuffer) - dprintk(2, - KERN_WARNING - "%s: %s - buffer %d already allocated!?\n", - ZR_DEVNAME(zr), __func__, i); + pci_warn(zr->pci_dev, "%s - buffer %d already allocated!?\n", __func__, i); //udelay(20); mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL | __GFP_NOWARN); @@ -300,10 +297,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) for (i = 0; i < fh->buffers.num_buffers; i++) { if (fh->buffers.buffer[i].jpg.frag_tab) - dprintk(2, - KERN_WARNING - "%s: %s - buffer %d already allocated!?\n", - ZR_DEVNAME(zr), __func__, i); + pci_warn(zr->pci_dev, "%s - buffer %d already allocated!?\n", __func__, i); /* Allocate fragment table for this buffer */ @@ -490,10 +484,7 @@ static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) res = -EBUSY; /* what are you doing? */ break; case BUZ_STATE_DONE: - dprintk(2, - KERN_WARNING - "%s: %s - queueing buffer %d in state DONE!?\n", - ZR_DEVNAME(zr), __func__, num); + pci_warn(zr->pci_dev, "%s - queueing buffer %d in state DONE!?\n", __func__, num); /* fallthrough */ case BUZ_STATE_USER: /* since there is at least one unused buffer there's room for at least @@ -627,10 +618,7 @@ static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num, if (!res) { switch (zr->jpg_buffers.buffer[num].state) { case BUZ_STATE_DONE: - dprintk(2, - KERN_WARNING - "%s: %s - queuing frame in BUZ_STATE_DONE state!?\n", - ZR_DEVNAME(zr), __func__); + pci_warn(zr->pci_dev, "%s - queuing frame in BUZ_STATE_DONE state!?\n", __func__); /* fallthrough */ case BUZ_STATE_USER: /* since there is at least one unused buffer there's room for at @@ -1330,10 +1318,7 @@ static int zoran_set_input(struct zoran *zr, int input) if (zr->v4l_buffers.active != ZORAN_FREE || zr->jpg_buffers.active != ZORAN_FREE) { - dprintk(1, - KERN_WARNING - "%s: %s called while in playback/capture mode\n", - ZR_DEVNAME(zr), __func__); + pci_warn(zr->pci_dev, "%s called while in playback/capture mode\n", __func__); return -EBUSY; } @@ -2285,9 +2270,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh, settings.jpg_comp = *params; if (fh->buffers.active != ZORAN_FREE) { - dprintk(1, KERN_WARNING - "%s: VIDIOC_S_JPEGCOMP called while in playback/capture mode\n", - ZR_DEVNAME(zr)); + pci_warn(zr->pci_dev, "VIDIOC_S_JPEGCOMP called while in playback/capture mode\n"); res = -EBUSY; return res; } From patchwork Mon Sep 21 10:19:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255712 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BC2C43463 for ; Mon, 21 Sep 2020 10:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7B42207BC for ; Mon, 21 Sep 2020 10:24:00 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="slyncmIC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726832AbgIUKXy (ORCPT ); Mon, 21 Sep 2020 06:23:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgIUKUs (ORCPT ); Mon, 21 Sep 2020 06:20:48 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0DCFC0613D6 for ; Mon, 21 Sep 2020 03:20:43 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id l9so12023355wme.3 for ; Mon, 21 Sep 2020 03:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XQtRtjHSNQiSv0g3mZwkcnE0Fkjc1fIWl4XCgS/r66c=; b=slyncmICmXdEhhWYEdsc+ean+2FXOU4MeBJKJmPo2//+IaYRB3AfzhfeHPRPoYmjcU /rK6AcQZekKH1tayoc7buUtGimhtDhst9KvohiUoWsxOYew2qxZKBurKJ6n8guxtd/Gm jsCVWoymfh3+RcpdH9ybo64Lr5V3alaPCfxDi3BVTmwrfWi7toQhMnjWq8+0K0mYpOT7 QP8kd9PMMb/Zff/N3U8eLFvWZnubKaM4LRKIdxFqb8WjXuX3eQxCGBPOPJFXS4scOKQ6 TBfMIbhGnuIeNHt578xdco7ka9XxF/X+NEfLiGkbz1J6+Oa88foumPYueZhAR/jNPAxi cv1Q== 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:in-reply-to :references; bh=XQtRtjHSNQiSv0g3mZwkcnE0Fkjc1fIWl4XCgS/r66c=; b=fhvK0Qvc4EdyqqSajl8/ukcMxyEZxbrGasWLNPBhRIWqje7DiHsQstvU4kS19DYMVO H7BZLwT79u9uB0tH2Uk+s89fneqU1J351FKigiWbshWWNidyO91lgiIs00s++yEj0FxJ QmCMoh7rE+KOwbv8ZOv/HWqMtdAbw584GvNx/K7yS2vpgoUf5/yoy/foDjrH9VYIgJhd udV5vs/m4rVT5f6wjqrv/azsNPRFtE9paLgbkcTLpq1OBplIsDYT7KLWnfB2KXmyHJu+ 07Zm7E5mx/E5y7jcEUJdxNPPL8qB7f8mCSmM/AOS36XFBCNocMhiBAugSW6EOXxiuTvt oyjA== X-Gm-Message-State: AOAM533pR1/Bf+sA1ZFkjG0mqLcKn7klSJ2AOV48XUUW+PyLG6dphphT HMqEbN5jr9RTyb26oyRMcBid5w== X-Google-Smtp-Source: ABdhPJzLqCAqD/VEfG70gkysoerYVRtzTxtVm9b+0uuTk5ona1L4qr25Ge+YWXB4ngJw2k5ewFF6kQ== X-Received: by 2002:a1c:6187:: with SMTP id v129mr29087223wmb.35.1600683642386; Mon, 21 Sep 2020 03:20:42 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:41 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 10/49] staging: media: zoran: convert dprintk info to pci_info Date: Mon, 21 Sep 2020 10:19:45 +0000 Message-Id: <1600683624-5863-11-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch convert dprintk(info) to pci_info (or pci_dbg if the message is not important). Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 46 +++++++--------------- drivers/staging/media/zoran/zoran_device.c | 27 ++++--------- drivers/staging/media/zoran/zoran_driver.c | 34 ++++++---------- 3 files changed, 36 insertions(+), 71 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 26f58e687333..fd633265761c 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -887,9 +887,9 @@ static void test_interrupts(struct zoran *zr) btwrite(0, ZR36057_ICR); btwrite(0x78000000, ZR36057_ISR); zr->testing = 0; - dprintk(5, KERN_INFO "%s: Testing interrupts...\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "Testing interrupts...\n"); if (timeout) - dprintk(1, ": time spent: %d\n", 1 * HZ - timeout); + pci_info(zr->pci_dev, ": time spent: %d\n", 1 * HZ - timeout); if (zr36067_debug > 1) print_interrupts(zr); btwrite(icr, ZR36057_ICR); @@ -899,10 +899,7 @@ static int zr36057_init(struct zoran *zr) { int j, err; - dprintk(1, - KERN_INFO - "%s: %s - initializing card[%d], zr=%p\n", - ZR_DEVNAME(zr), __func__, zr->id, zr); + pci_info(zr->pci_dev, "initializing card[%d]\n", zr->id); /* default setup of all parameters which will persist between opens */ zr->user = 0; @@ -1134,18 +1131,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_unreg; zr->revision = zr->pci_dev->revision; - dprintk(1, - KERN_INFO - "%s: Zoran ZR360%c7 (rev %d), irq: %d, memory: 0x%08llx\n", - ZR_DEVNAME(zr), zr->revision < 2 ? '5' : '6', zr->revision, - zr->pci_dev->irq, (uint64_t)pci_resource_start(zr->pci_dev, 0)); - if (zr->revision >= 2) { - dprintk(1, - KERN_INFO - "%s: Subsystem vendor=0x%04x id=0x%04x\n", - ZR_DEVNAME(zr), zr->pci_dev->subsystem_vendor, - zr->pci_dev->subsystem_device); - } + pci_info(zr->pci_dev, "Zoran ZR360%c7 (rev %d), irq: %d, memory: 0x%08llx\n", + zr->revision < 2 ? '5' : '6', zr->revision, + zr->pci_dev->irq, (uint64_t)pci_resource_start(zr->pci_dev, 0)); + if (zr->revision >= 2) + pci_info(zr->pci_dev, "Subsystem vendor=0x%04x id=0x%04x\n", + zr->pci_dev->subsystem_vendor, zr->pci_dev->subsystem_device); /* Use auto-detected card type? */ if (card[nr] == -1) { @@ -1208,14 +1199,13 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) &latency); need_latency = zr->revision > 1 ? 32 : 48; if (latency != need_latency) { - dprintk(2, KERN_INFO "%s: Changing PCI latency from %d to %d\n", - ZR_DEVNAME(zr), latency, need_latency); + pci_info(zr->pci_dev, "Changing PCI latency from %d to %d\n", latency, need_latency); pci_write_config_byte(zr->pci_dev, PCI_LATENCY_TIMER, need_latency); } zr36057_restart(zr); /* i2c */ - dprintk(2, KERN_INFO "%s: Initializing i2c bus...\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "Initializing i2c bus...\n"); if (zoran_register_i2c(zr) < 0) { pci_err(pdev, "%s - can't initialize i2c bus\n", __func__); @@ -1229,7 +1219,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, &zr->i2c_adapter, zr->card.i2c_encoder, 0, zr->card.addrs_encoder); - dprintk(2, KERN_INFO "%s: Initializing videocodec bus...\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "Initializing videocodec bus...\n"); if (zr->card.video_codec) { codec_name = codecid_to_modulename(zr->card.video_codec); @@ -1285,9 +1275,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) /* take care of Natoma chipset and a revision 1 zr36057 */ if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) { zr->jpg_buffers.need_contiguous = 1; - dprintk(1, KERN_INFO - "%s: ZR36057/Natoma bug, max. buffer size is 128K\n", - ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "ZR36057/Natoma bug, max. buffer size is 128K\n"); } if (zr36057_init(zr) < 0) @@ -1356,12 +1344,8 @@ static int __init zoran_init(void) if (jpg_bufsize > (512 * 1024)) jpg_bufsize = 512 * 1024; /* Use parameter for vidmem or try to find a video card */ - if (vidmem) { - dprintk(1, - KERN_INFO - "%s: Using supplied video memory base address @ 0x%lx\n", - ZORAN_NAME, vidmem); - } + if (vidmem) + pr_info("%s: Using supplied video memory base address @ 0x%lx\n", ZORAN_NAME, vidmem); /* some mainboards might not do PCI-PCI data transfer well */ if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index a04fbae30745..1f625e1e8477 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -118,8 +118,7 @@ int post_office_wait(struct zoran *zr) } if ((por & ZR36057_POR_POTime) && !zr->card.gws_not_connected) { /* In LML33/BUZ \GWS line is not connected, so it has always timeout set */ - dprintk(1, KERN_INFO "%s: pop timeout %08x\n", ZR_DEVNAME(zr), - por); + pci_info(zr->pci_dev, "pop timeout %08x\n", por); return -1; } @@ -218,16 +217,10 @@ void jpeg_codec_sleep(struct zoran *zr, int sleep) { GPIO(zr, zr->card.gpio[ZR_GPIO_JPEG_SLEEP], !sleep); if (!sleep) { - dprintk(3, - KERN_INFO - "%s: %s() - wake GPIO=0x%08x\n", - ZR_DEVNAME(zr), __func__, btread(ZR36057_GPPGCR1)); + pci_dbg(zr->pci_dev, "%s() - wake GPIO=0x%08x\n", __func__, btread(ZR36057_GPPGCR1)); udelay(500); } else { - dprintk(3, - KERN_INFO - "%s: %s() - sleep GPIO=0x%08x\n", - ZR_DEVNAME(zr), __func__, btread(ZR36057_GPPGCR1)); + pci_dbg(zr->pci_dev, "%s() - sleep GPIO=0x%08x\n", __func__, btread(ZR36057_GPPGCR1)); udelay(2); } } @@ -309,8 +302,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height, Wa = tvn->Wa; Ha = tvn->Ha; - dprintk(2, KERN_INFO "%s: set_vfe() - width = %d, height = %d\n", - ZR_DEVNAME(zr), video_width, video_height); + pci_info(zr->pci_dev, "set_vfe() - width = %d, height = %d\n", video_width, video_height); if (video_width < BUZ_MIN_WIDTH || video_height < BUZ_MIN_HEIGHT || @@ -940,8 +932,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) zr36057_set_jpg(zr, mode); // \P_Reset, ... Video param, FIFO clear_interrupt_counters(zr); - dprintk(2, KERN_INFO "%s: enable_jpg(MOTION_COMPRESS)\n", - ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "enable_jpg(MOTION_COMPRESS)\n"); break; } @@ -968,8 +959,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) zr36057_set_jpg(zr, mode); // \P_Reset, ... Video param, FIFO clear_interrupt_counters(zr); - dprintk(2, KERN_INFO "%s: enable_jpg(MOTION_DECOMPRESS)\n", - ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "enable_jpg(MOTION_DECOMPRESS)\n"); break; case BUZ_MODE_IDLE: @@ -994,7 +984,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) decoder_call(zr, video, s_stream, 1); encoder_call(zr, video, s_routing, 0, 0, 0); - dprintk(2, KERN_INFO "%s: enable_jpg(IDLE)\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "enable_jpg(IDLE)\n"); break; } } @@ -1112,8 +1102,7 @@ static void zoran_restart(struct zoran *zr) jpeg_start(zr); if (zr->num_errors <= 8) - dprintk(2, KERN_INFO "%s: Restart\n", - ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "Restart\n"); zr->JPEG_missed = 0; zr->JPEG_error = 2; diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 3b061c3e4a82..02c1f69d073e 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -225,11 +225,8 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh) for (off = 0; off < fh->buffers.buffer_size; off += PAGE_SIZE) SetPageReserved(virt_to_page(mem + off)); - dprintk(4, - KERN_INFO - "%s: %s - V4L frame %d mem %p (bus: 0x%llx)\n", - ZR_DEVNAME(zr), __func__, i, mem, - (unsigned long long)virt_to_bus(mem)); + pci_info(zr->pci_dev, "%s - V4L frame %d mem %p (bus: 0x%llx)\n", __func__, i, mem, + (unsigned long long)virt_to_bus(mem)); } fh->buffers.allocated = 1; @@ -244,7 +241,7 @@ static void v4l_fbuffer_free(struct zoran_fh *fh) int i, off; unsigned char *mem; - dprintk(4, KERN_INFO "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); for (i = 0; i < fh->buffers.num_buffers; i++) { if (!fh->buffers.buffer[i].v4l.fbuffer) @@ -820,8 +817,8 @@ static int zoran_open(struct file *file) struct zoran_fh *fh; int res, first_open = 0; - dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", - ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); + pci_info(zr->pci_dev, "%s(%s, pid=[%d]), users(-)=%d\n", __func__, current->comm, + task_pid_nr(current), zr->user + 1); mutex_lock(&zr->lock); @@ -876,8 +873,7 @@ static int zoran_open(struct file *file) fail_unlock: mutex_unlock(&zr->lock); - dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", - ZR_DEVNAME(zr), res, zr->user); + pci_info(zr->pci_dev, "open failed (%d), users(-)=%d\n", res, zr->user); return res; } @@ -887,8 +883,8 @@ static int zoran_close(struct file *file) struct zoran_fh *fh = file->private_data; struct zoran *zr = fh->zr; - dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(+)=%d\n", - ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user - 1); + pci_info(zr->pci_dev, "%s(%s, pid=[%d]), users(+)=%d\n", __func__, current->comm, + task_pid_nr(current), zr->user - 1); /* kernel locks (fs/device.c), so don't do that ourselves * (prevents deadlocks) */ @@ -933,7 +929,7 @@ static int zoran_close(struct file *file) kfree(fh->overlay_mask); kfree(fh); - dprintk(4, KERN_INFO "%s: %s done\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s done\n", __func__); return 0; } @@ -2381,8 +2377,7 @@ static void zoran_vm_close(struct vm_area_struct *vma) struct zoran *zr = fh->zr; int i; - dprintk(3, KERN_INFO "%s: %s - munmap(%s)\n", ZR_DEVNAME(zr), - __func__, mode_name(fh->map_mode)); + pci_info(zr->pci_dev, "%s - munmap(%s)\n", ZR_DEVNAME(zr), mode_name(fh->map_mode)); for (i = 0; i < fh->buffers.num_buffers; i++) { if (fh->buffers.buffer[i].map == map) @@ -2396,8 +2391,7 @@ static void zoran_vm_close(struct vm_area_struct *vma) return; } - dprintk(3, KERN_INFO "%s: %s - free %s buffers\n", ZR_DEVNAME(zr), - __func__, mode_name(fh->map_mode)); + pci_info(zr->pci_dev, "%s - free %s buffers\n", __func__, mode_name(fh->map_mode)); if (fh->map_mode == ZORAN_MAP_MODE_RAW) { if (fh->buffers.active != ZORAN_FREE) { @@ -2437,10 +2431,8 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) struct zoran_mapping *map; int res = 0; - dprintk(3, - KERN_INFO "%s: %s(%s) of 0x%08lx-0x%08lx (size=%lu)\n", - ZR_DEVNAME(zr), __func__, - mode_name(fh->map_mode), vma->vm_start, vma->vm_end, size); + pci_info(zr->pci_dev, "%s(%s) of 0x%08lx-0x%08lx (size=%lu)\n", __func__, + mode_name(fh->map_mode), vma->vm_start, vma->vm_end, size); if (!(vma->vm_flags & VM_SHARED) || !(vma->vm_flags & VM_READ) || !(vma->vm_flags & VM_WRITE)) { From patchwork Mon Sep 21 10:19:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A6B0C43464 for ; Mon, 21 Sep 2020 10:24:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2971920EDD for ; Mon, 21 Sep 2020 10:24:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="ihhzXOQx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgIUKYB (ORCPT ); Mon, 21 Sep 2020 06:24:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726817AbgIUKUs (ORCPT ); Mon, 21 Sep 2020 06:20:48 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6070C0613D9 for ; Mon, 21 Sep 2020 03:20:44 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id s13so11551822wmh.4 for ; Mon, 21 Sep 2020 03:20:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=psEAVLj+sH2AqoAHfj9DEEGhFTvZRUKNVBnToNLqBd0=; b=ihhzXOQxkEROGLDVgaZhfXhqylK69WyPOGFY/lWUQGQzcM/FpDD2hcr9pqKTswU2CR iNk1CSkYXR2TuJdCN+3naymh0SIlfnd5S5D3dFy6/fF3xdW/irQFhnTOpyXFGDXV2N4R cseIp6UiIjhKaP+njfPkd98w33P5oz3IPE5+MQmjepCEIcu3bu/wT15YwrsJ3S5bT2U8 qKot92KRw9gcc1wJbkLgtfkzxDHDLhwWn0c7mg+rhPfGdfeKVsdWRjuCrQbF6y4LkwZ1 ZvK90mGsFBEILQCpZbshtsRzKV17WHC7smkLjUugLHAvQG1tOYRD1DMnWQKwg3QqoVR/ +35w== 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:in-reply-to :references; bh=psEAVLj+sH2AqoAHfj9DEEGhFTvZRUKNVBnToNLqBd0=; b=Nm5T7StpXZkeK0ibXiTClx3dtsP5G2cT6OyU7RcR/4UZ/2vC68cD6rCuPRzAGcUEZA Iwp07n3OBlMxnoxyi/KF4mdc1aGjXfuPsZPulTY5RXjcmHqOHhq4O+ZCBbhbk24BrnZ2 aw/+RSkb919H7IhSQSYoU9FJL2ifPjj1GvvKRnwI/51PrYVSF4c1AwAG3v9nUbcyihRF d0Uqv/0mgfGObVSnEs+jOrFadGiaydvLqGNt+hKnqKUGEdZuczXnyVD2yqEg36uSUpMy ITu0gbMBnIy1MKQlE+vSQXT8hrtLFaGXjFkkeMjgrHfoM5nX2J+pxJxHOcTP2vWe7fNL BW+g== X-Gm-Message-State: AOAM533A0BY5SCkUASkVL6UYzqof+hcZ2tC0qUEGK295EnQMzD5Qejmm 8OnzquCUbUOE8b2ObCbfQIJGsQ== X-Google-Smtp-Source: ABdhPJw1h5T5T9K5f3+6kx+h317+Hq1cVUPcP0ii3iKm1tSFevx0Vve5X0isQHnCkNWZ8ljZuhFeEw== X-Received: by 2002:a7b:c317:: with SMTP id k23mr28410922wmj.44.1600683643274; Mon, 21 Sep 2020 03:20:43 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:42 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 11/49] staging: media: zoran: convert dprintk debug Date: Mon, 21 Sep 2020 10:19:46 +0000 Message-Id: <1600683624-5863-12-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch convert dprintk(debug) to pci_dbg. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 30 ++++++++-------------- drivers/staging/media/zoran/zoran_card.h | 6 ----- drivers/staging/media/zoran/zoran_device.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 28 ++++++++------------ 4 files changed, 21 insertions(+), 45 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index fd633265761c..5a3fa5fe32b1 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -203,7 +203,7 @@ void zr36016_write(struct videocodec *codec, u16 reg, u32 val) static void dc10_init(struct zoran *zr) { - dprintk(3, KERN_DEBUG "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); /* Pixel clock selection */ GPIO(zr, 4, 0); @@ -214,12 +214,12 @@ static void dc10_init(struct zoran *zr) static void dc10plus_init(struct zoran *zr) { - dprintk(3, KERN_DEBUG "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); } static void buz_init(struct zoran *zr) { - dprintk(3, KERN_DEBUG "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); /* some stuff from Iomega */ pci_write_config_dword(zr->pci_dev, 0xfc, 0x90680f15); @@ -229,7 +229,7 @@ static void buz_init(struct zoran *zr) static void lml33_init(struct zoran *zr) { - dprintk(3, KERN_DEBUG "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); GPIO(zr, 2, 1); // Set Composite input/output } @@ -669,15 +669,11 @@ int zoran_check_jpg_settings(struct zoran *zr, struct zoran_jpg_settings *settin { int err = 0, err0 = 0; - dprintk(4, - KERN_DEBUG - "%s: %s - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n", - ZR_DEVNAME(zr), __func__, settings->decimation, settings->HorDcm, + pci_dbg(zr->pci_dev, "%s - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n", + __func__, settings->decimation, settings->HorDcm, settings->VerDcm, settings->TmpDcm); - dprintk(4, - KERN_DEBUG - "%s: %s - x: %d, y: %d, w: %d, y: %d\n", - ZR_DEVNAME(zr), __func__, settings->img_x, settings->img_y, + pci_dbg(zr->pci_dev, "%s - x: %d, y: %d, w: %d, y: %d\n", __func__, + settings->img_x, settings->img_y, settings->img_width, settings->img_height); /* Check decimation, set default values for decimation = 1, 2, 4 */ switch (settings->decimation) { @@ -707,10 +703,7 @@ int zoran_check_jpg_settings(struct zoran *zr, struct zoran_jpg_settings *settin case 4: if (zr->card.type == DC10_new) { - dprintk(1, - KERN_DEBUG - "%s: %s - HDec by 4 is not supported on the DC10\n", - ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s - HDec by 4 is not supported on the DC10\n", __func__); err0++; break; } @@ -1151,10 +1144,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_err(pdev, "Unknown card, try specifying card=X module parameter\n"); goto zr_unreg; } - dprintk(3, - KERN_DEBUG - "%s: %s() - card %s detected\n", - ZR_DEVNAME(zr), __func__, zoran_cards[card_num].name); + pci_info(zr->pci_dev, "%s() - card %s detected\n", __func__, zoran_cards[card_num].name); } else { card_num = card[nr]; if (card_num >= NUM_CARDS || card_num < 0) { diff --git a/drivers/staging/media/zoran/zoran_card.h b/drivers/staging/media/zoran/zoran_card.h index 4af8cb91d03a..8e0d634cb30f 100644 --- a/drivers/staging/media/zoran/zoran_card.h +++ b/drivers/staging/media/zoran/zoran_card.h @@ -14,12 +14,6 @@ extern int zr36067_debug; -#define dprintk(num, format, args...) \ - do { \ - if (zr36067_debug >= num) \ - printk(format, ##args); \ - } while (0) - /* Anybody who uses more than four? */ #define BUZ_MAX 4 diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 1f625e1e8477..516a7f18ce7a 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -871,7 +871,7 @@ void jpeg_start(struct zoran *zr) set_frame(zr, 1); // /FRAME - dprintk(3, KERN_DEBUG "%s: jpeg_start\n", ZR_DEVNAME(zr)); + pci_dbg(zr->pci_dev, "jpeg_start\n"); } void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 02c1f69d073e..2f6ef995927a 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -341,9 +341,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) } } - dprintk(4, - KERN_DEBUG "%s: %s - %d KB allocated\n", - ZR_DEVNAME(zr), __func__, + pci_dbg(zr->pci_dev, "%s - %d KB allocated\n", __func__, (fh->buffers.num_buffers * fh->buffers.buffer_size) >> 10); fh->buffers.allocated = 1; @@ -360,7 +358,7 @@ static void jpg_fbuffer_free(struct zoran_fh *fh) __le32 frag_tab; struct zoran_buffer *buffer; - dprintk(4, KERN_DEBUG "%s: %s\n", ZR_DEVNAME(zr), __func__); + pci_dbg(zr->pci_dev, "%s\n", __func__); for (i = 0, buffer = &fh->buffers.buffer[0]; i < fh->buffers.num_buffers; i++, buffer++) { @@ -1185,10 +1183,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, } spin_lock_irqsave(&zr->spinlock, flags); - dprintk(3, - KERN_DEBUG - "%s: %s() - raw active=%c, buffer %d: state=%c, map=%c\n", - ZR_DEVNAME(zr), __func__, + pci_dbg(zr->pci_dev, "%s() - raw active=%c, buffer %d: state=%c, map=%c\n", __func__, "FAL"[fh->buffers.active], num, "UPMD"[zr->v4l_buffers.buffer[num].state], fh->buffers.buffer[num].map ? 'Y' : 'N'); @@ -1563,9 +1558,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) { struct zoran_fh *fh = __fh; + struct zoran *zr = fh->zr; int res; - dprintk(3, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n", + pci_dbg(zr->pci_dev, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n", fmt->fmt.win.w.left, fmt->fmt.win.w.top, fmt->fmt.win.w.width, fmt->fmt.win.w.height, @@ -1586,7 +1582,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format struct zoran_jpg_settings settings; int res = 0; - dprintk(3, "size=%dx%d, fmt=0x%x (%4.4s)\n", + pci_dbg(zr->pci_dev, "size=%dx%d, fmt=0x%x (%4.4s)\n", fmt->fmt.pix.width, fmt->fmt.pix.height, fmt->fmt.pix.pixelformat, (char *)&printformat); @@ -2303,10 +2299,8 @@ static __poll_t zoran_poll(struct file *file, poll_table *wait) frame = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; spin_lock_irqsave(&zr->spinlock, flags); - dprintk(3, - KERN_DEBUG - "%s: %s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n", - ZR_DEVNAME(zr), __func__, + pci_dbg(zr->pci_dev, "%s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n", + __func__, "FAL"[fh->buffers.active], zr->v4l_sync_tail, "UPMD"[zr->v4l_buffers.buffer[frame].state], zr->v4l_pend_tail, zr->v4l_pend_head); @@ -2325,10 +2319,8 @@ static __poll_t zoran_poll(struct file *file, poll_table *wait) frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; spin_lock_irqsave(&zr->spinlock, flags); - dprintk(3, - KERN_DEBUG - "%s: %s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n", - ZR_DEVNAME(zr), __func__, + pci_dbg(zr->pci_dev, "%s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n", + __func__, "FAL"[fh->buffers.active], zr->jpg_que_tail, "UPMD"[zr->jpg_buffers.buffer[frame].state], zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head); From patchwork Mon Sep 21 10:19:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255713 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6DFDC43464 for ; Mon, 21 Sep 2020 10:23:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93843207BC for ; Mon, 21 Sep 2020 10:23:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="g2ZZiy2u" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbgIUKXz (ORCPT ); Mon, 21 Sep 2020 06:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbgIUKUs (ORCPT ); Mon, 21 Sep 2020 06:20:48 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF650C0613DB for ; Mon, 21 Sep 2020 03:20:45 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id e17so11564356wme.0 for ; Mon, 21 Sep 2020 03:20:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3+BODOaAXA+uCGmzHO/lJ88Q7uOk7/VYMBsUUN6E7FI=; b=g2ZZiy2uI7gbXpoEi2F50flRdFq1ECigCJz6wdUdIQYHcawsArICTGRu5VXPUhOqxz BKklg6BeS6jJvIh+HoVfJXRi8BO/7K7HR8DMlVXNXZiaiTpd8Vf1g+VJUWo2dJNys2MP KfN6zqWB/n+twqGa3g2MQtq79oAG83WTdYf5fzoD57GbX5gkesP+a0Zyd67xb95IAMo6 xvWjKG8RsNkwGzxB/9ePE0g6f+Kp7UZVlgx/W4P925AP4tRS9nVSY8uJ6+r8NnWUnrxL KTrWooeGuI7+C4tZZ15K21pC+JofulEB+fYRSxWvKx4GuoWuqd9MMu1wTECKEvOturnL wzUg== 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:in-reply-to :references; bh=3+BODOaAXA+uCGmzHO/lJ88Q7uOk7/VYMBsUUN6E7FI=; b=TNkqcSnQ8Cyj155b9rB+W9SnlINbsF8W8TNulnMI1KNigj5a23LhMqDGNlnRS6fBAo 8HlMWLf1MgPFf6IMPeO3QTdwFPvfU0zcLTDqwhTcqNLizxiasMK4J79jkQeuSER8ndDQ oI3PLAZy17DvpxCS7pGSi+zL0WzWDAxH22m8P2Sjf1NEIckMMEUWFbFT7prnbeSg63Ux 6EjekVKPfoSHbirf1v2EhnaHGaJMjkyKLN6AvujiVtowyFAcqZU8uXNLU3lpRwDUsW8G UTBI82JLHPEN8DEvQ4Un/OhF1ziytwMms+Iq8vLj8wp+C2yTsaHRoPPSzPNyGXb0S4oT DrGg== X-Gm-Message-State: AOAM531djTgMslJqwG6dppxAo7JLr8/jH49ntwKN97MVzXQHR7c5gK+r 9Dl1C3+H8joZCdP6i77ltvyuZw== X-Google-Smtp-Source: ABdhPJx/OW+rrphaBSknMg7GqCDSQ46jnMDP5ojIonXfLVvVb0RNJxHTiZB4zTGsRPyjTGtIWxph7w== X-Received: by 2002:a1c:4943:: with SMTP id w64mr28400063wma.62.1600683644388; Mon, 21 Sep 2020 03:20:44 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:43 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 12/49] staging: media: zoran: zoran_device.c: convert pr_x to pci_x Date: Mon, 21 Sep 2020 10:19:47 +0000 Message-Id: <1600683624-5863-13-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_device.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 516a7f18ce7a..03ad3562a807 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -162,7 +162,7 @@ static void dump_guests(struct zoran *zr) for (i = 1; i < 8; i++) /* Don't read jpeg codec here */ guest[i] = post_office_read(zr, i, 0); - pr_info("%s: Guests: %*ph\n", ZR_DEVNAME(zr), 8, guest); + pci_info(zr->pci_dev, "Guests: %*ph\n", 8, guest); } } @@ -172,7 +172,7 @@ void detect_guest_activity(struct zoran *zr) ktime_t t0, t1; dump_guests(zr); - pr_info("%s: Detecting guests activity, please wait...\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "Detecting guests activity, please wait...\n"); for (i = 1; i < 8; i++) /* Don't read jpeg codec here */ guest0[i] = guest[i] = post_office_read(zr, i, 0); @@ -198,15 +198,14 @@ void detect_guest_activity(struct zoran *zr) break; } - pr_info("%s: Guests: %*ph\n", ZR_DEVNAME(zr), 8, guest0); + pci_info(zr->pci_dev, "Guests: %*ph\n", 8, guest0); if (j == 0) { - pr_info("%s: No activity detected.\n", ZR_DEVNAME(zr)); + pci_info(zr->pci_dev, "No activity detected.\n"); return; } for (i = 0; i < j; i++) - pr_info("%s: %6d: %d => 0x%02x\n", ZR_DEVNAME(zr), - change[i][0], change[i][1], change[i][2]); + pci_info(zr->pci_dev, "%6d: %d => 0x%02x\n", change[i][0], change[i][1], change[i][2]); } /* From patchwork Mon Sep 21 10:19:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD8EC43464 for ; Mon, 21 Sep 2020 10:20:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EBFCD207BC for ; Mon, 21 Sep 2020 10:20:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="I9A+ozHb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726841AbgIUKUu (ORCPT ); Mon, 21 Sep 2020 06:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbgIUKUs (ORCPT ); Mon, 21 Sep 2020 06:20:48 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A3E1C0613CF for ; Mon, 21 Sep 2020 03:20:48 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id s13so11552011wmh.4 for ; Mon, 21 Sep 2020 03:20:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7hg4hkt0xKc+u3OMG6BJG4ab1Qlz/YPXWuTo+eYO1gA=; b=I9A+ozHbjj5JIKiaEWlISCq0H27Pvji2tPH9MWl/bJlBO/XHBY+M9xbil5zUFwme8r RopHc97gNGKXhpYPb2FtNbXH6YJVWex7q8flecpw+CgjEZoGmYW2dFWs3e28zn2RcW8W u0BqgrDL6rfkc5QCTixqui4vUZ9hvKw6oCy5eL5XvLxrzk7xqLe0X3DgrPbLTJ3OyJJu Da7lRhMZXm50cMBW5GS5yE2f5MzK/dNRVh8YnNwIuk8Zh2oa2OGELlicuASRb1HUGg1H xEiveZMZmDXPoJsly6mRcaMfuDoNyFsBP+Bft/kd1lhQArcgu6n7mKb+Ar0zuFmIopv+ vMiw== 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:in-reply-to :references; bh=7hg4hkt0xKc+u3OMG6BJG4ab1Qlz/YPXWuTo+eYO1gA=; b=ATRbwVWlTQlryZx/6yIKI4InvjQFxnNuRDywUs/Y8tQDtNZVZRNiD9iRXP+Z2Ma1gT 9ZLDxLFotRZnt2QTjZN/sXsIg1W/NGV/2rGSOohOCjonCDoj5M9UU7hGbZ0ugG9IH3Jy cLSVjqRc1c7mwGsf5JbRR1VRh5KRb7m/IRKpmDadsgJPBma6+kuD2WrOew9BfXS7oNgU ec+lEP1NAJGD7UPyHxY9IWXLlRb2nGHt0a9PHpM4LpATgGj5L7oWGitDq+dInDzTPAqZ Sun8IZ40+tfdaj1oFR/O/URqG+5c6ZV0pS4GU8znj4O1PRf08OpC3KeIHHPTeQZOL44N 6Fyg== X-Gm-Message-State: AOAM531MbJ0G3VA4Q/cSCypfHXgZltqKwlIq2ztt11ofEKUwiE4IfVn0 T5o9VFK6AEBncr0fgaJMOygxuQ== X-Google-Smtp-Source: ABdhPJwJJAhkkByBZiA+u9aw9ZaL1S/4JSy8xlyXdLg6vqMKmmptWk2OW3Tnk20GbyYqMkxkQjAz+w== X-Received: by 2002:a7b:c4d9:: with SMTP id g25mr29201004wmk.15.1600683647080; Mon, 21 Sep 2020 03:20:47 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:46 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 15/49] staging: media: zoran: use v4l2_buffer_set_timestamp Date: Mon, 21 Sep 2020 10:19:50 +0000 Message-Id: <1600683624-5863-16-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The ns_to_timeval function is removed, so replace it with v4l2_buffer_set_timestamp(). Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 31ed36906204..a996161cb276 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1197,7 +1197,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, fh->buffers.buffer[num].state == BUZ_STATE_USER) { buf->sequence = fh->buffers.buffer[num].bs.seq; buf->flags |= V4L2_BUF_FLAG_DONE; - buf->timestamp = ns_to_timeval(fh->buffers.buffer[num].bs.ts); + v4l2_buffer_set_timestamp(buf, fh->buffers.buffer[num].bs.ts); } else { buf->flags |= V4L2_BUF_FLAG_QUEUED; } @@ -1228,7 +1228,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, if (fh->buffers.buffer[num].state == BUZ_STATE_DONE || fh->buffers.buffer[num].state == BUZ_STATE_USER) { buf->sequence = fh->buffers.buffer[num].bs.seq; - buf->timestamp = ns_to_timeval(fh->buffers.buffer[num].bs.ts); + v4l2_buffer_set_timestamp(buf, fh->buffers.buffer[num].bs.ts); buf->bytesused = fh->buffers.buffer[num].bs.length; buf->flags |= V4L2_BUF_FLAG_DONE; } else { From patchwork Mon Sep 21 10:19:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255716 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14924C43463 for ; Mon, 21 Sep 2020 10:23:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C7BD720EDD for ; Mon, 21 Sep 2020 10:23:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="COEGfMiF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727211AbgIUKXZ (ORCPT ); Mon, 21 Sep 2020 06:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726844AbgIUKUu (ORCPT ); Mon, 21 Sep 2020 06:20:50 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73620C061755 for ; Mon, 21 Sep 2020 03:20:50 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id q9so11566560wmj.2 for ; Mon, 21 Sep 2020 03:20:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XUCRDH6iHP/B7aPgUO/p342/Ws8bKasBR0X3UR3PF+I=; b=COEGfMiFZniPYReKLoWfHR9tS+laqXb9erzlYjDHLUnLrwz0wv6itTpod8UALUjn9i CckJCm4NK0/nwWiIdp21MpKvskhvcuxTfpzCeaKWybxDA1xUfz4ogGR2IHS9lVpJzsLu wBsBnWZjkJ4tuUcprvJ1RNy4PtuDMMX3uKdOUvJ4M27IFjBUWxXgFfI+QJHCayQsJO3s SMwlXUIXP9bViMENlKKWaLnfb4Nk4fPJ5/hbXU3gjfB8jXH0vg5sYs3WPIRDchrcKWsc dAYMUnZbfBg3bbLcVxi++zEhfwgUNOWHxxjDF/IQ25Q6twqzEJjQ6C7ULa6IGDtzOZqr 0/ZQ== 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:in-reply-to :references; bh=XUCRDH6iHP/B7aPgUO/p342/Ws8bKasBR0X3UR3PF+I=; b=LToZ06Dy8/+DYrXKd34h0EkhPKi6PNyqzbbJ9yzxJqLd3fsPlmicdHx8VgVCm/J+6A kCVfblsXUul8+31RDTdgMUYba/fisvXdNK40WPN0FogOZiSeiE8c+vctG+b+H5ibnTsi XL/uH1oAbEuOhBc24KKmPNljvG4UznSWg19TlACrBNpPdEp/B7FshNVuH9JG6k432ZR1 3jDPoQmU++aXKUi6L19ufGMJenb81XnjFF9/WrQoYu3P9NGUApUWhhTV71sL4Mm9Hbih BIXpQxgSEvewTUkJfSTImc698PnyHmkwXdN7YxnctVK8eWG01MpQGos9zFAfJY2nrMTl CCYg== X-Gm-Message-State: AOAM5330PaCavDRMTHzMV4/uY3aIeSP65TIh4fBE0GWND94nb62HZNJE 63UvnPrRKDblVb1oaRa+XkB7ZQ== X-Google-Smtp-Source: ABdhPJww3+HOO9uP4NbpSoCHegjIzTUgjpnk7lEmGXSWSZ+qbnX+IR0Tn9nDi7Xvljaj39CspqSQgw== X-Received: by 2002:a7b:c1d4:: with SMTP id a20mr29620554wmj.30.1600683649047; Mon, 21 Sep 2020 03:20:49 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:48 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 17/49] staging: media: zoran: move buffer_size out of zoran_fh Date: Mon, 21 Sep 2020 10:19:52 +0000 Message-Id: <1600683624-5863-18-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We need to get rid of zoran_fh, so move the buffer_size directly in the zoran structure. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran.h | 3 +- drivers/staging/media/zoran/zoran_device.c | 3 +- drivers/staging/media/zoran/zoran_driver.c | 62 +++++++++++----------- 3 files changed, 35 insertions(+), 33 deletions(-) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 1b3eceaead5a..97933c550113 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -195,7 +195,7 @@ enum zoran_lock_activity { /* buffer collections */ struct zoran_buffer_col { enum zoran_lock_activity active; /* feature currently in use? */ - unsigned int num_buffers, buffer_size; + unsigned int num_buffers; struct zoran_buffer buffer[MAX_FRAME]; /* buffers */ u8 allocated; /* Flag if buffers are allocated */ u8 need_contiguous; /* Flag if contiguous buffers are needed */ @@ -292,6 +292,7 @@ struct zoran { v4l2_std_id norm; /* Current buffer params */ + unsigned int buffer_size; void *vbuf_base; int vbuf_height, vbuf_width; int vbuf_depth; diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index a33de61a5e9b..4f9b28e63ac0 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -882,8 +882,7 @@ void jpeg_start(struct zoran *zr) void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode) { struct vfe_settings cap; - int field_size = - zr->jpg_buffers.buffer_size / zr->jpg_settings.field_per_buff; + int field_size = zr->buffer_size / zr->jpg_settings.field_per_buff; zr->codec_mode = mode; diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index a996161cb276..a97faf54e19d 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -178,15 +178,18 @@ static void jpg_fbuffer_free(struct zoran_fh *fh); /* Set mapping mode */ static void map_mode_raw(struct zoran_fh *fh) { + struct zoran *zr = fh->zr; fh->map_mode = ZORAN_MAP_MODE_RAW; - fh->buffers.buffer_size = v4l_bufsize; + zr->buffer_size = v4l_bufsize; fh->buffers.num_buffers = v4l_nbufs; } static void map_mode_jpg(struct zoran_fh *fh, int play) { + struct zoran *zr = fh->zr; + fh->map_mode = play ? ZORAN_MAP_MODE_JPG_PLAY : ZORAN_MAP_MODE_JPG_REC; - fh->buffers.buffer_size = jpg_bufsize; + zr->buffer_size = jpg_bufsize; fh->buffers.num_buffers = jpg_nbufs; } @@ -212,7 +215,7 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh) pci_warn(zr->pci_dev, "%s - buffer %d already allocated!?\n", __func__, i); //udelay(20); - mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL | __GFP_NOWARN); + mem = kmalloc(zr->buffer_size, GFP_KERNEL | __GFP_NOWARN); if (!mem) { pci_err(zr->pci_dev, "%s - kmalloc for V4L buf %d failed\n", __func__, i); v4l_fbuffer_free(fh); @@ -221,7 +224,7 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh) fh->buffers.buffer[i].v4l.fbuffer = mem; fh->buffers.buffer[i].v4l.fbuffer_phys = virt_to_phys(mem); fh->buffers.buffer[i].v4l.fbuffer_bus = virt_to_bus(mem); - for (off = 0; off < fh->buffers.buffer_size; + for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) SetPageReserved(virt_to_page(mem + off)); pci_info(zr->pci_dev, "%s - V4L frame %d mem %p (bus: 0x%llx)\n", __func__, i, mem, @@ -247,7 +250,7 @@ static void v4l_fbuffer_free(struct zoran_fh *fh) continue; mem = fh->buffers.buffer[i].v4l.fbuffer; - for (off = 0; off < fh->buffers.buffer_size; + for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) ClearPageReserved(virt_to_page(mem + off)); kfree(fh->buffers.buffer[i].v4l.fbuffer); @@ -307,7 +310,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) fh->buffers.buffer[i].jpg.frag_tab_bus = virt_to_bus(mem); if (fh->buffers.need_contiguous) { - mem = kmalloc(fh->buffers.buffer_size, GFP_KERNEL); + mem = kmalloc(zr->buffer_size, GFP_KERNEL); if (!mem) { pci_err(zr->pci_dev, "%s - kmalloc failed for buffer %d\n", __func__, i); jpg_fbuffer_free(fh); @@ -316,12 +319,12 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) fh->buffers.buffer[i].jpg.frag_tab[0] = cpu_to_le32(virt_to_bus(mem)); fh->buffers.buffer[i].jpg.frag_tab[1] = - cpu_to_le32((fh->buffers.buffer_size >> 1) | 1); - for (off = 0; off < fh->buffers.buffer_size; off += PAGE_SIZE) + cpu_to_le32((zr->buffer_size >> 1) | 1); + for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) SetPageReserved(virt_to_page(mem + off)); } else { /* jpg_bufsize is already page aligned */ - for (j = 0; j < fh->buffers.buffer_size / PAGE_SIZE; j++) { + for (j = 0; j < zr->buffer_size / PAGE_SIZE; j++) { mem = (void *)get_zeroed_page(GFP_KERNEL); if (!mem) { pci_err(zr->pci_dev, "%s - get_zeroed_page failed for buffer %d\n", __func__, i); @@ -341,7 +344,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) } pci_dbg(zr->pci_dev, "%s - %d KB allocated\n", __func__, - (fh->buffers.num_buffers * fh->buffers.buffer_size) >> 10); + (fh->buffers.num_buffers * zr->buffer_size) >> 10); fh->buffers.allocated = 1; @@ -369,14 +372,14 @@ static void jpg_fbuffer_free(struct zoran_fh *fh) if (frag_tab) { mem = bus_to_virt(le32_to_cpu(frag_tab)); - for (off = 0; off < fh->buffers.buffer_size; off += PAGE_SIZE) + for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) ClearPageReserved(virt_to_page(mem + off)); kfree(mem); buffer->jpg.frag_tab[0] = 0; buffer->jpg.frag_tab[1] = 0; } } else { - for (j = 0; j < fh->buffers.buffer_size / PAGE_SIZE; j++) { + for (j = 0; j < zr->buffer_size / PAGE_SIZE; j++) { frag_tab = buffer->jpg.frag_tab[2 * j]; if (!frag_tab) @@ -416,9 +419,9 @@ static int zoran_v4l_set_format(struct zoran_fh *fh, int width, int height, bpp = (format->depth + 7) / 8; /* Check against available buffer size */ - if (height * width * bpp > fh->buffers.buffer_size) { + if (height * width * bpp > zr->buffer_size) { pci_err(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n", - __func__, fh->buffers.buffer_size >> 10); + __func__, zr->buffer_size >> 10); return -EINVAL; } @@ -1189,7 +1192,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, spin_unlock_irqrestore(&zr->spinlock, flags); buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf->length = fh->buffers.buffer_size; + buf->length = zr->buffer_size; /* get buffer */ buf->bytesused = fh->buffers.buffer[num].bs.length; @@ -1222,7 +1225,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, buf->type = (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ? V4L2_BUF_TYPE_VIDEO_CAPTURE : V4L2_BUF_TYPE_VIDEO_OUTPUT; - buf->length = fh->buffers.buffer_size; + buf->length = zr->buffer_size; /* these variables are only written after frame has been captured */ if (fh->buffers.buffer[num].state == BUZ_STATE_DONE || @@ -1634,7 +1637,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format fh->jpg_settings = settings; map_mode_jpg(fh, fmt->type == V4L2_BUF_TYPE_VIDEO_OUTPUT); - fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); + zr->buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); /* tell the user what we actually did */ fmt->fmt.pix.width = settings.img_width / settings.HorDcm; @@ -1646,7 +1649,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format fmt->fmt.pix.field = (fh->jpg_settings.odd_even ? V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM); fmt->fmt.pix.bytesperline = 0; - fmt->fmt.pix.sizeimage = fh->buffers.buffer_size; + fmt->fmt.pix.sizeimage = zr->buffer_size; fmt->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; return res; } @@ -1798,7 +1801,7 @@ static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffe /* The next mmap will map the MJPEG buffers */ map_mode_jpg(fh, req->type == V4L2_BUF_TYPE_VIDEO_OUTPUT); fh->buffers.num_buffers = req->count; - fh->buffers.buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); + zr->buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); if (jpg_fbuffer_alloc(fh)) { res = -ENOMEM; @@ -2270,8 +2273,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh, if (res) return res; if (!fh->buffers.allocated) - fh->buffers.buffer_size = - zoran_v4l2_calc_bufsize(&fh->jpg_settings); + zr->buffer_size = zoran_v4l2_calc_bufsize(&fh->jpg_settings); fh->jpg_settings.jpg_comp = settings.jpg_comp; return res; } @@ -2437,15 +2439,15 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) return res; } - first = offset / fh->buffers.buffer_size; - last = first - 1 + size / fh->buffers.buffer_size; - if (offset % fh->buffers.buffer_size != 0 || - size % fh->buffers.buffer_size != 0 || first < 0 || + first = offset / zr->buffer_size; + last = first - 1 + size / zr->buffer_size; + if (offset % zr->buffer_size != 0 || + size % zr->buffer_size != 0 || first < 0 || last < 0 || first >= fh->buffers.num_buffers || - last >= fh->buffers.buffer_size) { + last >= zr->buffer_size) { pci_err(zr->pci_dev, "%s(%s) - offset=%lu or size=%lu invalid for bufsize=%d and numbufs=%d\n", __func__, mode_name(fh->map_mode), offset, size, - fh->buffers.buffer_size, + zr->buffer_size, fh->buffers.num_buffers); res = -EINVAL; return res; @@ -2476,8 +2478,8 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) if (fh->map_mode == ZORAN_MAP_MODE_RAW) { for (i = first; i <= last; i++) { todo = size; - if (todo > fh->buffers.buffer_size) - todo = fh->buffers.buffer_size; + if (todo > zr->buffer_size) + todo = zr->buffer_size; page = fh->buffers.buffer[i].v4l.fbuffer_phys; if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, todo, PAGE_SHARED)) { @@ -2494,7 +2496,7 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) } else { for (i = first; i <= last; i++) { for (j = 0; - j < fh->buffers.buffer_size / PAGE_SIZE; + j < zr->buffer_size / PAGE_SIZE; j++) { fraglen = (le32_to_cpu(fh->buffers.buffer[i].jpg. From patchwork Mon Sep 21 10:19:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255718 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9093C43463 for ; Mon, 21 Sep 2020 10:22:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 87F90207BC for ; Mon, 21 Sep 2020 10:22:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="MFapb0WZ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726890AbgIUKVA (ORCPT ); Mon, 21 Sep 2020 06:21:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgIUKU6 (ORCPT ); Mon, 21 Sep 2020 06:20:58 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08C56C0613D4 for ; Mon, 21 Sep 2020 03:20:53 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id g4so12117098wrs.5 for ; Mon, 21 Sep 2020 03:20:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=acYsfKeNEhwhXW64kid3uQVciTvV530pHLdvT4EkhOs=; b=MFapb0WZTnmZYxo/+ryk7zdccjz6X8FBC93cC1U5HlCKki9ha2cSi3/VTHvApm0A9F wfiYdm4LoJZpmcdspQW5rXIUp4KdTf24gG6LCv8QKR/eDOQU/hM68PeLcOP7Jnz4myiY tLTQzBsHQ0aBLHl8ns3/1xf4IyCPx1erDnQFt/OJef4UL2mifCBtZaVEYvrXL6H7w3mU TgpwpaEo+eoBKjQ2AbiGiz7tbTI2JU+whjLg8pNMCWxQUdLtcpthYcVUK5H4KCwLpKdC D0sJhAmn4Dm1mKQEVY+WDIm7ki/+8fIIr9UVktSVOCuQv/WjtWty1dre9WaZGWug3QVg 0CYA== 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:in-reply-to :references; bh=acYsfKeNEhwhXW64kid3uQVciTvV530pHLdvT4EkhOs=; b=eegFmWVcr6ti5bQ2+hewTkoVqkSTZgZ+3ywYHWDAOAOOK0DAaci3+a+ZHrQFI9rhEt KOHgphUMVIgtoVPGQja9zMWANb9zShyVLJwMP6vn59JKbxBBb/YjSMHuBPP8HrZtgmK/ cNX4gwVvHTRkzY3dDhxJIOKlx+XcZnk80UZD6hqQS6dkzlb7GJW/guOCBDm0mUZYwQ36 ag3G4QEB+PPHSPhjCOLvLmGHAa1NalDPghfK452DrkXhWA35327KOV1uhOf9vUy91WyG TZHwAwKV9607jLPB0A5QGmGP2W2QZhAQ81R1SLguE9uYQ6EH6KQrsasUAgeoGPLKnmKx BMzA== X-Gm-Message-State: AOAM531mNqY9CCfBuBpTjy9QFOiZ6OjkS/v7HjPZKlaUwyvbvbsnxDsU C3Hajd3fg5axnJ+/GLdiN4VBvA== X-Google-Smtp-Source: ABdhPJwOqwj2DdxlPUUYHqY5YZyaVArlb2cPryKJCMnUYXsMB4+IKBo3UJpF0CE4yHthYegYqPMXLQ== X-Received: by 2002:a5d:630a:: with SMTP id i10mr50490903wru.137.1600683651707; Mon, 21 Sep 2020 03:20:51 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:51 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 20/49] staging: media: zoran: move overlay_settings out of zoran_fh Date: Mon, 21 Sep 2020 10:19:55 +0000 Message-Id: <1600683624-5863-21-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We need to get rid of zoran_fh, so move the overlay_settings directly in the zoran structure. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran.h | 1 - drivers/staging/media/zoran/zoran_device.c | 8 ++--- drivers/staging/media/zoran/zoran_driver.c | 40 +++++++++------------- 3 files changed, 21 insertions(+), 28 deletions(-) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 7e6e03563a2a..e9fef23a720c 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -211,7 +211,6 @@ struct zoran_fh { enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */ - struct zoran_overlay_settings overlay_settings; u32 *overlay_mask; /* overlay mask */ enum zoran_lock_activity overlay_active;/* feature currently in use? */ diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 4f9b28e63ac0..e81316ac6521 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -508,10 +508,10 @@ void write_overlay_mask(struct zoran_fh *fh, struct v4l2_clip *vp, int count) height += y; y = 0; } - if (x + width > fh->overlay_settings.width) - width = fh->overlay_settings.width - x; - if (y + height > fh->overlay_settings.height) - height = fh->overlay_settings.height - y; + if (x + width > zr->overlay_settings.width) + width = zr->overlay_settings.width - x; + if (y + height > zr->overlay_settings.height) + height = zr->overlay_settings.height - y; /* ignore degenerate clips */ if (height <= 0) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index f0ceda9a3d44..77cd2c07c394 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -744,9 +744,7 @@ static void zoran_open_init_session(struct zoran_fh *fh) map_mode_raw(fh); /* take over the card's current settings */ - fh->overlay_settings = zr->overlay_settings; - fh->overlay_settings.is_set = 0; - fh->overlay_settings.format = zr->overlay_settings.format; + zr->overlay_settings.is_set = 0; fh->overlay_active = ZORAN_FREE; /* buffers */ @@ -1005,7 +1003,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height return -EINVAL; } - if (!fh->overlay_settings.format) { + if (!zr->overlay_settings.format) { pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__); return -EINVAL; } @@ -1043,11 +1041,11 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height return -EINVAL; } - fh->overlay_settings.x = x; - fh->overlay_settings.y = y; - fh->overlay_settings.width = width; - fh->overlay_settings.height = height; - fh->overlay_settings.clipcount = clipcount; + zr->overlay_settings.x = x; + zr->overlay_settings.y = y; + zr->overlay_settings.width = width; + zr->overlay_settings.height = height; + zr->overlay_settings.clipcount = clipcount; /* * If an overlay is running, we have to switch it off @@ -1069,7 +1067,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height */ if (bitmap) { /* fake value - it just means we want clips */ - fh->overlay_settings.clipcount = 1; + zr->overlay_settings.clipcount = 1; if (copy_from_user(fh->overlay_mask, bitmap, (width * height + 7) / 8)) { @@ -1091,10 +1089,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height vfree(vcp); } - fh->overlay_settings.is_set = 1; - if (fh->overlay_active != ZORAN_FREE && - zr->overlay_active != ZORAN_FREE) - zr->overlay_settings = fh->overlay_settings; + zr->overlay_settings.is_set = 1; if (on) zr36057_overlay(zr, 1); @@ -1135,18 +1130,17 @@ static int setup_overlay(struct zoran_fh *fh, int on) zr36057_overlay(zr, 0); zr->overlay_mask = NULL; } else { - if (!zr->vbuf_base || !fh->overlay_settings.is_set) { + if (!zr->vbuf_base || !zr->overlay_settings.is_set) { pci_err(zr->pci_dev, "%s - buffer or window not set\n", __func__); return -EINVAL; } - if (!fh->overlay_settings.format) { + if (!zr->overlay_settings.format) { pci_err(zr->pci_dev, "%s - no overlay format set\n", __func__); return -EINVAL; } zr->overlay_active = fh->overlay_active = ZORAN_LOCKED; zr->v4l_overlay_active = 1; zr->overlay_mask = fh->overlay_mask; - zr->overlay_settings = fh->overlay_settings; if (!zr->v4l_memgrab_active) zr36057_overlay(zr, 1); /* @@ -1430,11 +1424,11 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh, struct zoran_fh *fh = __fh; struct zoran *zr = fh->zr; - fmt->fmt.win.w.left = fh->overlay_settings.x; - fmt->fmt.win.w.top = fh->overlay_settings.y; - fmt->fmt.win.w.width = fh->overlay_settings.width; - fmt->fmt.win.w.height = fh->overlay_settings.height; - if (fh->overlay_settings.width * 2 > BUZ_MAX_HEIGHT) + fmt->fmt.win.w.left = zr->overlay_settings.x; + fmt->fmt.win.w.top = zr->overlay_settings.y; + fmt->fmt.win.w.width = zr->overlay_settings.width; + fmt->fmt.win.w.height = zr->overlay_settings.height; + if (zr->overlay_settings.width * 2 > BUZ_MAX_HEIGHT) fmt->fmt.win.field = V4L2_FIELD_INTERLACED; else fmt->fmt.win.field = V4L2_FIELD_TOP; @@ -1703,7 +1697,7 @@ static int zoran_g_fbuf(struct file *file, void *__fh, fb->fmt.width = zr->vbuf_width; fb->fmt.height = zr->vbuf_height; if (zr->overlay_settings.format) - fb->fmt.pixelformat = fh->overlay_settings.format->fourcc; + fb->fmt.pixelformat = zr->overlay_settings.format->fourcc; fb->fmt.bytesperline = zr->vbuf_bytesperline; fb->fmt.colorspace = V4L2_COLORSPACE_SRGB; fb->fmt.field = V4L2_FIELD_INTERLACED; From patchwork Mon Sep 21 10:19:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255717 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 112D0C43463 for ; Mon, 21 Sep 2020 10:23:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0CE9207BC for ; Mon, 21 Sep 2020 10:23:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Du24+tm/" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727189AbgIUKXL (ORCPT ); Mon, 21 Sep 2020 06:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbgIUKU6 (ORCPT ); Mon, 21 Sep 2020 06:20:58 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CCDC0613D6 for ; Mon, 21 Sep 2020 03:20:54 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id t10so12133483wrv.1 for ; Mon, 21 Sep 2020 03:20:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=65FXJqBuVDUzxD7doK++gxysr5EY6cSmpC745+zOXJs=; b=Du24+tm/QhmhZ5IVy7r2qPHUeCurWcwjdhxfvUmy4+7fplJwd3mtGQfOB8MZgTqFl1 vbavMjLPVGU5vW1vR8Ms6EEpiDMFdTbMx6KzdLWgyGxAGWyJ9l3IJo+b51zvZfdlaWRo IgYhmvKycQsZFysfm9I7u+CkXkCTVxIy6D/955vSwybNxK5FpllxCk+uP/W68dKwvAhH t/Cv7GX9cr5h5PmH2L6acNNPIQNFtM9K0joVNuxFlS65+lOOCrjn7Ia5FfRHY7nCHeTt BT/0zrRLOTDyGVt4Wh2NawrP8Tl3/QtEXp9E9Y1Xrgx0Zm5VP3P4SCeTC7G59H/yNTtC 3F4A== 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:in-reply-to :references; bh=65FXJqBuVDUzxD7doK++gxysr5EY6cSmpC745+zOXJs=; b=BxqMoQDamNys4YIZza6PohM3lYy9T8596cH8YDV9nHiIeM9nfP2VxvlcXWWsvhYNmS MNP8s2BIxHHQenT3NIT0SApwtA7N1IDSS9z/dHxeFhGKbGQqUdxRVT2b00OJ83qfvnT0 ltNDzaY5sUHMg9eD69MSgbnzOCXXPIzU08BTPEnIsZOqyfTOlkAnj8a3+tdUVXDyFdcd pIjCNyhLHaOSEbYjQpT0w0I+NDuhyrUskLM3OALGCL2rrH6IlgR9I96zL1b5i+RP2EUM dsrq+u/GSBn2ZyE5uYYepAO07zO4kP3MsafNIeHn2OGIyNE9xox+F6oNW2JNTZ4CezZt FTGw== X-Gm-Message-State: AOAM530QXyoEVR8/Co0sMwmvrdBiUBjoa67WklfdXWVDjYSQInrULy7v KpuQMLMhyTwjPH3auVpdyJHA1A== X-Google-Smtp-Source: ABdhPJwk1tGudOVy78cc5atd6bTRWuBVMmN4LKzZfKPwxptMUejJSagxk3DjbhP5ecTDndV98Boo8A== X-Received: by 2002:a05:6000:85:: with SMTP id m5mr22915576wrx.160.1600683652749; Mon, 21 Sep 2020 03:20:52 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:51 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 21/49] staging: media: zoran: Use video_drvdata to get struct zoran Date: Mon, 21 Sep 2020 10:19:56 +0000 Message-Id: <1600683624-5863-22-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Using video_drvdata() is proper and shorter than using directly fh pointers. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 40 ++++++++-------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 77cd2c07c394..9d39e98c9af1 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1320,8 +1320,7 @@ static int zoran_set_input(struct zoran *zr, int input) static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); strscpy(cap->driver, "zoran", sizeof(cap->driver)); @@ -1352,8 +1351,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_CAPTURE); } @@ -1361,8 +1359,7 @@ static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh, static int zoran_enum_fmt_vid_out(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_PLAYBACK); } @@ -1370,8 +1367,7 @@ static int zoran_enum_fmt_vid_out(struct file *file, void *__fh, static int zoran_enum_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_fmtdesc *f) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); return zoran_enum_fmt(zr, f, ZORAN_FORMAT_OVERLAY); } @@ -1421,8 +1417,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); fmt->fmt.win.w.left = zr->overlay_settings.x; fmt->fmt.win.w.top = zr->overlay_settings.y; @@ -1439,8 +1434,7 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh, static int zoran_try_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); if (fmt->fmt.win.w.width > BUZ_MAX_WIDTH) fmt->fmt.win.w.width = BUZ_MAX_WIDTH; @@ -1641,8 +1635,8 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format *fmt) { + struct zoran *zr = video_drvdata(file); struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; int i; int res = 0; @@ -1689,8 +1683,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format static int zoran_g_fbuf(struct file *file, void *__fh, struct v4l2_framebuffer *fb) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); memset(fb, 0, sizeof(*fb)); fb->base = zr->vbuf_base; @@ -1709,8 +1702,8 @@ static int zoran_g_fbuf(struct file *file, void *__fh, static int zoran_s_fbuf(struct file *file, void *__fh, const struct v4l2_framebuffer *fb) { + struct zoran *zr = video_drvdata(file); struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; int i, res = 0; __le32 printformat = __cpu_to_le32(fb->fmt.pixelformat); @@ -2042,8 +2035,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); *std = zr->norm; return 0; @@ -2051,8 +2043,7 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); int res = 0; res = zoran_set_norm(zr, std); @@ -2065,8 +2056,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *inp) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); if (inp->index >= zr->card.inputs) return -EINVAL; @@ -2082,8 +2072,7 @@ static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *in static int zoran_g_input(struct file *file, void *__fh, unsigned int *input) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); *input = zr->input; @@ -2092,8 +2081,7 @@ static int zoran_g_input(struct file *file, void *__fh, unsigned int *input) static int zoran_s_input(struct file *file, void *__fh, unsigned int input) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); int res; res = zoran_set_input(zr, input); From patchwork Mon Sep 21 10:19:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255715 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB26C43465 for ; Mon, 21 Sep 2020 10:23:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7FEF20EDD for ; Mon, 21 Sep 2020 10:23:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="iqAWoqv5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726782AbgIUKXX (ORCPT ); Mon, 21 Sep 2020 06:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbgIUKU6 (ORCPT ); Mon, 21 Sep 2020 06:20:58 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1DF1C0613D9 for ; Mon, 21 Sep 2020 03:20:54 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id d4so11562080wmd.5 for ; Mon, 21 Sep 2020 03:20:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W9l+Ys/sZM3d6xhrHezcVkS5bzDQH0s3RIYh871x9x4=; b=iqAWoqv5mek5bGr8V+7R0brhUWGzYzXqVnoTLGANdKVfzIASu5Ltfsvs/4QvSr1bUj W13DByuHiY/QO33bU9WbKnRQIveOUq9DnzlbCwj/k9Wb0sXc6xN/r7a24sY5Mr5fmlW9 fehkIyJ/btG4MOLjcvxxxBmQsEuU8/+Q77ItYkW1vYAZuYW8Hgcj1G7tbGddUM6yjBoc 2f5+DJ7tggv8b7IlDjP2SRf7gJRqMLVtiFedDbDt3ktarlkUN64pGtcv0lmwGrAQQM74 73MCe6ygzcqb+xnEfU1jGZgwFmrKtVHDR4cuOOXIN60VVQH6n14jNbvOSWLyWMYFWQxx m06A== 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:in-reply-to :references; bh=W9l+Ys/sZM3d6xhrHezcVkS5bzDQH0s3RIYh871x9x4=; b=dmM50tdolhvW5F/xjVr9wItTIphWCT/JJZVjVxXy15a6fmoqubg8AfSjwoolKXR4pK Y0qRvwn5TRba6R/DFPcY69ZyBJXIgM9u47ik7uTfm4AnGfjauVfhm5D0UeSMBAYJSKdv qSXSwWPKw9fc8u5tyK80Ao/8dzgamX1/sEo5DTdgyWy5Yy8hzxGGT15GMYoYK8FLnRee B3VjH52dZgCLa/7+iSHJurcp74SkT+rSA9aTplqgdsBymxp+D+mDW+17krAf06qMNHet xJ/iQQmKmbdj8tZqwpAq1SYnKLXtzRZ3v4iLAD3HHIUoh3btkS9C886vHPfeWra3bZn2 aOqQ== X-Gm-Message-State: AOAM533WQ+vZ6I3h+SfnqkRuIrAS5tmAM1tSAEk13ECpov6kbkRl/4mF NpPF7eOBe8vU49T/X1WvEiNs5g== X-Google-Smtp-Source: ABdhPJx+Jio63BI97Ba3xgqm05G+Ycj9Xis82lW+zvFdcZtzfep2WU/z7PUICZIkSF0z6EKAwYAVtw== X-Received: by 2002:a1c:6187:: with SMTP id v129mr29088035wmb.35.1600683653663; Mon, 21 Sep 2020 03:20:53 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:53 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 22/49] staging: media: zoran: Change zoran_v4l_set_format parameter from zoran_fh to zoran Date: Mon, 21 Sep 2020 10:19:57 +0000 Message-Id: <1600683624-5863-23-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org We need to get rid of zoran_fh, so let's change function arguments. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 9d39e98c9af1..078575334b5d 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -401,11 +401,9 @@ static void jpg_fbuffer_free(struct zoran_fh *fh) /* * V4L Buffer grabbing */ - -static int zoran_v4l_set_format(struct zoran_fh *fh, int width, int height, +static int zoran_v4l_set_format(struct zoran *zr, int width, int height, const struct zoran_format *format) { - struct zoran *zr = fh->zr; int bpp; /* Check size and format of the grab wanted */ @@ -1665,7 +1663,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format map_mode_raw(fh); - res = zoran_v4l_set_format(fh, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]); + res = zoran_v4l_set_format(zr, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]); if (res) return res; From patchwork Mon Sep 21 10:20:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255719 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECE64C43465 for ; Mon, 21 Sep 2020 10:22:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE1ED20EDD for ; Mon, 21 Sep 2020 10:22:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="OLmZzc/r" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726912AbgIUKVC (ORCPT ); Mon, 21 Sep 2020 06:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbgIUKU7 (ORCPT ); Mon, 21 Sep 2020 06:20:59 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79A09C061755 for ; Mon, 21 Sep 2020 03:20:59 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id k18so12017824wmj.5 for ; Mon, 21 Sep 2020 03:20:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=14WJj/RqQjb5y9fKAYpp9xKxfwW/Mh3U1gqbae/yMEI=; b=OLmZzc/r2Nu25RC4agP9sFqGyGE70U4vF6jpgeTe/Ld9FCKI9UNwkO38fJLJpnZ1aT FCuiWAZQldH0H9H4eu33pQfeCK9MCtMtlQWhCWnWnB8wVDF+c3MNEupsagEPgbtYXDGt AOCBnJ7YKYP+Ed+Put7CP4VxKa0/l9MZaoJu94G23aW6gCRaY/wfw2obNAKsxpVXqAkY yq161oDjhmqwoRa0Frx1xjgajGOtn/IoFgdh4OVkXJ8DE9Vuc8TfMMwKIW06d6KwjPNL XFV2lOzn/RhtqaZ/CYpyLbt42ZFLL4f17M0TrKTSlEHOnmNe+2ZA4PkmVDmyVcJ0IwzU NW3w== 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:in-reply-to :references; bh=14WJj/RqQjb5y9fKAYpp9xKxfwW/Mh3U1gqbae/yMEI=; b=naFWWov12gX1ck0lW2RbkXjumMbEGlvkssMnW29j50g40Wns2O+ivDdqCOGuwaV4cm PG/4bTRQTF0vXtZIUtzrjImKnZIW25ZoKVEaTo72dsT7aNwYDDFsNXCpnWF/Qy9w1KbM mtepMMwUo6bjur94thywN6BkETrROGqFvx8MEEePWHXQcs2WR4LHQZ32LqeKzWzg6u67 ysNAWK/fDlTbqjUxxG1ua8aOIpvs9EUJtuITIzOXLMJ2+oh/YnIwOnDSOnz1Xt9lDAHt mXBcADDfq5dUghmosY0XgBgh4pVA4FuSlBUGmeFKtQcc8Fn2xmLm/4/KaQZ/V9DGkned cIHQ== X-Gm-Message-State: AOAM532pjzd5w0nMSz2MeBZeFNXnkZ1xEE+Sms+JUaTNSu4MPn9/z4ao 6rouIy+slH9Tphl+350AQnq/Ww== X-Google-Smtp-Source: ABdhPJx1Ryc9pfX4wBErhIyfQ0T8KkhSO1BIqse9FMAU5+1kMZdMdiuOXHzz3wNhtql/XUvTWjWShw== X-Received: by 2002:a1c:7508:: with SMTP id o8mr28218460wmc.127.1600683658224; Mon, 21 Sep 2020 03:20:58 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:57 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 27/49] staging: media: zoran: convert irq to pci irq Date: Mon, 21 Sep 2020 10:20:02 +0000 Message-Id: <1600683624-5863-28-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch convert zoran to pci_irq functions. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 1c587ce0d8c0..fe4d34e388b4 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1008,7 +1008,7 @@ static void zoran_remove(struct pci_dev *pdev) zoran_set_pci_master(zr, 0); /* put chip into reset */ btwrite(0, ZR36057_SPGPPCR); - free_irq(zr->pci_dev->irq, zr); + pci_free_irq(zr->pci_dev, 0, zr); /* unmap and free memory */ dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), zr->stat_com, zr->p_sc); iounmap(zr->zr36057_mem); @@ -1166,8 +1166,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_unreg; } - result = request_irq(zr->pci_dev->irq, zoran_irq, - IRQF_SHARED, ZR_DEVNAME(zr), zr); + result = pci_request_irq(pdev, 0, zoran_irq, NULL, zr, ZR_DEVNAME(zr)); if (result < 0) { if (result == -EINVAL) { pci_err(pdev, "%s - bad IRQ number or handler\n", __func__); @@ -1281,7 +1280,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zoran_unregister_i2c(zr); zr_free_irq: btwrite(0, ZR36057_SPGPPCR); - free_irq(zr->pci_dev->irq, zr); + pci_free_irq(zr->pci_dev, 0, zr); zr_unmap: iounmap(zr->zr36057_mem); zr_unreg: From patchwork Mon Sep 21 10:20:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255720 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D6BEC43464 for ; Mon, 21 Sep 2020 10:22:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF486207BC for ; Mon, 21 Sep 2020 10:22:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="SPcgfzwx" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726928AbgIUKVD (ORCPT ); Mon, 21 Sep 2020 06:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbgIUKVB (ORCPT ); Mon, 21 Sep 2020 06:21:01 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463FDC0613CF for ; Mon, 21 Sep 2020 03:21:01 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id k15so12116476wrn.10 for ; Mon, 21 Sep 2020 03:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Phn676ck9fxFNj85BpKV8apw8QC3TViwDCE0eTe2lKw=; b=SPcgfzwxG+7TAk0IVdcJAFHhW8FgtzKodBdFxADUrLFsEGadjF7vCav7EEu+lU0+GP NoSmoxIDJ3mjicDERBPfRbNj0tsMIMvrPFRtjvcX38BcDEyPZ+/MtRLdkL1pEoHeC0J+ gXrEKMhnbxYg66roPjpaq84u95xIeiKLqFwr6gZRgbMVE1Ejz55JtyaTrEwjb4KbTcfG PpIGABEtexnVZHJNYqRPwi+RilJspBYCpSHEv7rBDHbghA1z5RyiTEM2DE/c619SP3FJ TbuHDmkJTLnNPptMWYqQEXm86UexWo+n/qwGjWsOL0TI/mnhmAyDZPYrSSrudAVE9pX/ XHFA== 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:in-reply-to :references; bh=Phn676ck9fxFNj85BpKV8apw8QC3TViwDCE0eTe2lKw=; b=lrSsfNt3CW7AMFuOT3xuzGU1iJj/CDcc5WIpzbFuIXN2DKzpZ/GHJy8CqjqvcxMq6n Is49BCv8Iz7FvYXh525wr3i6rz6hjJilKnSvJiXv8cnrhGsLF7qjuOdLMyUpquLwJm/M 0SljNoW/8ArOffl4gk241q5hDEWJKt4ABYkJ54uOtizL/pN5Nb3s87Go81oyYUnTjpmo iJyk58iJL9TY8M/4uVQcqZ50RoNxhmsjK+Oqty1aDjFDHhDFQByQBdCD6iwfTARkco1L 58c3t5bo/Dg2RBOxCfE7ADKK5tFdpSOH2rsdtExttmOOAo5XnznBKJ2Or53TBcqgdyAa sTxw== X-Gm-Message-State: AOAM531VrWoXUUPaqs5Bf7hu2Po0Jfa67rjYGSqAKdqYJMMiQPjmF18j eO15XOQzW8vrYa+JXPm5vcmy/Q== X-Google-Smtp-Source: ABdhPJzidbt0pzET/EtSowQUwY6EY9mSfVSCXN4I8uUlbcM+UuJ2gQy4RnxaDKlVsybR+D7AZPvq9A== X-Received: by 2002:a5d:668b:: with SMTP id l11mr50274670wru.89.1600683660027; Mon, 21 Sep 2020 03:21:00 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.20.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:20:59 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 29/49] staging: media: zoran: convert mdelay to udelay Date: Mon, 21 Sep 2020 10:20:04 +0000 Message-Id: <1600683624-5863-30-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As asked by checkpath, let's use udelay. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 3a353130afb9..82d522c1a528 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -1315,9 +1315,9 @@ void zoran_init_hardware(struct zoran *zr) void zr36057_restart(struct zoran *zr) { btwrite(0, ZR36057_SPGPPCR); - mdelay(1); + udelay(1000); btor(ZR36057_SPGPPCR_SoftReset, ZR36057_SPGPPCR); - mdelay(1); + udelay(1000); /* assert P_Reset */ btwrite(0, ZR36057_JPC); From patchwork Mon Sep 21 10:20:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255730 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E275BC43466 for ; Mon, 21 Sep 2020 10:21:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABCAB207BC for ; Mon, 21 Sep 2020 10:21:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="aTvoD3hF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726935AbgIUKVE (ORCPT ); Mon, 21 Sep 2020 06:21:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726924AbgIUKVD (ORCPT ); Mon, 21 Sep 2020 06:21:03 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15F2AC061755 for ; Mon, 21 Sep 2020 03:21:03 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id m6so12148248wrn.0 for ; Mon, 21 Sep 2020 03:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r85oKelmSxCT/ytNZb+5lrzckUj7jOhmVdpf8jChvhQ=; b=aTvoD3hFXs3POFwDeGWyKdJ5WNaRfIUoDo3FLhNdWtwLbIgWIC+y8D//me7P05cZBL mfqi8yRRUNP+A+ONA5XfI1lgHoVeBeNXWHk5SSAMd16oikUA9+mXSWxN59qqQFpaay5b E4OMN3iLZWjyBf5dDc10VlinaR7+6JQxh70cO0U67K2ebbOl7dnA8Sclvv8pVR/DrUSE 7pKvEwaEZIJVn6INdPJJUaRGV/EfIBQbc9iDoi9dOsvxPbeJ2wL1Gg5kVd4ygIYDcDll h0SUVJSqhd5JcaZbo1RzpE0k3mDwR0oj2gFfoDKAEIVWFUMG+I1JHA0TrocC9yg4/yIs RbrQ== 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:in-reply-to :references; bh=r85oKelmSxCT/ytNZb+5lrzckUj7jOhmVdpf8jChvhQ=; b=iieUMNOMtNUmIFmf52GKxeC8NdtQox9aUXKDM6I21O9bpZczW9z5a5DOVln0f5Ho7a UH1xBOhUoTpuk2m0Vt8CjxwYEaOq6VYB3ceKEruW9/TwFje7GvxqgKvdkaOfBdbvJOZn zcS/3b55ceXH5hOLDBwLzi9X/kkAbSe/pM0e4iVAp0AOFRuoGGD1TIrCFXqU+S0pbGqW 2287WJT6sv3pmRvysjO2hgd0lhB5+5kf1nMwEJ2dTCkmZJSR5IrjWFoAjCFWfBnPmkxV WCgYiB9eT6bbpGGTMo8oCTQ5N181ElLQOEsm6Pk2C3jR8wJLCN1TcRmTLvMxx8yPYCz7 JiUQ== X-Gm-Message-State: AOAM530i0IoSH64gcl1Thno7xpqstEmvcy4pGWFf6hWmDARgo8IGdh2o 1Gr6ftNz80/zBsAaeddo+J1z9Q== X-Google-Smtp-Source: ABdhPJx3vSrvmd5LQMjT6ohRvSlIA6LBabrT+xHJ+GrgKpx5lmH4iadrY/KQb8lY1YMKMr3HjkoCDw== X-Received: by 2002:a5d:6291:: with SMTP id k17mr51139822wru.130.1600683661822; Mon, 21 Sep 2020 03:21:01 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:01 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 31/49] staging: media: zoran: use pci_request_regions Date: Mon, 21 Sep 2020 10:20:06 +0000 Message-Id: <1600683624-5863-32-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Use pci_request_regions so now we can see zoran in /proc/iomem. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 756b9a339f7e..ed4ecf92c040 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1004,6 +1004,7 @@ static void zoran_remove(struct pci_dev *pdev) /* unmap and free memory */ dma_free_coherent(&zr->pci_dev->dev, BUZ_NUM_STAT_COM * sizeof(u32), zr->stat_com, zr->p_sc); iounmap(zr->zr36057_mem); + pci_release_regions(pdev); pci_disable_device(zr->pci_dev); video_unregister_device(zr->video_dev); exit_free: @@ -1151,10 +1152,14 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->card = zoran_cards[card_num]; snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "%s[%u]", zr->card.name, zr->id); + err = pci_request_regions(pdev, ZR_DEVNAME(zr)); + if (err) + goto zr_unreg; + zr->zr36057_mem = pci_ioremap_bar(zr->pci_dev, 0); if (!zr->zr36057_mem) { pci_err(pdev, "%s() - ioremap failed\n", __func__); - goto zr_unreg; + goto zr_pci_release; } result = pci_request_irq(pdev, 0, zoran_irq, NULL, zr, ZR_DEVNAME(zr)); @@ -1270,6 +1275,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_free_irq(zr->pci_dev, 0, zr); zr_unmap: iounmap(zr->zr36057_mem); +zr_pci_release: + pci_release_regions(pdev); zr_unreg: v4l2_ctrl_handler_free(&zr->hdl); v4l2_device_unregister(&zr->v4l2_dev); From patchwork Mon Sep 21 10:20:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAC16C43463 for ; Mon, 21 Sep 2020 10:22:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3B7121D43 for ; Mon, 21 Sep 2020 10:22:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="JCcu8rOS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726640AbgIUKW1 (ORCPT ); Mon, 21 Sep 2020 06:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726948AbgIUKVG (ORCPT ); Mon, 21 Sep 2020 06:21:06 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDCBBC061755 for ; Mon, 21 Sep 2020 03:21:05 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id b79so12013232wmb.4 for ; Mon, 21 Sep 2020 03:21:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OuktUbzogSgMnm6tl68bM64IlyF+ws6MaXPokPAQRHg=; b=JCcu8rOSnPInqXXKrkjuF8aGuowsFaGAbtpYyb+vQHU7NqPENDa9PW1qv8sAfKG1f3 7ntQVJJZGoBUND9z+U/AAht1eWh5G/xaHd+Ojy86mTkXkHqGrfpq7cQIUJHHomFT7ait tQhT432OntImygVT+KMUCebXRrIC9w2Ex4czSug9xHx6W3wOUR4Ef7v3Q+7KZVsJJVQw whoqxIl+7pkUT/u242X0EMAD1q4tcn6lHU5Uoh+PWv4P0ZhaV9iJ9lZ2XHdY3BJoTpDY G0O6Ocfbz+qG86kxfAb2iXxcQs+zspSw5+4QSCm5c8SIZiGLBT/rd2BjisiuKUO605hA OZkA== 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:in-reply-to :references; bh=OuktUbzogSgMnm6tl68bM64IlyF+ws6MaXPokPAQRHg=; b=HSFfKL+uNYoBQX7xigBUL49SUtxb4RMmL6fwriu9SfWTLN66lF4aYxMPUGlPV0KkNc tR9u9m/zYPltK4011MD/qbPliy+6LfcRUKFi7wNoqZHrvBiHYNXOHhP/53MYu9EptGc3 oQqDPaz6qVDRsDD6hFGEvqf61Gul4IAskvBUvwZWPRU/nUEeMY0FASHlZFQFga8vwrbL C19BtPbv1MzDOW9dLzWH5Uq2LTRGYvM8Uh3ozTgSun2CPXUVKU3PT/2/wGv6m5xO0h9w b9ZaoiHLtLcqyaDniEC/8TvdkbtPR/DHVhjNaNG+TWohpcSBjvORSg+D6wzUYTUEJzL4 dG6Q== X-Gm-Message-State: AOAM531I6C4BvUq0Lgw6SNURzkB8zgUOiv6D+08Fh3rsqA4o0LiXIfwA fwL3+74D+VmfhgxR7IYbcSChHw== X-Google-Smtp-Source: ABdhPJz9qluklEwv8ciov73f9EFAyhxDpwQwXye4ZaFDhhVRjgzehOstV5sBL1dsX8CAEJIsF5SddQ== X-Received: by 2002:a05:600c:220f:: with SMTP id z15mr16339258wml.87.1600683664607; Mon, 21 Sep 2020 03:21:04 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:03 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 34/49] staging: media: zoran: constify struct tvnorm Date: Mon, 21 Sep 2020 10:20:09 +0000 Message-Id: <1600683624-5863-35-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The structure tvnorm could be consified. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/videocodec.h | 2 +- drivers/staging/media/zoran/zoran.h | 4 ++-- drivers/staging/media/zoran/zoran_card.c | 24 +++++++++++----------- drivers/staging/media/zoran/zoran_device.c | 4 ++-- drivers/staging/media/zoran/zr36016.c | 4 ++-- drivers/staging/media/zoran/zr36050.c | 4 ++-- drivers/staging/media/zoran/zr36060.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/staging/media/zoran/videocodec.h b/drivers/staging/media/zoran/videocodec.h index 553af4ad431e..a049f3c2c68a 100644 --- a/drivers/staging/media/zoran/videocodec.h +++ b/drivers/staging/media/zoran/videocodec.h @@ -256,7 +256,7 @@ struct videocodec { // set compression or decompression (or freeze, stop, standby, etc) int (*set_mode)(struct videocodec *codec, int mode); // setup picture size and norm (for the codec's video frontend) - int (*set_video)(struct videocodec *codec, struct tvnorm *norm, + int (*set_video)(struct videocodec *codec, const struct tvnorm *norm, struct vfe_settings *cap, struct vfe_polarity *pol); // other control commands, also mmap setup etc. int (*control)(struct videocodec *codec, int type, int size, void *data); diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index c73b7e7fd5e1..727ba67afd56 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -227,7 +227,7 @@ struct card_info { } input[BUZ_MAX_INPUT]; v4l2_std_id norms; - struct tvnorm *tvn[3]; /* supported TV norms */ + const struct tvnorm *tvn[3]; /* supported TV norms */ u32 jpeg_int; /* JPEG interrupt */ u32 vsync_int; /* VSYNC interrupt */ @@ -266,7 +266,7 @@ struct zoran { u8 initialized; /* flag if zoran has been correctly initialized */ int user; /* number of current users */ struct card_info card; - struct tvnorm *timing; + const struct tvnorm *timing; unsigned short id; /* number of this device */ char name[32]; /* name of this device */ diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index b841f532e6bb..176ce8a355ba 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -277,24 +277,24 @@ static char *codecid_to_modulename(u16 codecid) // u16 Wt, Wa, HStart, HSyncStart, Ht, Ha, VStart; // }; -static struct tvnorm f50sqpixel = { 944, 768, 83, 880, 625, 576, 16 }; -static struct tvnorm f60sqpixel = { 780, 640, 51, 716, 525, 480, 12 }; -static struct tvnorm f50ccir601 = { 864, 720, 75, 804, 625, 576, 18 }; -static struct tvnorm f60ccir601 = { 858, 720, 57, 788, 525, 480, 16 }; +static const struct tvnorm f50sqpixel = { 944, 768, 83, 880, 625, 576, 16 }; +static const struct tvnorm f60sqpixel = { 780, 640, 51, 716, 525, 480, 12 }; +static const struct tvnorm f50ccir601 = { 864, 720, 75, 804, 625, 576, 18 }; +static const struct tvnorm f60ccir601 = { 858, 720, 57, 788, 525, 480, 16 }; -static struct tvnorm f50ccir601_lml33 = { 864, 720, 75 + 34, 804, 625, 576, 18 }; -static struct tvnorm f60ccir601_lml33 = { 858, 720, 57 + 34, 788, 525, 480, 16 }; +static const struct tvnorm f50ccir601_lml33 = { 864, 720, 75 + 34, 804, 625, 576, 18 }; +static const struct tvnorm f60ccir601_lml33 = { 858, 720, 57 + 34, 788, 525, 480, 16 }; /* The DC10 (57/16/50) uses VActive as HSync, so HStart must be 0 */ -static struct tvnorm f50sqpixel_dc10 = { 944, 768, 0, 880, 625, 576, 0 }; -static struct tvnorm f60sqpixel_dc10 = { 780, 640, 0, 716, 525, 480, 12 }; +static const struct tvnorm f50sqpixel_dc10 = { 944, 768, 0, 880, 625, 576, 0 }; +static const struct tvnorm f60sqpixel_dc10 = { 780, 640, 0, 716, 525, 480, 12 }; /* * FIXME: I cannot swap U and V in saa7114, so i do one pixel left shift in zoran (75 -> 74) * (Maxim Yevtyushkin ) */ -static struct tvnorm f50ccir601_lm33r10 = { 864, 720, 74 + 54, 804, 625, 576, 18 }; -static struct tvnorm f60ccir601_lm33r10 = { 858, 720, 56 + 54, 788, 525, 480, 16 }; +static const struct tvnorm f50ccir601_lm33r10 = { 864, 720, 74 + 54, 804, 625, 576, 18 }; +static const struct tvnorm f60ccir601_lm33r10 = { 858, 720, 56 + 54, 788, 525, 480, 16 }; /* * FIXME: The ks0127 seem incapable of swapping U and V, too, which is why I copy Maxim's left @@ -303,8 +303,8 @@ static struct tvnorm f60ccir601_lm33r10 = { 858, 720, 56 + 54, 788, 525, 480, 16 * Christer's driver used the unshifted norms, though... * /Sam */ -static struct tvnorm f50ccir601_avs6eyes = { 864, 720, 74, 804, 625, 576, 18 }; -static struct tvnorm f60ccir601_avs6eyes = { 858, 720, 56, 788, 525, 480, 16 }; +static const struct tvnorm f50ccir601_avs6eyes = { 864, 720, 74, 804, 625, 576, 18 }; +static const struct tvnorm f60ccir601_avs6eyes = { 858, 720, 56, 788, 525, 480, 16 }; static const unsigned short vpx3220_addrs[] = { 0x43, 0x47, I2C_CLIENT_END }; static const unsigned short saa7110_addrs[] = { 0x4e, 0x4f, I2C_CLIENT_END }; diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index 82d522c1a528..9558bafdde7d 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -292,7 +292,7 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode) static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height, const struct zoran_format *format) { - struct tvnorm *tvn; + const struct tvnorm *tvn; unsigned int HStart, HEnd, VStart, VEnd; unsigned int DispMode; unsigned int VidWinWid, VidWinHt; @@ -510,7 +510,7 @@ static void init_jpeg_queue(struct zoran *zr) static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode) { - struct tvnorm *tvn; + const struct tvnorm *tvn; u32 reg; tvn = zr->timing; diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c index a8190005bc4d..046cffb92f5f 100644 --- a/drivers/staging/media/zoran/zr36016.c +++ b/drivers/staging/media/zoran/zr36016.c @@ -238,8 +238,8 @@ static int zr36016_set_mode(struct videocodec *codec, int mode) } /* set picture size */ -static int zr36016_set_video(struct videocodec *codec, struct tvnorm *norm, - struct vfe_settings *cap, struct vfe_polarity *pol) +static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm, + struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36016 *ptr = (struct zr36016 *)codec->data; diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c index f551631c18cd..348b9f0ab74c 100644 --- a/drivers/staging/media/zoran/zr36050.c +++ b/drivers/staging/media/zoran/zr36050.c @@ -554,8 +554,8 @@ static int zr36050_set_mode(struct videocodec *codec, int mode) } /* set picture size (norm is ignored as the codec doesn't know about it) */ -static int zr36050_set_video(struct videocodec *codec, struct tvnorm *norm, - struct vfe_settings *cap, struct vfe_polarity *pol) +static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm, + struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36050 *ptr = (struct zr36050 *)codec->data; int size; diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c index 0a0916f5f8cd..773de0e64daf 100644 --- a/drivers/staging/media/zoran/zr36060.c +++ b/drivers/staging/media/zoran/zr36060.c @@ -477,7 +477,7 @@ static int zr36060_set_mode(struct videocodec *codec, int mode) } /* set picture size (norm is ignored as the codec doesn't know about it) */ -static int zr36060_set_video(struct videocodec *codec, struct tvnorm *norm, +static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm, struct vfe_settings *cap, struct vfe_polarity *pol) { struct zr36060 *ptr = (struct zr36060 *)codec->data; From patchwork Mon Sep 21 10:20:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 947C7C43465 for ; Mon, 21 Sep 2020 10:22:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50460205F4 for ; Mon, 21 Sep 2020 10:22:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="H6312PE+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727119AbgIUKWS (ORCPT ); Mon, 21 Sep 2020 06:22:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726952AbgIUKVH (ORCPT ); Mon, 21 Sep 2020 06:21:07 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E32B3C0613D1 for ; Mon, 21 Sep 2020 03:21:06 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id l9so12024674wme.3 for ; Mon, 21 Sep 2020 03:21:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dGPy5ojL0a12oJizSoTZbHP5FGaftfAgkoEVHs65l4s=; b=H6312PE+010ywJeFOg4lNE3sW8va0OwgWJcvpBLNSV2n4oQ/q8IOwKVpE4MsPUnCeQ 3lpyvqzzokBMxsB7SmGe6P7LXw7OeHq5WbZxslzvA9P2yo0fJ0pTvlMWXOzRQzKv5LJn qREcus9oypZcllMr4npr7tiYPVtXo8D4b/UiQDXlaqafrU8hDph/dIUwP1h0id/08Tut nUn/Tp0o6OCDVI6BX+DecGAk9Tm39IxMfe171qbtAJ/dmDpitBnqim6npCnJjDUAFKSK CjHDaVPZuxwdAuBXj+rNfxl9txyLroSy6dhuekiskmcVACAtl8XF5cgwVLhIWBxO1Pp3 58Bw== 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:in-reply-to :references; bh=dGPy5ojL0a12oJizSoTZbHP5FGaftfAgkoEVHs65l4s=; b=Z1WKqLp8M+y8ijKt/v6NLYoFsP5qXoqW6rzCC/3IlgjRvPGwTBSjtDHunw3GnlWVcJ PRTXmHyP9M4wWbNV5nmay/RnMFVJ3+HvA+x/gLfciEb6aIgSgtwDSA4xt5axasvlytdh A1fMRNeFp+wRwG9ziHDl8FEoHFUdZt7Yx8PtRQmd/SIsF9/v+zcyq84lJ+q45yP4NFBy E5WRX6yjx8cP3AExXffAhDDZXXtavcaP7tThuXhYqDxTllIDwTCfevYOq7Od6DRrpHHL xmNpAeHrvvuKddMge2jzNO0ycbMRkepWDNOXzM0mxKb5I5/HXNIczklU7mIt4qLfYKsx 8qtQ== X-Gm-Message-State: AOAM531O9KYp6fvKsNw5mtn90dIGImAWqY3lYJFE7AkyLLBNDEi6KyLe AFBuwxojcXA0dGdbZDS8lwV2dNMTIfe3Rg== X-Google-Smtp-Source: ABdhPJzNjyNJHKBehOtbtsaCLPkzNr95oSX2JPP9UpbfgavliKvqivJ0H/6ycjsOjh8/p3Iea3rfVg== X-Received: by 2002:a7b:c0ca:: with SMTP id s10mr29336977wmh.103.1600683665592; Mon, 21 Sep 2020 03:21:05 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:04 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 35/49] staging: media: zoran: constify codec_name Date: Mon, 21 Sep 2020 10:20:10 +0000 Message-Id: <1600683624-5863-36-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The codec_name could be const. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 176ce8a355ba..d956bd45194f 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -254,9 +254,9 @@ static void avs6eyes_init(struct zoran *zr) GPIO(zr, 7, mux & 4); /* MUX S2 */ } -static char *codecid_to_modulename(u16 codecid) +static const char *codecid_to_modulename(u16 codecid) { - char *name = NULL; + const char *name = NULL; switch (codecid) { case CODEC_TYPE_ZR36060: @@ -1092,7 +1092,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct videocodec_master *master_vfe = NULL; struct videocodec_master *master_codec = NULL; int card_num; - char *codec_name, *vfe_name; + const char *codec_name, *vfe_name; unsigned int nr; nr = zoran_num++; From patchwork Mon Sep 21 10:20:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255729 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52F88C43464 for ; Mon, 21 Sep 2020 10:21:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2D16205F4 for ; Mon, 21 Sep 2020 10:21:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="zR38c7Se" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbgIUKVN (ORCPT ); Mon, 21 Sep 2020 06:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726983AbgIUKVL (ORCPT ); Mon, 21 Sep 2020 06:21:11 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B10D1C0613CF for ; Mon, 21 Sep 2020 03:21:09 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id l15so11153248wmh.1 for ; Mon, 21 Sep 2020 03:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sIJI1VmfT4UQyJ8L1vQhQ3LXVu1W40LxciQOzXqhnFQ=; b=zR38c7SeOoxikufCUp8OwDGZoe3jI7qvWTUwzIXCtaY0y4YHuj7D/new/NRF4AUw5e /vOBrsHoFiIk+KJlVSNhiem+g2/WcFDBG7UbnE48F0Re3pmGozxroae5AcpNencz9E/f 09C63vnRrOYjnW8uXRcuLCL9X3BDWvEibTqsAXyqQ4SkqCir4Ok7NRXACIc2qZzKje7l Ur3S6NOgIm1e7IFyLSs6gFWon0O5mw1ffh1O4158Qf3AloIwzBytEfI2TCEyanxo0Nn0 8y71NQ/BKj58S2KmqxQalJ+pAMa0AGVkgT4RozMrLdlJwvNfbf76Yqy29aA0ha6dKgxI IfaQ== 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:in-reply-to :references; bh=sIJI1VmfT4UQyJ8L1vQhQ3LXVu1W40LxciQOzXqhnFQ=; b=FGdiBoezg+545r8PxVDYsb+VA4igtGzB/7PpLTnwsrgD4uUmzZfxm8Lyw+qzzGbNnX bTHOtB6sqObFajobI1POXhtEFjmPxEOoIeOf50Ja9SjG6V+W4v74xSLcqv4wLAXrt7Fy mOJbohrSg4+aUvkaqovF3Pb4c3X7qpqVxWQOqi+ZEGAvzfDRU7Yosf2SROL6rJe67q3x qHHeJvY1Rj+YdM9/vL/52yhwiRxWQYhjSXaeVQKU1X+xCo1lrsbTdoXhPrW5XCE3eIe4 dKWyoSrt3epeATvXiE69HxYDrE7NjhpxGifA2hBvMRQ+RdmwOEAxiaU+e4Ej3kD4Pg6N jpJQ== X-Gm-Message-State: AOAM533AQ8UbMKQDRdLAVVIh6IMPkLcII20xvgicewK+n2UoRh/CpqgS M5O4+WF9lkhz53JBM0RDesVuKQ== X-Google-Smtp-Source: ABdhPJx2gYuKZb+y0TS5XFiEyqCrjEpoW+LpkvCqGkFYyjvD+J8jfUk6sj2b5WUr+4M5kREALWUhaA== X-Received: by 2002:a1c:800f:: with SMTP id b15mr28034106wmd.114.1600683668382; Mon, 21 Sep 2020 03:21:08 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:07 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 38/49] staging: media: zoran: Add vb_queue Date: Mon, 21 Sep 2020 10:20:13 +0000 Message-Id: <1600683624-5863-39-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patchs adds a vb_queue without using it. This reduce the final VB2 conversion patch. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 1 + drivers/staging/media/zoran/zoran.h | 30 +++ drivers/staging/media/zoran/zoran_card.c | 7 + drivers/staging/media/zoran/zoran_driver.c | 233 +++++++++++++++++++++ 4 files changed, 271 insertions(+) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index 34a18135ede0..ddf38a931c01 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -2,6 +2,7 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS depends on !ALPHA + select VIDEOBUF2_DMA_CONTIG help Say Y for support for MJPEG capture cards based on the Zoran 36057/36067 PCI controller chipset. This includes the Iomega diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 727ba67afd56..294e52d78e1b 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -21,6 +21,9 @@ #include #include #include +#include +#include +#include #define ZR_NORM_PAL 0 #define ZR_NORM_NTSC 1 @@ -33,6 +36,18 @@ struct zoran_sync { u64 ts; /* timestamp */ }; +struct zr_buffer { + /* common v4l buffer stuff -- must be first */ + struct vb2_v4l2_buffer vbuf; + struct list_head queue; +}; + +static inline struct zr_buffer *vb2_to_zr_buffer(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb); + + return container_of(vbuf, struct zr_buffer, vbuf); +} #define ZORAN_NAME "ZORAN" /* name of the device */ @@ -104,6 +119,7 @@ enum zoran_buffer_state { }; enum zoran_map_mode { + ZORAN_MAP_MODE_NONE, ZORAN_MAP_MODE_RAW, ZORAN_MAP_MODE_JPG_REC, #define ZORAN_MAP_MODE_JPG ZORAN_MAP_MODE_JPG_REC @@ -250,6 +266,7 @@ struct zoran { struct v4l2_device v4l2_dev; struct v4l2_ctrl_handler hdl; struct video_device *video_dev; + struct vb2_queue vq; struct i2c_adapter i2c_adapter; /* */ struct i2c_algo_bit_data i2c_algo; /* */ @@ -320,6 +337,7 @@ struct zoran { unsigned long jpg_err_seq; /* last seq_num before error */ unsigned long jpg_err_shift; unsigned long jpg_queued_num; /* count of frames queued since grab/play started */ + unsigned long vbseq; /* zr36057's code buffer table */ __le32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ @@ -350,15 +368,23 @@ struct zoran { int num_errors; int JPEG_max_missed; int JPEG_min_missed; + unsigned int prepared; + unsigned int queued; u32 last_isr; unsigned long frame_num; + int running; + int buf_in_reserve; wait_queue_head_t test_q; dma_addr_t p_sc; __le32 *stat_comb; dma_addr_t p_scb; + enum zoran_map_mode map_mode; + struct list_head queued_bufs; + spinlock_t queued_bufs_lock; /* Protects queued_bufs */ + struct zr_buffer *inuse[BUZ_NUM_STAT_COM * 2]; }; static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) @@ -376,3 +402,7 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) #define btaor(dat, mask, adr) btwrite((dat) | ((mask) & btread(adr)), adr) #endif + +int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq); +void zoran_queue_exit(struct zoran *zr); +int zr_set_buf(struct zoran *zr); diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index d956bd45194f..93318ae1803a 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -961,6 +961,9 @@ static int zr36057_init(struct zoran *zr) * another day. */ zr->video_dev->vfl_dir = VFL_DIR_M2M; + + zoran_queue_init(zr, &zr->vq); + err = video_register_device(zr->video_dev, VFL_TYPE_VIDEO, video_nr[zr->id]); if (err < 0) goto exit_statcomb; @@ -996,6 +999,8 @@ static void zoran_remove(struct pci_dev *pdev) if (!zr->initialized) goto exit_free; + zoran_queue_exit(zr); + /* unregister videocodec bus */ if (zr->codec) videocodec_detach(zr->codec); @@ -1270,6 +1275,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (zr36057_init(zr) < 0) goto zr_detach_vfe; + zr->map_mode = ZORAN_MAP_MODE_RAW; + return 0; zr_detach_vfe: diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index a326c0a16e0c..2c1e70cf2f0c 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -2255,3 +2255,236 @@ const struct video_device zoran_template = { .tvnorms = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM, }; +static int zr_vb2_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsigned int *nplanes, + unsigned int sizes[], struct device *alloc_devs[]) +{ + struct zoran *zr = vb2_get_drv_priv(vq); + unsigned int size = zr->buffer_size; + + pci_dbg(zr->pci_dev, "%s nbuf=%u nplanes=%u", __func__, *nbuffers, *nplanes); + + zr->buf_in_reserve = 0; + + if (*nbuffers < vq->min_buffers_needed) + *nbuffers = vq->min_buffers_needed; + + if (*nplanes) + if (sizes[0] < size) + return -EINVAL; + else + return 0; + *nplanes = 1; + sizes[0] = size; + + return 0; +} + +static void zr_vb2_queue(struct vb2_buffer *vb) +{ + struct zoran *zr = vb2_get_drv_priv(vb->vb2_queue); + struct zr_buffer *buf = vb2_to_zr_buffer(vb); + unsigned long flags; + + spin_lock_irqsave(&zr->queued_bufs_lock, flags); + list_add_tail(&buf->queue, &zr->queued_bufs); + zr->buf_in_reserve++; + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + if (zr->running == ZORAN_MAP_MODE_JPG_REC) + zoran_feed_stat_com(zr); + zr->queued++; +} + +static int zr_vb2_prepare(struct vb2_buffer *vb) +{ + struct zoran *zr = vb2_get_drv_priv(vb->vb2_queue); + + zr->prepared++; + return 0; +} + +int zr_set_buf(struct zoran *zr) +{ + struct zr_buffer *buf; + struct vb2_v4l2_buffer *vbuf; + dma_addr_t phys_addr; + unsigned long flags; + u32 reg; + + if (zr->running == ZORAN_MAP_MODE_NONE) + return 0; + + if (zr->inuse[0]) { + buf = zr->inuse[0]; + buf->vbuf.vb2_buf.timestamp = ktime_get_ns(); + buf->vbuf.sequence = zr->vbseq++; + vbuf = &buf->vbuf; + + buf->vbuf.field = V4L2_FIELD_INTERLACED; + vb2_set_plane_payload(&buf->vbuf.vb2_buf, 0, zr->buffer_size); + vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_DONE); + zr->inuse[0] = NULL; + } + + spin_lock_irqsave(&zr->queued_bufs_lock, flags); + if (list_empty(&zr->queued_bufs)) { + btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); + vb2_queue_error(zr->video_dev->queue); + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + return -EINVAL; + } + buf = list_first_entry_or_null(&zr->queued_bufs, struct zr_buffer, queue); + if (!buf) { + btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); + vb2_queue_error(zr->video_dev->queue); + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + return -EINVAL; + } + list_del(&buf->queue); + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + + vbuf = &buf->vbuf; + vbuf->vb2_buf.state = VB2_BUF_STATE_ACTIVE; + phys_addr = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0); + + if (!phys_addr) + return -EINVAL; + + zr->inuse[0] = buf; + + reg = phys_addr; + btwrite(reg, ZR36057_VDTR); + if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) + reg += zr->v4l_settings.bytesperline; + btwrite(reg, ZR36057_VDBR); + + reg = 0; + if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) + reg += zr->v4l_settings.bytesperline; + reg = (reg << ZR36057_VSSFGR_DispStride); + reg |= ZR36057_VSSFGR_VidOvf; + reg |= ZR36057_VSSFGR_SnapShot; + reg |= ZR36057_VSSFGR_FrameGrab; + btwrite(reg, ZR36057_VSSFGR); + + btor(ZR36057_VDCR_VidEn, ZR36057_VDCR); + return 0; +} + +static int zr_vb2_start_streaming(struct vb2_queue *vq, unsigned int count) +{ + struct zoran *zr = vq->drv_priv; + int j; + + for (j = 0; j < BUZ_NUM_STAT_COM; j++) { + zr->stat_com[j] = cpu_to_le32(1); + zr->inuse[j] = NULL; + } + + if (zr->map_mode != ZORAN_MAP_MODE_RAW) { + pci_info(zr->pci_dev, "START JPG\n"); + zr36057_restart(zr); + zoran_init_hardware(zr); + if (zr->map_mode == ZORAN_MAP_MODE_JPG_REC) + zr36057_enable_jpg(zr, BUZ_MODE_MOTION_DECOMPRESS); + else + zr36057_enable_jpg(zr, BUZ_MODE_MOTION_COMPRESS); + zoran_feed_stat_com(zr); + jpeg_start(zr); + zr->running = zr->map_mode; + btor(ZR36057_ICR_IntPinEn, ZR36057_ICR); + return 0; + } + + pci_info(zr->pci_dev, "START RAW\n"); + zr36057_restart(zr); + zoran_init_hardware(zr); + + zr36057_enable_jpg(zr, BUZ_MODE_IDLE); + zr36057_set_memgrab(zr, 1); + zr->running = zr->map_mode; + btor(ZR36057_ICR_IntPinEn, ZR36057_ICR); + return 0; +} + +static void zr_vb2_stop_streaming(struct vb2_queue *vq) +{ + struct zoran *zr = vq->drv_priv; + struct zr_buffer *buf; + unsigned long flags; + int j; + + btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); + if (zr->map_mode != ZORAN_MAP_MODE_RAW) + zr36057_enable_jpg(zr, BUZ_MODE_IDLE); + zr36057_set_memgrab(zr, 0); + zr->running = ZORAN_MAP_MODE_NONE; + + zoran_set_pci_master(zr, 0); + + if (!pass_through) { /* Switch to color bar */ + decoder_call(zr, video, s_stream, 0); + encoder_call(zr, video, s_routing, 2, 0, 0); + } + + for (j = 0; j < BUZ_NUM_STAT_COM; j++) { + zr->stat_com[j] = cpu_to_le32(1); + if (!zr->inuse[j]) + continue; + buf = zr->inuse[j]; + pci_dbg(zr->pci_dev, "%s clean buf %d\n", __func__, j); + vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); + zr->inuse[j] = NULL; + } + + spin_lock_irqsave(&zr->queued_bufs_lock, flags); + while (!list_empty(&zr->queued_bufs)) { + buf = list_entry(zr->queued_bufs.next, struct zr_buffer, queue); + list_del(&buf->queue); + vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_ERROR); + zr->buf_in_reserve--; + } + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + if (zr->buf_in_reserve) + pci_err(zr->pci_dev, "Buffer remaining %d\n", zr->buf_in_reserve); + zr->map_mode = ZORAN_MAP_MODE_RAW; +} + +static const struct vb2_ops zr_video_qops = { + .queue_setup = zr_vb2_queue_setup, + .buf_queue = zr_vb2_queue, + .buf_prepare = zr_vb2_prepare, + .start_streaming = zr_vb2_start_streaming, + .stop_streaming = zr_vb2_stop_streaming, + .wait_prepare = vb2_ops_wait_prepare, + .wait_finish = vb2_ops_wait_finish, +}; + +int zoran_queue_init(struct zoran *zr, struct vb2_queue *vq) +{ + int err; + + spin_lock_init(&zr->queued_bufs_lock); + INIT_LIST_HEAD(&zr->queued_bufs); + + vq->dev = &zr->pci_dev->dev; + vq->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + vq->io_modes = VB2_USERPTR | VB2_DMABUF | VB2_MMAP | VB2_READ | VB2_WRITE; + vq->drv_priv = zr; + vq->buf_struct_size = sizeof(struct zr_buffer); + vq->ops = &zr_video_qops; + vq->mem_ops = &vb2_dma_contig_memops; + vq->gfp_flags = GFP_DMA32, + vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; + vq->min_buffers_needed = 9; + vq->lock = &zr->lock; + err = vb2_queue_init(vq); + if (err) + return err; + zr->video_dev->queue = vq; + return 0; +} + +void zoran_queue_exit(struct zoran *zr) +{ + vb2_queue_release(zr->video_dev->queue); +} From patchwork Mon Sep 21 10:20:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255723 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ED9FC43464 for ; Mon, 21 Sep 2020 10:22:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 53C82205F4 for ; Mon, 21 Sep 2020 10:22:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="hsFrcDBi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727101AbgIUKWE (ORCPT ); Mon, 21 Sep 2020 06:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726934AbgIUKVL (ORCPT ); Mon, 21 Sep 2020 06:21:11 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80DF1C0613D1 for ; Mon, 21 Sep 2020 03:21:10 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id d4so11562783wmd.5 for ; Mon, 21 Sep 2020 03:21:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uDkkWNM0rHPx30WBJ9RYyqITIKCjYLog+rU9zqKzxvE=; b=hsFrcDBiXN61Z9d04dj5g+ouWOEmK2VyMDvFapjJe1DUDa08wnRo5XTxjQPuQ999wW 49LL96NcTSaVmoRUZsnyVxCZ85I+f1W0jwvPuNJ/CTPC1tYoPvRVa3U5d5ysmebuj5Kz m0Uj8YhGjdHI/c/ihKVYEno9U9fLfDkyxO5sXVSJM6qISfaaCjGb8egyruLYPwYxF2NK fblQWKEWwMuEp+AAbL0hxAXCdA8hER/GnDU0rQ3+e8aObv8aGq5DTv+Hzt4HfI0SLgsr r2W8OEp9y3qdHVY1TRHJ1UPWNU+hF3/OvfbbWKtM+8QpS6iVepUalojmrcC8CO/RIzW2 Eebg== 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:in-reply-to :references; bh=uDkkWNM0rHPx30WBJ9RYyqITIKCjYLog+rU9zqKzxvE=; b=MSdpJ78NR9k/kC/2hrbRzYdOtwiyzYb7G/FAlFo9SPy2Puf/Fb/L9iAM8/EVS8zZn3 hXltSGk7bfSLB3bfwRsxqQxxyLmaBpk3Yj9S+ZFIFXRaPG428DQAIcIuRAQ+PH5kkC6a xmpD1FJOMF6mDhA+5ZAVLOUZlZ5s+vF5XDxuaof8SHBD9nB/IZUbR3OSTXiJlI22yiHM XW7cdV9RrQMa/Ki9JE5HeihUTTKfimIlJ98YAQaXG8RcTjmDRScOzeC2dJtvBvGayrd6 sj6vWy/GtGZDjLeT5VdLs3T+86NPJvLKvNpM5o1+5+10MICXYrhEhEGyWKM81WhYSubF ZSew== X-Gm-Message-State: AOAM5322599YLonDYCkG8+MddRplZ9kW53ThK32FpkA6w5yrIszSZjei vxEvR1bthDis3ZXqMk+4SDU8Bw== X-Google-Smtp-Source: ABdhPJzWXxqw72kvusYKTW95fuGlXzwUmj6ka2u4TTLGkffH+FdJpwHQKoa69Ob7+uHu9Y8yhALwsg== X-Received: by 2002:a1c:4381:: with SMTP id q123mr28357827wma.108.1600683669228; Mon, 21 Sep 2020 03:21:09 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:08 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 39/49] staging: media: zoran: disable output Date: Mon, 21 Sep 2020 10:20:14 +0000 Message-Id: <1600683624-5863-40-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Zoran is picky about jpeg data it accepts. At least it seems to not support COM and APPn. So until a way to filter data will be done, disable output. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 2 ++ drivers/staging/media/zoran/zoran_driver.c | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 93318ae1803a..864196e7acae 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -954,6 +954,8 @@ static int zr36057_init(struct zoran *zr) *zr->video_dev = zoran_template; zr->video_dev->v4l2_dev = &zr->v4l2_dev; zr->video_dev->lock = &zr->lock; + zr->video_dev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE; + strscpy(zr->video_dev->name, ZR_DEVNAME(zr), sizeof(zr->video_dev->name)); /* * It's not a mem2mem device, but you can both capture and output from one and the same diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 2c1e70cf2f0c..1efec2edd72f 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1082,8 +1082,7 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability strscpy(cap->card, ZR_DEVNAME(zr), sizeof(cap->card)); strscpy(cap->driver, "zoran", sizeof(cap->driver)); snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", pci_name(zr->pci_dev)); - cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE | - V4L2_CAP_VIDEO_OUTPUT; + cap->device_caps = zr->video_dev->device_caps; cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; return 0; } @@ -2204,6 +2203,11 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma) return res; } +/* + * Output is disabled temporarily + * Zoran is picky about jpeg data it accepts. At least it seems to unsupport COM and APPn. + * So until a way to filter data will be done, disable output. + */ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_querycap = zoran_querycap, .vidioc_s_selection = zoran_s_selection, @@ -2211,9 +2215,9 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_enum_input = zoran_enum_input, .vidioc_g_input = zoran_g_input, .vidioc_s_input = zoran_s_input, - .vidioc_enum_output = zoran_enum_output, +/* .vidioc_enum_output = zoran_enum_output, .vidioc_g_output = zoran_g_output, - .vidioc_s_output = zoran_s_output, + .vidioc_s_output = zoran_s_output,*/ .vidioc_g_fbuf = zoran_g_fbuf, .vidioc_s_fbuf = zoran_s_fbuf, .vidioc_g_std = zoran_g_std, @@ -2227,13 +2231,13 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_streamon = zoran_streamon, .vidioc_streamoff = zoran_streamoff, .vidioc_enum_fmt_vid_cap = zoran_enum_fmt_vid_cap, - .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out, +/* .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out,*/ .vidioc_g_fmt_vid_cap = zoran_g_fmt_vid_cap, - .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out, +/* .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out,*/ .vidioc_s_fmt_vid_cap = zoran_s_fmt_vid_cap, - .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out, +/* .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out,*/ .vidioc_try_fmt_vid_cap = zoran_try_fmt_vid_cap, - .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out, +/* .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out,*/ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, }; From patchwork Mon Sep 21 10:20:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255724 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F988C43465 for ; Mon, 21 Sep 2020 10:22:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6907820EDD for ; Mon, 21 Sep 2020 10:22:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="cNOdhewY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726606AbgIUKWA (ORCPT ); Mon, 21 Sep 2020 06:22:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgIUKVM (ORCPT ); Mon, 21 Sep 2020 06:21:12 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60BE6C0613D3 for ; Mon, 21 Sep 2020 03:21:11 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id t10so12134484wrv.1 for ; Mon, 21 Sep 2020 03:21:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=X+rFpG4vvom05OvyshLNJdJ8kwgKGSpX9C8YhBuxe5o=; b=cNOdhewYGKl2YXjKJURDIdKsQu8ZURzvDXtycD++ZmmwaT+J5kQ3pbSlKC1ljvk1rb 7c9mM7lwiacjgzmwvAgZqpm1kttbtMjT/I+1RArtwZZzP+BmSylpv0oayqX6TuxbD1AL YtAxB3UvYq7EPNfCtQPdFX+CqsLux1DiX9RG77Qg6/2jtASmro4jYFwhX5ZSnlwr8eJ3 5rwMXXBdln8bHX4yjru65FoT9fcu0bCqi5LVbEND7/ih/YnZo4HF33N3w8aem5HtqdAd XH7qB8d4UKF8a5zjD2c4Zpu3TiAUisMPK5kiY48tVI0NvfXrE+ArvVK9tY0QmZ4spCa/ M4Yg== 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:in-reply-to :references; bh=X+rFpG4vvom05OvyshLNJdJ8kwgKGSpX9C8YhBuxe5o=; b=NsSsnNv2YFbcRvrb+aVGQb980luvU5fN4PjZf7Iw3y50Xr/7CPwzO7Bo+jjjWerUlL iK7fbC9GzNGl4emdKEH+248c0b/y8OdXGmdMqE+TFMEpjnILgIdzm9/vVR61QsgUabg0 PV9747VL5EgAAdyoBRMSSel/PZIJXylY8vm8G2MNi1SGwbJ4Gh6agshst5DNDiSKoeMN xPaX5VSLTQyev7Na+4Rr9zKS53IFYWm5ZIM3v/vww0tKzhVWu259pSR4avpLIXXfvy1y bNeHEDM0LoLYxJu5sLe7u4YtdulYVaL0DQBaGP8oMzEhWrjEbnceiGrjjAc1ZgnxlQH3 CLnw== X-Gm-Message-State: AOAM5300UwwkMDyIbL9nIlfInUcKO4bgBeOB1W4qUyly9xSDNkBAXQfX n1s+8cFFuQXbabv1fzcrJHa79g== X-Google-Smtp-Source: ABdhPJx5/I5MOZQ6v+bndDYnz6frgD0KgYbwoj30CpffrluyW6RiigjRwAq0J2375zGKyZudwb/chw== X-Received: by 2002:a5d:60cc:: with SMTP id x12mr51120033wrt.84.1600683670104; Mon, 21 Sep 2020 03:21:10 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:09 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 40/49] staging: media: zoran: device support only 32bit DMA address Date: Mon, 21 Sep 2020 10:20:15 +0000 Message-Id: <1600683624-5863-41-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The zoran device only supports 32bit DMA address. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_card.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index 864196e7acae..ab16a70a7451 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -1101,6 +1101,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) int card_num; const char *codec_name, *vfe_name; unsigned int nr; + int err; + + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (err) + return -ENODEV; + vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); nr = zoran_num++; if (nr >= BUZ_MAX) { From patchwork Mon Sep 21 10:20:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255725 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82A24C43465 for ; Mon, 21 Sep 2020 10:21:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42F6120EDD for ; Mon, 21 Sep 2020 10:21:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="YY36+18N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727075AbgIUKVu (ORCPT ); Mon, 21 Sep 2020 06:21:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727000AbgIUKVN (ORCPT ); Mon, 21 Sep 2020 06:21:13 -0400 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3920AC0613CF for ; Mon, 21 Sep 2020 03:21:13 -0700 (PDT) Received: by mail-wr1-x444.google.com with SMTP id t10so12134578wrv.1 for ; Mon, 21 Sep 2020 03:21:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mJHxmatwliiILb7dsJ+xU9dZGkpFAiokQ09uJSwZTko=; b=YY36+18NrSi43hiI1GypE3L3g7YkZYC4dvqcoG7y95SOj1DcWqwIToU6gOxxryf9q8 aXDMUATQCVAArDmi3knlOtzdjOhVud7zU1UPPGGZlBStGw/sDaSo2uRZUQ1izWMJ+w7S lsJnR06Z4Y8Y+aa8LX/PXD0W4IvLdrLpfAaeW3R19RfP536Wke1u2HSxxqjNC0hF5NVt t2QKRUmmeD3UAhu1FJ+i77IN9m+MF9l+VGp7G0ThCesVk4TBYgJ+DLCznQ+LJdeYQ0HC WVS8QATv415OnmoScSh8oUTMTzFcJI2mDyUkzVqgJ8GxzVAv2R3W8PQNKcsaHLNWk6Y1 YMqQ== 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:in-reply-to :references; bh=mJHxmatwliiILb7dsJ+xU9dZGkpFAiokQ09uJSwZTko=; b=KHL9nb8yVpkA9BAe4Jp6BOoSw1MjNlzIK9wPtK0FrDkxGMJYaSxpVwWHhCjR+FOBEg 2ciyARrK4vAtRekOKG3kCqdnIqKjk+keedCs8ugq5UAbN58JClwMtU+fvSKzBND80w7d vNpbvYme48Rz/RFVB3KkEZFKOnRzhoAMBFGV01ltJ/V/4mg3gxQb4ZXI+xUB4bNkJVyC QGakkFePDEqhujxeH//kXaRbA7QxytGlY0DsF1lB7yF1287mIKU7mKxRVsfCbgfu/IOI 4FtjDPvx4Cas9L66a+SHNyZgbcygq0b5A/B3A9ZMXojKZIa3QhUoSf1XpWyCdRlAvmhW LLAQ== X-Gm-Message-State: AOAM5312YBJcaDSguPzogyn5kEDpQL8phdZyxycq/e7FVzuVzZfZsMR7 mFjfQrGpuWzJQl1zbi4thUrb4w== X-Google-Smtp-Source: ABdhPJwtsP6qs8zegG7/DtdHTKeW1KXJsBuEqLj+EEMBeNJc/0krxjR0o43Of5KJoFWEVdN8Jioegw== X-Received: by 2002:adf:ef45:: with SMTP id c5mr49998455wrp.37.1600683671890; Mon, 21 Sep 2020 03:21:11 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:11 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 42/49] staging: media: zoran: remove framebuffer support Date: Mon, 21 Sep 2020 10:20:17 +0000 Message-Id: <1600683624-5863-43-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The framebuffer support is obsolete, so let's reduce code size. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran.h | 4 - drivers/staging/media/zoran/zoran_card.c | 6 -- drivers/staging/media/zoran/zoran_driver.c | 85 ---------------------- 3 files changed, 95 deletions(-) diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index 294e52d78e1b..0246635e0eac 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -299,10 +299,6 @@ struct zoran { /* Current buffer params */ unsigned int buffer_size; - void *vbuf_base; - int vbuf_height, vbuf_width; - int vbuf_depth; - int vbuf_bytesperline; wait_queue_head_t v4l_capq; diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index ab16a70a7451..530dd326ad94 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -895,12 +895,6 @@ static int zr36057_init(struct zoran *zr) zr->jpg_buffers.allocated = 0; zr->v4l_buffers.allocated = 0; - zr->vbuf_base = (void *)vidmem; - zr->vbuf_width = 0; - zr->vbuf_height = 0; - zr->vbuf_depth = 0; - zr->vbuf_bytesperline = 0; - /* Avoid nonsense settings from user for default input/norm */ if (default_norm < 0 || default_norm > 2) default_norm = 0; diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 1efec2edd72f..0b4bfc184b57 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -881,48 +881,6 @@ static int zoran_close(struct file *file) return 0; } -static int setup_fbuffer(struct zoran_fh *fh, void *base, const struct zoran_format *fmt, - int width, int height, int bytesperline) -{ - struct zoran *zr = fh->zr; - - /* (Ronald) v4l/v4l2 guidelines */ - if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) - return -EPERM; - - /* - * Don't allow frame buffer overlay if PCI or AGP is buggy, or on - ALi Magik (that needs very low latency while the card needs a - higher value always) - */ - - if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) - return -ENXIO; - - /* we need a bytesperline value, even if not given */ - if (!bytesperline) - bytesperline = width * ((fmt->depth + 7) & ~7) / 8; - - if (height <= 0 || width <= 0 || bytesperline <= 0) { - pci_err(zr->pci_dev, "%s - invalid height/width/bpl value (%d|%d|%d)\n", - __func__, width, height, bytesperline); - return -EINVAL; - } - if (bytesperline & 3) { - pci_err(zr->pci_dev, "%s - bytesperline (%d) must be 4-byte aligned\n", - __func__, bytesperline); - return -EINVAL; - } - - zr->vbuf_base = (void *)((unsigned long)base & ~3); - zr->vbuf_height = height; - zr->vbuf_width = width; - zr->vbuf_depth = fmt->depth; - zr->vbuf_bytesperline = bytesperline; - - return 0; -} - /* get the status of a buffer in the clients buffer queue */ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, struct v4l2_buffer *buf, int num) @@ -1388,47 +1346,6 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format return res; } -static int zoran_g_fbuf(struct file *file, void *__fh, - struct v4l2_framebuffer *fb) -{ - struct zoran *zr = video_drvdata(file); - - memset(fb, 0, sizeof(*fb)); - fb->base = zr->vbuf_base; - fb->fmt.width = zr->vbuf_width; - fb->fmt.height = zr->vbuf_height; - fb->fmt.bytesperline = zr->vbuf_bytesperline; - fb->fmt.colorspace = V4L2_COLORSPACE_SRGB; - fb->fmt.field = V4L2_FIELD_INTERLACED; - fb->capability = V4L2_FBUF_CAP_LIST_CLIPPING; - - return 0; -} - -static int zoran_s_fbuf(struct file *file, void *__fh, - const struct v4l2_framebuffer *fb) -{ - struct zoran *zr = video_drvdata(file); - struct zoran_fh *fh = __fh; - int i, res = 0; - __le32 printformat = __cpu_to_le32(fb->fmt.pixelformat); - - for (i = 0; i < NUM_FORMATS; i++) - if (zoran_formats[i].fourcc == fb->fmt.pixelformat) - break; - if (i == NUM_FORMATS) { - pci_err(zr->pci_dev, "VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n", - fb->fmt.pixelformat, - (char *)&printformat); - return -EINVAL; - } - - res = setup_fbuffer(fh, fb->base, &zoran_formats[i], fb->fmt.width, - fb->fmt.height, fb->fmt.bytesperline); - - return res; -} - static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type); static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffers *req) @@ -2218,8 +2135,6 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { /* .vidioc_enum_output = zoran_enum_output, .vidioc_g_output = zoran_g_output, .vidioc_s_output = zoran_s_output,*/ - .vidioc_g_fbuf = zoran_g_fbuf, - .vidioc_s_fbuf = zoran_s_fbuf, .vidioc_g_std = zoran_g_std, .vidioc_s_std = zoran_s_std, .vidioc_g_jpegcomp = zoran_g_jpegcomp, From patchwork Mon Sep 21 10:20:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E84BC4346A for ; Mon, 21 Sep 2020 10:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27FE920EDD for ; Mon, 21 Sep 2020 10:21:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="kkgqvr4w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727026AbgIUKVS (ORCPT ); Mon, 21 Sep 2020 06:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727022AbgIUKVR (ORCPT ); Mon, 21 Sep 2020 06:21:17 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15F47C061755 for ; Mon, 21 Sep 2020 03:21:17 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id w5so12118727wrp.8 for ; Mon, 21 Sep 2020 03:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pJYZMlRu+8oQA/EIZAQFePFUOgqonaLTxBSJ9QI8wUU=; b=kkgqvr4wSg1oA/tAod4PBJeP+Sa5+sT0bCecTAqpNi2QvT5/ftglSujMJ/OijhuAVh NweHDQRZ+0eqxK5Xul9Xk23FBkH8wriuqXCWtud0RKmUsw6w9qjSNl7Cm1S78syECJcR nU9VenHt/Yr1Vm9D65mXdsJzZf4dVjIjFC26q7m6nv1pN3gpSLcnpnPhAdIYCq2lMdHt Ow0RVD2OUUhJaGD7Q4osvdVKkPZ+5SURUlnZmS/6tohRNWKcfJXC0Fh4nFtlE4tKlfiY k+JSJwXo8CoXWDwUGtg4XKHmukpgv+K4lAhiMQESnU5o1zxLEJNMPpIbZq5fhUAN1EhP twEg== 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:in-reply-to :references; bh=pJYZMlRu+8oQA/EIZAQFePFUOgqonaLTxBSJ9QI8wUU=; b=gIMr45pR7asPw7Uy8aQSBgOs+GtyQruDBAhbVZedBHg/RFPtiKt50j+oy+19HAqhwW A6Np0M3E1aeCMof865DWGhYBc4iZeZ3MUQlsONdVK5kyPWTAHeYk6bXd2OgXKsCrWzO+ 3mkz+3CRbdHkuOIxgASI4OIvt4odHCWFgxzY0+mh8xbcDN5s7bgxoj+O+upybb8nL8Am iFopJTfUvE0c/g9MI05imK10SLmKgzohk7zraQa3UGY/8VHyyQdK9kOSWE7xYrmocQ4p QMka4RmaE1YdmfewcQpmn95Mg1iS2lhZPHhEfO+CFYjABN6d5WYumrkL/Ue+e9T1JlPR 0edA== X-Gm-Message-State: AOAM532xM6vIODlIirxw6zmAA3sVrkYtfRU99PLO2reBHVnQVsvqDpYv ZnWooGF9UhSzG0FXJMitZXtHjg== X-Google-Smtp-Source: ABdhPJz16X1uCIJdhDJDadI4Sw0QdewJNAkUb4ZoiDOllk9GkQZ8DXmQGWKncpp4djpXEc//OafjiQ== X-Received: by 2002:a5d:56cd:: with SMTP id m13mr50725470wrw.261.1600683675812; Mon, 21 Sep 2020 03:21:15 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:15 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 46/49] staging: media: zoran: fix some compliance test Date: Mon, 21 Sep 2020 10:20:21 +0000 Message-Id: <1600683624-5863-47-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add TODO for "TRY_FMT cannot handle an invalid pixelformat" We need to set pixelformat in some case. We should also handle some minimum requirement. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/zoran_driver.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 47f397ff190f..4299578c9bb5 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -1206,9 +1206,12 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh, if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat) break; - if (i == NUM_FORMATS) + if (i == NUM_FORMATS) { + /* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL; + } + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; fmt->fmt.pix.colorspace = zoran_formats[i].colorspace; if (BUZ_MAX_HEIGHT < (fmt->fmt.pix.height * 2)) fmt->fmt.pix.field = V4L2_FIELD_INTERLACED; @@ -1318,6 +1321,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format if (i == NUM_FORMATS) { pci_err(zr->pci_dev, "VIDIOC_S_FMT - unknown/unsupported format 0x%x\n", fmt->fmt.pix.pixelformat); + /* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL; } @@ -1327,10 +1331,16 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format res = -EBUSY; return res; } + + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT) fmt->fmt.pix.height = BUZ_MAX_HEIGHT; if (fmt->fmt.pix.width > BUZ_MAX_WIDTH) fmt->fmt.pix.width = BUZ_MAX_WIDTH; + if (fmt->fmt.pix.height < BUZ_MIN_HEIGHT) + fmt->fmt.pix.height = BUZ_MIN_HEIGHT; + if (fmt->fmt.pix.width < BUZ_MIN_WIDTH) + fmt->fmt.pix.width = BUZ_MIN_WIDTH; map_mode_raw(fh); From patchwork Mon Sep 21 10:20:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255726 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8546FC43464 for ; Mon, 21 Sep 2020 10:21:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F0F9207BC for ; Mon, 21 Sep 2020 10:21:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="Wk9BZ5Px" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbgIUKV0 (ORCPT ); Mon, 21 Sep 2020 06:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbgIUKVU (ORCPT ); Mon, 21 Sep 2020 06:21:20 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0EB5C061755 for ; Mon, 21 Sep 2020 03:21:19 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id j2so12127466wrx.7 for ; Mon, 21 Sep 2020 03:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=nfSbga+vAU0kYeCKYqq+VB/e/rXfL1l81Z9vsntVsiY=; b=Wk9BZ5Px9tQsqRYsbQniiT5U6/060Xdtu/okYHCqctemgXBKjGM7jMk8wXTUXRnrCW OeC+obThRy/JXRZKQnohj/Tn2V/4vQ15GWdA8yWlcHyVzQgxIK0KjPWqu+4AZCOQ393E JYWwvURkcIsughrix3/GJmJpDhEEtsHZlNkvu2uv5JAFSgCQiykHv1+fS+rDmPlxXGva sZMvLAc3Lkl0VtuOs0ufvvhF0egjK32J8CsfWikpWWALrjsWY0rGe/38Sl/w7QKytFoM b/YdYiCm/sKeP5Y9FDUMmOr73XBalvUfcMt7UUr9DR+NlWuoBQfX7l5+6nOCEbo0++Ix bK3Q== 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:in-reply-to :references; bh=nfSbga+vAU0kYeCKYqq+VB/e/rXfL1l81Z9vsntVsiY=; b=FKgr4oih5xUa7ppu5fXN66I+X6+/jN/RkJAWmzlu3BVdCJ1DhNextmaQnVuyiuJQZD /Ngh6+GjqmVCpiYdTc8/98JMsK8su8gaCN+m05XlH0/sofzmHfp+RXiytuPxLJCe2EOq UmqGwzb+7bjG1oyeMMrZWTQGImDBmUR4QVEw6Uabphi0c/68JU9NV0bxChjM/DPswbbX HsZ4nPu09ah99GAQgxwF7DT0JMJTOlytUd9irdOin+7/ymDWHVo9jG05oTL5MdiSWmmk SCcHz0OLOPs5CdQ7P38Zpm2ri5ztxMm7+j1a9pIo5MmXuGq+cXAt12MyHu6bZPZVdJNX Vy3A== X-Gm-Message-State: AOAM531DlQSK2NZr9B4P+TBt4WZSM931BNuZsHr+TsHu3IjfQAdPTgCm ziZNnRR1RZVRvTd8HczLKizyQw== X-Google-Smtp-Source: ABdhPJwFraKIV91Qlldqlh3NSxFpmXJqIY+E08b9GRHPud3pL8rF808MRfdDEItFpEmWMwPqbvJ73g== X-Received: by 2002:adf:9405:: with SMTP id 5mr28244604wrq.51.1600683677862; Mon, 21 Sep 2020 03:21:17 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:17 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 48/49] staging: media: zoran: convert to vb2 Date: Mon, 21 Sep 2020 10:20:23 +0000 Message-Id: <1600683624-5863-49-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is it! the ultimate last step, the vb2 conversion. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 2 +- drivers/staging/media/zoran/zoran.h | 83 +- drivers/staging/media/zoran/zoran_card.c | 45 +- drivers/staging/media/zoran/zoran_device.c | 488 ++----- drivers/staging/media/zoran/zoran_driver.c | 1453 +------------------- 5 files changed, 137 insertions(+), 1934 deletions(-) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index ddf38a931c01..492507030276 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -1,6 +1,6 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" - depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS + depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 depends on !ALPHA select VIDEOBUF2_DMA_CONTIG help diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index fd27d1968e60..372fadfd9a01 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -20,7 +20,6 @@ #include #include -#include #include #include #include @@ -29,13 +28,6 @@ #define ZR_NORM_NTSC 1 #define ZR_NORM_SECAM 2 -struct zoran_sync { - unsigned long frame; /* number of buffer that has been free'd */ - unsigned long length; /* number of code bytes in buffer (capture only) */ - unsigned long seq; /* frame sequence number */ - u64 ts; /* timestamp */ -}; - struct zr_buffer { /* common v4l buffer stuff -- must be first */ struct vb2_v4l2_buffer vbuf; @@ -111,18 +103,10 @@ enum zoran_codec_mode { BUZ_MODE_STILL_DECOMPRESS /* still frame conversion */ }; -enum zoran_buffer_state { - BUZ_STATE_USER, /* buffer is owned by application */ - BUZ_STATE_PEND, /* buffer is queued in pend[] ready to feed to I/O */ - BUZ_STATE_DMA, /* buffer is queued in dma[] for I/O */ - BUZ_STATE_DONE /* buffer is ready to return to application */ -}; - enum zoran_map_mode { ZORAN_MAP_MODE_NONE, ZORAN_MAP_MODE_RAW, ZORAN_MAP_MODE_JPG_REC, -#define ZORAN_MAP_MODE_JPG ZORAN_MAP_MODE_JPG_REC ZORAN_MAP_MODE_JPG_PLAY, }; @@ -174,45 +158,6 @@ struct zoran_jpg_settings { struct v4l2_jpegcompression jpg_comp; /* JPEG-specific capture settings */ }; -struct zoran_fh; - -struct zoran_mapping { - struct zoran_fh *fh; - atomic_t count; -}; - -struct zoran_buffer { - struct zoran_mapping *map; - enum zoran_buffer_state state; /* state: unused/pending/dma/done */ - struct zoran_sync bs; /* DONE: info to return to application */ - union { - struct { - __le32 *frag_tab; /* addresses of frag table */ - u32 frag_tab_bus; /* same value cached to save time in ISR */ - } jpg; - struct { - char *fbuffer; /* virtual address of frame buffer */ - unsigned long fbuffer_phys;/* physical address of frame buffer */ - unsigned long fbuffer_bus;/* bus address of frame buffer */ - } v4l; - }; -}; - -enum zoran_lock_activity { - ZORAN_FREE, /* free for use */ - ZORAN_ACTIVE, /* active but unlocked */ - ZORAN_LOCKED, /* locked */ -}; - -/* buffer collections */ -struct zoran_buffer_col { - enum zoran_lock_activity active; /* feature currently in use? */ - unsigned int num_buffers; - struct zoran_buffer buffer[MAX_FRAME]; /* buffers */ - u8 allocated; /* Flag if buffers are allocated */ - u8 need_contiguous; /* Flag if contiguous buffers are needed */ - /* only applies to jpg buffers, raw buffers are always contiguous */ -}; struct zoran; @@ -220,10 +165,6 @@ struct zoran; struct zoran_fh { struct v4l2_fh fh; struct zoran *zr; - - enum zoran_map_mode map_mode; /* Flag which bufferset will map by next mmap() */ - - struct zoran_buffer_col buffers; /* buffers' info */ }; struct card_info { @@ -281,7 +222,6 @@ struct zoran { struct mutex lock; /* file ops serialize lock */ u8 initialized; /* flag if zoran has been correctly initialized */ - int user; /* number of current users */ struct card_info card; const struct tvnorm *timing; @@ -300,28 +240,12 @@ struct zoran { /* Current buffer params */ unsigned int buffer_size; - wait_queue_head_t v4l_capq; - - int v4l_memgrab_active; /* Memory grab is activated */ - - int v4l_grab_frame; /* Frame number being currently grabbed */ -#define NO_GRAB_ACTIVE (-1) - unsigned long v4l_grab_seq; /* Number of frames grabbed */ struct zoran_v4l_settings v4l_settings; /* structure with a lot of things to play with */ - /* V4L grab queue of frames pending */ - unsigned long v4l_pend_head; - unsigned long v4l_pend_tail; - unsigned long v4l_sync_tail; - int v4l_pend[V4L_MAX_FRAME]; - struct zoran_buffer_col v4l_buffers; /* V4L buffers' info */ - /* Buz MJPEG parameters */ enum zoran_codec_mode codec_mode; /* status of codec */ struct zoran_jpg_settings jpg_settings; /* structure with a lot of things to play with */ - wait_queue_head_t jpg_capq; /* wait here for grab to finish */ - /* grab queue counts/indices, mask with BUZ_MASK_STAT_COM before using as index */ /* (dma_head - dma_tail) is number active in DMA, must be <= BUZ_NUM_STAT_COM */ /* (value & BUZ_MASK_STAT_COM) corresponds to index in stat_com table */ @@ -338,13 +262,8 @@ struct zoran { /* zr36057's code buffer table */ __le32 *stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ - /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */ - int jpg_pend[BUZ_MAX_FRAME]; - - /* array indexed by frame number */ - struct zoran_buffer_col jpg_buffers; /* MJPEG buffers' info */ - /* Additional stuff for testing */ + unsigned int ghost_int; int jpeg_error; int intr_counter_GIRQ1; int intr_counter_GIRQ0; diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index ca998f0000c2..302034ec98f1 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -10,25 +10,17 @@ */ #include - -#include #include #include -#include -#include #include #include #include #include #include -#include -#include -#include #include #include -#include #include #include #include @@ -812,29 +804,12 @@ void zoran_open_init_params(struct zoran *zr) { int i; - zr->v4l_memgrab_active = 0; - zr->v4l_grab_frame = NO_GRAB_ACTIVE; - zr->v4l_grab_seq = 0; zr->v4l_settings.width = 192; zr->v4l_settings.height = 144; zr->v4l_settings.format = &zoran_formats[7]; /* YUY2 - YUV-4:2:2 packed */ - zr->v4l_settings.bytesperline = - zr->v4l_settings.width * - ((zr->v4l_settings.format->depth + 7) / 8); - - /* DMA ring stuff for V4L */ - zr->v4l_pend_tail = 0; - zr->v4l_pend_head = 0; - zr->v4l_sync_tail = 0; - zr->v4l_buffers.active = ZORAN_FREE; - for (i = 0; i < VIDEO_MAX_FRAME; i++) - zr->v4l_buffers.buffer[i].state = BUZ_STATE_USER; /* nothing going on */ - zr->v4l_buffers.allocated = 0; - - for (i = 0; i < BUZ_MAX_FRAME; i++) - zr->jpg_buffers.buffer[i].state = BUZ_STATE_USER; /* nothing going on */ - zr->jpg_buffers.active = ZORAN_FREE; - zr->jpg_buffers.allocated = 0; + zr->v4l_settings.bytesperline = zr->v4l_settings.width * + ((zr->v4l_settings.format->depth + 7) / 8); + /* Set necessary params and call zoran_check_jpg_settings to set the defaults */ zr->jpg_settings.decimation = 1; zr->jpg_settings.jpg_comp.quality = 50; /* default compression factor 8 */ @@ -863,14 +838,6 @@ static int zr36057_init(struct zoran *zr) pci_info(zr->pci_dev, "initializing card[%d]\n", zr->id); - /* default setup of all parameters which will persist between opens */ - zr->user = 0; - - init_waitqueue_head(&zr->v4l_capq); - init_waitqueue_head(&zr->jpg_capq); - zr->jpg_buffers.allocated = 0; - zr->v4l_buffers.allocated = 0; - /* Avoid nonsense settings from user for default input/norm */ if (default_norm < 0 || default_norm > 2) default_norm = 0; @@ -942,8 +909,6 @@ static int zr36057_init(struct zoran *zr) video_set_drvdata(zr->video_dev, zr); zoran_init_hardware(zr); - if (zr36067_debug > 2) - detect_guest_activity(zr); if (!pass_through) { decoder_call(zr, video, s_stream, 0); encoder_call(zr, video, s_routing, 2, 0, 0); @@ -1266,10 +1231,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* take care of Natoma chipset and a revision 1 zr36057 */ - if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) { - zr->jpg_buffers.need_contiguous = 1; + if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) pci_info(zr->pci_dev, "ZR36057/Natoma bug, max. buffer size is 128K\n"); - } if (zr36057_init(zr) < 0) goto zr_detach_vfe; diff --git a/drivers/staging/media/zoran/zoran_device.c b/drivers/staging/media/zoran/zoran_device.c index ae4abf8ffa36..834f536a9f84 100644 --- a/drivers/staging/media/zoran/zoran_device.c +++ b/drivers/staging/media/zoran/zoran_device.c @@ -12,9 +12,6 @@ #include #include #include -#include -#include -#include #include #include @@ -22,13 +19,12 @@ #include #include #include -#include #include #include #include +#include -#include #include #include "videocodec.h" @@ -54,6 +50,7 @@ static bool lml33dpath; /* default = 0 module_param(lml33dpath, bool, 0644); MODULE_PARM_DESC(lml33dpath, "Use digital path capture mode (on LML33 cards)"); +int zr_set_buf(struct zoran *zr); /* * initialize video front end */ @@ -114,6 +111,7 @@ int post_office_wait(struct zoran *zr) // while (((por = btread(ZR36057_POR)) & (ZR36057_POR_POPen | ZR36057_POR_POTime)) == ZR36057_POR_POPen) { while ((por = btread(ZR36057_POR)) & ZR36057_POR_POPen) { /* wait for something to happen */ + /* TODO add timeout */ } if ((por & ZR36057_POR_POTime) && !zr->card.gws_not_connected) { /* In LML33/BUZ \GWS line is not connected, so it has always timeout set */ @@ -424,42 +422,16 @@ void zr36057_set_memgrab(struct zoran *zr, int mode) zr36057_set_vfe(zr, zr->v4l_settings.width, zr->v4l_settings.height, zr->v4l_settings.format); - - zr->v4l_memgrab_active = 1; } else { /* switch off VSync interrupts */ btand(~zr->card.vsync_int, ZR36057_ICR); // SW - zr->v4l_memgrab_active = 0; - zr->v4l_grab_frame = NO_GRAB_ACTIVE; - /* re-enable grabbing to screen if it was running */ btand(~ZR36057_VDCR_VidEn, ZR36057_VDCR); btand(~ZR36057_VSSFGR_SnapShot, ZR36057_VSSFGR); } } -int wait_grab_pending(struct zoran *zr) -{ - unsigned long flags; - - /* wait until all pending grabs are finished */ - - if (!zr->v4l_memgrab_active) - return 0; - - wait_event_interruptible(zr->v4l_capq, - (zr->v4l_pend_tail == zr->v4l_pend_head)); - if (signal_pending(current)) - return -ERESTARTSYS; - - spin_lock_irqsave(&zr->spinlock, flags); - zr36057_set_memgrab(zr, 0); - spin_unlock_irqrestore(&zr->spinlock, flags); - - return 0; -} - /***************************************************************************** * * * Set up the Buz-specific MJPEG part * @@ -503,9 +475,6 @@ static void init_jpeg_queue(struct zoran *zr) zr->jpg_err_seq = 0; zr->jpg_err_shift = 0; zr->jpg_queued_num = 0; - for (i = 0; i < zr->jpg_buffers.num_buffers; i++) - zr->jpg_buffers.buffer[i].state = BUZ_STATE_USER; /* nothing going on */ - for (i = 0; i < BUZ_NUM_STAT_COM; i++) zr->stat_com[i] = cpu_to_le32(1); /* mark as unavailable to zr36057 */ } @@ -607,50 +576,6 @@ static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode) zr36057_adjust_vfe(zr, mode); } -void print_interrupts(struct zoran *zr) -{ - int res, noerr = 0; - - pr_info("%s: interrupts received:", ZR_DEVNAME(zr)); - res = zr->field_counter; - if (res < -1 || res > 1) - printk(KERN_CONT " FD:%d", res); - res = zr->intr_counter_GIRQ1; - if (res != 0) { - printk(KERN_CONT " GIRQ1:%d", res); - noerr++; - } - res = zr->intr_counter_GIRQ0; - if (res != 0) { - printk(KERN_CONT " GIRQ0:%d", res); - noerr++; - } - res = zr->intr_counter_CodRepIRQ; - if (res != 0) { - printk(KERN_CONT " CodRepIRQ:%d", res); - noerr++; - } - res = zr->intr_counter_JPEGRepIRQ; - if (res != 0) { - printk(KERN_CONT " JPEGRepIRQ:%d", res); - noerr++; - } - if (zr->JPEG_max_missed) { - printk(KERN_CONT " JPEG delays: max=%d min=%d", zr->JPEG_max_missed, - zr->JPEG_min_missed); - } - if (zr->END_event_missed) { - printk(KERN_CONT " ENDs missed: %d", zr->END_event_missed); - } - //if (zr->jpg_queued_num) { - printk(KERN_CONT " queue_state=%ld/%ld/%ld/%ld", zr->jpg_que_tail, - zr->jpg_dma_tail, zr->jpg_dma_head, zr->jpg_que_head); - //} - if (!noerr) - printk(KERN_CONT ": no interrupts detected."); - printk(KERN_CONT "\n"); -} - void clear_interrupt_counters(struct zoran *zr) { zr->intr_counter_GIRQ1 = 0; @@ -864,33 +789,57 @@ void zoran_feed_stat_com(struct zoran *zr) { /* move frames from pending queue to DMA */ - int frame, i, max_stat_com; + int i, max_stat_com; + struct zr_buffer *buf; + struct vb2_v4l2_buffer *vbuf; + dma_addr_t phys_addr = 0; + unsigned long flags; + unsigned long payload; max_stat_com = (zr->jpg_settings.TmpDcm == 1) ? BUZ_NUM_STAT_COM : (BUZ_NUM_STAT_COM >> 1); - while ((zr->jpg_dma_head - zr->jpg_dma_tail) < max_stat_com && - zr->jpg_dma_head < zr->jpg_que_head) { - frame = zr->jpg_pend[zr->jpg_dma_head & BUZ_MASK_FRAME]; + spin_lock_irqsave(&zr->queued_bufs_lock, flags); + while ((zr->jpg_dma_head - zr->jpg_dma_tail) < max_stat_com) { + buf = list_first_entry_or_null(&zr->queued_bufs, struct zr_buffer, queue); + if (!buf) { + pci_err(zr->pci_dev, "No buffer available to queue\n"); + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); + return; + } + list_del(&buf->queue); + zr->buf_in_reserve--; + vbuf = &buf->vbuf; + vbuf->vb2_buf.state = VB2_BUF_STATE_ACTIVE; + phys_addr = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0); + payload = vb2_get_plane_payload(&vbuf->vb2_buf, 0); + if (payload == 0) + payload = zr->buffer_size; if (zr->jpg_settings.TmpDcm == 1) { /* fill 1 stat_com entry */ i = (zr->jpg_dma_head - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; if (!(zr->stat_com[i] & cpu_to_le32(1))) break; - zr->stat_com[i] = - cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus); + zr->stat_comb[i * 2] = cpu_to_le32(phys_addr); + zr->stat_comb[i * 2 + 1] = cpu_to_le32((payload >> 1) | 1); + zr->inuse[i] = buf; + zr->stat_com[i] = cpu_to_le32(zr->p_scb + i * 2 * 4); } else { /* fill 2 stat_com entries */ i = ((zr->jpg_dma_head - zr->jpg_err_shift) & 1) * 2; if (!(zr->stat_com[i] & cpu_to_le32(1))) break; - zr->stat_com[i] = - cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus); - zr->stat_com[i + 1] = - cpu_to_le32(zr->jpg_buffers.buffer[frame].jpg.frag_tab_bus); + zr->stat_com[i] = cpu_to_le32(zr->p_scb + i * 2 * 4); + zr->stat_com[i + 1] = cpu_to_le32(zr->p_scb + i * 2 * 4); + + zr->stat_comb[i * 2] = cpu_to_le32(phys_addr); + zr->stat_comb[i * 2 + 1] = cpu_to_le32((payload >> 1) | 1); + + zr->inuse[i] = buf; + zr->inuse[i + 1] = NULL; } - zr->jpg_buffers.buffer[frame].state = BUZ_STATE_DMA; zr->jpg_dma_head++; } + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) zr->jpg_queued_num++; } @@ -904,8 +853,10 @@ static void zoran_reap_stat_com(struct zoran *zr) u32 stat_com; unsigned int seq; unsigned int dif; - struct zoran_buffer *buffer; - int frame; + unsigned long flags; + struct zr_buffer *buf; + unsigned int size = 0; + u32 fcnt; /* In motion decompress we don't have a hardware frame counter, * we just count the interrupts here */ @@ -913,347 +864,78 @@ static void zoran_reap_stat_com(struct zoran *zr) if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) zr->jpg_seq_num++; + spin_lock_irqsave(&zr->queued_bufs_lock, flags); while (zr->jpg_dma_tail < zr->jpg_dma_head) { if (zr->jpg_settings.TmpDcm == 1) - i = (zr->jpg_dma_tail - - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; + i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; else - i = ((zr->jpg_dma_tail - - zr->jpg_err_shift) & 1) * 2 + 1; + i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2 + 1; stat_com = le32_to_cpu(zr->stat_com[i]); - - if ((stat_com & 1) == 0) + if ((stat_com & 1) == 0) { + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); return; + } + + fcnt = (stat_com & GENMASK(31, 24)) >> 24; + size = (stat_com & GENMASK(22, 1)) >> 1; - frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; - buffer = &zr->jpg_buffers.buffer[frame]; - buffer->bs.ts = ktime_get_ns(); + buf = zr->inuse[i]; + buf->vbuf.vb2_buf.timestamp = ktime_get_ns(); if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { - buffer->bs.length = (stat_com & 0x7fffff) >> 1; + vb2_set_plane_payload(&buf->vbuf.vb2_buf, 0, size); /* update sequence number with the help of the counter in stat_com */ - - seq = ((stat_com >> 24) + zr->jpg_err_seq) & 0xff; + seq = (fcnt + zr->jpg_err_seq) & 0xff; dif = (seq - zr->jpg_seq_num) & 0xff; zr->jpg_seq_num += dif; - } else { - buffer->bs.length = 0; } - buffer->bs.seq = - zr->jpg_settings.TmpDcm == + buf->vbuf.sequence = zr->jpg_settings.TmpDcm == 2 ? (zr->jpg_seq_num >> 1) : zr->jpg_seq_num; - buffer->state = BUZ_STATE_DONE; - - zr->jpg_dma_tail++; - } -} - -static void zoran_restart(struct zoran *zr) -{ - /* Now the stat_comm buffer is ready for restart */ - unsigned int status = 0; - int mode; - - if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { - decoder_call(zr, video, g_input_status, &status); - mode = CODEC_DO_COMPRESSION; - } else { - status = V4L2_IN_ST_NO_SIGNAL; - mode = CODEC_DO_EXPANSION; - } - if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || - !(status & V4L2_IN_ST_NO_SIGNAL)) { - /********** RESTART code *************/ - jpeg_codec_reset(zr); - zr->codec->set_mode(zr->codec, mode); - zr36057_set_jpg(zr, zr->codec_mode); - jpeg_start(zr); - - if (zr->num_errors <= 8) - pci_info(zr->pci_dev, "Restart\n"); - - zr->JPEG_missed = 0; - zr->JPEG_error = 2; - /********** End RESTART code ***********/ - } -} - -static void error_handler(struct zoran *zr, u32 astat, u32 stat) -{ - int i; - - /* This is JPEG error handling part */ - if (zr->codec_mode != BUZ_MODE_MOTION_COMPRESS && - zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS) { - return; - } - - if ((stat & 1) == 0 && - zr->codec_mode == BUZ_MODE_MOTION_COMPRESS && - zr->jpg_dma_tail - zr->jpg_que_tail >= zr->jpg_buffers.num_buffers) { - /* No free buffers... */ - zoran_reap_stat_com(zr); - zoran_feed_stat_com(zr); - wake_up_interruptible(&zr->jpg_capq); - zr->JPEG_missed = 0; - return; - } - - if (zr->JPEG_error == 1) { - zoran_restart(zr); - return; - } - - /* - * First entry: error just happened during normal operation - * - * In BUZ_MODE_MOTION_COMPRESS: - * - * Possible glitch in TV signal. In this case we should - * stop the codec and wait for good quality signal before - * restarting it to avoid further problems - * - * In BUZ_MODE_MOTION_DECOMPRESS: - * - * Bad JPEG frame: we have to mark it as processed (codec crashed - * and was not able to do it itself), and to remove it from queue. - */ - btand(~ZR36057_JMC_Go_en, ZR36057_JMC); - udelay(1); - stat = stat | (post_office_read(zr, 7, 0) & 3) << 8; - btwrite(0, ZR36057_JPC); - btor(ZR36057_MCTCR_CFlush, ZR36057_MCTCR); - jpeg_codec_reset(zr); - jpeg_codec_sleep(zr, 1); - zr->JPEG_error = 1; - zr->num_errors++; - - /* Report error */ - if (zr36067_debug > 1 && zr->num_errors <= 8) { - long frame; - int j; - - frame = zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; - pci_err(zr->pci_dev, "JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. ", - stat, zr->last_isr, - zr->jpg_que_tail, zr->jpg_dma_tail, - zr->jpg_dma_head, zr->jpg_que_head, - zr->jpg_seq_num, frame); - pr_info("stat_com frames:"); - for (j = 0; j < BUZ_NUM_STAT_COM; j++) { - for (i = 0; i < zr->jpg_buffers.num_buffers; i++) { - if (le32_to_cpu(zr->stat_com[j]) == zr->jpg_buffers.buffer[i].jpg.frag_tab_bus) - printk(KERN_CONT "% d->%d", j, i); - } - } - printk(KERN_CONT "\n"); - } - /* Find an entry in stat_com and rotate contents */ - if (zr->jpg_settings.TmpDcm == 1) - i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; - else - i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; - if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) { - /* Mimic zr36067 operation */ - zr->stat_com[i] |= cpu_to_le32(1); + zr->inuse[i] = NULL; if (zr->jpg_settings.TmpDcm != 1) - zr->stat_com[i + 1] |= cpu_to_le32(1); - /* Refill */ - zoran_reap_stat_com(zr); - zoran_feed_stat_com(zr); - wake_up_interruptible(&zr->jpg_capq); - /* Find an entry in stat_com again after refill */ - if (zr->jpg_settings.TmpDcm == 1) - i = (zr->jpg_dma_tail - zr->jpg_err_shift) & BUZ_MASK_STAT_COM; + buf->vbuf.field = zr->jpg_settings.odd_even ? + V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM; else - i = ((zr->jpg_dma_tail - zr->jpg_err_shift) & 1) * 2; - } - if (i) { - /* Rotate stat_comm entries to make current entry first */ - int j; - __le32 bus_addr[BUZ_NUM_STAT_COM]; - - /* Here we are copying the stat_com array, which - * is already in little endian format, so - * no endian conversions here - */ - memcpy(bus_addr, zr->stat_com, sizeof(bus_addr)); + buf->vbuf.field = zr->jpg_settings.odd_even ? + V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; + vb2_buffer_done(&buf->vbuf.vb2_buf, VB2_BUF_STATE_DONE); - for (j = 0; j < BUZ_NUM_STAT_COM; j++) - zr->stat_com[j] = bus_addr[(i + j) & BUZ_MASK_STAT_COM]; - - zr->jpg_err_shift += i; - zr->jpg_err_shift &= BUZ_MASK_STAT_COM; + zr->jpg_dma_tail++; } - if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) - zr->jpg_err_seq = zr->jpg_seq_num; /* + 1; */ - zoran_restart(zr); + spin_unlock_irqrestore(&zr->queued_bufs_lock, flags); } irqreturn_t zoran_irq(int irq, void *dev_id) { - u32 stat, astat; - int count = 0; struct zoran *zr = dev_id; - unsigned long flags; - - spin_lock_irqsave(&zr->spinlock, flags); - while (1) { - /* get/clear interrupt status bits */ - stat = count_reset_interrupt(zr); - astat = stat & IRQ_MASK; - if (!astat) - break; - pr_debug("%s: astat: 0x%08x, mask: 0x%08x\n", __func__, astat, btread(ZR36057_ICR)); - if (astat & zr->card.vsync_int) { // SW - - if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || - zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { - /* count missed interrupts */ - zr->JPEG_missed++; - } - //post_office_read(zr,1,0); - /* - * Interrupts may still happen when - * zr->v4l_memgrab_active is switched off. - * We simply ignore them - */ - - if (zr->v4l_memgrab_active) { - /* A lot more checks should be here ... */ - if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) == 0) - pci_warn(zr->pci_dev, "BuzIRQ with SnapShot off ???\n"); - - if (zr->v4l_grab_frame != NO_GRAB_ACTIVE) { - /* There is a grab on a frame going on, check if it has finished */ - if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_FrameGrab) == 0) { - /* it is finished, notify the user */ - - zr->v4l_buffers.buffer[zr->v4l_grab_frame].state = BUZ_STATE_DONE; - zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.seq = zr->v4l_grab_seq; - zr->v4l_buffers.buffer[zr->v4l_grab_frame].bs.ts = ktime_get_ns(); - zr->v4l_grab_frame = NO_GRAB_ACTIVE; - zr->v4l_pend_tail++; - } - } - - if (zr->v4l_grab_frame == NO_GRAB_ACTIVE) - wake_up_interruptible(&zr->v4l_capq); - - /* Check if there is another grab queued */ - - if (zr->v4l_grab_frame == NO_GRAB_ACTIVE && - zr->v4l_pend_tail != zr->v4l_pend_head) { - int frame = zr->v4l_pend[zr->v4l_pend_tail & V4L_MASK_FRAME]; - u32 reg; - - zr->v4l_grab_frame = frame; - - /* Set zr36057 video front end and enable video */ - - /* Buffer address */ - - reg = zr->v4l_buffers.buffer[frame].v4l.fbuffer_bus; - btwrite(reg, ZR36057_VDTR); - if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) - reg += zr->v4l_settings.bytesperline; - btwrite(reg, ZR36057_VDBR); - - /* video stride, status, and frame grab register */ - reg = 0; - if (zr->v4l_settings.height > BUZ_MAX_HEIGHT / 2) - reg += zr->v4l_settings.bytesperline; - reg = (reg << ZR36057_VSSFGR_DispStride); - reg |= ZR36057_VSSFGR_VidOvf; - reg |= ZR36057_VSSFGR_SnapShot; - reg |= ZR36057_VSSFGR_FrameGrab; - btwrite(reg, ZR36057_VSSFGR); - - btor(ZR36057_VDCR_VidEn, ZR36057_VDCR); - } - } - - /* - * even if we don't grab, we do want to increment - * the sequence counter to see lost frames - */ - zr->v4l_grab_seq++; - } -#if (IRQ_MASK & ZR36057_ISR_CodRepIRQ) - if (astat & ZR36057_ISR_CodRepIRQ) { - zr->intr_counter_CodRepIRQ++; - IDEBUG(printk(KERN_DEBUG "%s: ZR36057_ISR_CodRepIRQ\n", ZR_DEVNAME(zr))); - btand(~ZR36057_ICR_CodRepIRQ, ZR36057_ICR); - } -#endif /* (IRQ_MASK & ZR36057_ISR_CodRepIRQ) */ - -#if (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) - if ((astat & ZR36057_ISR_JPEGRepIRQ) && - (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || - zr->codec_mode == BUZ_MODE_MOTION_COMPRESS)) { - if (zr36067_debug > 1 && (!zr->frame_num || zr->JPEG_error)) { - char sv[BUZ_NUM_STAT_COM + 1]; - int i; - - pr_info("%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n", - ZR_DEVNAME(zr), stat, zr->jpg_settings.odd_even, - zr->jpg_settings.field_per_buff, zr->JPEG_missed); - - for (i = 0; i < BUZ_NUM_STAT_COM; i++) - sv[i] = le32_to_cpu(zr->stat_com[i]) & 1 ? '1' : '0'; - sv[BUZ_NUM_STAT_COM] = 0; - pr_info("%s: stat_com=%s queue_state=%ld/%ld/%ld/%ld\n", - ZR_DEVNAME(zr), sv, zr->jpg_que_tail, zr->jpg_dma_tail, - zr->jpg_dma_head, zr->jpg_que_head); - } else { - /* Get statistics */ - if (zr->JPEG_missed > zr->JPEG_max_missed) - zr->JPEG_max_missed = zr->JPEG_missed; - if (zr->JPEG_missed < zr->JPEG_min_missed) - zr->JPEG_min_missed = zr->JPEG_missed; - } - - if (zr36067_debug > 2 && zr->frame_num < 6) { - int i; + u32 stat, astat; - pr_info("%s: seq=%ld stat_com:", ZR_DEVNAME(zr), zr->jpg_seq_num); - for (i = 0; i < 4; i++) - printk(KERN_CONT " %08x", le32_to_cpu(zr->stat_com[i])); - printk(KERN_CONT "\n"); - } - zr->frame_num++; - zr->JPEG_missed = 0; - zr->JPEG_error = 0; - zoran_reap_stat_com(zr); - zoran_feed_stat_com(zr); - wake_up_interruptible(&zr->jpg_capq); + stat = count_reset_interrupt(zr); + astat = stat & IRQ_MASK; + if (astat & zr->card.vsync_int) { + if (zr->running == ZORAN_MAP_MODE_RAW) { + if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot) == 0) + pci_warn(zr->pci_dev, "BuzIRQ with SnapShot off ???\n"); + if ((btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_FrameGrab) == 0) + zr_set_buf(zr); + return IRQ_HANDLED; } -#endif /* (IRQ_MASK & ZR36057_ISR_JPEGRepIRQ) */ - - /* DATERR, too many fields missed, error processing */ - if ((astat & zr->card.jpeg_int) || - zr->JPEG_missed > 25 || - zr->JPEG_error == 1 || - ((zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS) && - (zr->frame_num && (zr->JPEG_missed > zr->jpg_settings.field_per_buff)))) { - error_handler(zr, astat, stat); - } - - count++; - if (count > 10) { - pci_warn(zr->pci_dev, "irq loop %d\n", count); - if (count > 20) { - btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); - pci_err(zr->pci_dev, "IRQ lockup, cleared int mask\n"); - break; + if (astat & ZR36057_ISR_JPEGRepIRQ) { + if (zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS && + zr->codec_mode != BUZ_MODE_MOTION_COMPRESS) { + pci_err(zr->pci_dev, "JPG IRQ when not in good mode\n"); + return IRQ_HANDLED; } + zr->frame_num++; + zoran_reap_stat_com(zr); + zoran_feed_stat_com(zr); + return IRQ_HANDLED; } - zr->last_isr = stat; + /* unused interrupts */ } - spin_unlock_irqrestore(&zr->spinlock, flags); - + zr->ghost_int++; return IRQ_HANDLED; } diff --git a/drivers/staging/media/zoran/zoran_driver.c b/drivers/staging/media/zoran/zoran_driver.c index 8c23bb4f6b71..594713b41c0a 100644 --- a/drivers/staging/media/zoran/zoran_driver.c +++ b/drivers/staging/media/zoran/zoran_driver.c @@ -35,7 +35,6 @@ #include #include #include -#include #include #include @@ -50,7 +49,6 @@ #include #include "videocodec.h" -#include #include #include @@ -159,234 +157,8 @@ static __u32 zoran_v4l2_calc_bufsize(struct zoran_jpg_settings *settings) return jpg_bufsize; if (result < 8192) return 8192; - return result; -} - -/* forward references */ -static void v4l_fbuffer_free(struct zoran_fh *fh); -static void jpg_fbuffer_free(struct zoran_fh *fh); - -/* Set mapping mode */ -static void map_mode_raw(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - fh->map_mode = ZORAN_MAP_MODE_RAW; - zr->buffer_size = v4l_bufsize; - fh->buffers.num_buffers = v4l_nbufs; -} - -static void map_mode_jpg(struct zoran_fh *fh, int play) -{ - struct zoran *zr = fh->zr; - - fh->map_mode = play ? ZORAN_MAP_MODE_JPG_PLAY : ZORAN_MAP_MODE_JPG_REC; - zr->buffer_size = jpg_bufsize; - fh->buffers.num_buffers = jpg_nbufs; -} - -static inline const char *mode_name(enum zoran_map_mode mode) -{ - return mode == ZORAN_MAP_MODE_RAW ? "V4L" : "JPG"; -} - -/* - * Allocate the V4L grab buffers - * - * These have to be pysically contiguous. - */ - -static int v4l_fbuffer_alloc(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - int i, off; - unsigned char *mem; - - for (i = 0; i < fh->buffers.num_buffers; i++) { - if (fh->buffers.buffer[i].v4l.fbuffer) - pci_warn(zr->pci_dev, "%s - buffer %d already allocated!?\n", __func__, i); - - //udelay(20); - mem = kmalloc(zr->buffer_size, GFP_KERNEL | __GFP_NOWARN); - if (!mem) { - pci_err(zr->pci_dev, "%s - kmalloc for V4L buf %d failed\n", __func__, i); - v4l_fbuffer_free(fh); - return -ENOBUFS; - } - fh->buffers.buffer[i].v4l.fbuffer = mem; - fh->buffers.buffer[i].v4l.fbuffer_phys = virt_to_phys(mem); - fh->buffers.buffer[i].v4l.fbuffer_bus = virt_to_bus(mem); - for (off = 0; off < zr->buffer_size; - off += PAGE_SIZE) - SetPageReserved(virt_to_page(mem + off)); - pci_info(zr->pci_dev, "%s - V4L frame %d mem %p (bus: 0x%llx)\n", __func__, i, mem, - (unsigned long long)virt_to_bus(mem)); - } - - fh->buffers.allocated = 1; - - return 0; -} - -/* free the V4L grab buffers */ -static void v4l_fbuffer_free(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - int i, off; - unsigned char *mem; - - pci_dbg(zr->pci_dev, "%s\n", __func__); - - for (i = 0; i < fh->buffers.num_buffers; i++) { - if (!fh->buffers.buffer[i].v4l.fbuffer) - continue; - - mem = fh->buffers.buffer[i].v4l.fbuffer; - for (off = 0; off < zr->buffer_size; - off += PAGE_SIZE) - ClearPageReserved(virt_to_page(mem + off)); - kfree(fh->buffers.buffer[i].v4l.fbuffer); - fh->buffers.buffer[i].v4l.fbuffer = NULL; - } - fh->buffers.allocated = 0; -} - -/* - * Allocate the MJPEG grab buffers. - * - * If a Natoma chipset is present and this is a revision 1 zr36057, - * each MJPEG buffer needs to be physically contiguous. - * (RJ: This statement is from Dave Perks' original driver, - * I could never check it because I have a zr36067) - * - * RJ: The contents grab buffers needs never be accessed in the driver. - * Therefore there is no need to allocate them with vmalloc in order - * to get a contiguous virtual memory space. - * I don't understand why many other drivers first allocate them with - * vmalloc (which uses internally also get_zeroed_page, but delivers you - * virtual addresses) and then again have to make a lot of efforts - * to get the physical address. - * - * Ben Capper: - * On big-endian architectures (such as ppc) some extra steps - * are needed. When reading and writing to the stat_com array - * and fragment buffers, the device expects to see little- - * endian values. The use of cpu_to_le32() and le32_to_cpu() - * in this function (and one or two others in zoran_device.c) - * ensure that these values are always stored in little-endian - * form, regardless of architecture. The zr36057 does Very Bad - * Things on big endian architectures if the stat_com array - * and fragment buffers are not little-endian. - */ - -static int jpg_fbuffer_alloc(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - int i, j, off; - u8 *mem; - - for (i = 0; i < fh->buffers.num_buffers; i++) { - if (fh->buffers.buffer[i].jpg.frag_tab) - pci_warn(zr->pci_dev, "%s - buffer %d already allocated!?\n", __func__, i); - - /* Allocate fragment table for this buffer */ - - mem = (void *)get_zeroed_page(GFP_KERNEL); - if (!mem) { - pci_err(zr->pci_dev, "%s - get_zeroed_page (frag_tab) failed for buffer %d\n", __func__, i); - jpg_fbuffer_free(fh); - return -ENOBUFS; - } - fh->buffers.buffer[i].jpg.frag_tab = (__le32 *)mem; - fh->buffers.buffer[i].jpg.frag_tab_bus = virt_to_bus(mem); - - if (fh->buffers.need_contiguous) { - mem = kmalloc(zr->buffer_size, GFP_KERNEL); - if (!mem) { - pci_err(zr->pci_dev, "%s - kmalloc failed for buffer %d\n", __func__, i); - jpg_fbuffer_free(fh); - return -ENOBUFS; - } - fh->buffers.buffer[i].jpg.frag_tab[0] = - cpu_to_le32(virt_to_bus(mem)); - fh->buffers.buffer[i].jpg.frag_tab[1] = - cpu_to_le32((zr->buffer_size >> 1) | 1); - for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) - SetPageReserved(virt_to_page(mem + off)); - } else { - /* jpg_bufsize is already page aligned */ - for (j = 0; j < zr->buffer_size / PAGE_SIZE; j++) { - mem = (void *)get_zeroed_page(GFP_KERNEL); - if (!mem) { - pci_err(zr->pci_dev, "%s - get_zeroed_page failed for buffer %d\n", __func__, i); - jpg_fbuffer_free(fh); - return -ENOBUFS; - } - - fh->buffers.buffer[i].jpg.frag_tab[2 * j] = - cpu_to_le32(virt_to_bus(mem)); - fh->buffers.buffer[i].jpg.frag_tab[2 * j + 1] = - cpu_to_le32((PAGE_SIZE >> 2) << 1); - SetPageReserved(virt_to_page(mem)); - } - - fh->buffers.buffer[i].jpg.frag_tab[2 * j - 1] |= cpu_to_le32(1); - } - } - - pci_dbg(zr->pci_dev, "%s - %d KB allocated\n", __func__, - (fh->buffers.num_buffers * zr->buffer_size) >> 10); - - fh->buffers.allocated = 1; - - return 0; -} - -/* free the MJPEG grab buffers */ -static void jpg_fbuffer_free(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - int i, j, off; - unsigned char *mem; - __le32 frag_tab; - struct zoran_buffer *buffer; - - pci_dbg(zr->pci_dev, "%s\n", __func__); - - for (i = 0, buffer = &fh->buffers.buffer[0]; - i < fh->buffers.num_buffers; i++, buffer++) { - if (!buffer->jpg.frag_tab) - continue; - - if (fh->buffers.need_contiguous) { - frag_tab = buffer->jpg.frag_tab[0]; - - if (frag_tab) { - mem = bus_to_virt(le32_to_cpu(frag_tab)); - for (off = 0; off < zr->buffer_size; off += PAGE_SIZE) - ClearPageReserved(virt_to_page(mem + off)); - kfree(mem); - buffer->jpg.frag_tab[0] = 0; - buffer->jpg.frag_tab[1] = 0; - } - } else { - for (j = 0; j < zr->buffer_size / PAGE_SIZE; j++) { - frag_tab = buffer->jpg.frag_tab[2 * j]; - - if (!frag_tab) - break; - ClearPageReserved(virt_to_page(bus_to_virt(le32_to_cpu(frag_tab)))); - free_page((unsigned long)bus_to_virt(le32_to_cpu(frag_tab))); - buffer->jpg.frag_tab[2 * j] = 0; - buffer->jpg.frag_tab[2 * j + 1] = 0; - } - } - - free_page((unsigned long)buffer->jpg.frag_tab); - buffer->jpg.frag_tab = NULL; - } - - fh->buffers.allocated = 0; + return result; } /* @@ -431,561 +203,8 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height, return 0; } -static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) -{ - struct zoran *zr = fh->zr; - unsigned long flags; - int res = 0; - - if (!fh->buffers.allocated) { - pci_err(zr->pci_dev, "%s - buffers not yet allocated\n", __func__); - res = -ENOMEM; - } - - /* No grabbing outside the buffer range! */ - if (num >= fh->buffers.num_buffers || num < 0) { - pci_err(zr->pci_dev, "%s - buffer %d is out of range\n", __func__, num); - res = -EINVAL; - } - - spin_lock_irqsave(&zr->spinlock, flags); - - if (fh->buffers.active == ZORAN_FREE) { - if (zr->v4l_buffers.active == ZORAN_FREE) { - zr->v4l_buffers = fh->buffers; - fh->buffers.active = ZORAN_ACTIVE; - } else { - pci_err(zr->pci_dev, "%s - another session is already capturing\n", __func__); - res = -EBUSY; - } - } - - /* make sure a grab isn't going on currently with this buffer */ - if (!res) { - switch (zr->v4l_buffers.buffer[num].state) { - default: - case BUZ_STATE_PEND: - if (zr->v4l_buffers.active == ZORAN_FREE) { - fh->buffers.active = ZORAN_FREE; - zr->v4l_buffers.allocated = 0; - } - res = -EBUSY; /* what are you doing? */ - break; - case BUZ_STATE_DONE: - pci_warn(zr->pci_dev, "%s - queueing buffer %d in state DONE!?\n", __func__, num); - /* fallthrough */ - case BUZ_STATE_USER: - /* since there is at least one unused buffer there's room for at least - * one more pend[] entry */ - zr->v4l_pend[zr->v4l_pend_head++ & V4L_MASK_FRAME] = num; - zr->v4l_buffers.buffer[num].state = BUZ_STATE_PEND; - zr->v4l_buffers.buffer[num].bs.length = - zr->v4l_settings.bytesperline * - zr->v4l_settings.height; - fh->buffers.buffer[num] = zr->v4l_buffers.buffer[num]; - break; - } - } - - spin_unlock_irqrestore(&zr->spinlock, flags); - - if (!res && zr->v4l_buffers.active == ZORAN_FREE) - zr->v4l_buffers.active = fh->buffers.active; - - return res; -} - -/* - * Sync on a V4L buffer - */ - -static int v4l_sync(struct zoran_fh *fh, int frame) -{ - struct zoran *zr = fh->zr; - unsigned long flags; - - if (fh->buffers.active == ZORAN_FREE) { - pci_err(zr->pci_dev, "%s - no grab active for this session\n", __func__); - return -EINVAL; - } - - /* check passed-in frame number */ - if (frame >= fh->buffers.num_buffers || frame < 0) { - pci_err(zr->pci_dev, "%s - frame %d is invalid\n", __func__, frame); - return -EINVAL; - } - - /* Check if is buffer was queued at all */ - if (zr->v4l_buffers.buffer[frame].state == BUZ_STATE_USER) { - pci_err(zr->pci_dev, "%s - attempt to sync on a buffer which was not queued?\n", __func__); - return -EPROTO; - } - - mutex_unlock(&zr->lock); - /* wait on this buffer to get ready */ - if (!wait_event_interruptible_timeout(zr->v4l_capq, - (zr->v4l_buffers.buffer[frame].state != BUZ_STATE_PEND), 10 * HZ)) { - mutex_lock(&zr->lock); - return -ETIME; - } - mutex_lock(&zr->lock); - if (signal_pending(current)) - return -ERESTARTSYS; - - /* buffer should now be in BUZ_STATE_DONE */ - if (zr->v4l_buffers.buffer[frame].state != BUZ_STATE_DONE) - pci_err(zr->pci_dev, "%s - internal state error\n", __func__); - - zr->v4l_buffers.buffer[frame].state = BUZ_STATE_USER; - fh->buffers.buffer[frame] = zr->v4l_buffers.buffer[frame]; - - spin_lock_irqsave(&zr->spinlock, flags); - - /* Check if streaming capture has finished */ - if (zr->v4l_pend_tail == zr->v4l_pend_head) { - zr36057_set_memgrab(zr, 0); - if (zr->v4l_buffers.active == ZORAN_ACTIVE) { - fh->buffers.active = zr->v4l_buffers.active = ZORAN_FREE; - zr->v4l_buffers.allocated = 0; - } - } - - spin_unlock_irqrestore(&zr->spinlock, flags); - - return 0; -} - -/* - * Queue a MJPEG buffer for capture/playback - */ -static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num, - enum zoran_codec_mode mode) -{ - struct zoran *zr = fh->zr; - unsigned long flags; - int res = 0; - - /* Check if buffers are allocated */ - if (!fh->buffers.allocated) { - pci_err(zr->pci_dev, "%s - buffers not yet allocated\n", __func__); - return -ENOMEM; - } - - /* No grabbing outside the buffer range! */ - if (num >= fh->buffers.num_buffers || num < 0) { - pci_err(zr->pci_dev, "%s - buffer %d out of range\n", __func__, num); - return -EINVAL; - } - - /* what is the codec mode right now? */ - if (zr->codec_mode != BUZ_MODE_IDLE && zr->codec_mode != mode) { - /* wrong codec mode active - invalid */ - pci_err(zr->pci_dev, "%s - codec in wrong mode\n", __func__); - return -EINVAL; - } - - if (fh->buffers.active == ZORAN_FREE) { - if (zr->jpg_buffers.active == ZORAN_FREE) { - zr->jpg_buffers = fh->buffers; - fh->buffers.active = ZORAN_ACTIVE; - } else { - pci_err(zr->pci_dev, "%s - another session is already capturing\n", __func__); - res = -EBUSY; - } - } - - if (!res && zr->codec_mode == BUZ_MODE_IDLE) { - /* Ok load up the jpeg codec */ - zr36057_enable_jpg(zr, mode); - } - - spin_lock_irqsave(&zr->spinlock, flags); - - if (!res) { - switch (zr->jpg_buffers.buffer[num].state) { - case BUZ_STATE_DONE: - pci_warn(zr->pci_dev, "%s - queuing frame in BUZ_STATE_DONE state!?\n", __func__); - /* fallthrough */ - case BUZ_STATE_USER: - /* since there is at least one unused buffer there's room for at - *least one more pend[] entry */ - zr->jpg_pend[zr->jpg_que_head++ & BUZ_MASK_FRAME] = num; - zr->jpg_buffers.buffer[num].state = BUZ_STATE_PEND; - fh->buffers.buffer[num] = zr->jpg_buffers.buffer[num]; - zoran_feed_stat_com(zr); - break; - default: - case BUZ_STATE_DMA: - case BUZ_STATE_PEND: - if (zr->jpg_buffers.active == ZORAN_FREE) { - fh->buffers.active = ZORAN_FREE; - zr->jpg_buffers.allocated = 0; - } - res = -EBUSY; /* what are you doing? */ - break; - } - } - - spin_unlock_irqrestore(&zr->spinlock, flags); - - if (!res && zr->jpg_buffers.active == ZORAN_FREE) - zr->jpg_buffers.active = fh->buffers.active; - - return res; -} - -static int jpg_qbuf(struct zoran_fh *fh, int frame, enum zoran_codec_mode mode) -{ - struct zoran *zr = fh->zr; - int res = 0; - - /* Does the user want to stop streaming? */ - if (frame < 0) { - if (zr->codec_mode == mode) { - if (fh->buffers.active == ZORAN_FREE) { - pci_err(zr->pci_dev, "%s(-1) - session not active\n", __func__); - return -EINVAL; - } - fh->buffers.active = zr->jpg_buffers.active = ZORAN_FREE; - zr->jpg_buffers.allocated = 0; - zr36057_enable_jpg(zr, BUZ_MODE_IDLE); - return 0; - } else { - pci_err(zr->pci_dev, "%s - stop streaming but not in streaming mode\n", __func__); - return -EINVAL; - } - } - - res = zoran_jpg_queue_frame(fh, frame, mode); - if (res) - return res; - - /* Start the jpeg codec when the first frame is queued */ - if (!res && zr->jpg_que_head == 1) - jpeg_start(zr); - - return res; -} - -/* - * Sync on a MJPEG buffer - */ - -static int jpg_sync(struct zoran_fh *fh, struct zoran_sync *bs) -{ - struct zoran *zr = fh->zr; - unsigned long flags; - int frame; - - if (fh->buffers.active == ZORAN_FREE) { - pci_err(zr->pci_dev, "%s - capture is not currently active\n", __func__); - return -EINVAL; - } - if (zr->codec_mode != BUZ_MODE_MOTION_DECOMPRESS && - zr->codec_mode != BUZ_MODE_MOTION_COMPRESS) { - pci_err(zr->pci_dev, "%s - codec not in streaming mode\n", __func__); - return -EINVAL; - } - mutex_unlock(&zr->lock); - if (!wait_event_interruptible_timeout(zr->jpg_capq, - (zr->jpg_que_tail != zr->jpg_dma_tail || - zr->jpg_dma_tail == zr->jpg_dma_head), - 10 * HZ)) { - int isr; - - btand(~ZR36057_JMC_Go_en, ZR36057_JMC); - udelay(1); - zr->codec->control(zr->codec, CODEC_G_STATUS, sizeof(isr), &isr); - mutex_lock(&zr->lock); - pci_err(zr->pci_dev, "%s - timeout: codec isr=0x%02x\n", __func__, isr); - - return -ETIME; - } - mutex_lock(&zr->lock); - if (signal_pending(current)) - return -ERESTARTSYS; - - spin_lock_irqsave(&zr->spinlock, flags); - - if (zr->jpg_dma_tail != zr->jpg_dma_head) - frame = zr->jpg_pend[zr->jpg_que_tail++ & BUZ_MASK_FRAME]; - else - frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; - - /* buffer should now be in BUZ_STATE_DONE */ - if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE) - pci_err(zr->pci_dev, "%s - internal state error\n", __func__); - - *bs = zr->jpg_buffers.buffer[frame].bs; - bs->frame = frame; - zr->jpg_buffers.buffer[frame].state = BUZ_STATE_USER; - fh->buffers.buffer[frame] = zr->jpg_buffers.buffer[frame]; - - spin_unlock_irqrestore(&zr->spinlock, flags); - - return 0; -} - -static void zoran_open_init_session(struct zoran_fh *fh) -{ - int i; - - /* Per default, map the V4L Buffers */ - map_mode_raw(fh); - - /* buffers */ - memset(&fh->buffers, 0, sizeof(fh->buffers)); - for (i = 0; i < MAX_FRAME; i++) { - fh->buffers.buffer[i].state = BUZ_STATE_USER; /* nothing going on */ - fh->buffers.buffer[i].bs.frame = i; - } - fh->buffers.allocated = 0; - fh->buffers.active = ZORAN_FREE; -} - -static void zoran_close_end_session(struct zoran_fh *fh) -{ - struct zoran *zr = fh->zr; - - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - /* v4l capture */ - if (fh->buffers.active != ZORAN_FREE) { - unsigned long flags; - - spin_lock_irqsave(&zr->spinlock, flags); - zr36057_set_memgrab(zr, 0); - zr->v4l_buffers.allocated = 0; - zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE; - spin_unlock_irqrestore(&zr->spinlock, flags); - } - - /* v4l buffers */ - if (fh->buffers.allocated) - v4l_fbuffer_free(fh); - } else { - /* jpg capture */ - if (fh->buffers.active != ZORAN_FREE) { - zr36057_enable_jpg(zr, BUZ_MODE_IDLE); - zr->jpg_buffers.allocated = 0; - zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE; - } - - /* jpg buffers */ - if (fh->buffers.allocated) - jpg_fbuffer_free(fh); - } -} - -/* - * Open a zoran card. Right now the flags stuff is just playing - */ -static int zoran_open(struct file *file) -{ - struct zoran *zr = video_drvdata(file); - struct zoran_fh *fh; - int res, first_open = 0; - - pci_info(zr->pci_dev, "%s(%s, pid=[%d]), users(-)=%d\n", __func__, current->comm, - task_pid_nr(current), zr->user + 1); - - mutex_lock(&zr->lock); - - if (zr->user >= 2048) { - pci_err(zr->pci_dev, "too many users (%d) on device\n", zr->user); - res = -EBUSY; - goto fail_unlock; - } - - /* now, create the open()-specific file_ops struct */ - fh = kzalloc(sizeof(*fh), GFP_KERNEL); - if (!fh) { - res = -ENOMEM; - goto fail_unlock; - } - v4l2_fh_init(&fh->fh, video_devdata(file)); - - if (zr->user++ == 0) - first_open = 1; - - /* default setup - TODO: look at flags */ - if (first_open) { /* First device open */ - zr36057_restart(zr); - zoran_open_init_params(zr); - zoran_init_hardware(zr); - - btor(ZR36057_ICR_IntPinEn, ZR36057_ICR); - } - - /* set file_ops stuff */ - file->private_data = fh; - fh->zr = zr; - zoran_open_init_session(fh); - v4l2_fh_add(&fh->fh); - mutex_unlock(&zr->lock); - - return 0; - -fail_unlock: - mutex_unlock(&zr->lock); - - pci_info(zr->pci_dev, "open failed (%d), users(-)=%d\n", res, zr->user); - - return res; -} - -static int zoran_close(struct file *file) -{ - struct zoran_fh *fh = file->private_data; - struct zoran *zr = fh->zr; - - pci_info(zr->pci_dev, "%s(%s, pid=[%d]), users(+)=%d\n", __func__, current->comm, - task_pid_nr(current), zr->user - 1); - - /* kernel locks (fs/device.c), so don't do that ourselves - * (prevents deadlocks) */ - mutex_lock(&zr->lock); - - zoran_close_end_session(fh); - - if (zr->user-- == 1) { /* Last process */ - /* Clean up JPEG process */ - wake_up_interruptible(&zr->jpg_capq); - zr36057_enable_jpg(zr, BUZ_MODE_IDLE); - zr->jpg_buffers.allocated = 0; - zr->jpg_buffers.active = ZORAN_FREE; - - /* disable interrupts */ - btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR); - - if (zr36067_debug > 1) - print_interrupts(zr); - - /* capture off */ - wake_up_interruptible(&zr->v4l_capq); - zr36057_set_memgrab(zr, 0); - zr->v4l_buffers.allocated = 0; - zr->v4l_buffers.active = ZORAN_FREE; - zoran_set_pci_master(zr, 0); - - if (!pass_through) { /* Switch to color bar */ - decoder_call(zr, video, s_stream, 0); - encoder_call(zr, video, s_routing, 2, 0, 0); - } - } - mutex_unlock(&zr->lock); - - v4l2_fh_del(&fh->fh); - v4l2_fh_exit(&fh->fh); - kfree(fh); - - pci_dbg(zr->pci_dev, "%s done\n", __func__); - - return 0; -} - -/* get the status of a buffer in the clients buffer queue */ -static int zoran_v4l2_buffer_status(struct zoran_fh *fh, - struct v4l2_buffer *buf, int num) -{ - struct zoran *zr = fh->zr; - unsigned long flags; - - buf->flags = V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: - /* check range */ - if (num < 0 || num >= fh->buffers.num_buffers || - !fh->buffers.allocated) { - pci_err(zr->pci_dev, "%s - wrong number or buffers not allocated\n", __func__); - return -EINVAL; - } - - spin_lock_irqsave(&zr->spinlock, flags); - pci_dbg(zr->pci_dev, "%s() - raw active=%c, buffer %d: state=%c, map=%c\n", __func__, - "FAL"[fh->buffers.active], num, - "UPMD"[zr->v4l_buffers.buffer[num].state], - fh->buffers.buffer[num].map ? 'Y' : 'N'); - spin_unlock_irqrestore(&zr->spinlock, flags); - - buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - buf->length = zr->buffer_size; - - /* get buffer */ - buf->bytesused = fh->buffers.buffer[num].bs.length; - if (fh->buffers.buffer[num].state == BUZ_STATE_DONE || - fh->buffers.buffer[num].state == BUZ_STATE_USER) { - buf->sequence = fh->buffers.buffer[num].bs.seq; - buf->flags |= V4L2_BUF_FLAG_DONE; - v4l2_buffer_set_timestamp(buf, fh->buffers.buffer[num].bs.ts); - } else { - buf->flags |= V4L2_BUF_FLAG_QUEUED; - } - - if (zr->v4l_settings.height <= BUZ_MAX_HEIGHT / 2) - buf->field = V4L2_FIELD_TOP; - else - buf->field = V4L2_FIELD_INTERLACED; - - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - - /* check range */ - if (num < 0 || num >= fh->buffers.num_buffers || - !fh->buffers.allocated) { - pci_err(zr->pci_dev, "%s - wrong number or buffers not allocated\n", __func__); - return -EINVAL; - } - - buf->type = (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ? - V4L2_BUF_TYPE_VIDEO_CAPTURE : - V4L2_BUF_TYPE_VIDEO_OUTPUT; - buf->length = zr->buffer_size; - - /* these variables are only written after frame has been captured */ - if (fh->buffers.buffer[num].state == BUZ_STATE_DONE || - fh->buffers.buffer[num].state == BUZ_STATE_USER) { - buf->sequence = fh->buffers.buffer[num].bs.seq; - v4l2_buffer_set_timestamp(buf, fh->buffers.buffer[num].bs.ts); - buf->bytesused = fh->buffers.buffer[num].bs.length; - buf->flags |= V4L2_BUF_FLAG_DONE; - } else { - buf->flags |= V4L2_BUF_FLAG_QUEUED; - } - - /* which fields are these? */ - if (zr->jpg_settings.TmpDcm != 1) - buf->field = zr->jpg_settings.odd_even ? - V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM; - else - buf->field = zr->jpg_settings.odd_even ? - V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; - - break; - - default: - - pci_err(zr->pci_dev, "%s - invalid buffer type|map_mode (%d|%d)\n", - __func__, buf->type, fh->map_mode); - return -EINVAL; - } - - buf->memory = V4L2_MEMORY_MMAP; - buf->index = num; - buf->m.offset = buf->length * num; - - return 0; -} - static int zoran_set_norm(struct zoran *zr, v4l2_std_id norm) { - if (zr->v4l_buffers.active != ZORAN_FREE || - zr->jpg_buffers.active != ZORAN_FREE) { - pr_warn("%s: %s called while in playback/capture mode\n", ZR_DEVNAME(zr), __func__); - return -EBUSY; - } if (!(norm & zr->card.norms)) { pci_err(zr->pci_dev, "%s - unsupported norm %llx\n", __func__, norm); @@ -1013,12 +232,6 @@ static int zoran_set_input(struct zoran *zr, int input) if (input == zr->input) return 0; - if (zr->v4l_buffers.active != ZORAN_FREE || - zr->jpg_buffers.active != ZORAN_FREE) { - pci_warn(zr->pci_dev, "%s called while in playback/capture mode\n", __func__); - return -EBUSY; - } - if (input < 0 || input >= zr->card.inputs) { pci_err(zr->pci_dev, "%s - unsupported input %d\n", __func__, input); return -EINVAL; @@ -1108,12 +321,10 @@ static int zoran_g_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - - if (fh->map_mode != ZORAN_MAP_MODE_RAW) - return zoran_g_fmt_vid_out(file, fh, fmt); + struct zoran *zr = video_drvdata(file); + if (zr->map_mode != ZORAN_MAP_MODE_RAW) + return zoran_g_fmt_vid_out(file, __fh, fmt); fmt->fmt.pix.width = zr->v4l_settings.width; fmt->fmt.pix.height = zr->v4l_settings.height; fmt->fmt.pix.sizeimage = zr->buffer_size; @@ -1194,13 +405,12 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh, static int zoran_try_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); int bpp; int i; if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG) - return zoran_try_fmt_vid_out(file, fh, fmt); + return zoran_try_fmt_vid_out(file, __fh, fmt); for (i = 0; i < NUM_FORMATS; i++) if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat) @@ -1226,8 +436,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh, static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format *fmt) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); __le32 printformat = __cpu_to_le32(fmt->fmt.pix.pixelformat); struct zoran_jpg_settings settings; int res = 0; @@ -1239,12 +448,6 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format if (fmt->fmt.pix.pixelformat != V4L2_PIX_FMT_MJPEG) return -EINVAL; - if (fh->buffers.allocated) { - pci_err(zr->pci_dev, "VIDIOC_S_FMT - cannot change capture mode\n"); - res = -EBUSY; - return res; - } - if (!fmt->fmt.pix.height || !fmt->fmt.pix.width) return -EINVAL; @@ -1287,7 +490,11 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format /* it's ok, so set them */ zr->jpg_settings = settings; - map_mode_jpg(fh, fmt->type == V4L2_BUF_TYPE_VIDEO_OUTPUT); + if (fmt->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) + zr->map_mode = ZORAN_MAP_MODE_JPG_REC; + else + zr->map_mode = ZORAN_MAP_MODE_JPG_PLAY; + zr->buffer_size = zoran_v4l2_calc_bufsize(&zr->jpg_settings); /* tell the user what we actually did */ @@ -1325,13 +532,6 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format return -EINVAL; } - if ((fh->map_mode != ZORAN_MAP_MODE_RAW && fh->buffers.allocated) || - fh->buffers.active != ZORAN_FREE) { - pci_err(zr->pci_dev, "VIDIOC_S_FMT - cannot change capture mode\n"); - res = -EBUSY; - return res; - } - fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; if (fmt->fmt.pix.height > BUZ_MAX_HEIGHT) fmt->fmt.pix.height = BUZ_MAX_HEIGHT; @@ -1342,7 +542,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format if (fmt->fmt.pix.width < BUZ_MIN_WIDTH) fmt->fmt.pix.width = BUZ_MIN_WIDTH; - map_mode_raw(fh); + zr->map_mode = ZORAN_MAP_MODE_RAW; res = zoran_v4l_set_format(zr, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]); if (res) @@ -1359,309 +559,6 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format return res; } -static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type); - -static int zoran_reqbufs(struct file *file, void *__fh, struct v4l2_requestbuffers *req) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int res = 0; - - if (req->memory != V4L2_MEMORY_MMAP) { - pci_err(zr->pci_dev, "only MEMORY_MMAP capture is supported, not %d\n", req->memory); - return -EINVAL; - } - - if (req->count == 0) - return zoran_streamoff(file, fh, req->type); - - if (fh->buffers.allocated) { - pr_warn("%s: VIDIOC_REQBUFS - buffers already allocated\n", ZR_DEVNAME(zr)); - res = -EBUSY; - return res; - } - - if (fh->map_mode == ZORAN_MAP_MODE_RAW && - req->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { - /* control user input */ - if (req->count < 2) - req->count = 2; - if (req->count > v4l_nbufs) - req->count = v4l_nbufs; - - /* The next mmap will map the V4L buffers */ - map_mode_raw(fh); - fh->buffers.num_buffers = req->count; - - if (v4l_fbuffer_alloc(fh)) { - res = -ENOMEM; - return res; - } - } else if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC || - fh->map_mode == ZORAN_MAP_MODE_JPG_PLAY) { - /* we need to calculate size ourselves now */ - if (req->count < 4) - req->count = 4; - if (req->count > jpg_nbufs) - req->count = jpg_nbufs; - - /* The next mmap will map the MJPEG buffers */ - map_mode_jpg(fh, req->type == V4L2_BUF_TYPE_VIDEO_OUTPUT); - fh->buffers.num_buffers = req->count; - zr->buffer_size = zoran_v4l2_calc_bufsize(&zr->jpg_settings); - - if (jpg_fbuffer_alloc(fh)) { - res = -ENOMEM; - return res; - } - } else { - pci_err(zr->pci_dev, "VIDIOC_REQBUFS - unknown type %d\n", req->type); - res = -EINVAL; - return res; - } - return res; -} - -static int zoran_querybuf(struct file *file, void *__fh, struct v4l2_buffer *buf) -{ - struct zoran_fh *fh = __fh; - - return zoran_v4l2_buffer_status(fh, buf, buf->index); -} - -static int zoran_qbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int res = 0, codec_mode, buf_type; - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: - if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - buf->type, fh->map_mode); - res = -EINVAL; - return res; - } - - res = zoran_v4l_queue_frame(fh, buf->index); - if (res) - return res; - if (!zr->v4l_memgrab_active && fh->buffers.active == ZORAN_LOCKED) - zr36057_set_memgrab(zr, 1); - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - if (fh->map_mode == ZORAN_MAP_MODE_JPG_PLAY) { - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - codec_mode = BUZ_MODE_MOTION_DECOMPRESS; - } else { - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - codec_mode = BUZ_MODE_MOTION_COMPRESS; - } - - if (buf->type != buf_type) { - pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - buf->type, fh->map_mode); - res = -EINVAL; - return res; - } - - res = zoran_jpg_queue_frame(fh, buf->index, codec_mode); - if (res != 0) - return res; - if (zr->codec_mode == BUZ_MODE_IDLE && - fh->buffers.active == ZORAN_LOCKED) - zr36057_enable_jpg(zr, codec_mode); - - break; - - default: - pci_err(zr->pci_dev, "VIDIOC_QBUF - unsupported type %d\n", buf->type); - res = -EINVAL; - break; - } - return res; -} - -static int zoran_dqbuf(struct file *file, void *__fh, struct v4l2_buffer *buf) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int res = 0, buf_type, num = -1; /* compiler borks here (?) */ - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: - if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { - pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - buf->type, fh->map_mode); - res = -EINVAL; - return res; - } - - num = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; - if (file->f_flags & O_NONBLOCK && - zr->v4l_buffers.buffer[num].state != BUZ_STATE_DONE) { - res = -EAGAIN; - return res; - } - res = v4l_sync(fh, num); - if (res) - return res; - zr->v4l_sync_tail++; - res = zoran_v4l2_buffer_status(fh, buf, num); - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - { - struct zoran_sync bs; - - if (fh->map_mode == ZORAN_MAP_MODE_JPG_PLAY) - buf_type = V4L2_BUF_TYPE_VIDEO_OUTPUT; - else - buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - - if (buf->type != buf_type) { - pci_err(zr->pci_dev, "VIDIOC_QBUF - invalid buf->type=%d for map_mode=%d\n", - buf->type, fh->map_mode); - res = -EINVAL; - return res; - } - - num = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; - - if (file->f_flags & O_NONBLOCK && - zr->jpg_buffers.buffer[num].state != BUZ_STATE_DONE) { - res = -EAGAIN; - return res; - } - bs.frame = 0; /* suppress compiler warning */ - res = jpg_sync(fh, &bs); - if (res) - return res; - res = zoran_v4l2_buffer_status(fh, buf, bs.frame); - break; - } - - default: - pci_err(zr->pci_dev, "VIDIOC_DQBUF - unsupported type %d\n", buf->type); - res = -EINVAL; - break; - } - return res; -} - -static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int res = 0; - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: /* raw capture */ - if (zr->v4l_buffers.active != ZORAN_ACTIVE || - fh->buffers.active != ZORAN_ACTIVE) { - res = -EBUSY; - return res; - } - - zr->v4l_buffers.active = fh->buffers.active = ZORAN_LOCKED; - - zr->v4l_sync_tail = zr->v4l_pend_tail; - if (!zr->v4l_memgrab_active && - zr->v4l_pend_head != zr->v4l_pend_tail) { - zr36057_set_memgrab(zr, 1); - } - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - /* what is the codec mode right now? */ - if (zr->jpg_buffers.active != ZORAN_ACTIVE || - fh->buffers.active != ZORAN_ACTIVE) { - res = -EBUSY; - return res; - } - - zr->jpg_buffers.active = fh->buffers.active = ZORAN_LOCKED; - - if (zr->jpg_que_head != zr->jpg_que_tail) { - /* Start the jpeg codec when the first frame is queued */ - jpeg_start(zr); - } - break; - - default: - pci_err(zr->pci_dev, "VIDIOC_STREAMON - invalid map mode %d\n", fh->map_mode); - res = -EINVAL; - break; - } - return res; -} - -static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type type) -{ - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; - int i, res = 0; - unsigned long flags; - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: /* raw capture */ - if (fh->buffers.active == ZORAN_FREE && - zr->v4l_buffers.active != ZORAN_FREE) { - res = -EPERM; /* stay off other's settings! */ - return res; - } - if (zr->v4l_buffers.active == ZORAN_FREE) - return res; - - spin_lock_irqsave(&zr->spinlock, flags); - /* unload capture */ - if (zr->v4l_memgrab_active) - zr36057_set_memgrab(zr, 0); - - for (i = 0; i < fh->buffers.num_buffers; i++) - zr->v4l_buffers.buffer[i].state = BUZ_STATE_USER; - fh->buffers = zr->v4l_buffers; - - zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE; - - zr->v4l_grab_seq = 0; - zr->v4l_pend_head = zr->v4l_pend_tail = 0; - zr->v4l_sync_tail = 0; - - spin_unlock_irqrestore(&zr->spinlock, flags); - - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - if (fh->buffers.active == ZORAN_FREE && - zr->jpg_buffers.active != ZORAN_FREE) { - res = -EPERM; /* stay off other's settings! */ - return res; - } - if (zr->jpg_buffers.active == ZORAN_FREE) - return res; - - res = jpg_qbuf(fh, -1, - (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) ? - BUZ_MODE_MOTION_COMPRESS : - BUZ_MODE_MOTION_DECOMPRESS); - if (res) - return res; - break; - default: - pci_err(zr->pci_dev, "VIDIOC_STREAMOFF - invalid map mode %d\n", fh->map_mode); - res = -EINVAL; - break; - } - return res; -} - static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) { struct zoran *zr = video_drvdata(file); @@ -1675,11 +572,10 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std) struct zoran *zr = video_drvdata(file); int res = 0; - res = zoran_set_norm(zr, std); - if (res) - return res; + if (zr->running != ZORAN_MAP_MODE_NONE) + return -EBUSY; - res = wait_grab_pending(zr); + res = zoran_set_norm(zr, std); return res; } @@ -1713,12 +609,10 @@ static int zoran_s_input(struct file *file, void *__fh, unsigned int input) struct zoran *zr = video_drvdata(file); int res; - res = zoran_set_input(zr, input); - if (res) - return res; + if (zr->running != ZORAN_MAP_MODE_NONE) + return -EBUSY; - /* Make sure the changes come into effect */ - res = wait_grab_pending(zr); + res = zoran_set_input(zr, input); return res; } @@ -1730,11 +624,12 @@ static int zoran_enum_output(struct file *file, void *__fh, outp->index = 0; outp->type = V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY; + outp->std = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM; + outp->capabilities = V4L2_OUT_CAP_STD; strscpy(outp->name, "Autodetect", sizeof(outp->name)); return 0; } - static int zoran_g_output(struct file *file, void *__fh, unsigned int *output) { *output = 0; @@ -1749,19 +644,14 @@ static int zoran_s_output(struct file *file, void *__fh, unsigned int output) return 0; } - /* cropping (sub-frame capture) */ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selection *sel) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); if (sel->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && - sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; - - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - pci_err(zr->pci_dev, "VIDIOC_G_SELECTION - subcapture only supported for compressed capture\n"); + sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { + pci_err(zr->pci_dev, "%s invalid combinaison\n", __func__); return -EINVAL; } @@ -1790,8 +680,7 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selection *sel) { - struct zoran_fh *fh = __fh; - struct zoran *zr = fh->zr; + struct zoran *zr = video_drvdata(file); struct zoran_jpg_settings settings; int res; @@ -1805,18 +694,13 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio if (sel->target != V4L2_SEL_TGT_CROP) return -EINVAL; - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { + if (zr->map_mode == ZORAN_MAP_MODE_RAW) { pci_err(zr->pci_dev, "VIDIOC_S_SELECTION - subcapture only supported for compressed capture\n"); return -EINVAL; } settings = zr->jpg_settings; - if (fh->buffers.allocated) { - pci_err(zr->pci_dev, "VIDIOC_S_SELECTION - cannot change settings while active\n"); - return -EBUSY; - } - /* move into a form that we understand */ settings.img_x = sel->r.left; settings.img_y = sel->r.top; @@ -1833,260 +717,6 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio return res; } -static __poll_t zoran_poll(struct file *file, poll_table *wait) -{ - struct zoran_fh *fh = file->private_data; - struct zoran *zr = fh->zr; - __poll_t res = v4l2_ctrl_poll(file, wait); - int frame; - unsigned long flags; - - /* we should check whether buffers are ready to be synced on - * (w/o waits - O_NONBLOCK) here - * if ready for read (sync), return EPOLLIN|EPOLLRDNORM, - * if ready for write (sync), return EPOLLOUT|EPOLLWRNORM, - * if error, return EPOLLERR, - * if no buffers queued or so, return EPOLLNVAL - */ - - switch (fh->map_mode) { - case ZORAN_MAP_MODE_RAW: - poll_wait(file, &zr->v4l_capq, wait); - frame = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME]; - - spin_lock_irqsave(&zr->spinlock, flags); - pci_dbg(zr->pci_dev, "%s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n", - __func__, - "FAL"[fh->buffers.active], zr->v4l_sync_tail, - "UPMD"[zr->v4l_buffers.buffer[frame].state], - zr->v4l_pend_tail, zr->v4l_pend_head); - /* Process is the one capturing? */ - if (fh->buffers.active != ZORAN_FREE && - /* Buffer ready to DQBUF? */ - zr->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE) - res |= EPOLLIN | EPOLLRDNORM; - spin_unlock_irqrestore(&zr->spinlock, flags); - - break; - - case ZORAN_MAP_MODE_JPG_REC: - case ZORAN_MAP_MODE_JPG_PLAY: - poll_wait(file, &zr->jpg_capq, wait); - frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME]; - - spin_lock_irqsave(&zr->spinlock, flags); - pci_dbg(zr->pci_dev, "%s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n", - __func__, - "FAL"[fh->buffers.active], zr->jpg_que_tail, - "UPMD"[zr->jpg_buffers.buffer[frame].state], - zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head); - if (fh->buffers.active != ZORAN_FREE && - zr->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) { - if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC) - res |= EPOLLIN | EPOLLRDNORM; - else - res |= EPOLLOUT | EPOLLWRNORM; - } - spin_unlock_irqrestore(&zr->spinlock, flags); - - break; - - default: - pci_err(zr->pci_dev, "%s - internal error, unknown map_mode=%d\n", __func__, fh->map_mode); - res |= EPOLLERR; - } - - return res; -} - -/* - * This maps the buffers to user space. - * - * Depending on the state of fh->map_mode - * the V4L or the MJPEG buffers are mapped - * per buffer or all together - * - * Note that we need to connect to some - * unmap signal event to unmap the de-allocate - * the buffer accordingly (zoran_vm_close()) - */ - -static void zoran_vm_open(struct vm_area_struct *vma) -{ - struct zoran_mapping *map = vma->vm_private_data; - - atomic_inc(&map->count); -} - -static void zoran_vm_close(struct vm_area_struct *vma) -{ - struct zoran_mapping *map = vma->vm_private_data; - struct zoran_fh *fh = map->fh; - struct zoran *zr = fh->zr; - int i; - - pci_info(zr->pci_dev, "%s - munmap(%s)\n", ZR_DEVNAME(zr), mode_name(fh->map_mode)); - - for (i = 0; i < fh->buffers.num_buffers; i++) { - if (fh->buffers.buffer[i].map == map) - fh->buffers.buffer[i].map = NULL; - } - kfree(map); - - /* Any buffers still mapped? */ - for (i = 0; i < fh->buffers.num_buffers; i++) { - if (fh->buffers.buffer[i].map) - return; - } - - pci_info(zr->pci_dev, "%s - free %s buffers\n", __func__, mode_name(fh->map_mode)); - - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - if (fh->buffers.active != ZORAN_FREE) { - unsigned long flags; - - spin_lock_irqsave(&zr->spinlock, flags); - zr36057_set_memgrab(zr, 0); - zr->v4l_buffers.allocated = 0; - zr->v4l_buffers.active = fh->buffers.active = ZORAN_FREE; - spin_unlock_irqrestore(&zr->spinlock, flags); - } - v4l_fbuffer_free(fh); - } else { - if (fh->buffers.active != ZORAN_FREE) { - jpg_qbuf(fh, -1, zr->codec_mode); - zr->jpg_buffers.allocated = 0; - zr->jpg_buffers.active = fh->buffers.active = ZORAN_FREE; - } - jpg_fbuffer_free(fh); - } -} - -static const struct vm_operations_struct zoran_vm_ops = { - .open = zoran_vm_open, - .close = zoran_vm_close, -}; - -static int zoran_mmap(struct file *file, struct vm_area_struct *vma) -{ - struct zoran_fh *fh = file->private_data; - struct zoran *zr = fh->zr; - unsigned long size = (vma->vm_end - vma->vm_start); - unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; - int i, j; - unsigned long page, start = vma->vm_start, todo, pos, fraglen; - int first, last; - struct zoran_mapping *map; - int res = 0; - - pci_info(zr->pci_dev, "%s(%s) of 0x%08lx-0x%08lx (size=%lu)\n", __func__, - mode_name(fh->map_mode), vma->vm_start, vma->vm_end, size); - - if (!(vma->vm_flags & VM_SHARED) || !(vma->vm_flags & VM_READ) || - !(vma->vm_flags & VM_WRITE)) { - pci_err(zr->pci_dev, "%s - no MAP_SHARED/PROT_{READ,WRITE} given\n", __func__); - return -EINVAL; - } - - if (!fh->buffers.allocated) { - pci_err(zr->pci_dev, "%s(%s) - buffers not yet allocated\n", __func__, mode_name(fh->map_mode)); - res = -ENOMEM; - return res; - } - - first = offset / zr->buffer_size; - last = first - 1 + size / zr->buffer_size; - if (offset % zr->buffer_size != 0 || - size % zr->buffer_size != 0 || first < 0 || - last < 0 || first >= fh->buffers.num_buffers || - last >= zr->buffer_size) { - pci_err(zr->pci_dev, "%s(%s) - offset=%lu or size=%lu invalid for bufsize=%d and numbufs=%d\n", - __func__, mode_name(fh->map_mode), offset, size, - zr->buffer_size, - fh->buffers.num_buffers); - res = -EINVAL; - return res; - } - - /* Check if any buffers are already mapped */ - for (i = first; i <= last; i++) { - if (fh->buffers.buffer[i].map) { - pci_err(zr->pci_dev, "%s(%s) - buffer %d already mapped\n", __func__, mode_name(fh->map_mode), i); - res = -EBUSY; - return res; - } - } - - /* map these buffers */ - map = kmalloc(sizeof(*map), GFP_KERNEL); - if (!map) { - res = -ENOMEM; - return res; - } - map->fh = fh; - atomic_set(&map->count, 1); - - vma->vm_ops = &zoran_vm_ops; - vma->vm_flags |= VM_DONTEXPAND; - vma->vm_private_data = map; - - if (fh->map_mode == ZORAN_MAP_MODE_RAW) { - for (i = first; i <= last; i++) { - todo = size; - if (todo > zr->buffer_size) - todo = zr->buffer_size; - page = fh->buffers.buffer[i].v4l.fbuffer_phys; - if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, - todo, PAGE_SHARED)) { - pci_err(zr->pci_dev, "%s(V4L) - remap_pfn_range failed\n", __func__); - res = -EAGAIN; - return res; - } - size -= todo; - start += todo; - fh->buffers.buffer[i].map = map; - if (size == 0) - break; - } - } else { - for (i = first; i <= last; i++) { - for (j = 0; - j < zr->buffer_size / PAGE_SIZE; - j++) { - fraglen = - (le32_to_cpu(fh->buffers.buffer[i].jpg. - frag_tab[2 * j + 1]) & ~1) << 1; - todo = size; - if (todo > fraglen) - todo = fraglen; - pos = - le32_to_cpu(fh->buffers. - buffer[i].jpg.frag_tab[2 * j]); - /* should just be pos on i386 */ - page = virt_to_phys(bus_to_virt(pos)) - >> PAGE_SHIFT; - if (remap_pfn_range(vma, start, page, - todo, PAGE_SHARED)) { - pci_err(zr->pci_dev, "%s(V4L) - remap_pfn_range failed\n", __func__); - res = -EAGAIN; - return res; - } - size -= todo; - start += todo; - if (size == 0) - break; - if (le32_to_cpu(fh->buffers.buffer[i].jpg. - frag_tab[2 * j + 1]) & 1) - break; /* was last fragment */ - } - fh->buffers.buffer[i].map = map; - if (size == 0) - break; - } - } - return res; -} - static int zoran_g_parm(struct file *file, void *priv, struct v4l2_streamparm *parm) { if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) @@ -2113,12 +743,14 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_s_output = zoran_s_output,*/ .vidioc_g_std = zoran_g_std, .vidioc_s_std = zoran_s_std, - .vidioc_reqbufs = zoran_reqbufs, - .vidioc_querybuf = zoran_querybuf, - .vidioc_qbuf = zoran_qbuf, - .vidioc_dqbuf = zoran_dqbuf, - .vidioc_streamon = zoran_streamon, - .vidioc_streamoff = zoran_streamoff, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_enum_fmt_vid_cap = zoran_enum_fmt_vid_cap, /* .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out,*/ .vidioc_g_fmt_vid_cap = zoran_g_fmt_vid_cap, @@ -2133,11 +765,13 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { static const struct v4l2_file_operations zoran_fops = { .owner = THIS_MODULE, - .open = zoran_open, - .release = zoran_close, .unlocked_ioctl = video_ioctl2, - .mmap = zoran_mmap, - .poll = zoran_poll, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .read = vb2_fop_read, + .write = vb2_fop_write, + .mmap = vb2_fop_mmap, + .poll = vb2_fop_poll, }; const struct video_device zoran_template = { @@ -2161,11 +795,13 @@ static int zr_vb2_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, unsi if (*nbuffers < vq->min_buffers_needed) *nbuffers = vq->min_buffers_needed; - if (*nplanes) + if (*nplanes) { if (sizes[0] < size) return -EINVAL; else return 0; + } + *nplanes = 1; sizes[0] = size; @@ -2191,7 +827,10 @@ static int zr_vb2_prepare(struct vb2_buffer *vb) { struct zoran *zr = vb2_get_drv_priv(vb->vb2_queue); + if (vb2_plane_size(vb, 0) < zr->buffer_size) + return -EINVAL; zr->prepared++; + return 0; } From patchwork Mon Sep 21 10:20:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 255728 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2953CC43463 for ; Mon, 21 Sep 2020 10:21:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EACE4205F4 for ; Mon, 21 Sep 2020 10:21:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="cqXso1We" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727054AbgIUKV0 (ORCPT ); Mon, 21 Sep 2020 06:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727036AbgIUKVU (ORCPT ); Mon, 21 Sep 2020 06:21:20 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF90C0613D1 for ; Mon, 21 Sep 2020 03:21:19 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id b79so12014025wmb.4 for ; Mon, 21 Sep 2020 03:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S9MzB7+azPxcpMxlGiEMSs7z6RlW8asusze1qBJiaHc=; b=cqXso1WeXMsOQTSMJsnRpwW6vw8vb52dEKHkPuvZGM4VKop5MTyriQZCa2VAmgKXOr 6c1e4BDDBKbJYdmtHs7EAJGjgrXlmHeffln/7gNXCUsNiyp/6bnDDzABtDtvgm83WBbu wpeVMsoLT2gdb7UfQkoUQ+K0wPFRtw0xbm6wokBSi3Zrb1vr1VOl0O94XHk98PWCgDnx HdNgaO/cwSEPz6RWMBmR8iMS3WJt8dd5N2QRjE1KkALT17HYzXNJug5lQ14x3Kcx3RF2 dWxYAgtv5XGlFBpF/dOyX+MNmI88hbCjsdHMzpXpyHEVYOfX7Swy8MPkhGJHhh31ycDS Rxog== 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:in-reply-to :references; bh=S9MzB7+azPxcpMxlGiEMSs7z6RlW8asusze1qBJiaHc=; b=fXXCSUadq54FgowD7XOKFjsiPv3S4iBjfF52S74GOWtIlxqZ9be2X5cplKwwt2tAYX Lfi8k9DHLPwMEXx3WwqlzL5PKfUPkoaUBbyEsvlzMmkerlFDfPCvKo0w+EvChcUvGdj5 Ewk3HGeJjX28uzX+nf1HkWIJKI+8ZiV24rErAKP75q+rA0Ksxi5xju9M7s09SZyEr3zt b/WFYR3JB+VBMxoWfbztdtiLul15/jNUIZjQXeLdGeea0n3Lz83bJ87PDofAwKZdZIMH SDXSfHP/ZKwKbwk7DYhkK740VJ1YpQ5wqpk+fY3EVadVr1Z74cb62bcTlpobX7NGREHr xLAg== X-Gm-Message-State: AOAM530CKHO7t4F5AJ0c34For7Fz5MFkUODpScyprDxoflYOdO/QYcn0 3uwBcNZhB30+hLQUj6S1RtZtNUj16u8xFg== X-Google-Smtp-Source: ABdhPJwLLiqE0xL9dMMevVsNtAO5akGgDxGF9LqBxoG4mXvA7KUeZ9nz/B8s78vAAAQzdhd3oK38Ig== X-Received: by 2002:a7b:c317:: with SMTP id k23mr28413581wmj.44.1600683678660; Mon, 21 Sep 2020 03:21:18 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id l17sm18804629wme.11.2020.09.21.03.21.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 03:21:18 -0700 (PDT) From: Corentin Labbe To: gregkh@linuxfoundation.org, laurent.pinchart@skynet.be, mchehab@kernel.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, Corentin Labbe Subject: [PATCH RFT/RFC 49/49] staging: media: zoran: update TODO Date: Mon, 21 Sep 2020 10:20:24 +0000 Message-Id: <1600683624-5863-50-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> References: <1600683624-5863-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Update the TODO of the zoran driver Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/TODO | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/zoran/TODO b/drivers/staging/media/zoran/TODO index 54464095d0d7..6992540d3e53 100644 --- a/drivers/staging/media/zoran/TODO +++ b/drivers/staging/media/zoran/TODO @@ -1,4 +1,19 @@ -The zoran driver is marked deprecated. It will be removed -around May 2019 unless someone is willing to update this -driver to the latest V4L2 frameworks (especially the vb2 -framework). + +How to test the zoran driver: +- RAW capture + mplayer tv:///dev/video0 -tv driver=v4l2 + +- MJPEG capture (compression) + mplayer tv:///dev/video0 -tv driver=v4l2:outfmt=mjpeg + TODO: need two test for both Dcim path + +- MJPEG play (decompression) + ffmpeg -i test.avi -vcodec mjpeg -an -f v4l2 /dev/video0 + Note: only recent ffmpeg has the ability of sending non-raw video via v4l2 + + The original way of sending video was via mplayer vo_zr/vo_zr2, but it does not compile + anymore and is a dead end (usage of some old private ffmpeg structures). + +TODO +- fix the v4l compliance "TRY_FMT cannot handle an invalid pixelformat" +- Filter JPEG data to made output work