From patchwork Fri Sep 25 21:16:21 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aleksandr V. Piskunov" X-Patchwork-Id: 50165 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8PLGK3S003287 for ; Fri, 25 Sep 2009 21:16:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752360AbZIYVQQ (ORCPT ); Fri, 25 Sep 2009 17:16:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752469AbZIYVQP (ORCPT ); Fri, 25 Sep 2009 17:16:15 -0400 Received: from mail-fx0-f218.google.com ([209.85.220.218]:41580 "EHLO mail-fx0-f218.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752352AbZIYVQP (ORCPT ); Fri, 25 Sep 2009 17:16:15 -0400 Received: by fxm18 with SMTP id 18so2521088fxm.17 for ; Fri, 25 Sep 2009 14:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=j8wEmudZ2T0ctiw7hwx7unmS8ZVKC/8avWNkIowMLzQ=; b=qOFVkrg1exXjk9s0cq1wVcmIw89u/1BEZsLIMON4H1KPS6J86taIxaA9l8sU4ENlEm p4gPx4XN20teNN7YQvqHv2C5mWn71ckOCH26GQ5u4kYhM+dKRMSXenMxzNZQGMPMaWXj QYtBbhWFLP9hBD/NBgwvkjdCSxSZPE6F+8q6M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=r4zLLipyJX4NBGxE9mvXiDW8XyV4QSSlyOq7o/DEpYZhLz4BxoeDpaLgFkyHI99l/V /AaxoTkEPB5bWic80AmPtLmUBe+zBpYB6kmee0PCRE+UvzNzKWeBKvi/uK042UQDqHno GL53j3Gr8kg4MFrESecq+cXRnWMDpuRNKXxIc= Received: by 10.86.242.15 with SMTP id p15mr1379078fgh.14.1253913378110; Fri, 25 Sep 2009 14:16:18 -0700 (PDT) Received: from moon ([80.232.250.86]) by mx.google.com with ESMTPS id 3sm359079fge.28.2009.09.25.14.16.17 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Sep 2009 14:16:17 -0700 (PDT) Date: Sat, 26 Sep 2009 00:16:21 +0300 From: "Aleksandr V. Piskunov" To: linux-media@vger.kernel.org Subject: [PATCH] cx25840 6.5MHz carrier detection fixes Message-ID: <20090925211621.GA15452@moon> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org cx25840: Disable 6.5MHz carrier autodetection for PAL, always assume its DK. Only try to autodetect 6.5MHz carrier for SECAM if user accepts both system DK and L. Signed-off-by: Aleksandr V. Piskunov Reviewed-by: Andy Walls --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -647,13 +647,30 @@ } cx25840_write(client, 0x80b, 0x00); } else if (std & V4L2_STD_PAL) { - /* Follow tuner change procedure for PAL */ + /* Autodetect audio standard and audio system */ cx25840_write(client, 0x808, 0xff); - cx25840_write(client, 0x80b, 0x10); + /* Since system PAL-L is pretty much non-existant and + not used by any public broadcast network, force + 6.5 MHz carrier to be interpreted as System DK, + this avoids DK audio detection instability */ + cx25840_write(client, 0x80b, 0x00); } else if (std & V4L2_STD_SECAM) { - /* Select autodetect for SECAM */ + /* Autodetect audio standard and audio system */ cx25840_write(client, 0x808, 0xff); - cx25840_write(client, 0x80b, 0x10); + /* If only one of SECAM-DK / SECAM-L is required, then force + 6.5MHz carrier, else autodetect it */ + if ((std & V4L2_STD_SECAM_DK) && + !(std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) { + /* 6.5 MHz carrier to be interpreted as System DK */ + cx25840_write(client, 0x80b, 0x00); + } else if (!(std & V4L2_STD_SECAM_DK) && + (std & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC))) { + /* 6.5 MHz carrier to be interpreted as System L */ + cx25840_write(client, 0x80b, 0x08); + } else { + /* 6.5 MHz carrier to be autodetected */ + cx25840_write(client, 0x80b, 0x10); + } } cx25840_and_or(client, 0x810, ~0x01, 0);