From patchwork Fri Apr 15 21:47:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 8859341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 64D85BF29F for ; Fri, 15 Apr 2016 21:49:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49EA0202E9 for ; Fri, 15 Apr 2016 21:49:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B75820272 for ; Fri, 15 Apr 2016 21:49:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1arBap-0002UB-6E; Fri, 15 Apr 2016 21:47:59 +0000 Received: from mail-db3on0124.outbound.protection.outlook.com ([157.55.234.124] helo=emea01-db3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1arBal-0002F3-RE for linux-arm-kernel@lists.infradead.org; Fri, 15 Apr 2016 21:47:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentiatech.onmicrosoft.com; s=selector1-axentia-se; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KjCx76/PvCZt27bQCqmkh1fNQAm5E1MGpoAF62VIs0w=; b=Q4SJ7w0fBAEnMqgJ7SQqrpWa4ZWzG7kPAb8rJB5bMYk4jxu9oJ5M1/2OIqNcnJi8JzAnWepqadcLDEwtPnlHte2UW2MD2l/P80WeEUezi7Eu32ll64cYLLHc5MXhc7FzPFQXWdYyNSs5EUpIl7OeRwioUIVT2EOJtlD+eLPzZmA= Received: from AM4PR02MB1299.eurprd02.prod.outlook.com (10.165.241.149) by AM4PR02MB1298.eurprd02.prod.outlook.com (10.165.241.148) with Microsoft SMTP Server (TLS) id 15.1.453.26; Fri, 15 Apr 2016 21:47:33 +0000 Received: from AM4PR02MB1299.eurprd02.prod.outlook.com ([10.165.241.149]) by AM4PR02MB1299.eurprd02.prod.outlook.com ([10.165.241.149]) with mapi id 15.01.0453.031; Fri, 15 Apr 2016 21:47:33 +0000 From: Peter Rosin To: "'linux-arm-kernel@lists.infradead.org'" Subject: atmel-ssc-dai problem with ssc1 Thread-Topic: atmel-ssc-dai problem with ssc1 Thread-Index: AdGXYGQ44mpA/dU1TFyqRhOepjG63g== Date: Fri, 15 Apr 2016 21:47:33 +0000 Message-ID: Accept-Language: en-US, sv-SE Content-Language: sv-SE X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: lists.infradead.org; dkim=none (message not signed) header.d=none; lists.infradead.org; dmarc=none action=none header.from=axentia.se; x-originating-ip: [217.210.101.82] x-ms-office365-filtering-correlation-id: b5b6d3a6-baa7-4cd6-f379-08d365778d25 x-microsoft-exchange-diagnostics: 1; AM4PR02MB1298; 5:YvYYHWTQpr1qocDx6oMqGoo2C/DkZmyKWeIXqoXHtabaPGV6iDFwB74rTyB4W738GGz4T+l4mr00r2P0oR0UK+LYtZcBonh14ShHezHwYdJkbY3pDKZBP/HGaO772730yjdbZfsURAwlbekKPns9Ig==; 24:sHD7/9DHTmq+YJLqMorD7FXD18WpYdLCqyL3jkQJ3aZP209/Rwf7UBpX4g2o82OUI7H8eS3nMl8vMLbaJrr62FQnlptW0qOQSBYVUhPkqJU= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR02MB1298; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(9101521026)(6040130)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041046)(6043046); SRVR:AM4PR02MB1298; BCL:0; PCL:0; RULEID:; SRVR:AM4PR02MB1298; x-forefront-prvs: 0913EA1D60 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(50986999)(107886002)(110136002)(77096005)(54356999)(5003600100002)(74316001)(450100001)(87936001)(2900100001)(74482002)(5002640100001)(76576001)(19580395003)(122556002)(11100500001)(1220700001)(1096002)(5004730100002)(3846002)(6116002)(5008740100001)(102836003)(229853001)(2906002)(230783001)(586003)(66066001)(33656002)(92566002)(81166005)(575784001)(189998001)(9686002)(3280700002)(86362001)(3660700001)(10400500002)(42262002)(491001); DIR:OUT; SFP:1102; SCL:1; SRVR:AM4PR02MB1298; H:AM4PR02MB1299.eurprd02.prod.outlook.com; FPR:; SPF:None; MLV:sfv; LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2016 21:47:33.1241 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR02MB1298 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160415_144756_397545_8A5B0EA2 X-CRM114-Status: GOOD ( 17.26 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi! I have problems using the sound/soc/atmel/atmel_ssc_dai.c driver with ssc1 on a board derived from the at91sam9261ek board. We use a different audio codec and we use ssc1 instead of ssc0, but that really should not matter. But it does. I have copied shamelessly from the sound/soc/atmel/atmel_wm8904.c card driver, with one of the changes showing a big problem in the atmel_ssc_dai driver. I call atmel_ssc_set_audio(1) where atmel_wm8904.c calls atmel_ssc_set_audio(0). Well, both call a value given from dt, but the dts using the atmel_wm8904 driver all use ssc0 and my dts uses ssc1. It turns out that all the dai devices registered by atmel_ssc_dai end up with id 0, which does not work at all in e.g. atmel_ssc_dai.c:atmel_ssc_startup() which is using dai->id as index into the ssc_info[] array and therefore looks at index 0 when the setup by atmel_ssc_set_audio(1) had stored the needed stuff at index 1. This leads to a NULL dereference, such as: Unable to handle kernel NULL pointer dereference at virtual address 0000000c pgd = c1bf8000 [0000000c] *pgd=218e9831, *pte=00000000, *ppte=00000000 Internal error: Oops: 17 [#1] ARM Modules linked in: CPU: 0 PID: 517 Comm: aplay Not tainted 4.1.0+ #20 Hardware name: Atmel AT91SAM9 task: c19e3180 ti: c1bee000 task.ti: c1bee000 PC is at atmel_ssc_startup+0x1c/0x14c LR is at soc_pcm_open+0xd4/0x7c8 pc : [] lr : [] psr: a0000013 sp : c1befcd8 ip : c1a08ab8 fp : 00000000 r10: c1a0fc00 r9 : c1beff74 r8 : 00000000 r7 : c0597d50 r6 : c19b5c00 r5 : c19b5c00 r4 : c0597d50 r3 : 00000000 r2 : 00000000 r1 : c1a065e0 r0 : c19b5c00 Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 0005317f Table: 21bf8000 DAC: 00000015 Process aplay (pid: 517, stack limit = 0xc1bee190) Stack: (0xc1befcd8 to 0xc1bf0000) fcc0: c19b5c00 c1a065e0 fce0: 00000000 c0301540 c19b6810 c19b5c00 c1a065e0 00000001 00000000 c1beff74 fd00: c1a0fc00 c02f8e0c c1a0fc00 00000000 ffffffff 00000011 c19ab400 000f4240 fd20: 00000009 c02e4d90 000f4240 c19b681c 0000000b ffffffff 00000000 c1befd8c fd40: 00000000 c19b7f88 c19b7f94 00000000 c1beff74 00000000 00000000 c02e4e00 fd60: c19b7c00 c19b5c00 c1a375c0 c19b7c00 c1a375c0 c02e4ee4 00000000 c19e3180 fd80: c002f938 c19b7f94 c19b7f94 c19b7c00 00000010 c19b7c00 c1a375c0 00000000 fda0: c1a22ce0 07400010 c1977000 c02e50b0 c0408f30 c1a375c0 c198b8b8 c02d8e54 fdc0: c198b8b8 c1a375c0 c191e680 00000000 c0408a40 c0087784 c198b8b8 00000010 fde0: c1a375c0 c198b8b8 c008767c c1a375c8 c1a375c0 c0082f6c c1befef0 c1a375c0 fe00: c1befeb4 c1befebc c1a375c0 c008fe94 00000037 c1be34a8 b6f10000 ffffffff fe20: 00000000 00000000 00020802 c1be34a8 c198bc60 00000000 c1414c38 00000000 fe40: 00000041 00000026 00000000 00000000 c1977000 00500088 c1977000 c008df24 fe60: 00000000 00500088 c1befe98 c00809e0 c198b8b8 00000002 00000040 c1befef0 fe80: c1a375c0 c1beff74 ffffff9c 00000000 c1bee000 c1977000 00000041 c0090270 fea0: c1befebc c1977000 c1a32d00 c02dd728 c1b527d4 c1ad4030 c1417198 00000000 fec0: 00000054 c1beff74 00000001 ffffff9c c1befef0 c1977000 c1bee000 00000000 fee0: 00000000 c00905e4 00000041 00000005 c1ad4030 c1417198 c4254b62 00000008 ff00: c1977019 be82833c 00000000 c1440bb0 c198b8b8 00000101 00000004 00000040 ff20: 00000000 00000000 00000000 00000000 c1b39020 00000000 00000400 c1bc5660 ff40: 000a0802 c009ad10 000a0802 ffffff9c 00000004 ffffff9c c1977000 00000005 ff60: c000a384 c0082b94 00000000 c1a37660 c1a37660 00020802 40040000 00000026 ff80: 00000100 00000001 0002c6f8 be82848c 00000000 ffffffff 00000005 c000a384 ffa0: 00000000 c000a200 be82848c 00000000 be82848c 000a0802 00000000 00000000 ffc0: be82848c 00000000 ffffffff 00000005 00000000 00000000 00000001 00000000 ffe0: b6f9cee4 be828328 b6f33284 b6e1bccc 60000010 be82848c 21ffd831 21ffdc31 [] (atmel_ssc_startup) from [] (soc_pcm_open+0xd4/0x7c8) [] (soc_pcm_open) from [] (snd_pcm_open_substream+0x48/0x90) [] (snd_pcm_open_substream) from [] (snd_pcm_open+0x9c/0x1cc) [] (snd_pcm_open) from [] (snd_pcm_playback_open+0x40/0x5c) [] (snd_pcm_playback_open) from [] (snd_open+0x128/0x148) [] (snd_open) from [] (chrdev_open+0x108/0x12c) [] (chrdev_open) from [] (do_dentry_open+0x1bc/0x2d0) [] (do_dentry_open) from [] (do_last+0x930/0xb58) [] (do_last) from [] (path_openat+0x1b4/0x4f8) [] (path_openat) from [] (do_filp_open+0x30/0x7c) [] (do_filp_open) from [] (do_sys_open+0x124/0x1c4) [] (do_sys_open) from [] (ret_fast_syscall+0x0/0x38) Code: e3a0403c e0247493 e5943004 e1a06000 (e593300c) ---[ end trace edfb18e35da5cede ]--- I'm fairly confident that this comes from the line clk_enable(ssc_p->ssc->clk); in atmel_ssc_startup() when ssc_p->ssc is NULL. Looking further, the function that selects id 0 is fmt_single_name() in sound/soc/soc-core.c which would have found individual ids for the three ssc devices if they would have had names like "fffbc000.ssc.0", "fffc0000.ssc.1" and "fffc4000.ssc.2" instead of plain "fffbc000.ssc" etc (i.e. w/o the needed trailing .#) which is what they do have as dev_name. I can force sound to work on my board by installing the below revolting patch (there is only one dai in use with legacy dai naming) which is a pretty good indicator that my analysis is correct. The atmel_ssc_dai driver really should make sure that the dais it registers end up with the correct id. Or, it could be the case that at91sam9261.dtsi is at fault for giving the ssc:s bad names, but something is clearly not working as intended. BTW, I'm on d034050b9d4d3d73 on the linux-4.1-at91 branch (nov 2015) of the linux4sam/linux-at91.git tree at github, plus a bunch of local patches. Cheers, Peter diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 2373252..671a63e 100644 (file) --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2601,6 +2601,8 @@ static int snd_soc_register_dais(struct snd_soc_component *component, */ if (count == 1 && legacy_dai_naming) { dai->name = fmt_single_name(dev, &dai->id); + /* uurk, force id 1 since we use ssc1 */ + dai->id = 1; } else { dai->name = fmt_multiple_name(dev, &dai_drv[i]); if (dai_drv[i].id)