From patchwork Fri Jan 8 16:04:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359092 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 7D554C433DB for ; Fri, 8 Jan 2021 16:06:20 +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 B2D8A239D1 for ; Fri, 8 Jan 2021 16:06:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2D8A239D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 1C7AD1681; Fri, 8 Jan 2021 17:05:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1C7AD1681 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610121976; bh=90C92itGJsCZYg4oFujOz3ck3shZhmhRGKxzuV+bW/Y=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Tf54WY7oL8a715qZ//bdVeIqkLS8kDanp7ETIZU4LvaDnuKsl9LHURp/h4k95dmKz Rz9JUtph1jhoDsh/v/rO/qR5KVY7LnGdDAjZN01ZhsrRTjBfd42MkmSLr0qZcHsnYC pEwWDRwQ9vf+7ekS5wGHaJNWVnnxUlNNTx6AO0aA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DBA87F8025E; Fri, 8 Jan 2021 17:05:24 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2B9D2F8027D; Fri, 8 Jan 2021 17:05:20 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BA5AFF800EE for ; Fri, 8 Jan 2021 17:05:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BA5AFF800EE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="pjeryqd8" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2EoX011561; Fri, 8 Jan 2021 10:05:08 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=2j2pa6/Jqo6QYZqsSeLPknoRF/7N3vv/yIiaZr+oTAo=; b=pjeryqd8SbN62ve1AflY1HOFGYsSF12MSr/J0ayKxf8VxDDs0WzXsuwGL63k5P4mLg9d SRYppa6wyfsynAPIVqyGqEf1A6PE/4j/kbqY1EFbHBF/O6pQRLZ7AyBPAFa3VpSO48Pb 9hDk5PfaDMiCZTm95CJqlPj42QsapkYbqwQ5bQooHzxqtxX349NKk03PfgmDlm2lcQuc YuBECeZnrdT/5OHUjwQf0OvxqXRlLrwgPlDrBfOPQGSWkcnF8642gaPcyutHCx0rKe2b 7UqxzyOYlSDmHBBtYkL8zwDshabVuM4jCo2TCnFM6KBM645O3oD93jk0gJHbi4GJdYZ8 ag== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35wqjka90t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:08 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:06 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:06 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 62C1E11CB; Fri, 8 Jan 2021 16:05:06 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 1/6] of: base: Add of_count_phandle_with_fixed_args() Date: Fri, 8 Jan 2021 16:04:56 +0000 Message-ID: <20210108160501.7638-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Rob Herring , patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" Add an equivalent of of_count_phandle_with_args() for fixed argument sets, to pair with of_parse_phandle_with_fixed_args(). The existing of_count_phandle_with_args() is modified to be a private function that handles both cases and the public functions are trivial wrappers round that. Signed-off-by: Richard Fitzgerald Reviewed-by: Rob Herring --- drivers/of/base.c | 73 +++++++++++++++++++++++++++++++--------------- include/linux/of.h | 9 ++++++ 2 files changed, 59 insertions(+), 23 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 161a23631472..c5ff2524bf40 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1720,34 +1720,22 @@ int of_parse_phandle_with_fixed_args(const struct device_node *np, } EXPORT_SYMBOL(of_parse_phandle_with_fixed_args); -/** - * of_count_phandle_with_args() - Find the number of phandles references in a property - * @np: pointer to a device tree node containing a list - * @list_name: property name that contains a list - * @cells_name: property name that specifies phandles' arguments count - * - * Returns the number of phandle + argument tuples within a property. It - * is a typical pattern to encode a list of phandle and variable - * arguments into a single property. The number of arguments is encoded - * by a property in the phandle-target node. For example, a gpios - * property would contain a list of GPIO specifies consisting of a - * phandle and 1 or more arguments. The number of arguments are - * determined by the #gpio-cells property in the node pointed to by the - * phandle. - */ -int of_count_phandle_with_args(const struct device_node *np, const char *list_name, - const char *cells_name) +static int __of_count_phandle_with_args(const struct device_node *np, + const char *list_name, + const char *cells_name, + int cells_count) { struct of_phandle_iterator it; int rc, cur_index = 0; /* - * If cells_name is NULL we assume a cell count of 0. This makes - * counting the phandles trivial as each 32bit word in the list is a - * phandle and no arguments are to consider. So we don't iterate through - * the list but just use the length to determine the phandle count. + * If cells_count < 0 and cells_name is NULL we assume a cell count + * of 0. A zero cell count makes counting the phandles trivial as each + * 32bit word in the list is a phandle and no arguments are to consider. + * So we don't iterate through the list but just use the length to + * determine the phandle count. */ - if (!cells_name) { + if ((cells_count < 0 && !cells_name) || cells_count == 0) { const __be32 *list; int size; @@ -1758,7 +1746,7 @@ int of_count_phandle_with_args(const struct device_node *np, const char *list_na return size / sizeof(*list); } - rc = of_phandle_iterator_init(&it, np, list_name, cells_name, -1); + rc = of_phandle_iterator_init(&it, np, list_name, cells_name, cells_count); if (rc) return rc; @@ -1770,8 +1758,47 @@ int of_count_phandle_with_args(const struct device_node *np, const char *list_na return cur_index; } + +/** + * of_count_phandle_with_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list + * @cells_name: property name that specifies phandles' arguments count + * + * Returns the number of phandle + argument tuples within a property. It + * is a typical pattern to encode a list of phandle and variable + * arguments into a single property. The number of arguments is encoded + * by a property in the phandle-target node. For example, a gpios + * property would contain a list of GPIO specifies consisting of a + * phandle and 1 or more arguments. The number of arguments are + * determined by the #gpio-cells property in the node pointed to by the + * phandle. + */ +int of_count_phandle_with_args(const struct device_node *np, const char *list_name, + const char *cells_name) +{ + return __of_count_phandle_with_args(np, list_name, cells_name, -1); +} EXPORT_SYMBOL(of_count_phandle_with_args); +/** + * of_count_phandle_with_fixed_args() - Find the number of phandles references in a property + * @np: pointer to a device tree node containing a list + * @list_name: property name that contains a list + * @cell_count: number of argument cells following the phandle + * + * Returns the number of phandle + argument tuples within a property. It + * is a typical pattern to encode a list of phandle and variable + * arguments into a single property. + */ +int of_count_phandle_with_fixed_args(const struct device_node *np, + const char *list_name, + int cells_count) +{ + return __of_count_phandle_with_args(np, list_name, NULL, cells_count); +} +EXPORT_SYMBOL(of_count_phandle_with_fixed_args); + /** * __of_add_property - Add a property to a node without lock operations */ diff --git a/include/linux/of.h b/include/linux/of.h index 4b27c9a27df3..4f09d644a803 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -377,6 +377,8 @@ extern int of_parse_phandle_with_fixed_args(const struct device_node *np, struct of_phandle_args *out_args); extern int of_count_phandle_with_args(const struct device_node *np, const char *list_name, const char *cells_name); +extern int of_count_phandle_with_fixed_args(const struct device_node *np, + const char *list_name, int cells_count); /* phandle iterator functions */ extern int of_phandle_iterator_init(struct of_phandle_iterator *it, @@ -888,6 +890,13 @@ static inline int of_count_phandle_with_args(struct device_node *np, return -ENOSYS; } +static inline int of_count_phandle_with_fixed_args(const struct device_node *np, + const char *list_name, + int cells_count) +{ + return -ENOSYS; +} + static inline int of_phandle_iterator_init(struct of_phandle_iterator *it, const struct device_node *np, const char *list_name, From patchwork Fri Jan 8 16:04:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359089 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 A9651C433E0 for ; Fri, 8 Jan 2021 16:09:05 +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 C4F2E2399C for ; Fri, 8 Jan 2021 16:09:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4F2E2399C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 5C5EB1727; Fri, 8 Jan 2021 17:08:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5C5EB1727 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610122143; bh=wadWVVJV3pMHrb2U76avAlvxL6DUqq12r5eur0k9OwA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=H9fcw9UvCua8zB9qvUk1+2of6JsgDUYE17WKNUfmJvAHDrVdIJ83tik1xsv+QS5oV btTExuqnWlAHESirK53ByjkAWmTmPNgs6F8m4lfmoWZBfdgSMYIGxWFZL6+PB9oAKT k6YB8yVX7J5yZ7FDRsujhmi6PaviWxHCuTP0Y130= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E6E5F804FE; Fri, 8 Jan 2021 17:05:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E1C35F80165; Fri, 8 Jan 2021 17:05:27 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BD913F80165 for ; Fri, 8 Jan 2021 17:05:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BD913F80165 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="oJ5K4MIT" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2EoY011561; Fri, 8 Jan 2021 10:05:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=kOekwXaZfSzN5B1r/aiMtLh+hLUch+Y8pXk00v7FV8I=; b=oJ5K4MITbPRuVJtx9dPXSS661PHDCyQCrnd23VoiyFcfqPtvWjFD6vXGOghK5aFkh4t0 4ySW1Rnyj8zU1lr1yMNIwBlrGILAOTLyhdlFTGxsfqvonQdMHVCED3H0q1i3/vk9Ff3c PQOqVqy+w7CSViB2V7LYFB30/h6LnEp0OSZ406zbFopfYNkISh0OqhKayejVfRvCrCEG +pMgabUx+uMEcxFnUpA61NMytQk8vfqXsrr/qBrAP9J1sY5l4vrgB9GhEjlWHGyd5aOF GjNjmVAo9SHH3FlXgweDUXQlOrVh1jGycqq32xCr6f/D2iJI8rZ2ihb0F7pckeIAQufz GQ== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35wqjka90t-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:09 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:07 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:07 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 0395C11CE; Fri, 8 Jan 2021 16:05:06 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 2/6] dt-bindings: audio-graph-card: Add plls and sysclks properties Date: Fri, 8 Jan 2021 16:04:57 +0000 Message-ID: <20210108160501.7638-3-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" The audio-graph-card driver has properties for configuring the clocking for DAIs within a component, but is missing properties for setting up the PLLs and sysclks of the component. This patch adds the two new properties 'plls' and 'sysclks' so that the audio-graph-driver can fully configure the component clocking. Signed-off-by: Richard Fitzgerald --- .../bindings/sound/audio-graph.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph.yaml b/Documentation/devicetree/bindings/sound/audio-graph.yaml index 4b46794e5153..9e0819205a17 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph.yaml @@ -39,6 +39,52 @@ properties: mic-det-gpio: maxItems: 1 + plls: + description: | + A list of component pll settings. There are 4 cells per PLL setting: + - phandle to the node of the codec or cpu component, + - component PLL id, + - component clock source id, + - frequency (in Hz) of the PLL output clock. + The PLL id and clock source id are specific to the particular component + so see the relevant component driver for the ids. Typically the + clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several plls + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + plls-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the plls property. + + sysclks: + description: | + A list of component sysclk settings. There are 4 cells per sysclk + setting: + - phandle to the node of the codec or cpu component, + - component sysclk id, + - component clock source id, + - direction of the clock: 0 if the clock is an input to the component, + 1 if it is an output. + The sysclk id and clock source id are specific to the particular + component so see the relevant component driver for the ids. Typically + the clock source id indicates the pin the source clock is connected to. + The same phandle can appear in multiple entries so that several sysclks + can be set in the same component. + $ref: /schemas/types.yaml#/definitions/phandle-array + + sysclks-clocks: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: | + A list of clock names giving the source clock for each setting + in the sysclks property. + +dependencies: + plls: [ plls-clocks ] + sysclks: [ sysclks-clocks ] + required: - dais From patchwork Fri Jan 8 16:04:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359090 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 16482C433E0 for ; Fri, 8 Jan 2021 16:08:07 +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 8849A2399C for ; Fri, 8 Jan 2021 16:08:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8849A2399C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 16A7916F0; Fri, 8 Jan 2021 17:07:15 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 16A7916F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610122085; bh=RsTVQkPsUTtKbxovbX/QG2SzjG52ADZkuJTt1Tdx+s0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DiAkKrcw8ZArkDoPjltNq/ek+09lh8Wr7Sco+hoKlk2JK8l7DBjpv18ccpMxpLwvV 9C2/0MnARDmYX9fxU4rLiGG16yVP9uLt2anr42Cz99pie4RCBOv91/H1mMOlz48JqH sBj+nksE7IaQmXFH7J1fQCx44tzb9PR82pG+yaH4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 758F8F804E5; Fri, 8 Jan 2021 17:05:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B2EB0F804C3; Fri, 8 Jan 2021 17:05:28 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 00715F8026F for ; Fri, 8 Jan 2021 17:05:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 00715F8026F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="ddM3LJcG" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2BWC031086; Fri, 8 Jan 2021 10:05:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=42pnSG0XijlsJoZl7LbbUTvg0aucn8KKA91v67tpRUo=; b=ddM3LJcGufoDxg+5NzzGAMQvJCFYV3PggDT9no/GlAZ5MkE0inNeJEFBQUptSIzFVfJ+ OTWqJ987fZB8cxcBBeOKbSu1sOc5mbvZYw35mBtMmlmm/IAA78nVMXE/jntXmMByHX0g fLYa5StbK1HC9G2mFjORy4q2llt1kHk3dZGyBMGRRy0oj89kVeCYZElJlL8dbLENy+Hq Zmrqr+0ZxVlI8yJ23lhAqyhZwMgnjFtoZEWx5hCD5lWfwxHMGnrCffpPVbHxznw/aDXB Zi8OPjlZ8Uc/4MXwI+E9lLYP1hy2LKROln7lP6Kp8e04YC3PMZd18pWd8L/QCesW3avb og== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 35wqjm2gnm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:10 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:08 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:08 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 8B64211CB; Fri, 8 Jan 2021 16:05:07 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 3/6] ASoC: audio-graph-card: Support setting component plls and sysclks Date: Fri, 8 Jan 2021 16:04:58 +0000 Message-ID: <20210108160501.7638-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 clxscore=1011 malwarescore=0 priorityscore=1501 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" Some codecs need plls and/or sysclks to be configured using the snd_soc_component_set_[sysclk|pll] functions. These drivers cannot necessarily be converted to use the clock framework. If the codec is on a I2C/SPI bus, a nested clk_get would be needed to enable the bus clock. But the clock framework does not support nested operations and this would deadlock. This patch adds new dt properties that list phandles of components with the pll/sysclk settings to be applied. Multiple settings can be given for the same phandle to allow for components with multiple clocks and plls. The plls and sysclks are enabled when the card bias level moves to STANDBY and disabled when it moves to OFF. The implementation does not attempt to handle specifying complex clock ordering interdependencies between components. The plls and sysclks are applied to a component as it is passed to the card set_bias_level/ set_bias_level_post callbacks. It follows from this that the order components are configured is the order that they are passed to those callbacks. Signed-off-by: Richard Fitzgerald --- include/sound/simple_card_utils.h | 25 +++ sound/soc/generic/audio-graph-card.c | 13 ++ sound/soc/generic/simple-card-utils.c | 238 ++++++++++++++++++++++++++ 3 files changed, 276 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index ba4a3e1897b9..1f755250f9c7 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -38,6 +38,16 @@ struct asoc_simple_jack { struct snd_soc_jack_gpio gpio; }; +struct asoc_simple_sysclk_pll { + struct device_node *node; + struct clk *clk; + int id; + int source; + unsigned int freq_out; + int dir; + bool enabled; +}; + struct asoc_simple_priv { struct snd_soc_card snd_card; struct simple_dai_props { @@ -59,6 +69,11 @@ struct asoc_simple_priv { const struct snd_soc_ops *ops; unsigned int dpcm_selectable:1; unsigned int force_dpcm:1; + + struct asoc_simple_sysclk_pll *sysclks; + int num_sysclks; + struct asoc_simple_sysclk_pll *plls; + int num_plls; }; #define simple_priv_to_card(priv) (&(priv)->snd_card) #define simple_priv_to_props(priv, i) ((priv)->dai_props + (i)) @@ -97,6 +112,14 @@ void asoc_simple_shutdown(struct snd_pcm_substream *substream); int asoc_simple_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd); + +int asoc_simple_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level); +int asoc_simple_set_bias_level_post(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level); + int asoc_simple_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params); @@ -131,6 +154,8 @@ int asoc_simple_parse_widgets(struct snd_soc_card *card, char *prefix); int asoc_simple_parse_pin_switches(struct snd_soc_card *card, char *prefix); +int asoc_simple_parse_sysclks(struct asoc_simple_priv *priv, char *prefix); +int asoc_simple_parse_plls(struct asoc_simple_priv *priv, char *prefix); int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack, diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 16a04a678828..9aa15d5ecbd0 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -592,6 +592,19 @@ int graph_parse_of(struct asoc_simple_priv *priv, struct device *dev) snd_soc_card_set_drvdata(card, priv); + ret = asoc_simple_parse_sysclks(priv, NULL); + if (ret < 0) + goto err; + + ret = asoc_simple_parse_plls(priv, NULL); + if (ret < 0) + goto err; + + if (priv->num_sysclks || priv->num_plls) { + card->set_bias_level = asoc_simple_set_bias_level; + card->set_bias_level_post = asoc_simple_set_bias_level_post; + } + asoc_simple_debug_info(priv); ret = devm_snd_soc_register_card(dev, card); diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 6cada4c1e283..a9b1849e328b 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -399,6 +399,162 @@ int asoc_simple_dai_init(struct snd_soc_pcm_runtime *rtd) } EXPORT_SYMBOL_GPL(asoc_simple_dai_init); +static bool asoc_simple_node_is_component(struct snd_soc_component *component, + struct device_node *node) +{ + struct device_node *comp_node; + + comp_node = component->dev->of_node; + if (!comp_node && component->dev->parent) + comp_node = component->dev->parent->of_node; + + return (comp_node == node); +} + +int asoc_simple_set_bias_level(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card); + struct snd_soc_component *component = dapm->component; + int i, ret; + + if (!component) + return 0; + + switch (level) { + case SND_SOC_BIAS_STANDBY: + if (dapm->bias_level != SND_SOC_BIAS_OFF) + break; + + /* + * A component's PLLs normally supply its SYSCLKs so enable + * the PLLs first. + */ + for (i = 0; i < priv->num_plls; ++i) { + if (!asoc_simple_node_is_component(component, priv->plls[i].node)) + continue; + + ret = clk_prepare_enable(priv->plls[i].clk); + if (ret) { + dev_err(card->dev, + "(%s) failed to enable pll %d parent clock: %d\n", + component->name, priv->plls[i].id, ret); + return ret; + } + + ret = snd_soc_component_set_pll(component, + priv->plls[i].id, + priv->plls[i].source, + clk_get_rate(priv->plls[i].clk), + priv->plls[i].freq_out); + if (ret) { + dev_err(card->dev, "(%s) failed to set pll %d: %d\n", + component->name, priv->plls[i].id, ret); + + clk_disable_unprepare(priv->plls[i].clk); + return ret; + } + + priv->plls[i].enabled = true; + } + + for (i = 0; i < priv->num_sysclks; ++i) { + if (!asoc_simple_node_is_component(component, priv->sysclks[i].node)) + continue; + + ret = clk_prepare_enable(priv->sysclks[i].clk); + if (ret) { + dev_err(card->dev, + "(%s) failed to enable sysclk %d parent clock: %d\n", + component->name, priv->sysclks[i].id, ret); + return ret; + } + + ret = snd_soc_component_set_sysclk(component, + priv->sysclks[i].id, + priv->sysclks[i].source, + clk_get_rate(priv->sysclks[i].clk), + priv->sysclks[i].dir); + if (ret) { + dev_err(card->dev, "(%s) failed to set sysclk %d: %d\n", + component->name, priv->sysclks[i].id, ret); + + clk_disable_unprepare(priv->sysclks[i].clk); + return ret; + } + + priv->sysclks[i].enabled = true; + } + break; + default: + break; + } + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_set_bias_level); + +int asoc_simple_set_bias_level_post(struct snd_soc_card *card, + struct snd_soc_dapm_context *dapm, + enum snd_soc_bias_level level) +{ + struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card); + struct snd_soc_component *component = dapm->component; + int i, ret; + + if (!component) + goto out; + + switch (level) { + case SND_SOC_BIAS_OFF: + for (i = 0; i < priv->num_sysclks; ++i) { + if (!asoc_simple_node_is_component(component, priv->sysclks[i].node)) + continue; + + if (!priv->sysclks[i].enabled) + continue; + + ret = snd_soc_component_set_sysclk(component, + priv->sysclks[i].id, + 0, + 0, + priv->sysclks[i].dir); + if (ret) + dev_warn(card->dev, "(%s) failed to disable sysclk %d: %d\n", + component->name, priv->sysclks[i].id, ret); + + clk_disable_unprepare(priv->sysclks[i].clk); + priv->sysclks[i].enabled = false; + } + + for (i = 0; i < priv->num_plls; ++i) { + if (!asoc_simple_node_is_component(component, priv->plls[i].node)) + continue; + + if (!priv->plls[i].enabled) + continue; + + ret = snd_soc_component_set_pll(component, priv->plls[i].id, 0, 0, 0); + if (ret) + dev_warn(card->dev, "(%s) failed to disable pll %d: %d\n", + component->name, priv->plls[i].id, ret); + + clk_disable_unprepare(priv->plls[i].clk); + priv->plls[i].enabled = false; + } + break; + default: + break; + } + +out: + dapm->bias_level = level; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_set_bias_level_post); + void asoc_simple_canonicalize_platform(struct snd_soc_dai_link *dai_link) { /* Assumes platform == cpu */ @@ -433,6 +589,7 @@ EXPORT_SYMBOL_GPL(asoc_simple_canonicalize_cpu); int asoc_simple_clean_reference(struct snd_soc_card *card) { + struct asoc_simple_priv *priv = snd_soc_card_get_drvdata(card); struct snd_soc_dai_link *dai_link; int i; @@ -440,6 +597,15 @@ int asoc_simple_clean_reference(struct snd_soc_card *card) of_node_put(dai_link->cpus->of_node); of_node_put(dai_link->codecs->of_node); } + + if (priv) { + for (i = 0; i < priv->num_sysclks; ++i) + of_node_put(priv->sysclks[i].node); + + for (i = 0; i < priv->num_plls; ++i) + of_node_put(priv->plls[i].node); + } + return 0; } EXPORT_SYMBOL_GPL(asoc_simple_clean_reference); @@ -538,6 +704,78 @@ int asoc_simple_parse_pin_switches(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(asoc_simple_parse_pin_switches); +static int asoc_simple_parse_sysclks_plls(struct asoc_simple_priv *priv, + char *prefix, + char *prop_root_name, + struct asoc_simple_sysclk_pll **out, + int *out_count) +{ + struct device *dev = priv->snd_card.dev; + struct device_node *node = dev->of_node; + struct of_phandle_args args; + int n_elem, i, ret; + char prop[128]; + char clocks_prop[128]; + const char *src_clk_name; + struct clk *in_clk; + + if (!prefix) + prefix = ""; + + snprintf(prop, sizeof(prop), "%s%s", prefix, prop_root_name); + snprintf(clocks_prop, sizeof(clocks_prop), "%s-clocks", prop); + n_elem = of_count_phandle_with_fixed_args(node, prop, 3); + if (n_elem == -ENOENT || n_elem == 0) { + return 0; + } else if (n_elem < 0) { + dev_err(dev, "Failed to parse %s: %d\n", prop, n_elem); + return n_elem; + } + + *out = devm_kcalloc(dev, n_elem, sizeof(**out), GFP_KERNEL); + if (!*out) + return -ENOMEM; + *out_count = 0; + + for (i = 0; i < n_elem; ++i) { + ret = of_property_read_string_index(node, clocks_prop, i, &src_clk_name); + if (ret < 0) + return ret; + + in_clk = devm_clk_get(dev, src_clk_name); + if (IS_ERR(in_clk)) + return PTR_ERR(in_clk); + + ret = of_parse_phandle_with_fixed_args(node, prop, 3, i, &args); + if (ret < 0) + return ret; + + (*out)[i].node = args.np; + (*out)[i].clk = in_clk; + (*out)[i].id = args.args[0]; + (*out)[i].source = args.args[1]; + (*out)[i].dir = args.args[2]; /* for sysclks */ + (*out)[i].freq_out = args.args[2]; /* for plls */ + ++*out_count; + } + + return 0; +} + +int asoc_simple_parse_sysclks(struct asoc_simple_priv *priv, char *prefix) +{ + return asoc_simple_parse_sysclks_plls(priv, prefix, "sysclks", + &priv->sysclks, &priv->num_sysclks); +} +EXPORT_SYMBOL_GPL(asoc_simple_parse_sysclks); + +int asoc_simple_parse_plls(struct asoc_simple_priv *priv, char *prefix) +{ + return asoc_simple_parse_sysclks_plls(priv, prefix, "plls", + &priv->plls, &priv->num_plls); +} +EXPORT_SYMBOL_GPL(asoc_simple_parse_plls); + int asoc_simple_init_jack(struct snd_soc_card *card, struct asoc_simple_jack *sjack, int is_hp, char *prefix, From patchwork Fri Jan 8 16:04:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359758 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 EC0A2C433E0 for ; Fri, 8 Jan 2021 16:07:14 +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 C0592239A1 for ; Fri, 8 Jan 2021 16:07:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0592239A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 18C8716B2; Fri, 8 Jan 2021 17:06:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 18C8716B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610122032; bh=zke0cwuYWPy87yWbSu/IGJK4NZo9qlg+tKhtBHwPB5U=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DOMwbEpaaZwxJxQ93RblxzNW0p031CXTgoapP72yzimgmC1vUjfvQKRPC+yPqqj+g M4N45PUZVtmnGFFYdHS/laCFjDGkQSSVZ+BQ4mgiozAH2eo20N1mRO/rrAPUBngv7Z XKvRm8Qx0lOQSuLNFA3xnIHfiDnYkswiXJbBIqfY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4E07CF8016A; Fri, 8 Jan 2021 17:05:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 853F1F80166; Fri, 8 Jan 2021 17:05:20 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F0B4CF80166 for ; Fri, 8 Jan 2021 17:05:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F0B4CF80166 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="VpR7EusF" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2BWD031086; Fri, 8 Jan 2021 10:05:11 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=jmswdNoeuPYWCu6tey6zuSVbEdkvG2AmuQ5MyVpdB2c=; b=VpR7EusFX0phly5iHULIsqN9p97CEPVAs6UxmRFXEeo+5F0YWVrijVtBsO5/O8/eKaEL Ab95v9E3YAuDpDRu5QbtXJqFz+U2oMSMdZbVKQuDIUOFyKhPeDhJb8PVkMdU4cbMR2XE tWVq1pEOEJUdY5V+9ErETJDSR70BNQjVmwzkMQzd9oQ9ldZlmoFL85Z7M2eKUcoNL7c0 vlpNLI04sBpjTNFGiUcptWlO02Ql3lxGwqS4LYLDiYOggZ08Waz+IECmvwLmFm+mVOPD j6UKrXZ69Kfw7r2GSxwrXcrYGRw3scjuxGL8xUbyZkk9bV3aJwkFAPAvm1N8QqFHxe8V ew== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0a-001ae601.pphosted.com with ESMTP id 35wqjm2gnm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:10 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:08 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:08 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2510811CC; Fri, 8 Jan 2021 16:05:08 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 4/6] ASoC: madera: Allow codecs to be selected from kernel config Date: Fri, 8 Jan 2021 16:04:59 +0000 Message-ID: <20210108160501.7638-5-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=978 lowpriorityscore=0 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 impostorscore=0 bulkscore=0 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" The codec Kconfig options were hidden and intended to be selected by the machine driver that requires them. But that means having either a dedicated machine driver or building all codecs. This patch makes the Kconfig options visible so that they can be selected independently of the machine driver, allowing the codec to be used with simple-card and other machine drivers that are not hardcoded to use a fixed set of codecs. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 9bf6bfdaf11e..599dd8d2577f 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -678,23 +678,23 @@ config SND_SOC_CS4349 depends on I2C config SND_SOC_CS47L15 - tristate + tristate "Cirrus Logic CS47L15 CODEC" config SND_SOC_CS47L24 tristate depends on MFD_CS47L24 config SND_SOC_CS47L35 - tristate + tristate "Cirrus Logic CS47L35 CODEC" config SND_SOC_CS47L85 - tristate + tristate "Cirrus Logic CS47L85 CODEC" config SND_SOC_CS47L90 - tristate + tristate "Cirrus Logic CS47L90 CODEC" config SND_SOC_CS47L92 - tristate + tristate "Cirrus Logic CS47L92 CODEC" # Cirrus Logic Quad-Channel ADC config SND_SOC_CS53L30 From patchwork Fri Jan 8 16:05:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359756 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.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UPPERCASE_50_75, URIBL_BLOCKED, USER_AGENT_GIT 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 4CD39C433DB for ; Fri, 8 Jan 2021 16:08:45 +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 B94B0239A1 for ; Fri, 8 Jan 2021 16:08:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B94B0239A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 493521708; Fri, 8 Jan 2021 17:07:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 493521708 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610122123; bh=tvAX3/2+xWsdlbqynAkPKd/pHdKxIJ6d0DeH1249BVg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UA65wLGgYFCTqyAyq1+15MIk5IBPPq3OaTlPRIKK1XKRQCnn90hHys3Qx/yYMhnEz G+FdRCg0523DHbTbAjm9de8KJk65Z7940pae8pVzpYo+egk15kxwlWpeRly9ovicod vTMZAgNRVBEKxv4cSwUPe6yYsLev3FolT9bKrbnE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3DC84F80165; Fri, 8 Jan 2021 17:05:34 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4C4F0F804CC; Fri, 8 Jan 2021 17:05:29 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C0CFEF800E9 for ; Fri, 8 Jan 2021 17:05:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C0CFEF800E9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="eoS6vRyt" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2EoZ011561; Fri, 8 Jan 2021 10:05:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=627cyMSOyeSzZ7/Nq+d6A7Mp3C4WbFQei8V0n6bIm60=; b=eoS6vRythwrqRcbrJrEBUWfYn/UNWAMCivNJSRovifGKPFGkKMmw9zgL4OO1Pe2G1NiR TqID91IfmBNy1Tmfnrni+Rb5m2O7eVvEbRbRVHnDCUm5B8qNQbYj3gzThostEu33kWYD 7t2/MQDQwmvCN8Le75mL4AX8yWWDAyLkV9P4looci6+liLdNTmyC4ATBG8cs7Gw2I1fX r7v5CaPNF7mJS/Nh7nKsVXGjev6SKCxW4FGz/gvrbYd9fZBXo0zfIyIwZeODuQWo4cxQ WoHJg4nfmmfom4aOE9wBjor6OJi5oDILe+Sx7SQ3TJDbk98XNEusZV2zA38aSctXZyNd 3Q== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35wqjka90t-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:09 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:09 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:09 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id B206811CB; Fri, 8 Jan 2021 16:05:08 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 5/6] ASoC: madera: Export clock config defines to dt-bindings Date: Fri, 8 Jan 2021 16:05:00 +0000 Message-ID: <20210108160501.7638-6-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" Move the defines for clock/fll IDs and sources into the dt-bindings header so that they can be used by machine driver dts files. Signed-off-by: Richard Fitzgerald --- include/dt-bindings/sound/madera.h | 60 ++++++++++++++++++++++++++++++ sound/soc/codecs/madera.h | 56 +--------------------------- 2 files changed, 61 insertions(+), 55 deletions(-) diff --git a/include/dt-bindings/sound/madera.h b/include/dt-bindings/sound/madera.h index d0096d5eb0da..5c5fc1bfe6f9 100644 --- a/include/dt-bindings/sound/madera.h +++ b/include/dt-bindings/sound/madera.h @@ -22,4 +22,64 @@ #define CS47L35_DMIC_REF_MICBIAS2A 2 #define CS47L35_DMIC_REF_MICBIAS2B 3 +/* FLL IDs */ +#define MADERA_FLL1_REFCLK 1 +#define MADERA_FLL2_REFCLK 2 +#define MADERA_FLL3_REFCLK 3 +#define MADERA_FLLAO_REFCLK 4 +#define MADERA_FLL1_SYNCCLK 5 +#define MADERA_FLL2_SYNCCLK 6 +#define MADERA_FLL3_SYNCCLK 7 +#define MADERA_FLLAO_SYNCCLK 8 + +/* FLL input source pin IDs */ +#define MADERA_FLL_SRC_NONE -1 +#define MADERA_FLL_SRC_MCLK1 0 +#define MADERA_FLL_SRC_MCLK2 1 +#define MADERA_FLL_SRC_MCLK3 2 +#define MADERA_FLL_SRC_SLIMCLK 3 +#define MADERA_FLL_SRC_FLL1 4 +#define MADERA_FLL_SRC_FLL2 5 +#define MADERA_FLL_SRC_AIF1BCLK 8 +#define MADERA_FLL_SRC_AIF2BCLK 9 +#define MADERA_FLL_SRC_AIF3BCLK 10 +#define MADERA_FLL_SRC_AIF4BCLK 11 +#define MADERA_FLL_SRC_AIF1LRCLK 12 +#define MADERA_FLL_SRC_AIF2LRCLK 13 +#define MADERA_FLL_SRC_AIF3LRCLK 14 +#define MADERA_FLL_SRC_AIF4LRCLK 15 + +/* SYSCLK IDs */ +#define MADERA_CLK_SYSCLK_1 1 +#define MADERA_CLK_ASYNCCLK_1 2 +#define MADERA_CLK_OPCLK 3 +#define MADERA_CLK_ASYNC_OPCLK 4 +#define MADERA_CLK_SYSCLK_2 5 +#define MADERA_CLK_SYSCLK_3 6 +#define MADERA_CLK_ASYNCCLK_2 7 +#define MADERA_CLK_DSPCLK 8 +#define MADERA_CLK_OUTCLK 9 + +/* SYSCLK source IDs */ +#define MADERA_CLK_SRC_MCLK1 0x0 +#define MADERA_CLK_SRC_MCLK2 0x1 +#define MADERA_CLK_SRC_MCLK3 0x2 +#define MADERA_CLK_SRC_FLL1 0x4 +#define MADERA_CLK_SRC_FLL2 0x5 +#define MADERA_CLK_SRC_FLL3 0x6 +#define MADERA_CLK_SRC_FLLAO_HI 0x7 +#define MADERA_CLK_SRC_FLL1_DIV6 0x7 +#define MADERA_CLK_SRC_AIF1BCLK 0x8 +#define MADERA_CLK_SRC_AIF2BCLK 0x9 +#define MADERA_CLK_SRC_AIF3BCLK 0xA +#define MADERA_CLK_SRC_AIF4BCLK 0xB +#define MADERA_CLK_SRC_FLLAO 0xF + +/* OPCLK source IDs */ +#define MADERA_OUTCLK_SYSCLK 0 +#define MADERA_OUTCLK_ASYNCCLK 1 +#define MADERA_OUTCLK_MCLK1 4 +#define MADERA_OUTCLK_MCLK2 5 +#define MADERA_OUTCLK_MCLK3 6 + #endif diff --git a/sound/soc/codecs/madera.h b/sound/soc/codecs/madera.h index e0c0be59e2ef..1f4ea15648c5 100644 --- a/sound/soc/codecs/madera.h +++ b/sound/soc/codecs/madera.h @@ -9,67 +9,13 @@ #ifndef ASOC_MADERA_H #define ASOC_MADERA_H +#include #include #include #include #include "wm_adsp.h" -#define MADERA_FLL1_REFCLK 1 -#define MADERA_FLL2_REFCLK 2 -#define MADERA_FLL3_REFCLK 3 -#define MADERA_FLLAO_REFCLK 4 -#define MADERA_FLL1_SYNCCLK 5 -#define MADERA_FLL2_SYNCCLK 6 -#define MADERA_FLL3_SYNCCLK 7 -#define MADERA_FLLAO_SYNCCLK 8 - -#define MADERA_FLL_SRC_NONE -1 -#define MADERA_FLL_SRC_MCLK1 0 -#define MADERA_FLL_SRC_MCLK2 1 -#define MADERA_FLL_SRC_MCLK3 2 -#define MADERA_FLL_SRC_SLIMCLK 3 -#define MADERA_FLL_SRC_FLL1 4 -#define MADERA_FLL_SRC_FLL2 5 -#define MADERA_FLL_SRC_AIF1BCLK 8 -#define MADERA_FLL_SRC_AIF2BCLK 9 -#define MADERA_FLL_SRC_AIF3BCLK 10 -#define MADERA_FLL_SRC_AIF4BCLK 11 -#define MADERA_FLL_SRC_AIF1LRCLK 12 -#define MADERA_FLL_SRC_AIF2LRCLK 13 -#define MADERA_FLL_SRC_AIF3LRCLK 14 -#define MADERA_FLL_SRC_AIF4LRCLK 15 - -#define MADERA_CLK_SYSCLK_1 1 -#define MADERA_CLK_ASYNCCLK_1 2 -#define MADERA_CLK_OPCLK 3 -#define MADERA_CLK_ASYNC_OPCLK 4 -#define MADERA_CLK_SYSCLK_2 5 -#define MADERA_CLK_SYSCLK_3 6 -#define MADERA_CLK_ASYNCCLK_2 7 -#define MADERA_CLK_DSPCLK 8 -#define MADERA_CLK_OUTCLK 9 - -#define MADERA_CLK_SRC_MCLK1 0x0 -#define MADERA_CLK_SRC_MCLK2 0x1 -#define MADERA_CLK_SRC_MCLK3 0x2 -#define MADERA_CLK_SRC_FLL1 0x4 -#define MADERA_CLK_SRC_FLL2 0x5 -#define MADERA_CLK_SRC_FLL3 0x6 -#define MADERA_CLK_SRC_FLLAO_HI 0x7 -#define MADERA_CLK_SRC_FLL1_DIV6 0x7 -#define MADERA_CLK_SRC_AIF1BCLK 0x8 -#define MADERA_CLK_SRC_AIF2BCLK 0x9 -#define MADERA_CLK_SRC_AIF3BCLK 0xA -#define MADERA_CLK_SRC_AIF4BCLK 0xB -#define MADERA_CLK_SRC_FLLAO 0xF - -#define MADERA_OUTCLK_SYSCLK 0 -#define MADERA_OUTCLK_ASYNCCLK 1 -#define MADERA_OUTCLK_MCLK1 4 -#define MADERA_OUTCLK_MCLK2 5 -#define MADERA_OUTCLK_MCLK3 6 - #define MADERA_MIXER_VOL_MASK 0x00FE #define MADERA_MIXER_VOL_SHIFT 1 #define MADERA_MIXER_VOL_WIDTH 7 From patchwork Fri Jan 8 16:05:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 359091 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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 CF9A6C433E0 for ; Fri, 8 Jan 2021 16:07:24 +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 34FC82399C for ; Fri, 8 Jan 2021 16:07:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34FC82399C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=opensource.cirrus.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 C023416CB; Fri, 8 Jan 2021 17:06:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C023416CB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1610122042; bh=GM+ZxYWvGVethBld5QrDkTe2e6EZ/H8hdU29NRiSXVU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gKEevnqWwRt8WtXNYyg7MLU9bEph+rmi6g+yqzAo8qIX/caBivSG7NNGdGFK3O1bX qAzZMzV1kbvdg+MD3PyfR+f33b42suL9gVBd9e939SL3zcSbeXnPs38sTzYZ16NkRB Mf7ieqzFlylAQV9mvv/EM3FYlsRsi5e/kK8s26ik= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BD90BF804D6; Fri, 8 Jan 2021 17:05:31 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18DFFF804CA; Fri, 8 Jan 2021 17:05:27 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C7685F8016A for ; Fri, 8 Jan 2021 17:05:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C7685F8016A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="kQ/6c7+0" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 108G2Eoa011561; Fri, 8 Jan 2021 10:05:10 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=+w5xx7LGiLqSPWaeC7AZtzqPzv7SbUjzZgWbyHwArP8=; b=kQ/6c7+0pZURMvtquXoe8K5kZCtbdb6+5lzgd4DfKDKugnqjZ1GqDruktZcTwV85Wc8L TGqCG06pM2Te84ZRGvV2rQfyhqs4wlNLjbQlWEu7yvRFBqn6ag5MA/gXOqejY9k/QC+8 aiakNg1s5YqM2r1muS3XHqbi2KF8Z1CesZHacNoU++nT9rAuy5ISIffg/ptJT3g+J8LA uITDhuW1we8N4cyfRdOyBI86OEOzzQXD2z0GS7yB6rvnyhWMQkm8FrlyEbp1ilasPh7r J8Z4qlALiV8jeW8Tiiu80b2hdaDTAisFEuP6+p7sZJPp3WwNpgkjKTqd0ERIvaHclW/Y yg== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 35wqjka90t-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Jan 2021 10:05:10 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Fri, 8 Jan 2021 16:05:09 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Fri, 8 Jan 2021 16:05:09 +0000 Received: from AUSNPC0LSNW1-debian.cirrus.com (AUSNPC0LSNW1.ad.cirrus.com [198.61.64.226]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 470ED45; Fri, 8 Jan 2021 16:05:09 +0000 (UTC) From: Richard Fitzgerald To: , , , , Subject: [PATCH v4 6/6] ARM: dts: Add dts for RPi4b + Cirrus Logic Lochnagar2 + CS47L15 Date: Fri, 8 Jan 2021 16:05:01 +0000 Message-ID: <20210108160501.7638-7-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210108160501.7638-1-rf@opensource.cirrus.com> References: <20210108160501.7638-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 phishscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101080091 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-kernel@vger.kernel.org, Richard Fitzgerald , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, 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" This adds a devicetree configuration for Raspberry Pi 4b connected to Cirrus Logic Lochnagar 2 audio development board and CS47L15 codec. The common (codec-independent) Lochnagar 2 configuration is separated into a dtsi to simplify re-using it for other codecs. Signed-off-by: Richard Fitzgerald --- MAINTAINERS | 1 + arch/arm/boot/dts/Makefile | 1 + .../dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts | 186 ++++++++++++++++ .../boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi | 201 ++++++++++++++++++ 4 files changed, 389 insertions(+) create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts create mode 100644 arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi diff --git a/MAINTAINERS b/MAINTAINERS index 9407dd55673b..c61d522838ee 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4233,6 +4233,7 @@ M: Charles Keepax M: Richard Fitzgerald L: patches@opensource.cirrus.com S: Supported +F: arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar* F: Documentation/devicetree/bindings/clock/cirrus,lochnagar.yaml F: Documentation/devicetree/bindings/hwmon/cirrus,lochnagar.yaml F: Documentation/devicetree/bindings/mfd/cirrus,lochnagar.yaml diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 3d1ea0b25168..87230f81aa7a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -93,6 +93,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ bcm2837-rpi-3-b-plus.dtb \ bcm2837-rpi-cm3-io3.dtb \ bcm2711-rpi-4-b.dtb \ + bcm2711-rpi-4-b-lochnagar-cs47l15.dtb \ bcm2835-rpi-zero.dtb \ bcm2835-rpi-zero-w.dtb dtb-$(CONFIG_ARCH_BCM_5301X) += \ diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts new file mode 100644 index 000000000000..7b516b3d7af1 --- /dev/null +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar-cs47l15.dts @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-4-b-lochnagar.dtsi" +#include + +/ { + sound { + status = "okay"; + + compatible = "audio-graph-card"; + label = "sound-card-cs47l15"; + + clocks = <&clk_24m>, <&fll1_out>, <&fll1_dsp>; + clock-names = "ln-clk-24m", "fll1-out", "fll1-dsp"; + + plls = < + &cs47l15 MADERA_FLL1_REFCLK MADERA_FLL_SRC_MCLK1 98304000 + >; + plls-clocks = "ln-clk-24m"; + + sysclks = < + &cs47l15 MADERA_CLK_SYSCLK_1 MADERA_CLK_SRC_FLL1 0 + &cs47l15 MADERA_CLK_DSPCLK MADERA_CLK_SRC_FLL1 0 + >; + sysclks-clocks = "fll1-out", "fll1-dsp"; + + widgets = "Microphone", "Microphone Jack", + "Headphone", "Headphone Jack"; + + routing = "Microphone Jack", "MICBIAS1A", + "IN1BRN", "Microphone Jack", + "IN1BRP", "Microphone Jack", + "Headphone Jack", "HPOUTL", + "Headphone Jack", "HPOUTR"; + + dais = <&cpu_i2s_port &cs47l15_trace_port>; + + /* Main output from FLL1 */ + fll1_out: fll1_out { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <98304000>; + }; + + /* x1.5 DSP output from FLL1 */ + fll1_dsp: fll1_dsp { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <147456000>; + }; + }; +}; + +&i2s { + ports { + #address-cells = <1>; + #size-cells = <0>; + cpu_i2s_port: port@0 { + reg = <0>; + cpu_i2s_ep: endpoint { + remote-endpoint = <&cs47l15_aif1>; + dai-format = "i2s"; + }; + }; + }; +}; + +&spi { + status = "okay"; + + cs47l15: cs47l15@1 { + status = "okay"; + + compatible = "cirrus,cs47l15"; + reg = <0x1>; + + spi-max-frequency = <11000000>; + + interrupts = <27 8>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio>; + gpio-controller; + #gpio-cells = <2>; + #sound-dai-cells = <1>; + + AVDD-supply = <&lochnagar_vdd1v8>; + DCVDD-supply = <&lochnagar_vddcore>; + DBVDD1-supply = <&lochnagar_vdd1v8>; + CPVDD1-supply = <&lochnagar_vdd1v8>; + SPKVDD-supply = <&wallvdd>; + MICVDD-supply = <&lochnagar_micvdd>; + + reset-gpios = <&lochnagar_pin 0 0>; + + cirrus,dmic-ref = < + MADERA_DMIC_REF_MICBIAS1 + >; + cirrus,inmode = < + MADERA_INMODE_SE MADERA_INMODE_SE /* IN1A */ + MADERA_INMODE_DIFF MADERA_INMODE_DIFF /* IN1B */ + MADERA_INMODE_SE MADERA_INMODE_SE /* IN2A */ + MADERA_INMODE_DIFF MADERA_INMODE_DIFF /* IN2B */ + >; + + clocks = <&lochnagar_clk LOCHNAGAR_CDC_MCLK1>, + <&lochnagar_clk LOCHNAGAR_CDC_MCLK2>; + clock-names = "mclk1", "mclk2"; + + pinctrl-names = "default"; + pinctrl-0 = <&cdc_irq &cs47l15_defaults>; + + cs47l15_defaults: cs47l15-gpio-defaults { + aif1 { + groups = "aif1"; + function = "aif1"; + bias-bus-hold; + }; + aif2 { + groups = "aif2"; + function = "aif2"; + bias-bus-hold; + }; + aif3 { + groups = "aif3"; + function = "aif3"; + bias-bus-hold; + }; + pdmspk1 { + groups = "pdmspk1"; + function = "pdmspk1"; + }; + }; + + micvdd { + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + }; + + MICBIAS1 { + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + }; + MICBIAS1A { + regulator-active-discharge = <1>; + }; + MICBIAS1B { + regulator-active-discharge = <1>; + }; + MICBIAS1C { + regulator-active-discharge = <1>; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + cs47l15_aif1_port: port@0 { + reg = <0>; + cs47l15_aif1: endpoint { + remote-endpoint = <&cpu_i2s_ep>; + bitclock-master; + frame-master; + system-clock-frequency = <0>; + mclk-fs = <0>; + }; + }; + /* Debug trace compressed stream */ + cs47l15_trace_port: port@3 { + reg = <3>; + cs47l15_trace_cpu: endpoint { + remote-endpoint = <&cs47l15_trace_codec>; + system-clock-frequency = <0>; + mclk-fs = <0>; + }; + }; + port@4 { + reg = <4>; + cs47l15_trace_codec: endpoint { + remote-endpoint = <&cs47l15_trace_cpu>; + system-clock-frequency = <0>; + mclk-fs = <0>; + }; + }; + }; + }; +}; diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi b/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi new file mode 100644 index 000000000000..af498d7ad18a --- /dev/null +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b-lochnagar.dtsi @@ -0,0 +1,201 @@ +// SPDX-License-Identifier: GPL-2.0 +/dts-v1/; +#include "bcm2711-rpi-4-b.dts" +#include +#include +#include + +/ { + wallvdd: wallvdd@0 { + compatible = "regulator-fixed"; + + regulator-name = "WALL_VDD_5V"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-boot-on; + regulator-always-on; + }; + +}; + +&gpio { + lochnagar_present: lochnagar_present { + brcm,pins = <22>; + brcm,function = ; + }; + + lochnagar_reset: lochnagar_reset { + brcm,pins = <24>; + brcm,function = ; + }; + + cdc_irq: cdc_irq { + brcm,pins = <27>; + brcm,function = ; + }; + + spi_pins: spi_pins { + brcm,pins = <9 10 11>; + brcm,function = ; + }; + + spi_cs: spi_cs { + brcm,pins = <7 8>; + brcm,function = ; + }; + + i2s_pins: i2s_pins { + brcm,pins = <18 19 20 21>; + brcm,function = ; + }; +}; + +&i2s { + status = "okay"; + #sound-dai-cells = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&i2s_pins>; + dmas = <&dma 2>, <&dma 3>; + dma-names = "tx", "rx"; +}; + +&i2c1 { + status = "okay"; + + lochnagar: lochnagar@22 { + status = "okay"; + + compatible = "cirrus,lochnagar2"; + reg = <0x22>; + + pinctrl-names = "default"; + pinctrl-0 = <&lochnagar_present &lochnagar_reset>; + + reset-gpio = <&gpio 24 0>; + present-gpio = <&gpio 22 0>; + + lochnagar_vdd1v8: VDD1V8 { + compatible = "regulator-fixed"; + + regulator-name = "VDD1V8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + + vin-supply = <&wallvdd>; + }; + + clk_pmic: clk_pmic { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + clk_24m: clk_24m { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24576000>; + }; + + lochnagar_clk: clk { + compatible = "cirrus,lochnagar2-clk"; + + #clock-cells = <1>; + + clocks = <&clk_pmic>, <&clk_24m>; + clock-names = "ln-pmic-32k", "ln-clk-24m"; + + assigned-clocks = <&lochnagar_clk LOCHNAGAR_CDC_MCLK1>, + <&lochnagar_clk LOCHNAGAR_CDC_MCLK2>, + <&lochnagar_clk LOCHNAGAR_SOUNDCARD_MCLK>; + assigned-clock-parents = <&clk_24m>, + <&clk_pmic>, + <&clk_24m>; + }; + + lochnagar_pin: pin { + compatible = "cirrus,lochnagar-pinctrl"; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&lochnagar_pin 0 0 LOCHNAGAR2_PIN_NUM_GPIOS>; + + pinctrl-names = "default"; + pinctrl-0 = <&pin_settings>; + + pin_settings: pin_settings { + rpi_aif { + input-enable; + groups = "gf-aif1"; + function = "codec-aif1"; + }; + codec_aif1 { + output-master; + groups = "codec-aif1"; + function = "gf-aif1"; + }; + sc_codec_aif { + output-enable; + groups = "codec-aif2"; + function = "soundcard-aif"; + }; + sc_lochnagar_aif { + input-enable; + groups = "soundcard-aif"; + function = "codec-aif2"; + }; + }; + }; + + lochnagar_hwmon: hwmon { + compatible = "cirrus,lochnagar2-hwmon"; + }; + + lochnagar_micvdd: MICVDD { + compatible = "cirrus,lochnagar2-micvdd"; + + SYSVDD-supply = <&wallvdd>; + + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + }; + + MIC1VDD { + compatible = "cirrus,lochnagar2-mic1vdd"; + + regulator-always-on; + cirrus,micbias-input = <2>; + }; + + MIC2VDD { + compatible = "cirrus,lochnagar2-mic2vdd"; + + regulator-always-on; + cirrus,micbias-input = <3>; + }; + + lochnagar_vddcore: VDDCORE { + compatible = "cirrus,lochnagar2-vddcore"; + + SYSVDD-supply = <&wallvdd>; + + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1200000>; + }; + + lochnagar_sc: soundcard { + compatible = "cirrus,lochnagar2-soundcard"; + + #sound-dai-cells = <1>; + + clocks = <&lochnagar_clk LOCHNAGAR_SOUNDCARD_MCLK>; + clock-names = "mclk"; + }; + }; +}; + +&spi { + pinctrl-names = "default"; + pinctrl-0 = <&spi_pins &spi_cs>; + cs-gpios = <&gpio 8 1>, <&gpio 7 1>; +};