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 X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 836D3C433E2 for ; Mon, 7 Sep 2020 17:22:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D4972080A for ; Mon, 7 Sep 2020 17:22:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hEXKQqhJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729831AbgIGRWo (ORCPT ); Mon, 7 Sep 2020 13:22:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729681AbgIGNrX (ORCPT ); Mon, 7 Sep 2020 09:47:23 -0400 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C74A5C061573 for ; Mon, 7 Sep 2020 06:37:24 -0700 (PDT) Received: by mail-il1-x144.google.com with SMTP id w8so12526710ilj.8 for ; Mon, 07 Sep 2020 06:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=hEXKQqhJ9NmSx4YCpKMr1NwW45bcnwzOkhMBL8DjeyYLJm78qmx6PfgWclUzVWmb2h fxaV6Sz2P9KxPrZSNITJVINtrvSAgSVSURAAgX1ASuRkdCqb7E91FrXanXeSPkc3ujAX +FFNNl0haD5QGCZw+GF/SsD6+N2HO6LCjCJF+VFuY1mxeUJW36pdkCIztgxwx60mVlQc yje66pdfUrcr4zkkHKkQoPkqLGdiP14j1niS7UWlfzNhCz3KJsftBXf8hOEiYD7uSXY9 mrAxej+Mmxa5Rq3IupJGnTLeDACHso2O2gLPL+GCXy5RjeQSrH+CAHW5xCBbD046Gi6G Fe4Q== 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=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=Uqbrezxc6554nh9TqHtz9+atQ8Be9LxDJ7pucDQPXCa7/iJzye3eCQMbQlwMtr6JJV 3ef6UNcEpl8Xn4yZ5dz/WJDRFzzlug/6agl2wDjJgjkIW/OwpoUHajC/QrheHOICh44B URr9qOPM6G8QAMKjbRoXbeQM++ZsntF2hEQ/ekuLTTVUyOcDLjeD3YzluBMIyuBtMfli QDc0zbFpZuOiIc5VkOcxKLMo6Ffah3mES7FI3/uLllp9/ATuA3h514QELAUM3TPOGYun b3YAoZPsgMEf6h5gn7+Te5xqY2bGnqDOodc39/hLKGdjQwQIElwcTAt49zw7GRgbqUrP 7C/A== X-Gm-Message-State: AOAM533Po9lwqcxmsCqlTWPfChV+sFVAWV4op5mM6wVlioQqYajwf5qB sYdE0FXf5QF3VfW4rKnZZ8BUoMV04xvVI8XNaYeX8g== X-Google-Smtp-Source: ABdhPJyBenIIH2d8wv7qBpX9DpeJamhA8s78sQ62WqhL82+W2hjTg5gPuJzXToQlghF4RNr5s/7pUi3tIrgzsCAuZGI= X-Received: by 2002:a05:6e02:c26:: with SMTP id q6mr19152124ilg.235.1599485843333; Mon, 07 Sep 2020 06:37:23 -0700 (PDT) MIME-Version: 1.0 References: <1597644455-8216-1-git-send-email-jiaxin.yu@mediatek.com> <1597644455-8216-3-git-send-email-jiaxin.yu@mediatek.com> <20200819103730.GB5441@sirena.org.uk> <20200819194005.GC38371@sirena.org.uk> In-Reply-To: <20200819194005.GC38371@sirena.org.uk> From: Tzung-Bi Shih Date: Mon, 7 Sep 2020 21:37:12 +0800 Message-ID: Subject: Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document To: Mark Brown Cc: Jiaxin Yu , Matthias Brugger , Rob Herring , Takashi Iwai , Linux Kernel Mailing List , ALSA development , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, howie.huang@mediatek.com, eason.yen@mediatek.com, shane.chien@mediatek.com, bicycle.tsai@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 20, 2020 at 3:40 AM Mark Brown wrote: > > On Wed, Aug 19, 2020 at 11:42:27PM +0800, Tzung-Bi Shih wrote: > > > But I found struct mfd_cell also contains member .of_compatible. What > > is the difference if we use compatible string (as is) for this device > > instead of falling back to use device name to match? > > That's for binding the MFD subdevice to an OF node, you don't need to do > that for a device like this - you can just use the of_node of the parent > to get at the properties. There is an issue we overlooked. In sound/soc/codecs/mt6359.c, mt6359_parse_dt() cannot read the DT properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/mt6359.c?h=for-next#n2640). The original DTS is as following: pmic { compatible = "mediatek,mt6359"; mt6359codec: mt6359codec { compatible = "mediatek,mt6359-sound"; (1) mediatek,dmic-mode = <1>; mediatek,mic-type-0 = <2>; } } After removing the line at (1), mt6359_parse_dt() cannot read the DT properties. The PMIC drivers/mfd/mt6397-core.c: - "mediatek,mt6359" - has the struct mfd_cell of mt6359-sound - adds all mfd_cells via devm_mfd_add_devices(). The audio codec sound/soc/codecs/mt6359.c: - "mediatek,mt6359-sound" Here are a few options we can come out with. 1. adds back the compatible string in the DTS 2. gets of_node of parent in mt6359.c, and iterates all children nodes to get the desired properties 3. parses all children nodes in the PMIC driver, and put them into either platform_data or device properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/include/linux/mfd/core.h?h=for-next#n77) - The PMIC is common for several sub-devices. It makes less sense to handle subdevice specific logic in the common code. 4. others Could you share with us what would you suggest for fixing the issue? 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07713C433E2 for ; Mon, 7 Sep 2020 13:38:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9D88216C4 for ; Mon, 7 Sep 2020 13:38:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="hA7L5V61"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="hEXKQqhJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9D88216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E8219174B; Mon, 7 Sep 2020 15:37:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E8219174B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1599485908; bh=w7zLgJJci31u8czghGSsl5fLZ4qoiwsq8QnKcq80zDA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hA7L5V61epQ4/SvGWwIHJrHMs99T1kfNoUSP1sIDM+vu2QU8vo6L5hmm147CC7MPv 4Gv25Hl//jfxIXHJsEdLT4faj/Zp2Mh6N6qukzbqV88zcAeFkQhxBQkLkuxzQGHAas +5aXp4HatBaksiY2DVI6RAPcAGGkLf83SbKxb7fQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 78357F8021C; Mon, 7 Sep 2020 15:37:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3651BF80227; Mon, 7 Sep 2020 15:37:36 +0200 (CEST) Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 36CB2F800D3 for ; Mon, 7 Sep 2020 15:37:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 36CB2F800D3 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hEXKQqhJ" Received: by mail-il1-x144.google.com with SMTP id a8so6804301ilk.1 for ; Mon, 07 Sep 2020 06:37:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=hEXKQqhJ9NmSx4YCpKMr1NwW45bcnwzOkhMBL8DjeyYLJm78qmx6PfgWclUzVWmb2h fxaV6Sz2P9KxPrZSNITJVINtrvSAgSVSURAAgX1ASuRkdCqb7E91FrXanXeSPkc3ujAX +FFNNl0haD5QGCZw+GF/SsD6+N2HO6LCjCJF+VFuY1mxeUJW36pdkCIztgxwx60mVlQc yje66pdfUrcr4zkkHKkQoPkqLGdiP14j1niS7UWlfzNhCz3KJsftBXf8hOEiYD7uSXY9 mrAxej+Mmxa5Rq3IupJGnTLeDACHso2O2gLPL+GCXy5RjeQSrH+CAHW5xCBbD046Gi6G Fe4Q== 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=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=d82Fs4L/83mgoxiqgbALSwS4ydRt9nTxL3kHuLqv1o41AVvtBGcTHMeEK9A2Nh9Ou6 YpQfsq6JM7Omc5Huw5fIwHx8EQ+6OOIODQ7aYK+/I1VdfoyT2GnHM+iLG8Rb/nmcx6vi fvsztUALUNcrVn3H9Nx9Ka3aZGfsEQD74+sCxybRAo7wORPmPwvFnKyqpryr+paN6c1b 57L7BheiF1JQGiIY+7p9IUk2vxxHOkhNf9Ep502EmzEGODTGNAtBZuxPr2zDqLjfhM4L 0eO1BIywv+19M2l4hbr6+tRmDGnrP2S6U3NRwsU3JlcIdZNgYeW+CWUSfDeKjzfdVM0t iLyA== X-Gm-Message-State: AOAM532zTIyP3uP2XBpRKkMaymi5rEny8C1ewZYQ5J0wNYsk/xGWFrDR HK3Tjci4I0XrEG4B4fvHbJxUYNHiB2hNUdwqmgt9Fw== X-Google-Smtp-Source: ABdhPJyBenIIH2d8wv7qBpX9DpeJamhA8s78sQ62WqhL82+W2hjTg5gPuJzXToQlghF4RNr5s/7pUi3tIrgzsCAuZGI= X-Received: by 2002:a05:6e02:c26:: with SMTP id q6mr19152124ilg.235.1599485843333; Mon, 07 Sep 2020 06:37:23 -0700 (PDT) MIME-Version: 1.0 References: <1597644455-8216-1-git-send-email-jiaxin.yu@mediatek.com> <1597644455-8216-3-git-send-email-jiaxin.yu@mediatek.com> <20200819103730.GB5441@sirena.org.uk> <20200819194005.GC38371@sirena.org.uk> In-Reply-To: <20200819194005.GC38371@sirena.org.uk> From: Tzung-Bi Shih Date: Mon, 7 Sep 2020 21:37:12 +0800 Message-ID: Subject: Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document To: Mark Brown Content-Type: text/plain; charset="UTF-8" Cc: ALSA development , howie.huang@mediatek.com, Takashi Iwai , Jiaxin Yu , Linux Kernel Mailing List , shane.chien@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, eason.yen@mediatek.com, Matthias Brugger , bicycle.tsai@mediatek.com, linux-arm-kernel@lists.infradead.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Thu, Aug 20, 2020 at 3:40 AM Mark Brown wrote: > > On Wed, Aug 19, 2020 at 11:42:27PM +0800, Tzung-Bi Shih wrote: > > > But I found struct mfd_cell also contains member .of_compatible. What > > is the difference if we use compatible string (as is) for this device > > instead of falling back to use device name to match? > > That's for binding the MFD subdevice to an OF node, you don't need to do > that for a device like this - you can just use the of_node of the parent > to get at the properties. There is an issue we overlooked. In sound/soc/codecs/mt6359.c, mt6359_parse_dt() cannot read the DT properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/mt6359.c?h=for-next#n2640). The original DTS is as following: pmic { compatible = "mediatek,mt6359"; mt6359codec: mt6359codec { compatible = "mediatek,mt6359-sound"; (1) mediatek,dmic-mode = <1>; mediatek,mic-type-0 = <2>; } } After removing the line at (1), mt6359_parse_dt() cannot read the DT properties. The PMIC drivers/mfd/mt6397-core.c: - "mediatek,mt6359" - has the struct mfd_cell of mt6359-sound - adds all mfd_cells via devm_mfd_add_devices(). The audio codec sound/soc/codecs/mt6359.c: - "mediatek,mt6359-sound" Here are a few options we can come out with. 1. adds back the compatible string in the DTS 2. gets of_node of parent in mt6359.c, and iterates all children nodes to get the desired properties 3. parses all children nodes in the PMIC driver, and put them into either platform_data or device properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/include/linux/mfd/core.h?h=for-next#n77) - The PMIC is common for several sub-devices. It makes less sense to handle subdevice specific logic in the common code. 4. others Could you share with us what would you suggest for fixing the issue? 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7032FC43461 for ; Mon, 7 Sep 2020 13:37:40 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D45C5215A4 for ; Mon, 7 Sep 2020 13:37:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VA9Jb0qH"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="hEXKQqhJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D45C5215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=YviOzMKnn3tJNqQU4s+mWcMh/93ra4H1oD7EaZ+TeyY=; b=VA9Jb0qHJRCuljOudP2+M2ioq k8ewHJuYX8U/eaPvYZiotoh/oPRJ6373zvrgRQNDldQroOfe6pe4oZU7HEzr2LR9cbgnnn+9EveBJ BsiMMqBhp9FZrtzJ2aWxb3MTOPytyN/sfrRECcWQfOWPWfWCujcOvZj6zN9N3WzVpm9pfAUYKgWAc thw44r78PCC8Sp+RtsZEUOZ1M5ltgZcHRaqTm/n4DGsylvqmLRKyfVWAglZpEyKPuMuH8yo7+V4qd /Eetu8hDlfWKKtF83v6QbbeWQOnJecNlD+WN11cgTqGccQF5FuB8GW8kaValub2+Ya5XFtTOVkv4G A3i0FxbVg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFHKs-0003DE-Ut; Mon, 07 Sep 2020 13:37:30 +0000 Received: from mail-il1-x143.google.com ([2607:f8b0:4864:20::143]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFHKp-0003C2-Pl for linux-mediatek@lists.infradead.org; Mon, 07 Sep 2020 13:37:28 +0000 Received: by mail-il1-x143.google.com with SMTP id p13so12533468ils.3 for ; Mon, 07 Sep 2020 06:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=hEXKQqhJ9NmSx4YCpKMr1NwW45bcnwzOkhMBL8DjeyYLJm78qmx6PfgWclUzVWmb2h fxaV6Sz2P9KxPrZSNITJVINtrvSAgSVSURAAgX1ASuRkdCqb7E91FrXanXeSPkc3ujAX +FFNNl0haD5QGCZw+GF/SsD6+N2HO6LCjCJF+VFuY1mxeUJW36pdkCIztgxwx60mVlQc yje66pdfUrcr4zkkHKkQoPkqLGdiP14j1niS7UWlfzNhCz3KJsftBXf8hOEiYD7uSXY9 mrAxej+Mmxa5Rq3IupJGnTLeDACHso2O2gLPL+GCXy5RjeQSrH+CAHW5xCBbD046Gi6G Fe4Q== 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=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=BUWYgpE7kH7sGiEHQTE2KouDo2iR12PSofqqMbS1D01zJOfioNE0APORZ1CuX1TIyq Oo/8mJpUCVj2W33yTkN1/wzv0edqGwN8V5egvmj8xGhtjYWIFu4xnaPYQ44TIjApclh/ 2MfEItP07kpC7apdPfdPpxSf2jNoLV/tws8xF0+ORI7VXjqeN6syKQPmltAQs0iayABW KqOjos+aKfOgDYqiQ666BtwFJuDyBi+FH6UaIqoQORCxDXwmimJtLgUjkT3wzVWliGtY 1c4t5jPZ1C5jEk+yl4znIUT8rPWsB8Qv9bU9K36C+FZiP2X5NnNYq2uzt43s4bxhYHOk rCWw== X-Gm-Message-State: AOAM5319UB/FxIPQb+FtmuPOzcV6Gh4EjGkCoqk9EXn23Sq2itzvPkTN 1FgqAF1wQCMIXnfq8jOeOwvKopo5ilWfJIOf4vLzHg== X-Google-Smtp-Source: ABdhPJyBenIIH2d8wv7qBpX9DpeJamhA8s78sQ62WqhL82+W2hjTg5gPuJzXToQlghF4RNr5s/7pUi3tIrgzsCAuZGI= X-Received: by 2002:a05:6e02:c26:: with SMTP id q6mr19152124ilg.235.1599485843333; Mon, 07 Sep 2020 06:37:23 -0700 (PDT) MIME-Version: 1.0 References: <1597644455-8216-1-git-send-email-jiaxin.yu@mediatek.com> <1597644455-8216-3-git-send-email-jiaxin.yu@mediatek.com> <20200819103730.GB5441@sirena.org.uk> <20200819194005.GC38371@sirena.org.uk> In-Reply-To: <20200819194005.GC38371@sirena.org.uk> From: Tzung-Bi Shih Date: Mon, 7 Sep 2020 21:37:12 +0800 Message-ID: Subject: Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document To: Mark Brown X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_093727_847317_00E9C030 X-CRM114-Status: GOOD ( 15.32 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ALSA development , howie.huang@mediatek.com, Takashi Iwai , Jiaxin Yu , Linux Kernel Mailing List , shane.chien@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, eason.yen@mediatek.com, Matthias Brugger , bicycle.tsai@mediatek.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Thu, Aug 20, 2020 at 3:40 AM Mark Brown wrote: > > On Wed, Aug 19, 2020 at 11:42:27PM +0800, Tzung-Bi Shih wrote: > > > But I found struct mfd_cell also contains member .of_compatible. What > > is the difference if we use compatible string (as is) for this device > > instead of falling back to use device name to match? > > That's for binding the MFD subdevice to an OF node, you don't need to do > that for a device like this - you can just use the of_node of the parent > to get at the properties. There is an issue we overlooked. In sound/soc/codecs/mt6359.c, mt6359_parse_dt() cannot read the DT properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/mt6359.c?h=for-next#n2640). The original DTS is as following: pmic { compatible = "mediatek,mt6359"; mt6359codec: mt6359codec { compatible = "mediatek,mt6359-sound"; (1) mediatek,dmic-mode = <1>; mediatek,mic-type-0 = <2>; } } After removing the line at (1), mt6359_parse_dt() cannot read the DT properties. The PMIC drivers/mfd/mt6397-core.c: - "mediatek,mt6359" - has the struct mfd_cell of mt6359-sound - adds all mfd_cells via devm_mfd_add_devices(). The audio codec sound/soc/codecs/mt6359.c: - "mediatek,mt6359-sound" Here are a few options we can come out with. 1. adds back the compatible string in the DTS 2. gets of_node of parent in mt6359.c, and iterates all children nodes to get the desired properties 3. parses all children nodes in the PMIC driver, and put them into either platform_data or device properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/include/linux/mfd/core.h?h=for-next#n77) - The PMIC is common for several sub-devices. It makes less sense to handle subdevice specific logic in the common code. 4. others Could you share with us what would you suggest for fixing the issue? _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2A41C43461 for ; Mon, 7 Sep 2020 13:38:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 91A58215A4 for ; Mon, 7 Sep 2020 13:38:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="l0Ufy+0Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="hEXKQqhJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91A58215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cZ0hPNoOvv6X2elKBayckaHwNNHg/UkpZ7xZg53skLE=; b=l0Ufy+0QIDZJHPlkXWIkXNm8z ez1Xg/jCxUfkUGfrW8Gi683UWK2v+BT+NCYwxo7Th8yMgC1mXFRAJL0RwfxW53im2AdUhjO5woFMc Dexvw7mGDRnEoValwNiNMteDr3YBuNTCBzoX9OmCFrq4iA8ckOyTU05VI50DP+ilhheFjSpJIlges /bkDrv/2U7PnFxy54zY8CXNPUxbQSJU2AuddofiG9SRj6HXhLoAOZxdyv0v5VZi4lLN0hm1slXd3q WaCqlkZ+WCkpm35RjN6PnYHncSnx8EztNzemfVrzaUM9D4jWTauMecqaw8OaHaL8gKxPCtb31hPF4 vteBaVlEg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFHKr-0003Ct-K4; Mon, 07 Sep 2020 13:37:29 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFHKp-0003C3-O9 for linux-arm-kernel@lists.infradead.org; Mon, 07 Sep 2020 13:37:28 +0000 Received: by mail-il1-x141.google.com with SMTP id m1so12498866ilj.10 for ; Mon, 07 Sep 2020 06:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=hEXKQqhJ9NmSx4YCpKMr1NwW45bcnwzOkhMBL8DjeyYLJm78qmx6PfgWclUzVWmb2h fxaV6Sz2P9KxPrZSNITJVINtrvSAgSVSURAAgX1ASuRkdCqb7E91FrXanXeSPkc3ujAX +FFNNl0haD5QGCZw+GF/SsD6+N2HO6LCjCJF+VFuY1mxeUJW36pdkCIztgxwx60mVlQc yje66pdfUrcr4zkkHKkQoPkqLGdiP14j1niS7UWlfzNhCz3KJsftBXf8hOEiYD7uSXY9 mrAxej+Mmxa5Rq3IupJGnTLeDACHso2O2gLPL+GCXy5RjeQSrH+CAHW5xCBbD046Gi6G Fe4Q== 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=PZpEmEr02MkgLosT7vPqFBX5vy+59cEEz8jZk2wlsPE=; b=S0ox1WtYH4I8yjZGFsglcf9oE6klblCFpc63tprrmYaGinYtewhyWd+pfmOdOEuCtA fi+f5kLmU9M6Qfa2y+1zn3FRQmX9c5/hagZEy06MmliO+AZ3NrJXCwAfK+YXh54HEfjV z2VS4mCi801EnpRsBju30HMlJHnEjBLkKqafQ/Bx4YMP8odK34J3rxzyb18joKzTbHMx u5h4OLVaFehBKotYGLXfTsYJM3mg6nyHXpVvY1Ol1q92KRvfKpPoV+bICWgWFIHzdvOJ jfaATeBNj31DlWy1HqTYWOLem8y3fS/ccvf5n3XcA8DgaqwiEBXx3ealDuYAqZagcRBl nYvQ== X-Gm-Message-State: AOAM533oVc01PBDxoezHQlkC0u7lL/jgJdwHFcYkrh9g4sV83lOP6vh8 O+NxPCe/arBnZxzlI8iRVwA4WBdgC1Aw3Gtp1YI7+ELPYbZvUw== X-Google-Smtp-Source: ABdhPJyBenIIH2d8wv7qBpX9DpeJamhA8s78sQ62WqhL82+W2hjTg5gPuJzXToQlghF4RNr5s/7pUi3tIrgzsCAuZGI= X-Received: by 2002:a05:6e02:c26:: with SMTP id q6mr19152124ilg.235.1599485843333; Mon, 07 Sep 2020 06:37:23 -0700 (PDT) MIME-Version: 1.0 References: <1597644455-8216-1-git-send-email-jiaxin.yu@mediatek.com> <1597644455-8216-3-git-send-email-jiaxin.yu@mediatek.com> <20200819103730.GB5441@sirena.org.uk> <20200819194005.GC38371@sirena.org.uk> In-Reply-To: <20200819194005.GC38371@sirena.org.uk> From: Tzung-Bi Shih Date: Mon, 7 Sep 2020 21:37:12 +0800 Message-ID: Subject: Re: [PATCH v5 2/2] dt-bindings: mediatek: mt6359: add codec document To: Mark Brown X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200907_093727_815641_1FE7295C X-CRM114-Status: GOOD ( 16.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ALSA development , howie.huang@mediatek.com, Takashi Iwai , Jiaxin Yu , Linux Kernel Mailing List , shane.chien@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, eason.yen@mediatek.com, Matthias Brugger , bicycle.tsai@mediatek.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Aug 20, 2020 at 3:40 AM Mark Brown wrote: > > On Wed, Aug 19, 2020 at 11:42:27PM +0800, Tzung-Bi Shih wrote: > > > But I found struct mfd_cell also contains member .of_compatible. What > > is the difference if we use compatible string (as is) for this device > > instead of falling back to use device name to match? > > That's for binding the MFD subdevice to an OF node, you don't need to do > that for a device like this - you can just use the of_node of the parent > to get at the properties. There is an issue we overlooked. In sound/soc/codecs/mt6359.c, mt6359_parse_dt() cannot read the DT properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/sound/soc/codecs/mt6359.c?h=for-next#n2640). The original DTS is as following: pmic { compatible = "mediatek,mt6359"; mt6359codec: mt6359codec { compatible = "mediatek,mt6359-sound"; (1) mediatek,dmic-mode = <1>; mediatek,mic-type-0 = <2>; } } After removing the line at (1), mt6359_parse_dt() cannot read the DT properties. The PMIC drivers/mfd/mt6397-core.c: - "mediatek,mt6359" - has the struct mfd_cell of mt6359-sound - adds all mfd_cells via devm_mfd_add_devices(). The audio codec sound/soc/codecs/mt6359.c: - "mediatek,mt6359-sound" Here are a few options we can come out with. 1. adds back the compatible string in the DTS 2. gets of_node of parent in mt6359.c, and iterates all children nodes to get the desired properties 3. parses all children nodes in the PMIC driver, and put them into either platform_data or device properties (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/tree/include/linux/mfd/core.h?h=for-next#n77) - The PMIC is common for several sub-devices. It makes less sense to handle subdevice specific logic in the common code. 4. others Could you share with us what would you suggest for fixing the issue? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel