From patchwork Sat Oct 14 17:26:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Otto_Pfl=C3=BCger?= X-Patchwork-Id: 733914 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C829CDB482 for ; Sat, 14 Oct 2023 17:28:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbjJNR25 (ORCPT ); Sat, 14 Oct 2023 13:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233313AbjJNR25 (ORCPT ); Sat, 14 Oct 2023 13:28:57 -0400 Received: from srv01.abscue.de (abscue.de [IPv6:2a03:4000:63:bf5:4817:8eff:feeb:8ac7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FC9AC9 for ; Sat, 14 Oct 2023 10:28:53 -0700 (PDT) Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 265CB1C0729; Sat, 14 Oct 2023 19:28:51 +0200 (CEST) Received: from fluffy-mammal.fritz.box (dslb-088-078-204-065.088.078.pools.vodafone-ip.de [88.78.204.65]) by srv01.abscue.de (Postfix) with ESMTPSA id C34E91C0728; Sat, 14 Oct 2023 19:28:50 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= To: linux-arm-msm@vger.kernel.org Cc: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, ~postmarketos/upstreaming@lists.sr.ht, =?utf-8?q?Otto_Pfl=C3=BCger?= Subject: [PATCH 0/3] ASoC: qcom: check ADSP version when setting clocks Date: Sat, 14 Oct 2023 19:26:21 +0200 Message-Id: <20231014172624.75301-1-otto.pflueger@abscue.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The apq8016_sbc driver currently works on APQ8016 and MSM8916 devices. It should also work on MSM8909 (and newer SoCs like MSM8917 and MSM8953 if the quinary MI2S line is added); however, newer devices with these SoCs ship with newer firmware that uses a different interface for controlling the digital codec and bit clocks, which causes the driver to fail because it cannot set LPAIF_BIT_CLK. In order to fix this problem, modify the LPAIF_* clock implementation in the qdsp6 driver to use the newer clock API if a newer firmware version is detected. This seems to be a better solution than exposing the firmware version to other drivers like apq8016_sbc and forcing them to figure out which clock to use. On MSM8916, a hack is currently used to control the LPAIF_DIG_CLK directly through the GCC driver, but on devices with the newer firmware, the INTERNAL_DIGITAL_CODEC_CORE clock provided by q6afe-clocks in the qdsp6 driver can be used instead. Add a fallback to make this clock work with the older firmware too, allowing one to specify it as the codec's "mclk" in the device tree: compatible = "qcom,msm8916-wcd-digital-codec"; clocks = <&xo_board>, <&q6afecc LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE LPASS_CLK_ATTRIBUTE_COUPLE_NO>; clock-names = "ahbix", "mclk"; assigned-clocks = <&q6afecc LPASS_CLK_ID_INTERNAL_DIGITAL_CODEC_CORE LPASS_CLK_ATTRIBUTE_COUPLE_NO>; assigned-clock-rates = <9600000>; This works both on MSM8916 and on the newer SoCs mentioned above. Otto Pflüger (3): ASoC: qcom: q6core: expose ADSP core firmware version ASoC: qcom: q6afe: check ADSP version when setting clocks ASoC: qcom: q6afe: remove "port already open" error sound/soc/qcom/qdsp6/q6afe.c | 85 +++++++++++++++++++++++++++++++++-- sound/soc/qcom/qdsp6/q6core.c | 61 +++++++++++++++++++++++++ sound/soc/qcom/qdsp6/q6core.h | 9 ++++ 3 files changed, 152 insertions(+), 3 deletions(-) base-commit: e3b18f7200f45d66f7141136c25554ac1e82009b