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: 9688885 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8512D60375 for ; Wed, 19 Apr 2017 20:47:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76CA0201F5 for ; Wed, 19 Apr 2017 20:47:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B88D209CD; Wed, 19 Apr 2017 20:47:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C02B820564 for ; Wed, 19 Apr 2017 20:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937700AbdDSUrH (ORCPT ); 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-Virus-Scanned: ClamAV using ClamSMTP 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);