Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753082AbbFLGed (ORCPT ); Fri, 12 Jun 2015 02:34:33 -0400 Received: from mail-bl2on0116.outbound.protection.outlook.com ([65.55.169.116]:56770 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751199AbbFLGeb (ORCPT ); Fri, 12 Jun 2015 02:34:31 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Fri, 12 Jun 2015 14:32:33 +0800 From: Zidan Wang To: Mark Brown CC: , , , , , , , Subject: Re: [alsa-devel][PATCH 1/4] ASoC: wm8960: codec mclk should be enabled early to avoid jack detect error Message-ID: <20150612063231.GA23608@shlinux2> References: <880838f666b591f5ffb0de1e39df5e3734846246.1434020423.git.zidan.wang@freescale.com> <20150611162028.GT14071@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20150611162028.GT14071@sirena.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD028;1:zFrCKBirqydc7qHzhnUjUAQrTgdtdPQKe32AbdAhg+apmkPp6DKbf2nQ2XKlH1Ml2niz5L7IPIiGXWJ2Fa26hhwCDQeypzdkL5KgqNqidWjyBSu5HE0gbCSq/EjjnEmEFIbTp9tJW6gQ/hMfB9PJszi5KBj6RKf8riU8vvkA1TtaFPcoOv7uWYR1sK18cezyPx5fgRdM5ROCUZkhdILPZDP861hYX3H/IytcqYlvFmlJSrK9A2IxQkZ10TUIy6GL1aYBQGfnfnTRk0NseHKc6cfECYaKd64dyOQ8c/hkDGKRTLALolM9CPQqhjLXkFwvcuK7lond6xqhsY1kB1CsYA== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(51704005)(24454002)(189002)(199003)(83506001)(6806004)(50466002)(85426001)(86362001)(87936001)(189998001)(77096005)(77156002)(33716001)(5001960100002)(110136002)(62966003)(2950100001)(23726002)(106466001)(4001350100001)(46406003)(97756001)(104016003)(105606002)(33656002)(46102003)(76176999)(54356999)(50986999)(92566002);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR03MB273;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB273;2:SL7oDTTGfYsTXO8dpOzzcj4dCj1NQxu8V1Idr6yydfjVmoiytxN82xFkaUexRKQ0;3:bXQHOC05KgrG1+kdbtCSIeY+ZSdQ0AKFWo2iQJSXWQGduQIEonTqw2ke6EKIrsZJf+ci2B93o2NGok3csf90JCUBC4DzL/xHCSFZ2OtfjmS3FVcxfTF8Z1b9UGGpZt1NMqdVbJQTYFruRwHLaKKbigLuwIyeMHrqopNZN9G24y+V9u+EhyjBCt7Wv4E9To1cUz3DuPpJRXxgk2bjtrqLiW6l1bujIjQov0AKcADWZxQ=;20:x/KMkrDF8zJbspMTaT8w4K/5MAbBsunEzb4gJQGPsxedR76iZTYg89XoYYC0pfpOFcyW/3Tl1rHsVDY5y0BXHPyw3kTsWkILiqOicyj3QP5NNYq4BpDGEeylmcP7xi5DzlJ9mPsLjDHCe8bN39cHhl7FpKtEvQzmP9orxq4765KTA60VA4wYuZqE4vSW5jMowD57iHes4G2t529HM5NYlTQn4mPCGq1eN0j6VVfAL6M4Ad5D+5s3WrZVZzkIvVPKLLtwXYKt51rwV/UAyfrZsLdHCMek77fP/BFUQxLXvZq8d0Mepeuqc3Z9pw8zs2LgcNEGKlTCM10Mndy2XziyTx/2XAldTS8/QgZOWgYp1wg=;4:Dr2SftFQGlydvTSsmHPieklujiPHdpT5BQf7E4nPgdD+ROpBbecbZeZd0R9mfrxZ/9N62vA9BKjiZGhXmF31kWW+L6feESL9Lh5yXI8s81sEoB3KWIjJQ4aTltbSwK86kXakbzn7CzA7hsk1dWsirYnMokUVSUMeNCejIxGdPIJDUhinYwC8RSQaX1g1yPnD7dMxVeo+JhB3IoZNEEe2npOjEeFbIlMoX5pTPbAKsChF6mmSzBUNU4CeWDeJEpmQzYFgvFWE63tJZJ213/whsFnvQxvaXVxCMgf2B8F1DuI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB273;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB515; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BL2PR03MB273;BCL:0;PCL:0;RULEID:;SRVR:BL2PR03MB273; X-Forefront-PRVS: 060503E79B X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB273;23:9qq70vwfLjtJztFb6GQ5M8smwxJMXBb1Sl5Nxu78c45LiLdDOS+Q54KjIc5/REHuchcWOFRsMDDBxptDpgIlAxxs6r7iSM9QMNvXw8YmukRrUJ94fhDWqhQILaQiSLRonZ/Fk9qsWmlr9pMKlfB3FPbYZCj69oAZtx4U/lyI1lSWK6ZBj7o+28oVhUVEZM6AlLt3QmDGCy5QQAax6SWdTJtcRVbVjSPXODLEAx8hdVC13iylsGxTZNspbk2od6GTAKLuUQfWvfbUXVyShusq5zEKWdGej5LERwvmPe24ZLfU3FCMyYuoby/CjT0C9sLva480ezuwSeGRXTiDXFMHstrLXNhMWIFUnAumsROnWc1aMiVOriH77NrFMbpaC2OsAEOijoFDnUTu3QCAA2BUTytni0xJg9uYZtfrmEkTYeQC611o3Z+iR2lfm+qSHdBFD797w3HYFZACGWSCS/Vav/QLgnvnqfnjeV48N4RuPEO6j2Jz7dj7Txb2recxjTKhvwsVlsSQ2Dxt6ZohSUa9PhGdw4G08nBJKqw2RVKMCcbJG3frh3E2wEjI9HNlZyxzZw88+y2z/2b3XO0SUIhohCg/a8yrp7zv6vLXRGLDsV0B9EZnYYQdI5y9iUB83Jypj1J0tJ9GD108X/dqhAGhLGYY+D94Tuy6BSUJPHLQ76VjAfEhtHcSJdmkk1dp9yRT8s7hZMl2IB+hq87PWEy9tqPDDaNO1KBqwFcSqKYRGprspJ4Dl+jlnMVNPosK7FUZgHbhjTIknEVsSzxW8+OIK6P2vdSmQ8/7H0OO61Bxrx45UECt9m9NO93RD3M6XfnC4WBXO0NNoc3cYMY1t5jE8mPksdQDyjV/3evKoeWnr8zKtXat2iFpYjudnhYu8Ys5 X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB273;5:JXe5wEzyFS/KsBnkZt5idgPHuSooIUmhSPkxT1xJfXc44fEpO9lLbQMNw12yI+Oi+mnr7x5PLGz2L3znMenTI398XJj4P1fPNPV2FxWabt+xahFUbnvVXYaWTnTFSRpJB/bsdke+trA6gnD1QgL9rA==;24:gdSkuss2MluIMsTlmpW7exO68XFwshGmcDNjG8DKpPYC6a0vw6F44WhAVtylHhujqKYPzFYxLmRa7kuPTOdDlQUAZfuvAgy/w9HLC/2YLL8=;20:qnwcDu4ekP42Tji1N/G0s7YhR2F0UHrkvSKl4ZRyyTiw0TVy7z2AiOg18uMX7vgWI/E9zfdDPbVBdI6uBvNKdg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2015 06:34:27.4345 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB273 X-Microsoft-Exchange-Diagnostics: 1;BL2PR03MB515;2:Q0hpqfyHHOrmfnYYp2N3IArzMQ29np86/toDccyMnUpJktYkJPhjB8bguowhWuSZ;2:uzuAS9+dpGd+FEUodLbYREdDNbAqYpVFGPB3QmSgAJzrbrgd81i3fLFxFWjEZPwamykJeChUz9F/ARp3LQX907HKsTkVZ5/TgG6D4p8W61a2GKXcNhbJr3LzyIbB4jHT2S6O4F4a3GNmZEy+xLugouqPAbNyEyfpjoj2CjoyTpx4gAW6VnjsLDKZouQwp3alYnjEFR5UNHVSKUdnof6acvN137Qlz1PTGCUN9Zv+w3w=;9:iASwjxgMaYZ9OdAPkFvr/HLK1Npoak3eQBK7aGktow0BtU8gVqNkXOlV+D6VyyWsShUUvMtRQ82GpW7fDXkSFhP+eaG42yWIq0v9J6gottbfCIWv66YLSCkg7Vqy3dL2DYpR6+GJnOfNycJhSZUjGA== X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2258 Lines: 42 On Thu, Jun 11, 2015 at 05:20:28PM +0100, Mark Brown wrote: > On Thu, Jun 11, 2015 at 07:14:33PM +0800, Zidan Wang wrote: > > It will playback from speaker in the first 2 seconds, then switch to > > headphone. Steps to reproduce this issue: > > 1. plug out headphone and playback a wav. > > 2. stop playback and wait for at least 5 seconds, then > > plug in headphone and playback a wav. > > I'd really like to understand the logic behind this in more detail - > what is the actual problem here and how does this fix it? You're moving > the clock management from the bias level setting to the stream startup > and teardown which doesn't seem directly related, if anything it seems > like it'd be making things worse since it reduces the proportion of the > time where the clock is enabled. My guess is that the jack detection > needs MCLK enabling. I select RINPUT3/JD3 pins as headphone jack detect inputs. I found that it would detected as speaker sometimes even if headphone jack is plugged in. And it would be reproduced everytime when i followed below steps: 1. Unplug headphone jack and playback a wav. It will playback from speaker. 2. Stop playback and wait for at least 5 seconds, then plug in headphone jack and playback a wav. I will playback from speaker in the first 1-2 seconds, and then switch to headphone. I suspect the codec need some time to prepare jack detect function after SYSCLK enable. When Unplug headphone jack and playback, it will detect as speaker. After this playback, the mclk will be disabled, and the detect function will be disabled too. So when you plug in the headphone jack in this moment, the codec can't detect as headphone. And when playback a wav, it will playback from speaker. After the headphone jack detect function works, it will switch to headphone. I have done some test today, and found that after mclk enable, we should delay at least 150ms to prepare the jack detect function. So no need to move mclk enable to startup. Best Regards, Zidan Wang -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/