From patchwork Fri Oct 20 15:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Travkin X-Patchwork-Id: 156193 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1140810vqb; Fri, 20 Oct 2023 08:34:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEZKEIRe5VYEu5ic4n8YvFIc2VftORF1pTzwQWV9wUrX3CDvDc+ZYtUiVFyjMjjqpPkHJ4E X-Received: by 2002:a05:6a20:9155:b0:16b:a5fb:eee5 with SMTP id x21-20020a056a20915500b0016ba5fbeee5mr2503454pzc.28.1697816093085; Fri, 20 Oct 2023 08:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697816093; cv=none; d=google.com; s=arc-20160816; b=RHxDSMek5wsYmSfLz3ukn+pDPsYKaMdRHsG3T2Zp7mgiGCym0jqAeY988/LHa8sr2K Q1KQQtplz7BlSr5SjmTDs61GUXBsDn3ohIAwKlnI6dm+UYL6gwgyr20fLyJcUvMjqW+j tPLAdRMAtyutmcq4X6F/+dmrRG/I0AW2NMyYOato9u9iGM//DKZIgPkSQAn7SZD8jylH HBbM4bCgQiBxYZ8cDyyQgL4T9Iqb86s3qF+8tdg7X67RxiJSOoFT/qEtMMfcYuYcPIe0 gH0UHrWWcWfObsCLj+VCE471O/CzQJF2inDqFZYitD6gh2527umYlWvVlbjD7ulm8ip+ ZPBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=2wLP5jCp2buMbu4IRpUwqPMFfY7dtOrz1vFWwNp6bJU=; fh=4LrQlIJMLB9MQJPZV0BDkVpvo6vlDY9OyiaVtw6KelY=; b=R/ZfmN3XSr7RzjbSAc+3/kcMShdCIOXY+SUbLZQFpc12Tm1WLUGv7JRmeZljQdONqZ AQYf1Q8jl4mKKMV6OfaRZvCTRGQcNveD1GBTWwT9qyW2VcSShdhGowt3jpITkYFGWYYT zwHv6CLK9QmQr7nmPuZ8Q04WEPLcZwlfkuPHfvei6SbcALpPNkbYLcUPCBmkK8rBgVld APfIyOjpR6aO36cEG1UqspLbn8kGuQaPc3b8soEWqXmz9JXT/e8Xbbm4+BH2DbWGY7So d8WzJFKRsaN0i57lB31kKFzWkSlSNwXKGon01ptkWBlvgYH3beeZzdYNVC0/tapd1V6v 9QTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=Z5L8FNDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r27-20020a638f5b000000b005898e10f9c4si2199754pgn.203.2023.10.20.08.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 08:34:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=Z5L8FNDH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id A95FD82F7FB6; Fri, 20 Oct 2023 08:34:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377789AbjJTPem (ORCPT + 26 others); Fri, 20 Oct 2023 11:34:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377764AbjJTPeg (ORCPT ); Fri, 20 Oct 2023 11:34:36 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A135BE; Fri, 20 Oct 2023 08:34:34 -0700 (PDT) Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 0015C4196A; Fri, 20 Oct 2023 20:34:11 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1697816052; bh=vWCRQ4fNqO5LRt80eRCCPf+N3EAHFNSQHWlhv9+dG6E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Z5L8FNDHYVBWFYR9uyEnwZMsgSWAsqlUfbTtakJ/TMRhONV/QkHnm0lEqnlsogkgz yHOaFyEDZLarArP+uO5ELIebdAt0fs/XFPZ/0m2lCVCJtuAwO8lGM+ttEjzN0h9vO7 O27uay2hl4KnH1YTPO3wmIA+A0pzfILS3L2nh1FODUbrBiENORTCIMhpv3VoVxZRi3 WPN/gfLxe/fpYeNQc2adVVDN8JAelNxH7J1YW8eFlHWCcWb/plmdxraFa8b8AldWuz QoqXwK6zLGyTRqEftjkyMn6sD/nZxVuZyhMfURLm17A3Ii5xQADyevclHH0WJ0jL5/ gDooo9iaZPscw== From: Nikita Travkin Date: Fri, 20 Oct 2023 20:33:46 +0500 Subject: [PATCH 1/2] ASoC: dt-bindings: qcom,sm8250: Add sc7180-qdsp6-sndcard MIME-Version: 1.0 Message-Id: <20231020-sc7180-qdsp-sndcard-v1-1-157706b7d06f@trvn.ru> References: <20231020-sc7180-qdsp-sndcard-v1-0-157706b7d06f@trvn.ru> In-Reply-To: <20231020-sc7180-qdsp-sndcard-v1-0-157706b7d06f@trvn.ru> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai Cc: jenneron@postmarketos.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin X-Developer-Signature: v=1; a=openpgp-sha256; l=860; i=nikita@trvn.ru; h=from:subject:message-id; bh=vWCRQ4fNqO5LRt80eRCCPf+N3EAHFNSQHWlhv9+dG6E=; b=owEBbQKS/ZANAwAIAUMc7O4oGb91AcsmYgBlMp3yDEpr0K/LD9Xkj5hdVslBNDAbnX6DeW10o V2dYQ3vvpWJAjMEAAEIAB0WIQTAhK9UUj+qg34uxUdDHOzuKBm/dQUCZTKd8gAKCRBDHOzuKBm/ dQxLEACIgUXHeK+5Mt/vq/zZhrJ6L8IscDRn96d3J9M5M3UFS8rBRJhkZwS1yzijdRdklGJc+bJ 67jfqHdMxEWEw+1lLnl36JnPO6Rp6hHYQGnVioObJ/C+G+LdZiKl5Io64RE/S+uJ5YiObB5UfFP 5KOvW68PL9J5YILWCkZIuA+HkBwe0tUr5bC+8n/ps1Y/BxsgzhQx6KkwQFGNwDQxlTPD0aQQFrD nwfPmVYElfosTlxDgxRbxpdpX/aG8OaEZ3mRwj/a0TZwh2xuZh+76dhNRP1Lq+iWrRHVRVpVrGt TsTVUyQbM/ruIjLsNuS8y4KGVSASAT1UJb7ukkZ2ggsreO6h63aoeOIlYC/ZQNCe6sfAXTUsj7N IFfeUkKSKs1zWsMxLiZQgXzHqtMtFGx+vGEqZeTUJ0P8j4GhBZ/d02LgSfFoHmD2y6O7zACu/Fi NirMMU/b9RZtVK/wvZjwGUKW3+ayLUqoTznBsEkL7qvo5rvuWFZR0fH7tiweubxwXlcUuBXXfMO l8aWeqd/LuqGYBAIfPdOFXNc4FBoTaPB5qIMqRda9mMhMg7s92XX+cdV5bXP1/WhChiAFaVCjbW sYAQ/cSIhUCyGSvf8lhjfeljKxtbZG2my3DC+4TYcS0jdPDVg7SV89MvoB8Kg8WVkj5FHhqHmS8 gaJOOsSZnpyWFPA== X-Developer-Key: i=nikita@trvn.ru; a=openpgp; fpr=C084AF54523FAA837E2EC547431CECEE2819BF75 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 20 Oct 2023 08:34:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780289207679268881 X-GMAIL-MSGID: 1780289207679268881 sc7180 can make use of the adsp-baked soundcard, add relevant compatible to the documentation. Signed-off-by: Nikita Travkin Acked-by: Conor Dooley --- Documentation/devicetree/bindings/sound/qcom,sm8250.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml index 262de7a60a73..e082a4fe095d 100644 --- a/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml +++ b/Documentation/devicetree/bindings/sound/qcom,sm8250.yaml @@ -25,6 +25,7 @@ properties: - qcom,apq8016-sbc-sndcard - qcom,msm8916-qdsp6-sndcard - qcom,qrb5165-rb5-sndcard + - qcom,sc7180-qdsp6-sndcard - qcom,sc8280xp-sndcard - qcom,sdm845-sndcard - qcom,sm8250-sndcard From patchwork Fri Oct 20 15:33:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Travkin X-Patchwork-Id: 156194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1140939vqb; Fri, 20 Oct 2023 08:35:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEVJA00tZclCBrVbKq4W2kWIQ+ygVD1lGLcrzIOOcHR4E4l4nPgEnpYMGYC1MwXdbHV62Vx X-Received: by 2002:a17:902:db0c:b0:1ca:7909:6ee6 with SMTP id m12-20020a170902db0c00b001ca79096ee6mr2174382plx.61.1697816104893; Fri, 20 Oct 2023 08:35:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697816104; cv=none; d=google.com; s=arc-20160816; b=CLOdDiI8Id8gnTaQtfE/gkFkN8uVQNH3PYUyJKT6f8qzoOS5L1VTAKsGxXlCm5049h +rkBGLUI7F1sRjCn+Y622HdRmMmoMAviFBQhvLCShgpESNNtOO+0DrIcd29FhRrVVg9c H5H83ZMVxxhBsj+ooCxgnEM/o9xryfQP0uCmDnqEUtzW7Wh4u8FAW2Kq8ZLsuBPPgJU8 v7C4cOeDvFFHOlmcN9zRoKF33IZ0P+unDjqAbUXZ2FvODGwOBV4rSkgC2qmQHENSwFQk QcqOr2cEcwAsE2YJyoCI07hlb9+6y/nYY1UM/U1sB8Ed1sn30BYgy0abH9I/nNHJ16rt IJwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=zZ0TSATkcVZEE4xi4fwJriWCSmggoxXknGkyBbR1BM4=; fh=4LrQlIJMLB9MQJPZV0BDkVpvo6vlDY9OyiaVtw6KelY=; b=PZ4B1k1SoZkMAHWB1q2d2HuiW18qeRqNqGJx99JB/H4WTmoGaEsjm3tLt5Z6oPD2KJ eGWu+AJ4tftxFnr3LE1nT+DSRwgmz6ydYpO5bYzj+VctJEQ+FBMucEtfvp17CidcIHon qycL6hwDYLVR7MY1euUXZvS7aur6KVTZmy7gym3sxfqqdC11JsvYruwtfA7b+ZkDdffj QTFLN8Ga4iTpLbCbyM+BEhNHEe5ADaPHg1qljYZIJt1yxzHCJt3IN/mtZbVsPd69/YMX lBMiWmZpAUo+JjcqzmSuZLs/w/qFFsbj5OMiieeCEwWIRuASSLs3cNcOeP9R+SYNgIRY jJvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=u57TrMvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id x15-20020a170902a38f00b001c9c3a16a91si1978593pla.70.2023.10.20.08.35.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 08:35:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@trvn.ru header.s=mail header.b=u57TrMvU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=trvn.ru Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id CE97280774C0; Fri, 20 Oct 2023 08:35:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377796AbjJTPer (ORCPT + 26 others); Fri, 20 Oct 2023 11:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377779AbjJTPei (ORCPT ); Fri, 20 Oct 2023 11:34:38 -0400 Received: from box.trvn.ru (box.trvn.ru [194.87.146.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F553B8; Fri, 20 Oct 2023 08:34:36 -0700 (PDT) Received: from authenticated-user (box.trvn.ru [194.87.146.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.trvn.ru (Postfix) with ESMTPSA id 27E8B4C0D6; Fri, 20 Oct 2023 20:34:13 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=trvn.ru; s=mail; t=1697816055; bh=1G83yOA3pOihJUDfxdRhCahaBLCDVm9iIdo/sbEw74s=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=u57TrMvUD2LYm/QOjQN1D9Med82xFogC+wkxbX2xTedwdEDaG8S25urIqltV7aW7D 4TxEU+Bodcsxi5WlkwefEUF8jWLmRQ33n3ADF7gBYEEuM6f4hLdISRCtCPsWVC5q9n 4dj9775yzrPGnxhPDVIszQoV/25E22pI2qyXf0yNy6oom6jAx5XJcxqo8mZpjPQF2v /+58vGmOLqpnd6k4ddJ15U1GfEG2p1xyXUnwiP7rw5X0CRBmAh1JF6Mieu1WKykbq/ 2ohEMAh3/qjHMl0/1gju6ppn9C49vT+V6ctDsTqLEFDdAYNHHBntJPXG/NAyifLmqw 6OT5Bh/YsCycw== From: Nikita Travkin Date: Fri, 20 Oct 2023 20:33:47 +0500 Subject: [PATCH 2/2] ASoC: qcom: sc7180: Add support for qdsp6 baked sound MIME-Version: 1.0 Message-Id: <20231020-sc7180-qdsp-sndcard-v1-2-157706b7d06f@trvn.ru> References: <20231020-sc7180-qdsp-sndcard-v1-0-157706b7d06f@trvn.ru> In-Reply-To: <20231020-sc7180-qdsp-sndcard-v1-0-157706b7d06f@trvn.ru> To: Andy Gross , Bjorn Andersson , Konrad Dybcio , Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai Cc: jenneron@postmarketos.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Nikita Travkin X-Developer-Signature: v=1; a=openpgp-sha256; l=10027; i=nikita@trvn.ru; h=from:subject:message-id; bh=1G83yOA3pOihJUDfxdRhCahaBLCDVm9iIdo/sbEw74s=; b=owEBbQKS/ZANAwAIAUMc7O4oGb91AcsmYgBlMp3yBxWeHPei58OHhvH81vnygDBHXXPgYVfhR 1B7cydUnrKJAjMEAAEIAB0WIQTAhK9UUj+qg34uxUdDHOzuKBm/dQUCZTKd8gAKCRBDHOzuKBm/ dYB7EACe/4fvl91OnPKs7NMSDVbv860CM3f7ZiSxRMSkDp0pzGLIYAsW4CaeilJAZRhBJAFLrfz unfLe2tYA9BIZU6BprVHlDjYDTRr3RZLm6y8qrFfCzcqL6kcfxvnXP7vfMz3RqgWUyG8EhhRDGA vDf9Do371DrNIppqj428cpCCzRFh4xC315Dh4kGy7hAUoAm6iLwsOL6o76cP68y/sBwzlR6Ifax UvuAHdpgB4U0ywNinUrA81iQDTvZ7P1ijrNUcRqhuUOrp56BAUAawDA1Gz1IacBImPa0zVL1SLC onC2LjIjjlEUThUWy/h8by3Rz5S+qJb44P4lNUEh7PZItvjOf51bB6i/AOCoIHNNyJA70FD0hhH Nkpsl4kd129maSN8fub7JxYQ3sEEJitL4d9+wAV90xGRx7rckhjeZxQW8QB9dEe/TqhqveOOZlm x4649bP7F65hpx+02rlWm/T55FMsQWT8DS4kmdpGK12mTa+7IkxZIYbBTPxz9MDdfyMkp57amSq WO9gXF5pavDn2QzFkOinphhI7piEX6lUPRQ6dJ9PGA+ui2Yded+DGAW5gNzdt1ZYk2aPrT7SqBC bE+Gmsf1p9c5HWfsK41Cm1WPczPkftV6CJvbPnoY8zdupmOzPcthFN5rkOSf9E+0UFFWNbJHCWJ TTcXr/cJLLE5HmA== X-Developer-Key: i=nikita@trvn.ru; a=openpgp; fpr=C084AF54523FAA837E2EC547431CECEE2819BF75 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Fri, 20 Oct 2023 08:35:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780289220033500827 X-GMAIL-MSGID: 1780289220033500827 Some sc7180 devices use audio adsp to play sound. The setup for this adsp is similar to the dirrect lpass usage but requires the use of different link ids and clocks. This commit adds support for the qdsp based audio, reusing the common parts like audio codec setup and jack creation. Since the setup is mostly generic and codec specific setup is guarded behind a check, a generic compatible is added, similar to other platforms. Even though those changes target Acer Aspire 1 as the only user of the adsp audio on this platform present upstream at the moment of the commit, those changes should be either dirrectly compatible or trivially expandable to the other devices that will be added in the future. Signed-off-by: Nikita Travkin Tested-by: Anton Bambura --- sound/soc/qcom/sc7180.c | 195 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 173 insertions(+), 22 deletions(-) diff --git a/sound/soc/qcom/sc7180.c b/sound/soc/qcom/sc7180.c index 8e433e309f77..b0320a74d508 100644 --- a/sound/soc/qcom/sc7180.c +++ b/sound/soc/qcom/sc7180.c @@ -5,6 +5,7 @@ // sc7180.c -- ALSA SoC Machine driver for SC7180 #include +#include #include #include #include @@ -19,8 +20,10 @@ #include "../codecs/rt5682.h" #include "../codecs/rt5682s.h" #include "common.h" +#include "qdsp6/q6afe.h" #define DEFAULT_MCLK_RATE 19200000 +#define MI2S_BCLK_RATE 1536000 #define RT5682_PLL1_FREQ (48000 * 512) #define DRIVER_NAME "SC7180" @@ -133,12 +136,28 @@ static int sc7180_init(struct snd_soc_pcm_runtime *rtd) return 0; } -static int sc7180_snd_startup(struct snd_pcm_substream *substream) +static int sc7180_qdsp_init(struct snd_soc_pcm_runtime *rtd) { - 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 = snd_soc_rtd_to_cpu(rtd, 0); + + switch (cpu_dai->id) { + case PRIMARY_MI2S_RX: + return sc7180_headset_init(rtd); + case PRIMARY_MI2S_TX: + case TERTIARY_MI2S_RX: + return 0; + case DISPLAY_PORT_RX: + return sc7180_hdmi_init(rtd); + default: + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, + cpu_dai->id); + return -EINVAL; + } + return 0; +} + +static int sc7180_startup_realtek_codec(struct snd_soc_pcm_runtime *rtd) +{ struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); int pll_id, pll_source, pll_in, pll_out, clk_id, ret; @@ -154,8 +173,40 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream) clk_id = RT5682S_SCLK_S_PLL2; pll_out = RT5682_PLL1_FREQ; pll_in = DEFAULT_MCLK_RATE; + } else { + return 0; + } + snd_soc_dai_set_fmt(codec_dai, + SND_SOC_DAIFMT_BC_FC | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_I2S); + + /* Configure PLL1 for codec */ + ret = snd_soc_dai_set_pll(codec_dai, pll_id, pll_source, + pll_in, pll_out); + 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, clk_id, pll_out, + SND_SOC_CLOCK_IN); + if (ret) + dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", + ret); + + return ret; +} + +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 = snd_soc_rtd_to_cpu(rtd, 0); + int ret; + switch (cpu_dai->id) { case MI2S_PRIMARY: if (++data->pri_mi2s_clk_count == 1) { @@ -165,30 +216,66 @@ static int sc7180_snd_startup(struct snd_pcm_substream *substream) SNDRV_PCM_STREAM_PLAYBACK); } - snd_soc_dai_set_fmt(codec_dai, - SND_SOC_DAIFMT_BC_FC | - SND_SOC_DAIFMT_NB_NF | - SND_SOC_DAIFMT_I2S); - - /* Configure PLL1 for codec */ - ret = snd_soc_dai_set_pll(codec_dai, pll_id, pll_source, - pll_in, pll_out); - if (ret) { - dev_err(rtd->dev, "can't set codec pll: %d\n", ret); + ret = sc7180_startup_realtek_codec(rtd); + if (ret) return ret; + + break; + case MI2S_SECONDARY: + break; + case LPASS_DP_RX: + break; + default: + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, + cpu_dai->id); + return -EINVAL; + } + return 0; +} + +static int sc7180_qdsp_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 = snd_soc_rtd_to_cpu(rtd, 0); + struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0); + int ret; + + switch (cpu_dai->id) { + case PRIMARY_MI2S_RX: + case PRIMARY_MI2S_TX: + if (++data->pri_mi2s_clk_count == 1) { + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_MCLK_1, + DEFAULT_MCLK_RATE, + SNDRV_PCM_STREAM_PLAYBACK); + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT, + MI2S_BCLK_RATE, + SNDRV_PCM_STREAM_PLAYBACK); } - /* Configure sysclk for codec */ - ret = snd_soc_dai_set_sysclk(codec_dai, clk_id, pll_out, - SND_SOC_CLOCK_IN); + snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP); + + ret = sc7180_startup_realtek_codec(rtd); if (ret) - dev_err(rtd->dev, "snd_soc_dai_set_sysclk err = %d\n", - ret); + return ret; break; - case MI2S_SECONDARY: + case TERTIARY_MI2S_RX: + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT, + MI2S_BCLK_RATE, + SNDRV_PCM_STREAM_PLAYBACK); + + snd_soc_dai_set_fmt(codec_dai, + SND_SOC_DAIFMT_BC_FC | + SND_SOC_DAIFMT_NB_NF | + SND_SOC_DAIFMT_I2S); + snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_BP_FP); break; - case LPASS_DP_RX: + case DISPLAY_PORT_RX: break; default: dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, @@ -246,6 +333,42 @@ static void sc7180_snd_shutdown(struct snd_pcm_substream *substream) } } +static void sc7180_qdsp_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 = snd_soc_rtd_to_cpu(rtd, 0); + + switch (cpu_dai->id) { + case PRIMARY_MI2S_RX: + case PRIMARY_MI2S_TX: + if (--data->pri_mi2s_clk_count == 0) { + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_MCLK_1, + 0, + SNDRV_PCM_STREAM_PLAYBACK); + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_PRI_MI2S_IBIT, + 0, + SNDRV_PCM_STREAM_PLAYBACK); + } + break; + case TERTIARY_MI2S_RX: + snd_soc_dai_set_sysclk(cpu_dai, + Q6AFE_LPASS_CLK_ID_TER_MI2S_IBIT, + 0, + SNDRV_PCM_STREAM_PLAYBACK); + break; + case DISPLAY_PORT_RX: + break; + default: + dev_err(rtd->dev, "%s: invalid dai id 0x%x\n", __func__, + cpu_dai->id); + break; + } +} + static int sc7180_adau7002_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); @@ -294,11 +417,30 @@ static int sc7180_adau7002_snd_startup(struct snd_pcm_substream *substream) return 0; } +static int sc7180_qdsp_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct snd_interval *rate = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); + + rate->min = rate->max = 48000; + channels->min = channels->max = 2; + + return 0; +} + static const struct snd_soc_ops sc7180_ops = { .startup = sc7180_snd_startup, .shutdown = sc7180_snd_shutdown, }; +static const struct snd_soc_ops sc7180_qdsp_ops = { + .startup = sc7180_qdsp_snd_startup, + .shutdown = sc7180_qdsp_snd_shutdown, +}; + static const struct snd_soc_ops sc7180_adau7002_ops = { .startup = sc7180_adau7002_snd_startup, }; @@ -354,7 +496,7 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) struct snd_soc_dai_link *link; int ret; int i; - bool no_headphone = false; + bool qdsp = false, no_headphone = false; /* Allocate the private data */ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); @@ -390,6 +532,8 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) no_headphone = true; card->dapm_widgets = sc7180_adau7002_snd_widgets; card->num_dapm_widgets = ARRAY_SIZE(sc7180_adau7002_snd_widgets); + } else if (of_device_is_compatible(dev->of_node, "qcom,sc7180-qdsp6-sndcard")) { + qdsp = true; } ret = qcom_snd_parse_of(card); @@ -400,6 +544,12 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) if (no_headphone) { link->ops = &sc7180_adau7002_ops; link->init = sc7180_adau7002_init; + } else if (qdsp) { + if (link->no_pcm == 1) { + link->ops = &sc7180_qdsp_ops; + link->be_hw_params_fixup = sc7180_qdsp_be_hw_params_fixup; + link->init = sc7180_qdsp_init; + } } else { link->ops = &sc7180_ops; link->init = sc7180_init; @@ -412,6 +562,7 @@ static int sc7180_snd_platform_probe(struct platform_device *pdev) static const struct of_device_id sc7180_snd_device_id[] = { {.compatible = "google,sc7180-trogdor"}, {.compatible = "google,sc7180-coachz"}, + {.compatible = "qcom,sc7180-qdsp6-sndcard"}, {}, }; MODULE_DEVICE_TABLE(of, sc7180_snd_device_id);