From patchwork Thu May 2 12:10:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabien Parent X-Patchwork-Id: 10930279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3FFBF933 for ; Sun, 5 May 2019 15:55:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BBB128068 for ; Sun, 5 May 2019 15:55:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2027A2863C; Sun, 5 May 2019 15:55:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7535D28068 for ; Sun, 5 May 2019 15:55:53 +0000 (UTC) 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 A161718B1; Sun, 5 May 2019 17:55:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A161718B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1557071751; bh=KqYCX2j4yYHSfjG2A3qqIXK7jRt5XKh1GqxjcCcusl0=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QZ3UtsCdWT0b4qSEBsQs7b4zui3CEiYXk4tG9OFNORssQcmsvwf4hnBNEI+fIrSlZ qG8IbPXeq87CFuneVTwjUQdAuT6580BQTPc+q++1Dk0HJaOBhETxL9Z5tnjOXbiCt/ fRsB4O2Zr8dBSyqXc8oyKa3IqCCbmCWIJIwu17Pk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3ABD1F896DF; Sun, 5 May 2019 17:54:05 +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 64A84F896EA; Thu, 2 May 2019 14:10:58 +0200 (CEST) Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) (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 15E60F8075A for ; Thu, 2 May 2019 14:10:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 15E60F8075A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="xHqWaiJW" Received: by mail-wm1-x342.google.com with SMTP id b188so3379716wmb.0 for ; Thu, 02 May 2019 05:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QoGRmL9hNOPY+eFMV8Hy2PltfqYDajcTCyiSgjQt9SQ=; b=xHqWaiJWsWUcZhoNbhOVBcJzfg9qdsYw5E2q3LjZu9iNGHbzEyPhLzBGVHZA6jT6KV 6Rtgs1XdKNUB6RCaHd11VIf1KnAUz5OPdkXzXacvy50eQe18yccKyj01+YzaridlzwTR j7yeJj/hnwUDO0jx0ea4gdQcYrJ/KAoQO2Pjnva1wD9MOKFXhuutHa5Uu3hzUkodrTdz a9HxFjfRBg7jiXHRRJbabYEkCNeAHDm5+AsVkCyLloIF6V/QRsR00pUUqrvbtFiYGAmS i4i+68mRlvdS3nrxG4lfLl72/v6dL1ev8BRaeVLfeeNqIkXwtORNEzNtNF0Gh2UQobnY +lGA== 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=QoGRmL9hNOPY+eFMV8Hy2PltfqYDajcTCyiSgjQt9SQ=; b=c3fqIz4nxXHOBSAdHr5aIRr7xpVWRsTe8oK2bdtoDVIHv3GkvQCHYboc4sgXboE/nA huuq9Jbwl+9EmV5Oh++vTwCe+T9o8CzQUgXGDirKcYQWH56YQ8riGjim6Vp7h1g+z+JD NMxw3vbaxwbBfYPaZSXHNf1owzxikllmt3GIRc6F4oQK7uI31chkv/bRRSkPHL5ZRYI5 QeeVfQv054DQtT6iqu4i4gtqo/skGv9PajVqp2qy6nSDQc067DntCxCjVDIQ50suJYGr X+SC5wF8xxEsdUvwhkmp/eGs/ZjeBKIhbOT4DF3JrKxl6nQqo/FNJ+gJcv0XnR7JOIGj 98qg== X-Gm-Message-State: APjAAAWbpnbf2dByStdywapsuJXtCucZNEje2Dt1pqUj9xVhn5TzraYq LRTXbVjuiFi+aGxrhIQgrOGNbw== X-Google-Smtp-Source: APXvYqzfD7lY9qYA6s3UXeqowSYnQbSJRYuX0+C/KKMF9ab6t31N4mkff3S6Ouo/4i4XI4ETpGxpDA== X-Received: by 2002:a7b:c010:: with SMTP id c16mr2137167wmb.82.1556799054205; Thu, 02 May 2019 05:10:54 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-8-187.w90-86.abo.wanadoo.fr. [90.86.125.187]) by smtp.gmail.com with ESMTPSA id u9sm3648348wmd.14.2019.05.02.05.10.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 05:10:53 -0700 (PDT) From: Fabien Parent To: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, matthias.bgg@gmail.com, perex@perex.cz, tiwai@suse.com, kaichieh.chuang@mediatek.com, shunli.wang@mediatek.com Date: Thu, 2 May 2019 14:10:37 +0200 Message-Id: <20190502121041.8045-2-fparent@baylibre.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190502121041.8045-1-fparent@baylibre.com> References: <20190502121041.8045-1-fparent@baylibre.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 05 May 2019 17:54:01 +0200 Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Fabien Parent , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH 1/5] ASoC: mediatek: make agent_disable, msb & hd fields optional 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" X-Virus-Scanned: ClamAV using ClamSMTP Not every SoC have the following registers: agent_disable_reg, msg_reg, and hd_reg. Make them optional in order to allow more SoC to use the common DAI FE code. Signed-off-by: Fabien Parent --- sound/soc/mediatek/common/mtk-afe-fe-dai.c | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index cf4978be062f..f39f5d8c4244 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -47,10 +47,13 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream, snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 16); + /* enable agent */ - mtk_regmap_update_bits(afe->regmap, memif->data->agent_disable_reg, - 1 << memif->data->agent_disable_shift, - 0 << memif->data->agent_disable_shift); + if (memif->data->agent_disable_shift >= 0) + mtk_regmap_update_bits(afe->regmap, + memif->data->agent_disable_reg, + 1 << memif->data->agent_disable_shift, + 0 << memif->data->agent_disable_shift); snd_soc_set_runtime_hwparams(substream, mtk_afe_hardware); @@ -143,9 +146,10 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, memif->phys_buf_addr + memif->buffer_size - 1); /* set MSB to 33-bit */ - mtk_regmap_update_bits(afe->regmap, memif->data->msb_reg, - 1 << memif->data->msb_shift, - msb_at_bit33 << memif->data->msb_shift); + if (memif->data->msb_shift >= 0) + mtk_regmap_update_bits(afe->regmap, memif->data->msb_reg, + 1 << memif->data->msb_shift, + msb_at_bit33 << memif->data->msb_shift); /* set channel */ if (memif->data->mono_shift >= 0) { @@ -269,9 +273,10 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, break; } - mtk_regmap_update_bits(afe->regmap, memif->data->hd_reg, - 1 << memif->data->hd_shift, - hd_audio << memif->data->hd_shift); + if (memif->data->hd_shift >= 0) + mtk_regmap_update_bits(afe->regmap, memif->data->hd_reg, + 1 << memif->data->hd_shift, + hd_audio << memif->data->hd_shift); return 0; }