From patchwork Wed Apr 19 20:46:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devin Heitmueller X-Patchwork-Id: 40906 X-Patchwork-Delegate: hverkuil@xs4all.nl Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0wVL-0003qD-Nz; Wed, 19 Apr 2017 20:47:11 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-5) with esmtp id 1d0wVJ-0008SC-7g; Wed, 19 Apr 2017 22:47:11 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937700AbdDSUrH (ORCPT + 1 other); Wed, 19 Apr 2017 16:47:07 -0400 Received: from mail-qt0-f175.google.com ([209.85.216.175]:34412 "EHLO mail-qt0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937689AbdDSUrG (ORCPT ); Wed, 19 Apr 2017 16:47:06 -0400 Received: by mail-qt0-f175.google.com with SMTP id c45so30140558qtb.1 for ; Wed, 19 Apr 2017 13:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernellabs-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MRm5GQMFqMYoQqTXN9/0gDJLeLA75ZKYtG36Sowc7vU=; b=Ao3xfhvOaH0gc4tEGIujCQqAmu8rzGPeADXrW1bNtg0OgC1Zx4vSaJ3SjuOd9NwuCV ncCMpGvqXAm1X+oPvh6wN9wK+S6SLOy3tdaRFlTqT735KgMdhxsqQAVpynnrJ74ViI82 2jKdngSx+jAuubDhqNpHbbfmYSzAAa8NmN4PwLnoMfy4nTQmTHceio6eTVVL79TLN3Ye 5SyuTEWffCZlUfNWkQITNEiw7YS2fNXfg3PvMe8UHpnlO49sTlvVnVGbDjF+RXGlMH5y Y8dUksFsK2g2NOxvbJyljtzZ9NyZ9M5tyCRn0d/Lm8irmW2tzTgiPbyltBr/QtaNv8d/ JEtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MRm5GQMFqMYoQqTXN9/0gDJLeLA75ZKYtG36Sowc7vU=; b=dLxkIMmHqsdlAslAYok9r214MyvuY7tuLDgSn0l0XoCennuG3j9uXb3xqmpSmc3Vue EIpe61HUqDrALbT1sc+UHO/gZorCePPVP2MiCApDLYjCG6h59ySbXS/o1mvIiMJ73pLL so2hgslYecPdWN7ruaqQUVkvOVipQ5jRLbS0ZWn1dsj25vGDU7/Iv0dAx994fM7a0avU 2PVlXg8jkJaT10tE3sSml74oNl123ADDZN1pvDfl86dQBgyE6/GUHYvK8kvIfHc5gt/b y41oUUFN1kpMRyKhsnsG9MFxCQzVrixpNR6GU0btWkaYVgOAoWJ+N0zbsG8MMJa6IxSJ oBqg== X-Gm-Message-State: AN3rC/68eMuxNwL8vHwFMYDYGTakCK27YqZP2bMjV2ZvOyqgT1abnTkI hXjOQZ4pOvL53qGJiAs= X-Received: by 10.237.61.170 with SMTP id i39mr5142805qtf.245.1492634825587; Wed, 19 Apr 2017 13:47:05 -0700 (PDT) Received: from localhost.localdomain (cpe-74-71-114-159.nyc.res.rr.com. [74.71.114.159]) by smtp.gmail.com with ESMTPSA id c33sm2669305qta.65.2017.04.19.13.47.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 13:47:05 -0700 (PDT) From: Devin Heitmueller To: linux-media@vger.kernel.org Cc: Devin Heitmueller Subject: [PATCH] cx88: Fix regression in initial video standard setting Date: Wed, 19 Apr 2017 16:46:51 -0400 Message-Id: <1492634811-4435-1-git-send-email-dheitmueller@kernellabs.com> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2017.4.19.203916 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, DATE_TZ_NA 0, DKIM_SIGNATURE 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_MEDIA_BODY 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_LIST_ID 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' Setting initial standard at the top of cx8800_initdev would cause the first call to cx88_set_tvnorm() to return without programming any registers (leaving the driver saying it's set to NTSC but the hardware isn't programmed). Even worse, any subsequent attempt to explicitly set it to NTSC-M will return success but actually fail to program the underlying registers unless first changing the standard to something other than NTSC-M. Set the initial standard later in the process, and make sure the field is zero at the beginning to ensure that the call always goes through. This regression was introduced in the following commit: commit ccd6f1d488e7 ("[media] cx88: move width, height and field to core struct") Author: Hans Verkuil Date: Sat Sep 20 09:23:44 2014 -0300 [media] cx88: move width, height and field to core struct Signed-off-by: Devin Heitmueller --- drivers/media/pci/cx88/cx88-cards.c | 9 ++++++++- drivers/media/pci/cx88/cx88-video.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c index 73cc7a6..b7a8c8c 100644 --- a/drivers/media/pci/cx88/cx88-cards.c +++ b/drivers/media/pci/cx88/cx88-cards.c @@ -3681,7 +3681,14 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) core->nr = nr; sprintf(core->name, "cx88[%d]", core->nr); - core->tvnorm = V4L2_STD_NTSC_M; + /* + * Note: Setting initial standard here would cause first call to + * cx88_set_tvnorm() to return without programming any registers. Leave + * it blank for at this point and it will get set later in + * cx8800_inittdev() + */ + core->tvnorm = 0; + core->width = 320; core->height = 240; core->field = V4L2_FIELD_INTERLACED; diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index c7d4e87..3c529dd 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -1435,7 +1435,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, /* initial device configuration */ mutex_lock(&core->lock); - cx88_set_tvnorm(core, core->tvnorm); + cx88_set_tvnorm(core, V4L2_STD_NTSC_M); v4l2_ctrl_handler_setup(&core->video_hdl); v4l2_ctrl_handler_setup(&core->audio_hdl); cx88_video_mux(core, 0);