Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4958094pxu; Wed, 21 Oct 2020 09:23:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxoqBOBvJ3+pc5zjc+kcWScApI72hyL41/Ty1uDVKETq6n6RCwPyvc7SSAYJtD3k6nk1kt X-Received: by 2002:aa7:c9c3:: with SMTP id i3mr3952419edt.236.1603297394240; Wed, 21 Oct 2020 09:23:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603297394; cv=none; d=google.com; s=arc-20160816; b=rdV6fKwuOOFX0p4gQ7NPdHzjg1gXjAv3p73Fum7S9Ot/VXQR0QRdCj5Mt1LDUnGSMI ds7T3Wgc7f/5Mary43z3cKAJ8B6/jBnEUUqzakaMsGlshC3NhA5xrwbvMmko0iDkKQxC Ks9LaN4cLmf5yRK1CxvAa51VWskt3ZPYPfk5n/pA0iNARpcuDBNQ13QRhUpEYeulBmq4 u5Vp3mZlR90WwO9eN8zV8TljzLFze1spftHp7ElPz7XnpGZG6DhXNEp3Yu/ClGPqoSJX tfLWNhxTKLe+2N8jwdelG972vevPk/g+DX+UIOqgYeHj96yBvVzayhiwp9382piEHFTS bugA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=jYFdycc4cemOIaYFUQzd2hjpOFiC6YIkhXB4IeoEDOc=; b=rFUXEz6BeQBWens/oXER4n2vX0wydrcK4WEUzAjCPCNzpnhVGZ8J8HvRIPyMYw3dH7 bvqe32VeV/4NCOMaxGrUogQi8olXzQyFx6FX4ZYJpGvJzIU/eUKQf8Ybrcp5GrO04X34 UYdTxNIfSvSPRHGmrp5KTvXVgXc8/F6ruk7UhS7FjWUjQ2phrEWa81YZZ/7s9/qcq4ep m87v3nfFtYjcc6pTkmbzkZEBHnNBKU/SUsoEI951CyrLFUysruG5t9hPtVpheFYbqHr/ Uegrzte4gZf375FGnslD5KJxRdD7KChpznUYrrHeR9yXhLQxGePezJjQgyDrZYczvH3y zZvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dbg1dsuc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e9si1638739ejd.398.2020.10.21.09.22.51; Wed, 21 Oct 2020 09:23:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dbg1dsuc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437751AbgJTSwF (ORCPT + 99 others); Tue, 20 Oct 2020 14:52:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727791AbgJTSwE (ORCPT ); Tue, 20 Oct 2020 14:52:04 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0049FC0613CE for ; Tue, 20 Oct 2020 11:52:03 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id h5so3496243wrv.7 for ; Tue, 20 Oct 2020 11:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jYFdycc4cemOIaYFUQzd2hjpOFiC6YIkhXB4IeoEDOc=; b=dbg1dsucJfSwBHh00T6Mc9TxIy2cA3D0xo1Vm098iBuTl3wM9obmhlk2Rgw+3Fe9DE lhn/KcJI0CzGJ6oaNtkW3L2DYRWLDfMqxzbcRxS7Ipt1zizebN8Dh7Zxgafe7FBS9DOS DhU2QoyTkvFT2KdsWGAohFct9ghNqDtSzxfoY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jYFdycc4cemOIaYFUQzd2hjpOFiC6YIkhXB4IeoEDOc=; b=PTvE/U+jI9J/7iqvJPIJW7Z95+0wKJJUcAUCKrU0h57LMCXf2bn/Lt3DPCPZzzgtLM 7X+0J/Tv/359fLrEGtu3a2qbpNxDCqPSj5iV4w7zfryQ3KLMnD/CCBht1jZuPV3vN5YB aRiRSInT4ioTbEOHtvbdzq976JLL+CZOIDvrHXmpenZ9r6dhN+6r6t1WkJV8bKjBB6Lz KHGmAKtKdDg8ojMm5XEn0xWFznMpkYYkbneNdtuWAhv9fA2pJ0I+vZMH/kcHTnL6vlc+ 0+Ww36d1d0CnMwZeeWVrjuMY75dlMk8ADCNqi3n4mgiyUQUKOhS/DpF05+xePkc8yCyu DbXg== X-Gm-Message-State: AOAM531S55Sonr5fHP8bxvz2oEDQJ+tkWzEFK9T1roOhnyaqmbT6GstD htbI6Cyo72wSnibPaTyjjpT10UTZoYac/vZbY7dxYQ== X-Received: by 2002:a5d:4001:: with SMTP id n1mr5162648wrp.426.1603219922351; Tue, 20 Oct 2020 11:52:02 -0700 (PDT) MIME-Version: 1.0 References: <20200914080619.4178587-1-cychiang@chromium.org> <20200914080619.4178587-3-cychiang@chromium.org> <7bdc0d63-27b1-f99e-c5f8-65f880733d16@linaro.org> <20201015161251.GF4390@sirena.org.uk> <20201020143711.GC9448@sirena.org.uk> In-Reply-To: <20201020143711.GC9448@sirena.org.uk> From: Cheng-yi Chiang Date: Wed, 21 Oct 2020 02:51:33 +0800 Message-ID: Subject: Re: [PATCH v11 2/3] ASoC: qcom: dt-bindings: Add sc7180 machine bindings To: Mark Brown Cc: Srinivas Kandagatla , linux-kernel , Taniya Das , Rohit kumar , Banajit Goswami , Patrick Lai , Andy Gross , Bjorn Andersson , Liam Girdwood , Rob Herring , Jaroslav Kysela , Takashi Iwai , Stephan Gerhold , Matthias Brugger , Heiko Stuebner , Srinivasa Rao , Doug Anderson , Dylan Reid , Tzung-Bi Shih , Linux ARM , linux-arm-msm , Kuninori Morimoto , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , "moderated list:ARM/Mediatek SoC support" , "open list:ARM/Rockchip SoC..." , Ajye Huang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 20, 2020 at 10:37 PM Mark Brown wrote: > > On Tue, Oct 20, 2020 at 09:37:05PM +0800, Cheng-yi Chiang wrote: > > > May I know your suggestion on Ajye's patch "ASoC: qcom: sc7180: Modify > > machine driver for 2mic" ? > > > https://lore.kernel.org/r/20200928063744.525700-3-ajye_huang@compal.corp-partner.google.com > > > I think adding code in the machine driver makes the intent straightforward. > > If we want the machine driver to be fully configurable, > > we can always add more code to handle properties like gpio, route, > > widget (mux, text selection) passed in from the device tree. > > If the device has both front and rear mics and only one can be active at > once that seems obvious and sensible. If the devices only have one of > these then this seems like a bad idea. > trogdor board: only front mic. pompom board: having both front mic and rear mic. Only one of them will be used at a time. It is toggled by mixer control backed by a gpio. My proposed solution: instead of using compatible strings, expose only dmic-gpio property. When the machine driver sees this property, it uses the dapm widgets and controls created in the machine driver. > > But I feel that we don't need a machine driver to be that configurable > > from the device tree. > > I think having the logic scattered in various dtsi files and relying > > on manual inspection to understand the usage would be less > > maintainable than only exposing needed property like gpio. > > Especially in the complicated case where we need to create a mux > > widget with callback toggling the gpio like this: > > I don't understand what "logic scattered in various dtsi files" means, > sorry. > I mean I don't want to use device property to pass in widget name, type, text and callbacks. Let me give an example: - Board trogdor uses front mic, rt5682, and max98357a. - Board pompom is based on board trogdor, but it has front mic and rear mic. If we somehow managed to add the code to pass in widget, route, type, text, and callbacks needed for dmic control, we will need to put a bunch of properties in trogdor-pompom.dtsi file. - Board ABC is based on trogdor as well, and it has front mic and rear mic, but with a different speaker amp. To use widget, route, type, text and callbacks for front mic and rear mic, in trogdor-ABC.dtsi file we would copy some properties used in trogdor-pompom.dtsi file. To support the different combination of codec, we would need some modification of the route and widget. Now the support of front mic and rear mic switch is scattered in trogdor-ABC.dtsi and trogdor-pompom.dtsi files. For example, when we change the code to parse or build the widget and route, we need to fix both trogdor-pompom.dtsi and trogdor-ABC.dtsi. Alternatively, if we only expose dmic-gpio property and put surrounding code in the machine driver, we can use this dmic-gpio property, plus the sound card name to identify the needed widget and route. > > Yes, that should work to describe the dailink we are using. > > But a more tricky issue is how to do calls like setting PLL in dai startup ops. > > ... > > > I think that asking a generic machine driver to do configuration like > > this with only a limited interface of device property > > might be too much of an ask for the machine driver. > > Richard was looking at some basic configuration for PLLs. That sounds promising. If we don't need to include the codec driver header file explicitly, that can make machine drivers simpler. Maybe for most of the simple cases we don't even need a dedicated machine driver. > > > Would you mind if I simplify the compatible string like Srinivas > > suggested, and send a v12? > > > As for other two kinds of variations that I am aware of: > > > 1. front mic / rear mic > > 2. replace alc5682 with adau7002 > > The CODEC change is going to be described in the DT no matter what - > you'll have a reference to the CODEC node but it may make sense if > there's enough custom code around it. For front vs rear mic the > simplest thing would just be to not mention which if this is a hardware > fixed thing, otherwise a control. > Would you suggest checking whether the codec node is a rt5682 node, and call required PLL calls accordingly ? "For front vs rear mic the simplest thing would just be to not mention which if this is a hardware fixed thing, otherwise a control." Sorry I am not sure if I understand this correctly. Please correct me if I am wrong. - For default case having 1 mic: not mention this at all - For front mic / rear mic case: see gpio property and use an additional control. > > We can set different board names and different compatible strings to > > achieve such variation. > > So that it would make sense to describe configuration in compatible > > strings like you suggested, and also provides UCM a way to distinguish > > different boards. > > I don't recall having suggested distinguishing these things with a > compatible string, especially not the microphones. UCM can already use > the display names for the boards to distinguish things. My apology that I made the wrong interpretation when I read your reply "These feel more like things that fit with compatible" regarding replacing alc5682 with adau7002. Please let me know which one solution you prefer: - deriving this information from codec node - deriving this information from different sound card name Thanks so much!