Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp602922pxb; Thu, 31 Mar 2022 12:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmQc+NogRy+iBH3NGEgoM6YCkE0Rs7+RP5pBGlFecvGRS1jIjsFK4Xxy2aQ+ujejVsmVtY X-Received: by 2002:a17:903:3051:b0:156:2d03:3434 with SMTP id u17-20020a170903305100b001562d033434mr6875007pla.101.1648755667804; Thu, 31 Mar 2022 12:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648755667; cv=none; d=google.com; s=arc-20160816; b=BKtPPMzGqluwet/z0yOnj+duE/f5LlPMZiug1Jf5uitxJ7f/fDnLcIUKVW0oUko4Pf AFN46DA/8uLiuPrSra8MXp6itcMHjxmA7tXZ/H7hbpLLefPUUb2MKHaxW0dYp6J3uU8o BI8jrsjAPf0wyDWyNXD+3aEfsKF+YQXadCJ2mNCZ+dzn5W5UoPnGAQ/6+XtFimHByVhG nfvsD0q0N5jy2ydv4Hnp6gBc1tfiokz8L8k+1LvBbLKhI917JZ4+I/8v7PPtVPUICd2g Xz07IxgKIfgtlqLnZI/GqYCaCbriawdI4o5CpSqmx7JJCpSg2HKR6p+XyOsYtAlwe8E8 Hu+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=Gbs6tg3skhw4iV8rn16Vi4dTeQOEU2j8Ua0eJjFEIRI=; b=sYMARfPSftI+/jM+LvbNErFKry6cIVexZ4kAm62C3FnCd7sksGwfmUfDcRcsbv0sKS G+yVto7mH2Mah71TFRPR/Ec0DqUFjEO1ucl76QgGXTUyDfak9Ly/XGXew3UB6igpXDIq CS5MM7Fo0m/pgaiGKlJZys2G53o/51rrmJ/Njx7f3O1jekmaGEvzzzhPGYlaOo21AbTN sH1Kl8s3xkNuGB8KU6nzobsSGtuch0CrgzG3/xc83UXhXSKg5rgbgSZU+1ysK921+MbU Fitu+FIE006QT+i6aRkT9gBxAutjSfvgmLPqGadJaUti6RyYKcNuFaVC7Aq23udo9EHu e32A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=UxK4Bkne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq10-20020a17090b380a00b001bd14e01f1asi4412943pjb.8.2022.03.31.12.40.52; Thu, 31 Mar 2022 12:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=UxK4Bkne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237942AbiCaPG3 (ORCPT + 99 others); Thu, 31 Mar 2022 11:06:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232527AbiCaPG1 (ORCPT ); Thu, 31 Mar 2022 11:06:27 -0400 Received: from hutie.ust.cz (hutie.ust.cz [185.8.165.127]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FA0531DC6; Thu, 31 Mar 2022 08:04:36 -0700 (PDT) Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1648739073; bh=Gbs6tg3skhw4iV8rn16Vi4dTeQOEU2j8Ua0eJjFEIRI=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=UxK4BkneLgDYJnS9yHUey/xTnu7DvHl4N0bAER7LwYK9NaIywtoi1EgnY8dqwpDk1 T8BGOYtJy+NLEeIQ+tGNddxWMikOZNYJoWHVMjgVjx5hiNwemRZTjiqj7ehZmEmmqI EkzlDxIPdcETMFA6N2eOy7+Q7vE2bXwkK1VUiDQo= Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Subject: Re: [RFC PATCH 0/5] Apple Macs machine-level ASoC driver From: =?utf-8?Q?Martin_Povi=C5=A1er?= In-Reply-To: Date: Thu, 31 Mar 2022 17:04:32 +0200 Cc: =?utf-8?Q?Martin_Povi=C5=A1er?= , Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Kettenis , Hector Martin , Sven Peter Content-Transfer-Encoding: quoted-printable Message-Id: <6D199EAB-FE14-4030-96A7-2E0E89D25FAB@cutebit.org> References: <20220331000449.41062-1-povik+lin@cutebit.org> To: Mark Brown X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 31. 3. 2022, at 16:18, Mark Brown wrote: >=20 > On Thu, Mar 31, 2022 at 03:28:12PM +0200, Martin Povi=C5=A1er wrote: >>> On 31. 3. 2022, at 14:34, Mark Brown wrote: >=20 >>> The broad issue here is that what you consider ridiculous someone = else >>> might have some bright ideas for configuring dynamically - if things = are >>> being exposed for dynamic configuration it's probably because = someone >>> wanted them, if the control is genuinely useless then it should just = be >=20 >> Well but these are codec drivers reused on different systems, it can = both >> be 'not genuinely useless=E2=80=99 on some system and ridiculous to = leave open on >> the systems I am trying to write drivers for. >=20 > It wouldn't be the first time that we've had someone turn up with a = new > idea for how to configure an already existing bit of hardware, part of > the reason for this approach is that people do get surprised by user > creativity with their systems. >=20 >>> The TDM swap thing you're mentioning looks like it's a left/right >>> selection which people do use sometimes as a way of doing mono mixes = and >>> reorientation. The ISENSE/VSENSE is less obvious, though it's = possible >>> there's issues with not having enough slots on a heavily used TDM = bus or >>> sometimes disabling the speaker protection processing for whatever >>> reason. >=20 >> Not only that. On TAS2770 the default value for =E2=80=98ASI1 Sel=E2=80= =99 is =E2=80=98I2C offset=E2=80=99 >> meaning the speaker amp driver ignores my set_tdm_slot calls. If you = tell >> me it=E2=80=99s okay to change that behaviour and it won=E2=80=99t be = considered backwards >> compatibility breaking, that would be part of the solution I am = seeking >> here. >=20 > Having the default state be muted or not routed is quite common, UCM > files or equivalent are typically required for embedded style hardware > like this. >=20 >> But even then, what for example if the system has a single speaker = (as it >> does on the Mac mini to be covered by this driver) and the I2S bus is = left >> undriven for the duration of unused TDM slots? That may genuinely = pose >> a risk of people blowing their speakers by switching something in = alsamixer. >=20 > Right, so that's a more sensible and valid use case. We do have the > platform_max feature available for precisely this reason - that's > probably more appropriate here since if there's a danger of people > blowing their speaker with a floating input they could also blow their > speaker with just a very loud audio signal so limiting the volume = people > can set on the speaker driver seems sensible and would also cover them > for misrouting. Whatever the device might pick up from noise on an > undriven bus could also be played as audio down the bus. This does > become a little fun with speaker protection as we'd want to raise the > kernel limit so that userspace can dynamically manage the volume to > contorl power (though that might be done with software control), but > it's easy enoguh to raise limits later. >=20 > On the other hand it seems like userspace might reasonably choose to = do > a mono mix for this output entirely in software, in which case telling > the speaker amp to pick up one channel would make sense, or to just = play > out a stereo signal over I2S and have the amplifier do a mono mix and > I'm not seeing why we'd force one or the other in the machine driver. Granted. If we make sure the volume caps are there to prevent damage under arbitrary input (which we should anyway) that covers slot misconfiguration too. >> The ISENSE/VSENSE controls are also actually useless on these systems = as we >> are not doing anything to pick up the measured values (which are sent = back >> over the I2S lines). I don=E2=80=99t know if there can be driver = conflict between >=20 > Presumably someone might want to work on figuring that out though, and > from a hardware safety point of view it would be better if they did. >=20 >> two speaker amps trying to drive the I2S lines at the same time = should >> the user happen to enable SENSE facilities on more than one of them. >> Now I can grudgingly study that and rule it out but I would rather = hide >> the controls altogether. >=20 > Yes, having two devices driving the bus at the same time wouldn't be > great. How is the TDM slot selection for the signals done in the > hardware, I'm not seeing anything immediately obvious in the driver? > I'd have thought that things would be implemented such that you could > implement speaker protection on all speakers simultaneously but = perhaps > not. I don=E2=80=99t know. I would have to go study the details of this. = Should I see if I can find a combination of =E2=80=98ASI1 Sel=E2=80=99 =E2=80=98VSENSE=E2= =80=99 =E2=80=98ISENSE=E2=80=99 settings that would lead to driver conflict on one of the models, or is there a chance we could hide those controls just on the basis of =E2=80=98it = doesn=E2=80=99t do anything usable and is possibly dangerous=E2=80=99? >> That=E2=80=99s the reasoning anyway. To reiterate, seems to me the = controls >> are useless/confusing at best and dangerous at worst. >=20 > I'm just not seeing an issue for the slot selection. Yeah, agreed there=E2=80=99s no (damage) issue as we should to proper = volume caps anyway. Martin