From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAB2FEB64DA for ; Sat, 15 Jul 2023 02:41:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230027AbjGOClE (ORCPT ); Fri, 14 Jul 2023 22:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229796AbjGOClC (ORCPT ); Fri, 14 Jul 2023 22:41:02 -0400 Received: from AUS01-SY4-obe.outbound.protection.outlook.com (mail-sy4aus01olkn2148.outbound.protection.outlook.com [40.92.62.148]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8F563599 for ; Fri, 14 Jul 2023 19:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IrrLa3MEAXeK4LqlG+pqg45hjjapvVCyBHFhoYwVv+BT25ySrqCMrGG4ZqPPDC/BbkbCS33VvxWiql6T1iwUPZ0AWZezOdwCB8UDVBx804sPlpVmHdKmycOXOFedCM0yHusyoMK0z2kCCzwXI00vqy1n6+Q0WI1vTOJ4E2ZOW8LXzeTbaywvTbAmx49gdJqs+BZ80dkmNZqPfGd4wJXenDeDDeXaPhai8BVA5ARGvbEeknAdGWJZdHWLm0JyDdWI8w1smUyyDQi9cEVDGUQLB+MRpEmrbhojJK3kd4QGPK1A7qDjOph62La7/2kbEYdunirSZ/6IjXBtn7tJPPS6YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZP360f4nC/GmuJ6VGeTm2O4mNsLDCYSHa9yeb4u11cA=; b=ZlA7yopZuUyhH1OAQ8m39oFw4w7nJjFqUgfzgTop2bO5nQNQ9YXC1m3xGHBeHE+mxaPXiaz+ZKxKLkCnojhVgc/01dELOS9Zw52fo5lviVYaFUzU3SrdNMFRxBGaKUarEqK3oqLpstCq3imiSqX303SS13MDtmXtdVtKebPZzq5S4RUGQXyuOTEXcC8MegVA0FhAAU0hQ0TqOnI//dbwZSgio2VJyR0Q4J3hlomNes3lDxqvfpoSm23R5QF6sqC0roD01UdYTI2J990kgLY/88zHhqbAzqgamdjYdGdTA5yW7tCcK2cDWTOnX2ba1C80JNvhhA2ue+pHsNoyKcCOzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZP360f4nC/GmuJ6VGeTm2O4mNsLDCYSHa9yeb4u11cA=; b=Jy/vHfD7EyxzUdJ5dahRERdAoPK/l5zwg9elV0wX8Pacpw3Y3Y4InKnHIBbcrh0c5ZdfzNAHsRnxIZGf8XZSPlV4xgjUm5CfKayBlAmuM0tL9G6ThELwIB5a83C8xFILBq5uhQkILbbj27Kpglpe1Mgrpz8fgkDfOY4UfeiGfEMXv+6xxmLIHLK+qm+01EWYXaauzwGjZj7nLx1Qku0TU/+rwsSe6h0YfFqXT7+Np4UyomAlfcbly8TAx/I2o99+aB+cqzRSm5YejELCG62SgFpVzA7OIO27k4nTZ4ndAY9CvgjkFGonKWGA7YUQNqoZGM6i3Q7IHqfEaLp+7x4IUg== Received: from SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:c2::7) by SYBP282MB2400.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:113::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.28; Sat, 15 Jul 2023 02:40:54 +0000 Received: from SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM ([fe80::8302:9e75:933d:b45]) by SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM ([fe80::8302:9e75:933d:b45%6]) with mapi id 15.20.6588.028; Sat, 15 Jul 2023 02:40:54 +0000 From: David Xu To: luke@ljones.dev Cc: alsa-devel@alsa-project.org, andy.chi@canonical.com, david.rhodes@cirrus.com, james.schulman@cirrus.com, kasper93@gmail.com, linux-kernel@vger.kernel.org, p.jungkamp@gmx.net, patches@opensource.cirrus.com, perex@perex.cz, rf@opensource.cirrus.com, ruinairas1992@gmail.com, sbinding@opensource.cirrus.com, tcrawford@system76.com, tiwai@suse.com, xuwd1@hotmail.com, yangyingliang@huawei.com, yangyuchi66@gmail.com Subject: Re: [PATCH 1/2] ALSA: hda: cs35l41: Add fixups for machines without a valid ACPI _DSD Date: Sat, 15 Jul 2023 10:40:36 +0800 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [C4yBfgeOSlwPagAeqnPz1p0THeTF6R6B] X-ClientProxiedBy: SG2PR02CA0094.apcprd02.prod.outlook.com (2603:1096:4:90::34) To SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:c2::7) X-Microsoft-Original-Message-ID: <20230715024036.23307-1-xuwd1@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SY4P282MB1835:EE_|SYBP282MB2400:EE_ X-MS-Office365-Filtering-Correlation-Id: d318b6a7-6932-4d87-6c7a-08db84dce8b1 X-MS-Exchange-SLBlob-MailProps: YfhX3sd/0TUvI142j/OdUPzgxVEMj/IKEpMjh1p+Ll+Eh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=?us-ascii?Q?DE9vSBXxswDxNF+GPGRGUuxU7PLXa86eK1yiiwNApUU9d6wiOXwl0Sb7UTfG?= =?us-ascii?Q?b/Mc0J/0dUV8QgYWOAzM13fSASNP60cTyf2JkEowwixsbTzd3X1os9hO4FrZ?= =?us-ascii?Q?ycsKgg4HyXtyrPE4NIL4vjfA7K/Y+P9W9/zu9pJ91MBVUw+BVemIPBU6FhSh?= =?us-ascii?Q?PYsg2G1tGJgleN1zAArUIYWWbaC3fwaMA9bMOBcZ9brOCngNm4tlDqyEsXMo?= =?us-ascii?Q?ZmMVX+MZkEGii2hbRnYXbV1m6EsIv3MYNhgSY2199NDV6iOIscLngfedlGKA?= =?us-ascii?Q?S7pAspLph7p0bMBcFh/DHy6ddlkur8q2U34+KrQqDPo9AqypaFUZWGiQvp8o?= =?us-ascii?Q?tGaehma96fDTb+UV7TOcffwMVfcSzhZPAvxRlJVVYRdjlhiNwcMS3wTSBNZ0?= =?us-ascii?Q?VP+nKdHHMht1xu6MvDIrDo+rGc2IpXz3rVGhqgXTLbL/SN4HzwQge1QXVlDz?= =?us-ascii?Q?lMKzLvz5CfIV3SmPw7pSPh9PU/je6yzSyvMe/bvvJF7dci6DSJOrHhx9VybA?= =?us-ascii?Q?Ex2G19GTB0qayZJ9KMyg7kg50U6VSQBQkwcsOBr2gF4QwnqS/f/x5TB4hsr2?= =?us-ascii?Q?73TLYcjxIGWk2rdS98DRMrw5sJ6ZA3VW4sUrhl16TmL2DJBtjUlsO3d/IUfE?= =?us-ascii?Q?O8V1qm56SVi84RBa3Fhrw85HyHwzsu3EaG9xfA=3D=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-746f3.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: d318b6a7-6932-4d87-6c7a-08db84dce8b1 X-MS-Exchange-CrossTenant-AuthSource: SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jul 2023 02:40:53.9585 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SYBP282MB2400 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Luke, Thank you for replying. > I tried with the patch applied and what I thought was correct setup > (in driver): > 1. without my DSD table additions (in acpi) > 2. With the CS part added (in acpi) > 3. With my full DSD table added (in acpi) > > all 3 instances failed with: > > cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: OTP Boot status 80000000 > error: 0 > cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error > -5 I see that you have some problem on making a working fixup table entry, with your key concern being the three fields you pointed out: > The key thing I am concerned about is how the values for the > following are gained: > + .reset_gpio_idx = {0, 0}, > + .reset_gpio_flags = {GPIOD_OUT_LOW, GPIOD_OUT_LOW}, > + .spkid_gpio_idx = {1, 1}, As I could see you have written an incorrect fixup entry when compared with the ACPI patch you provided: 1. For the .reset_gpio_idx field, from your ACPI patch: > Package () { "reset-gpios", Package () { > SPK1, One, Zero, Zero, > SPK1, One, Zero, Zero > } }, for your machine, the index of the reset GpioIo resource is 1, which means the correct form would be .reset_gpio_idx = {1, 1}. You could find this index by looking for the GpioIo resource descriptor that has a "IoRestrictionOutputOnly" IORestriction argument in your ACPI CSC3551 _CRS method, and I suppose this reset gpio should has the only GpioIo descriptor with this "IoRestrictionOutputOnly" argument. Besides, having taking this into consideration, the error you get is probably due to a incorrect reset. 2. For the value of .reset_gpio_flags, it needs more or less some guessing: it's common for chips to have their reset to be pin active low and this polarity can also be checked by reading the gpio resource buffer with kernel acpica infrastructures. Anyway, I think for most cases, .reset_gpio_flags = {GPIOD_OUT_LOW, GPIOD_OUT_LOW} is good. 3. For the value of .spkid_gpio_idx, by investigating the CSC3551 ACPI _CRS method and the driver code, my shallow thought is that it has 3 pins, with one being the reset pin which we have dealt with, one being the interrupt pin, which usually is declared with "GpioInt" if the pin is connected to PCH GPIO and is considered to be one of the cs35l41's configurable GPIO, and another one configurable GPIO whose function is usually assigned with "VSPK_SWITCH". For the spkid to be honest I still have not figured out how it was designed. I suspect that the spkid gpio is acually a reused funcion of one of the three gpios I mentioned. From the driver implementation, the .spkid_gpio_idx field should be the index of the GpioIo resource descriptor in the _CRS returned buffer. However also from the implementation of the driver, whether this field is configured correctly should not be the major factor affecting if the speakers would work, it only affects the selection of the cs35l41 firmware. Anyway, from your working ACPI patch: > Package () { "spk-id-gpios", Package () { > SPK1, 0x02, Zero, Zero, > SPK1, 0x02, Zero, Zero > } }, you may try setting .spkid_gpio_idx = {2, 2}. If that still does not work you could try setting .spkid_gpio_idx = {-1, -1}, and this would make the driver try to find the "spk-id-gpios" package from the ACPI table. (however even though you did not provide this by patching the ACPI table and it fails to get it, the driver still should not fail.) Please try to modify the fixup entry as the advice above to see if it works. If still not, feel free to futher reply me, and I think it would be very beneficial for me to help solving your problem if you could post your orignial CSC3551 ACPI table.