From patchwork Mon Sep 7 10:00:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 11760383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41AED92C for ; Mon, 7 Sep 2020 10:02:42 +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 95A6420C09 for ; Mon, 7 Sep 2020 10:02:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="EYOL226V"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZSFhT/G0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95A6420C09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 BF6F717AF; Mon, 7 Sep 2020 12:01:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BF6F717AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1599472958; bh=OTuUQ/rz3IDO86eVgFErLLaQkDdJD7fTsTfRL1IqJuU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EYOL226VZyPhry+VqbcwKRKiz8DqP/0swzl3FSqBXCcwEhs5uHL2W4RE80GIuwHQX rbJtGC36F4whDNqPvZcEIKXTGDNVt5f9JJHvjT9cRRvV0g8BD0OuSUVZifDSMbZOTp i5uRXR06lBf2R/sw66Y97eerZ1o2phOIjj8W2g+4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A3E24F802C2; Mon, 7 Sep 2020 12:01:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 80E89F802A7; Mon, 7 Sep 2020 12:01:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (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 D4120F80227 for ; Mon, 7 Sep 2020 12:00:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D4120F80227 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZSFhT/G0" Received: by mail-pl1-x643.google.com with SMTP id c3so4003000plz.5 for ; Mon, 07 Sep 2020 03:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2nWlloeWe4+nv6hVrTbPWUl2P9w8K0JESAZLCRmELVU=; b=ZSFhT/G0q2ZaK8YsX7jmEYkhDH+k8OV7xGmjBtvpTzk3L39iAumjSbh4Axz8veUrI1 zbtz8cidopzd53DfFCwBiLaW9GeSIXA49tQhOlPKtK30jJV2Yg7j72ll/sD1XJfplKrS AxpoKTS6ly9EvBwPZ/5OZ+U4tj7GTMQmaAlDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2nWlloeWe4+nv6hVrTbPWUl2P9w8K0JESAZLCRmELVU=; b=Ssx1t2kD5DJ1IdgJh3npMTi9MwgFh4mBxBD0R9djk5OG5h/dMjG2m1uvVza5MkntqM TkpwQL+ctPspA8sV0/b5p72GCW44AJ07QnsiPQfgXtCB02yBWfIdHzYCWt3601hOpZ0g xWSUGHGjydt9mx3bmrePN+MZHU6f6kT6A6bF8bZV6b2coQS5EoBh41i0L4wYs8RC/Pu+ XS6Waqg2TbXNaXLzhtRQYSxk2pV5HCApQj8osYrmJU/Ur15FIo+yS+4xly4I4OW9Yd/z sf+Zz3MjdFWcTEttBDEMG7lsSnJrJeMgU2wrEf2sTuNzU4PoEbX1R2879tdrE5B0ji5M uCaw== X-Gm-Message-State: AOAM533hGcQH1jzbGEueFgBHLVzVWLQs2vz5HS5ZsDcvJcLR84uQCH34 LxvEP4g+iCCJjS0X0OhX46Djpg== X-Google-Smtp-Source: ABdhPJyzkGLS8a+7KSSGTBGA/HS6YOR6NLj9qpJjgdERmm+21vDaW83cz9pHjsM1Ewzm/k9QXh/Q8Q== X-Received: by 2002:a17:902:d709:: with SMTP id w9mr17541295ply.117.1599472857215; Mon, 07 Sep 2020 03:00:57 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:de4a:3eff:fe7d:d39c]) by smtp.gmail.com with ESMTPSA id g17sm11882180pjl.30.2020.09.07.03.00.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Sep 2020 03:00:56 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Subject: [PATCH v7 1/3] ASoC: hdmi-codec: Use set_jack ops to set jack Date: Mon, 7 Sep 2020 18:00:37 +0800 Message-Id: <20200907100039.1731457-2-cychiang@chromium.org> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200907100039.1731457-1-cychiang@chromium.org> References: <20200907100039.1731457-1-cychiang@chromium.org> MIME-Version: 1.0 Cc: Taniya Das , alsa-devel@alsa-project.org, Banajit Goswami , Heiko Stuebner , Liam Girdwood , Rohit kumar , Cheng-Yi Chiang , Patrick Lai , linux-rockchip@lists.infradead.org, Andy Gross , dgreid@chromium.org, devicetree@vger.kernel.org, tzungbi@chromium.org, Stephan Gerhold , linux-arm-msm@vger.kernel.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, dianders@chromium.org, Takashi Iwai , Mark Brown , Srini Kandagatla 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" Use set_jack ops to set jack so machine drivers do not need to include hdmi-codec.h explicitly. Signed-off-by: Cheng-Yi Chiang --- include/sound/hdmi-codec.h | 3 --- sound/soc/codecs/hdmi-codec.c | 12 ++++-------- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 5 ++--- sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 5 ++--- .../mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 5 ++--- sound/soc/rockchip/rockchip_max98090.c | 3 +-- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 7754631a3102..b55970859a13 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -117,9 +117,6 @@ struct hdmi_codec_pdata { struct snd_soc_component; struct snd_soc_jack; -int hdmi_codec_set_jack_detect(struct snd_soc_component *component, - struct snd_soc_jack *jack); - #define HDMI_CODEC_DRV_NAME "hdmi-audio-codec" #endif /* __HDMI_CODEC_H__ */ diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 8c6f540533ba..d1de5bcd5daa 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -698,13 +698,9 @@ static void plugged_cb(struct device *dev, bool plugged) hdmi_codec_jack_report(hcp, 0); } -/** - * hdmi_codec_set_jack_detect - register HDMI plugged callback - * @component: the hdmi-codec instance - * @jack: ASoC jack to report (dis)connection events on - */ -int hdmi_codec_set_jack_detect(struct snd_soc_component *component, - struct snd_soc_jack *jack) +static int hdmi_codec_set_jack_detect(struct snd_soc_component *component, + struct snd_soc_jack *jack, + void *data) { struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); int ret = -EOPNOTSUPP; @@ -720,7 +716,6 @@ int hdmi_codec_set_jack_detect(struct snd_soc_component *component, } return ret; } -EXPORT_SYMBOL_GPL(hdmi_codec_set_jack_detect); static int hdmi_dai_spdif_probe(struct snd_soc_dai *dai) { @@ -806,6 +801,7 @@ static const struct snd_soc_component_driver hdmi_driver = { .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, + .set_jack = hdmi_codec_set_jack_detect, }; static int hdmi_codec_probe(struct platform_device *pdev) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek/mt8173/mt8173-rt5650.c index 347b095d478d..c28ebf891cb0 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -11,7 +11,6 @@ #include #include #include -#include #include "../../codecs/rt5645.h" #define MCLK_FOR_CODECS 12288000 @@ -154,8 +153,8 @@ static int mt8173_rt5650_hdmi_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component, - &mt8173_rt5650_hdmi_jack); + return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, + &mt8173_rt5650_hdmi_jack, NULL); } enum { diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c index 06d0a4f80fc1..e53c6200d5a7 100644 --- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -369,8 +368,8 @@ static int mt8183_da7219_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component, - &priv->hdmi_jack); + return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, + &priv->hdmi_jack, NULL); } static struct snd_soc_dai_link mt8183_da7219_dai_links[] = { diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 07410d7afaa9..327dfad41e31 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -350,8 +349,8 @@ mt8183_mt6358_ts3a227_max98357_hdmi_init(struct snd_soc_pcm_runtime *rtd) if (ret) return ret; - return hdmi_codec_set_jack_detect(asoc_rtd_to_codec(rtd, 0)->component, - &priv->hdmi_jack); + return snd_soc_component_set_jack(asoc_rtd_to_codec(rtd, 0)->component, + &priv->hdmi_jack, NULL); } static struct snd_soc_dai_link mt8183_mt6358_ts3a227_dai_links[] = { diff --git a/sound/soc/rockchip/rockchip_max98090.c b/sound/soc/rockchip/rockchip_max98090.c index 9acfd024aa5d..c8f1a28a92b7 100644 --- a/sound/soc/rockchip/rockchip_max98090.c +++ b/sound/soc/rockchip/rockchip_max98090.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -238,7 +237,7 @@ static int rk_hdmi_init(struct snd_soc_pcm_runtime *runtime) return ret; } - return hdmi_codec_set_jack_detect(component, &rk_hdmi_jack); + return snd_soc_component_set_jack(component, &rk_hdmi_jack, NULL); } /* max98090 dai_link */ From patchwork Mon Sep 7 10:00:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 11760387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B879759D for ; Mon, 7 Sep 2020 10:03:12 +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 0B40120C09 for ; Mon, 7 Sep 2020 10:03:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ExzT3Ltr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="G2U+xauh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B40120C09 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 D2F0E179D; Mon, 7 Sep 2020 12:02:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D2F0E179D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1599472989; bh=wNUmWXGcaMRt1eMpYHH1Xgda1hSwvDATWtnRaqeXQEg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ExzT3Ltrer4boXPh8tmxzMrxYr4f4T4qCW4h4Vx2KqABlYaqa54td2LzbErK0dSf1 FBFb4qCxKeoVKBmdr3Df/3oKs+ifi2p0cHq3EKJpYH+co++ZKMPR5qVS2Xs9vdyWRT Wx++kt02qRVWnlYD63yr9Tpl+lv5XcvxdW9n8gwU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BD43DF802A7; Mon, 7 Sep 2020 12:01:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id B8E90F802DB; Mon, 7 Sep 2020 12:01:16 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pl1-x642.google.com (mail-pl1-x642.google.com [IPv6:2607:f8b0:4864:20::642]) (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 45EEBF80227 for ; Mon, 7 Sep 2020 12:01:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 45EEBF80227 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="G2U+xauh" Received: by mail-pl1-x642.google.com with SMTP id y6so4252720plk.10 for ; Mon, 07 Sep 2020 03:01:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZtBzFsLnQlADUQhDYi9AZbvuBk6CQQ/iUSZHP9znWeA=; b=G2U+xauhwOUIg1+sfdCC9aGNcSvglEqkkMBh6DCjmfq58K/T2d7rJA9Cm3fcyMxHva FZL7nTTT0HKvp2iSqi9GycSU1R25JyFScUE8CIwwhjboY6mUfSUEWHlrUwFy4jp08xOP rLUPwbwHtsSqUQcR+GUR0uUTwxIaBGbGCdHzQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZtBzFsLnQlADUQhDYi9AZbvuBk6CQQ/iUSZHP9znWeA=; b=fKhgmmMqm2Lj1mwpdeg5kqn9xSmzZz9TvkHPYJRVOHF250NJDwEyTHcX38FPScN8LO ec7mP2j21XvXjcWhqlmOHpaks6EvQcUCmH72np+paplhBeHw7RV7d/ASoUvgPYB7PpL4 5PkVZnskJfuun2Qb85LBo6JSeXGRAeAEpi37r2Xse4iEEafFuFB+vy63JzSfX9tXLuFa eacZs6qiwJeVdLUOf6f8tpN703KGT85vrkfPot9QYf0G+SZtIMBcYqdkkU1Alt9Ch+3b YK65Vtcaptja9s5g6wGYAhCaEhE8PQ4JWieH74H0kN4v2cwTM6OyehhhJz3PMyHbhY2z RwiQ== X-Gm-Message-State: AOAM533MqUNSLp+qcXnhoqaOOFfwuXqM4KzCDBGTzBfS0BuH5vfGKcib 1cn6SwEFI9WxBUDKrdJHwNWDDg== X-Google-Smtp-Source: ABdhPJy9M8TMIRsRKfrSjFR15RkH+UCAIyZCO0fegGFdbr591p5xjKjo7GRykgUpbZfQWpn/LAH21A== X-Received: by 2002:a17:90a:fa8b:: with SMTP id cu11mr18268777pjb.10.1599472863741; Mon, 07 Sep 2020 03:01:03 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:de4a:3eff:fe7d:d39c]) by smtp.gmail.com with ESMTPSA id k4sm11907489pjl.10.2020.09.07.03.00.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Sep 2020 03:01:03 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Subject: [PATCH v7 2/3] ASoC: qcom: dt-bindings: Add sc7180 machine bindings Date: Mon, 7 Sep 2020 18:00:38 +0800 Message-Id: <20200907100039.1731457-3-cychiang@chromium.org> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200907100039.1731457-1-cychiang@chromium.org> References: <20200907100039.1731457-1-cychiang@chromium.org> MIME-Version: 1.0 Cc: Taniya Das , alsa-devel@alsa-project.org, Banajit Goswami , Heiko Stuebner , Liam Girdwood , Rohit kumar , Cheng-Yi Chiang , Patrick Lai , linux-rockchip@lists.infradead.org, Andy Gross , dgreid@chromium.org, devicetree@vger.kernel.org, tzungbi@chromium.org, Stephan Gerhold , linux-arm-msm@vger.kernel.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, dianders@chromium.org, Takashi Iwai , Mark Brown , Srini Kandagatla 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 devicetree bindings documentation file for sc7180 sound card. Signed-off-by: Cheng-Yi Chiang --- .../bindings/sound/qcom,sc7180.yaml | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/qcom,sc7180.yaml diff --git a/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml new file mode 100644 index 000000000000..ae809346ca80 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/qcom,sc7180.yaml @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/qcom,sc7180.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Technologies Inc. SC7180 ASoC sound card driver + +maintainers: + - Rohit kumar + - Cheng-Yi Chiang + +description: + This binding describes the SC7180 sound card which uses LPASS for audio. + +properties: + compatible: + const: qcom,sc7180-sndcard + + audio-routing: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + A list of the connections between audio components. Each entry is a + pair of strings, the first being the connection's sink, the second + being the connection's source. + + model: + $ref: /schemas/types.yaml#/definitions/string + description: User specified audio sound card name + + headset-jack: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle of the codec for headset detection + + hdmi-jack: + $ref: /schemas/types.yaml#/definitions/phandle + description: phandle of the codec for hdmi jack detection + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +patternProperties: + "^dai-link(@[0-9])?$": + description: + Each subnode represents a dai link. Subnodes of each dai links would be + cpu/codec dais. + + type: object + + properties: + link-name: + description: Indicates dai-link name and PCM stream name. + $ref: /schemas/types.yaml#/definitions/string + maxItems: 1 + + reg: + description: dai link address. + + cpu: + description: Holds subnode which indicates cpu dai. + type: object + properties: + sound-dai: true + + codec: + description: Holds subnode which indicates codec dai. + type: object + properties: + sound-dai: true + + required: + - link-name + - cpu + - codec + + additionalProperties: false + +required: + - compatible + - model + - headset-jack + - hdmi-jack + - "#address-cells" + - "#size-cells" + +additionalProperties: false + +examples: + + - | + sound { + compatible = "qcom,sc7180-sndcard"; + model = "sc7180-snd-card"; + + audio-routing = + "Headphone Jack", "HPOL", + "Headphone Jack", "HPOR"; + + headset-jack = <&alc5682>; + hdmi-jack = <&msm_dp>; + + #address-cells = <1>; + #size-cells = <0>; + + dai-link@0 { + link-name = "MultiMedia0"; + reg = <0>; + cpu { + sound-dai = <&lpass_cpu 0>; + }; + + codec { + sound-dai = <&alc5682 0>; + }; + }; + + dai-link@1 { + link-name = "MultiMedia1"; + reg = <1>; + cpu { + sound-dai = <&lpass_cpu 1>; + }; + + codec { + sound-dai = <&max98357a>; + }; + }; + + dai-link@2 { + link-name = "MultiMedia2"; + reg = <2>; + cpu { + sound-dai = <&lpass_hdmi 0>; + }; + + codec { + sound-dai = <&msm_dp>; + }; + }; + }; From patchwork Mon Sep 7 10:00:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 11760389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C1C9F59D for ; Mon, 7 Sep 2020 10:03: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 43FA721531 for ; Mon, 7 Sep 2020 10:03:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="gxaTIzeq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="H7LU0cWV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43FA721531 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org 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 BA9C617BE; Mon, 7 Sep 2020 12:02:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BA9C617BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1599473009; bh=m6/inXuVqnrY19ODv/zMRPLK5GzYbU+RljoALSOkz/4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gxaTIzeqze6NTU/l+hvwO13t8bMQrcQJE7mVLsbh7ccz0y4NE/mm4sPIbEHJfUL3+ 4GtWfsJ5+HV7DG5jY7w5l9lWittmoe26yZUnaDG3U06yNt7P8qbASxfrUZW72Afyg5 +mzPvcN1p5R8s1wPle75nkMD4rH/LtWn+PPHAaOI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C689CF802DF; Mon, 7 Sep 2020 12:01:29 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 752A3F802D2; Mon, 7 Sep 2020 12:01:21 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (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 9EF84F8028D for ; Mon, 7 Sep 2020 12:01:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9EF84F8028D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="H7LU0cWV" Received: by mail-pf1-x444.google.com with SMTP id f18so8373049pfa.10 for ; Mon, 07 Sep 2020 03:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wd2LEFWjK0hTZW5wh6FLMbT8PjGZ5hIr9mxrP+YrFfw=; b=H7LU0cWVVbxej3Bxa462x0qw1ZuSp36NOHIW1abtmae9CZPtAUtQM9idr1wgmVJm8K 7L7ZnMND2Ifth2SaEfkOkaHgvzj+gbeJFElBzl7vxrRno8tqEDuySBTIBAHEReLNRGU5 F7KVv1uHMaM6/dJja89BAszihQoTtgkLoRUz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wd2LEFWjK0hTZW5wh6FLMbT8PjGZ5hIr9mxrP+YrFfw=; b=GTW6UWG6W6YJy1YhwdeTLb4Pep3+Ot7Yom3hBSOv/KiRNc6cRtbvE8L3xs945MUi1j y2htfb8e3auSQVQHrm8Ib953w+wVVPNdqSMk8vIxSdZPDYb8gT7HmluCv2jiE9QtsEVN Nxlhd4/hgws4Cd3fiR7qRBbuewvB+lsKjzKrBwG+47Eu3GdPv4Fz8W0pK+/gB63NvG3G 0ONd5yIDkgOFwCXbbEItELKnrYumaIduk8iymOCW2wShPNzhOrZ5XIGQQOLJ2r3uM03a GuurD0YvFkak9qE473UA6ftUy9LCA9PTPWRJg+KUR3zqpTej0qjQZdTY/omxErKkTtn1 JgPQ== X-Gm-Message-State: AOAM530X4QN8mS+wZTQAi7+awV+cNAxLs/y5X6Zdm1zxfpQrIMMuoY/L W2G8yF+6p3bxHtruM/B1JSo6MA== X-Google-Smtp-Source: ABdhPJw5j9uzbrrAJ6+d725gUBxfIjtVv0GyndMGjGYwDO0qByOVL20MJgam73KY7Mk4e3oz0s0vHg== X-Received: by 2002:a62:e107:0:b029:13c:1611:658b with SMTP id q7-20020a62e1070000b029013c1611658bmr17926105pfh.8.1599472870588; Mon, 07 Sep 2020 03:01:10 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:de4a:3eff:fe7d:d39c]) by smtp.gmail.com with ESMTPSA id 64sm7977963pgi.90.2020.09.07.03.01.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Sep 2020 03:01:09 -0700 (PDT) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Subject: [PATCH v7 3/3] ASoC: qcom: sc7180: Add machine driver for sound card registration Date: Mon, 7 Sep 2020 18:00:39 +0800 Message-Id: <20200907100039.1731457-4-cychiang@chromium.org> X-Mailer: git-send-email 2.28.0.526.ge36021eeef-goog In-Reply-To: <20200907100039.1731457-1-cychiang@chromium.org> References: <20200907100039.1731457-1-cychiang@chromium.org> MIME-Version: 1.0 Cc: Taniya Das , alsa-devel@alsa-project.org, Banajit Goswami , Heiko Stuebner , Liam Girdwood , Rohit kumar , Cheng-Yi Chiang , Tzung-Bi Shih , Patrick Lai , Ajit Pandey , linux-rockchip@lists.infradead.org, Andy Gross , dgreid@chromium.org, devicetree@vger.kernel.org, tzungbi@chromium.org, Stephan Gerhold , linux-arm-msm@vger.kernel.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , Bjorn Andersson , linux-arm-kernel@lists.infradead.org, dianders@chromium.org, Takashi Iwai , Mark Brown , Srini Kandagatla 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" From: Ajit Pandey Add new driver to register sound card on sc7180 trogdor board and do the required configuration for lpass cpu dai and external codecs connected over MI2S interfaces. Signed-off-by: Ajit Pandey Signed-off-by: Cheng-Yi Chiang Reviewed-by: Tzung-Bi Shih --- sound/soc/qcom/Kconfig | 12 ++ sound/soc/qcom/Makefile | 2 + sound/soc/qcom/sc7180.c | 288 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 302 insertions(+) create mode 100644 sound/soc/qcom/sc7180.c diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig index a607ace8b089..0459185ee243 100644 --- a/sound/soc/qcom/Kconfig +++ b/sound/soc/qcom/Kconfig @@ -116,4 +116,16 @@ config SND_SOC_SDM845 SDM845 SoC-based systems. Say Y if you want to use audio device on this SoCs. +config SND_SOC_SC7180 + tristate "SoC Machine driver for SC7180 boards" + depends on I2C + select SND_SOC_QCOM_COMMON + select SND_SOC_LPASS_SC7180 + select SND_SOC_MAX98357A + select SND_SOC_RT5682_I2C + help + To add support for audio on Qualcomm Technologies Inc. + SC7180 SoC-based systems. + Say Y if you want to use audio device on this SoCs. + endif #SND_SOC_QCOM diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile index 7972c9479ab0..0cdcbf367ef1 100644 --- a/sound/soc/qcom/Makefile +++ b/sound/soc/qcom/Makefile @@ -17,12 +17,14 @@ snd-soc-storm-objs := storm.o snd-soc-apq8016-sbc-objs := apq8016_sbc.o snd-soc-apq8096-objs := apq8096.o snd-soc-sdm845-objs := sdm845.o +snd-soc-sc7180-objs := sc7180.o snd-soc-qcom-common-objs := common.o obj-$(CONFIG_SND_SOC_STORM) += snd-soc-storm.o obj-$(CONFIG_SND_SOC_APQ8016_SBC) += snd-soc-apq8016-sbc.o obj-$(CONFIG_SND_SOC_MSM8996) += snd-soc-apq8096.o obj-$(CONFIG_SND_SOC_SDM845) += snd-soc-sdm845.o +obj-$(CONFIG_SND_SOC_SC7180) += snd-soc-sc7180.o obj-$(CONFIG_SND_SOC_QCOM_COMMON) += snd-soc-qcom-common.o #DSP lib diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c new file mode 100644 index 000000000000..175a2f36842c --- /dev/null +++ b/sound/soc/qcom/sc7180.c @@ -0,0 +1,288 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// Copyright (c) 2020, The Linux Foundation. All rights reserved. +// +// sc7180.c -- ALSA SoC Machine driver for SC7180 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../codecs/rt5682.h" +#include "common.h" +#include "lpass.h" + +#define DEFAULT_SAMPLE_RATE_48K 48000 +#define DEFAULT_MCLK_RATE 19200000 +#define RT5682_PLL1_FREQ (48000 * 512) + +struct sc7180_snd_data { + u32 pri_mi2s_clk_count; + struct snd_soc_jack hs_jack; + struct device_node *hs_jack_of_node; + struct snd_soc_jack hdmi_jack; + struct device_node *hdmi_jack_of_node; +}; + +static void sc7180_jack_free(struct snd_jack *jack) +{ + struct snd_soc_component *component = jack->private_data; + + snd_soc_component_set_jack(component, NULL, NULL); +} + +static int sc7180_headset_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + struct sc7180_snd_data *pdata = snd_soc_card_get_drvdata(card); + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_component *component = codec_dai->component; + struct snd_jack *jack; + int rval; + + rval = snd_soc_card_jack_new( + card, "Headset Jack", + SND_JACK_HEADSET | + SND_JACK_HEADPHONE | + SND_JACK_BTN_0 | SND_JACK_BTN_1 | + SND_JACK_BTN_2 | SND_JACK_BTN_3, + &pdata->hs_jack, NULL, 0); + + if (rval < 0) { + dev_err(card->dev, "Unable to add Headset Jack\n"); + return rval; + } + + jack = pdata->hs_jack.jack; + + snd_jack_set_key(jack, SND_JACK_BTN_0, KEY_PLAYPAUSE); + snd_jack_set_key(jack, SND_JACK_BTN_1, KEY_VOICECOMMAND); + snd_jack_set_key(jack, SND_JACK_BTN_2, KEY_VOLUMEUP); + snd_jack_set_key(jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN); + + jack->private_data = component; + jack->private_free = sc7180_jack_free; + + return snd_soc_component_set_jack(component, &pdata->hs_jack, NULL); +} + +static int sc7180_hdmi_init(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_card *card = rtd->card; + struct sc7180_snd_data *pdata = snd_soc_card_get_drvdata(card); + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_component *component = codec_dai->component; + struct snd_jack *jack; + int rval; + + rval = snd_soc_card_jack_new( + card, "HDMI Jack", + SND_JACK_LINEOUT, + &pdata->hdmi_jack, NULL, 0); + + if (rval < 0) { + dev_err(card->dev, "Unable to add HDMI Jack\n"); + return rval; + } + + jack = pdata->hdmi_jack.jack; + jack->private_data = component; + jack->private_free = sc7180_jack_free; + + return snd_soc_component_set_jack(component, &pdata->hdmi_jack, NULL); +} + +static int sc7180_snd_startup(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + int ret; + + switch (cpu_dai->id) { + case MI2S_PRIMARY: + if (++data->pri_mi2s_clk_count == 1) { + snd_soc_dai_set_sysclk(cpu_dai, + LPASS_MCLK0, + DEFAULT_MCLK_RATE, + SNDRV_PCM_STREAM_PLAYBACK); + } + + snd_soc_dai_set_fmt(codec_dai, + SND_SOC_DAIFMT_CBS_CFS | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_I2S); + + /* Configure PLL1 for codec */ + ret = snd_soc_dai_set_pll(codec_dai, 0, RT5682_PLL1_S_MCLK, + DEFAULT_MCLK_RATE, RT5682_PLL1_FREQ); + if (ret) { + dev_err(rtd->dev, "can't set codec pll: %d\n", ret); + return ret; + } + + /* Configure sysclk for codec */ + ret = snd_soc_dai_set_sysclk(codec_dai, RT5682_SCLK_S_PLL1, + RT5682_PLL1_FREQ, + SND_SOC_CLOCK_IN); + if (ret) + dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", + ret); + + break; + case MI2S_SECONDARY: + break; + case HDMI: + break; + default: + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, + cpu_dai->id); + return -EINVAL; + } + return 0; +} + +static void sc7180_snd_shutdown(struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct sc7180_snd_data *data = snd_soc_card_get_drvdata(card); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + + switch (cpu_dai->id) { + case MI2S_PRIMARY: + if (--data->pri_mi2s_clk_count == 0) { + snd_soc_dai_set_sysclk(cpu_dai, + LPASS_MCLK0, + 0, + SNDRV_PCM_STREAM_PLAYBACK); + } + break; + case MI2S_SECONDARY: + break; + case HDMI: + break; + default: + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, + cpu_dai->id); + break; + } +} + +static const struct snd_soc_ops sc7180_ops = { + .startup = sc7180_snd_startup, + .shutdown = sc7180_snd_shutdown, +}; + +static const struct snd_soc_dapm_widget sc7180_snd_widgets[] = { + SND_SOC_DAPM_HP("Headphone Jack", NULL), + SND_SOC_DAPM_MIC("Headset Mic", NULL), +}; + +static struct snd_soc_card sc7180_card = { + .owner = THIS_MODULE, + .dapm_widgets = sc7180_snd_widgets, + .num_dapm_widgets = ARRAY_SIZE(sc7180_snd_widgets), +}; + +static int sc7180_parse_headset_jack_of(struct sc7180_snd_data *data, struct device *dev) +{ + data->hs_jack_of_node = of_parse_phandle(dev->of_node, "headset-jack", 0); + if (!data->hs_jack_of_node) + return -EINVAL; + return 0; +} + +static int sc7180_parse_hdmi_jack_of(struct sc7180_snd_data *data, struct device *dev) +{ + data->hdmi_jack_of_node = of_parse_phandle( + dev->of_node, "hdmi-jack", 0); + if (!data->hdmi_jack_of_node) + return -EINVAL; + return 0; +} + +static void sc7180_add_ops(struct snd_soc_card *card) +{ + struct snd_soc_dai_link *link; + int i; + struct sc7180_snd_data *pdata = snd_soc_card_get_drvdata(card); + + for_each_card_prelinks(card, i, link) { + link->ops = &sc7180_ops; + if (link->codecs && + link->codecs->of_node == pdata->hs_jack_of_node) { + link->init = sc7180_headset_init; + } + if (link->codecs && + link->codecs->of_node == pdata->hdmi_jack_of_node) { + link->init = sc7180_hdmi_init; + } + } +} + +static int sc7180_snd_platform_probe(struct platform_device *pdev) +{ + struct snd_soc_card *card = &sc7180_card; + struct sc7180_snd_data *data; + struct device *dev = &pdev->dev; + int ret; + + /* Allocate the private data */ + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) + return -ENOMEM; + + card->dev = dev; + + ret = qcom_snd_parse_of(card); + if (ret) { + dev_err(dev, "Error parsing OF data\n"); + return ret; + } + + snd_soc_card_set_drvdata(card, data); + + ret = sc7180_parse_headset_jack_of(data, dev); + if (ret) { + dev_err(dev, "Failed to parse OF for headset jack device\n"); + return ret; + } + + ret = sc7180_parse_hdmi_jack_of(data, dev); + if (ret) { + dev_err(dev, "Failed to parse OF for hdmi jack device\n"); + return ret; + } + + sc7180_add_ops(card); + + return devm_snd_soc_register_card(dev, card); +} + +static const struct of_device_id sc7180_snd_device_id[] = { + { .compatible = "qcom,sc7180-sndcard" }, + {}, +}; +MODULE_DEVICE_TABLE(of, sc7180_snd_device_id); + +static struct platform_driver sc7180_snd_driver = { + .probe = sc7180_snd_platform_probe, + .driver = { + .name = "msm-snd-sc7180", + .of_match_table = sc7180_snd_device_id, + }, +}; +module_platform_driver(sc7180_snd_driver); + +MODULE_DESCRIPTION("sc7180 ASoC Machine Driver"); +MODULE_LICENSE("GPL v2");