From patchwork Sat Apr 10 22:28:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Lord X-Patchwork-Id: 91879 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3AMSM9g026391 for ; Sat, 10 Apr 2010 22:28:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752242Ab0DJW2V (ORCPT ); Sat, 10 Apr 2010 18:28:21 -0400 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:41051 "EHLO sasl.smtp.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752212Ab0DJW2U (ORCPT ); Sat, 10 Apr 2010 18:28:20 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 09142A9670; Sat, 10 Apr 2010 18:28:19 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=message-id :date:from:mime-version:to:cc:subject:references:in-reply-to :content-type; s=sasl; bh=auLaK1aCq5encEoizHbm109Dn3g=; b=vzR2l2 jHvPgGypKDkb735L/ECUdxx+mYdbT3OhIL/fFC3fYML8znipSA3t53btszusZvff HLQDzLgQIDklE/LZsar+CIDb2e/ln/7fwKYezRbW/rI/mEvnuJ+rO17p1R0LXqHw Vc6MwGbGP5uOn/l4ic6p/r7XPxYtQHE7vn5Fk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=message-id:date :from:mime-version:to:cc:subject:references:in-reply-to :content-type; q=dns; s=sasl; b=t/Lyar5mx6xdIwoiZMeDIehP89mlSWax spfanEQ/ZdUhsLMD7/LMIKOzh3X4ZipMPW6oCXK2ezxD4DQD0vTc3NSpfF7L0KP3 KZTM2KdOsFgufSSacwhpnBdV/wTVPxvQdPVydlvydkb+T2cbQD+hCLPa2U1VO0b1 oEJ87SB6qHM= Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id CA892A966C; Sat, 10 Apr 2010 18:28:15 -0400 (EDT) Received: from [10.0.0.6] (unknown [75.119.251.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 04AB0A9660; Sat, 10 Apr 2010 18:28:11 -0400 (EDT) Message-ID: <4BC0FB79.7080601@pobox.com> Date: Sat, 10 Apr 2010 18:28:09 -0400 From: Mark Lord Organization: Real-Time Remedies Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-GB; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: Andy Walls CC: Hans Verkuil , linux-media@vger.kernel.org, ivtv-devel@ivtvdriver.org Subject: Re: cx18: "missing audio" for analog recordings References: <4B8BE647.7070709@teksavvy.com> <1267493641.4035.17.camel@palomino.walls.org> <4B8CA8DD.5030605@teksavvy.com> <1267533630.3123.17.camel@palomino.walls.org> <4B9DA003.90306@teksavvy.com> <1268653884.3209.32.camel@palomino.walls.org> In-Reply-To: <1268653884.3209.32.camel@palomino.walls.org> X-Pobox-Relay-ID: 5B3D9C50-44F0-11DF-9229-D033EE7EF46B-82205200!a-pb-sasl-quonix.pobox.com Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 10 Apr 2010 22:28:22 +0000 (UTC) --- v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-audio.c 2010-04-05 22:56:43.000000000 -0400 +++ patched/linux/drivers/media/video/cx18/cx18-av-audio.c 2010-03-13 22:06:55.000000000 -0500 @@ -305,14 +305,14 @@ struct cx18_av_state *state = &cx->av_state; u8 v; + /* assert soft reset */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) | 0x01; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); + /* stop microcontroller */ v = cx18_av_read(cx, 0x803) & ~0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); - /* assert soft reset */ - v = cx18_av_read(cx, 0x810) | 0x01; - cx18_av_write_expect(cx, 0x810, v, v, 0x0f); - /* Mute everything to prevent the PFFT! */ cx18_av_write(cx, 0x8d3, 0x1f); @@ -330,16 +330,17 @@ set_audclk_freq(cx, state->audclk_freq); - /* deassert soft reset */ - v = cx18_av_read(cx, 0x810) & ~0x01; - cx18_av_write_expect(cx, 0x810, v, v, 0x0f); - if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { + /* start microcontroller */ /* When the microcontroller detects the * audio format, it will unmute the lines */ v = cx18_av_read(cx, 0x803) | 0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); } + + /* deassert soft reset */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) & ~0x01; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); } static int get_volume(struct cx18 *cx) @@ -449,12 +450,13 @@ * changes to the mute register. */ v = cx18_av_read(cx, 0x803); if (mute) { - /* disable microcontroller */ + /* stop microcontroller */ v &= ~0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); + /* mute all of Path 1 */ cx18_av_write(cx, 0x8d3, 0x1f); } else { - /* enable microcontroller */ + /* start microcontroller */ v |= 0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); } @@ -471,22 +473,29 @@ int retval; u8 v; + /* assert soft reset */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) | 0x1; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); + if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { + /* stop microcontroller */ v = cx18_av_read(cx, 0x803) & ~0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); + /* mute all of Path 1 */ cx18_av_write(cx, 0x8d3, 0x1f); } - v = cx18_av_read(cx, 0x810) | 0x1; - cx18_av_write_expect(cx, 0x810, v, v, 0x0f); retval = set_audclk_freq(cx, freq); - v = cx18_av_read(cx, 0x810) & ~0x1; - cx18_av_write_expect(cx, 0x810, v, v, 0x0f); if (state->aud_input > CX18_AV_AUDIO_SERIAL2) { + /* start microcontroller */ v = cx18_av_read(cx, 0x803) | 0x10; cx18_av_write_expect(cx, 0x803, v, v, 0x1f); } + + /* deassert soft reset */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) & ~0x1; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); return retval; } diff -u --recursive --new-file --exclude='.*' --exclude='*.[osa]' --exclude=System.map --exclude='*.orig' --exclude='*.lds' --exclude='*.symvers' --exclude='*.mod.c' --exclude='*.ko' v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-core.c patched/linux/drivers/media/video/cx18/cx18-av-core.c --- v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-core.c 2010-04-05 22:56:43.000000000 -0400 +++ patched/linux/drivers/media/video/cx18/cx18-av-core.c 2010-04-10 17:10:13.618719139 -0400 @@ -525,6 +525,10 @@ cx18_av_and_or(cx, 0x401, ~0x60, 0); cx18_av_and_or(cx, 0x401, ~0x60, 0x60); + /* assert soft reset of audio */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) | 0x01; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); + if (std & V4L2_STD_525_60) { if (std == V4L2_STD_NTSC_M_JP) { /* Japan uses EIAJ audio standard */ @@ -549,14 +553,9 @@ cx18_av_write_expect(cx, 0x80b, 0x03, 0x03, 0x3f); } - v = cx18_av_read(cx, 0x803); - if (v & 0x10) { - /* restart audio decoder microcontroller */ - v &= ~0x10; - cx18_av_write_expect(cx, 0x803, v, v, 0x1f); - v |= 0x10; - cx18_av_write_expect(cx, 0x803, v, v, 0x1f); - } + /* deassert soft reset of audio */ + v = cx18_av_read(cx, CXADEC_AUDIO_SOFT_RESET) & ~0x01; + cx18_av_write_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); } static int cx18_av_s_frequency(struct v4l2_subdev *sd, diff -u --recursive --new-file --exclude='.*' --exclude='*.[osa]' --exclude=System.map --exclude='*.orig' --exclude='*.lds' --exclude='*.symvers' --exclude='*.mod.c' --exclude='*.ko' v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-core.h patched/linux/drivers/media/video/cx18/cx18-av-core.h --- v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-core.h 2010-04-05 22:56:43.000000000 -0400 +++ patched/linux/drivers/media/video/cx18/cx18-av-core.h 2010-04-10 17:09:26.532890773 -0400 @@ -246,6 +246,7 @@ #define CXADEC_DW8051_INT 0x80C #define CXADEC_GENERAL_CTL 0x810 +#define CXADEC_AUDIO_SOFT_RESET 0x810 /* 0x810 or 0x9cc ??? */ #define CXADEC_AAGC_CTL 0x814 #define CXADEC_IF_SRC_CTL 0x818 #define CXADEC_ANLOG_DEMOD_CTL 0x81C diff -u --recursive --new-file --exclude='.*' --exclude='*.[osa]' --exclude=System.map --exclude='*.orig' --exclude='*.lds' --exclude='*.symvers' --exclude='*.mod.c' --exclude='*.ko' v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-firmware.c patched/linux/drivers/media/video/cx18/cx18-av-firmware.c --- v4l-dvb-7c0b887911cf/linux/drivers/media/video/cx18/cx18-av-firmware.c 2010-04-05 22:56:43.000000000 -0400 +++ patched/linux/drivers/media/video/cx18/cx18-av-firmware.c 2010-03-13 22:06:55.000000000 -0500 @@ -142,14 +142,20 @@ return -EIO; } + /* Disable firmware upload, keeping the 8051 in reset */ cx18_av_write4_expect(cx, CXADEC_DL_CTL, 0x03000000 | fw->size, 0x03000000, 0x13000000); CX18_INFO_DEV(sd, "loaded %s firmware (%d bytes)\n", FWFILE, size); - if (cx18_av_verifyfw(cx, fw) == 0) + if (cx18_av_verifyfw(cx, fw) == 0) { + /* deassert soft reset */ + v = cx18_av_read4(cx, CXADEC_AUDIO_SOFT_RESET) & ~0x01; + cx18_av_write4_expect(cx, CXADEC_AUDIO_SOFT_RESET, v, v, 0x0f); + /* deassert 8051 reset */ cx18_av_write4_expect(cx, CXADEC_DL_CTL, 0x13000000 | fw->size, 0x13000000, 0x13000000); + } /* Output to the 416 */ cx18_av_and_or4(cx, CXADEC_PIN_CTRL1, ~0, 0x78000);