Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3362188ybz; Mon, 4 May 2020 01:18:42 -0700 (PDT) X-Google-Smtp-Source: APiQypJj25svU8/X3i9MrV1evuRwNWERae7Om4YlxXlrWoMr1K5yBqkJIbYlCZy+OTQZm8II65cr X-Received: by 2002:a50:a883:: with SMTP id k3mr13333949edc.198.1588580322574; Mon, 04 May 2020 01:18:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588580322; cv=none; d=google.com; s=arc-20160816; b=HRcveEdhHUkx++TdAiy0LSpoF8IbG24MjaOLM1hx708eG6czMnrPrhIUsC8qTPVLkc 5y4vURhNGy61lzjb3SsBIirtpEdMcjmkMiq7iJFaD+DEP7pvTAyEzSKVuJkQltkDpIXb wOjlUX9GJR0BQntnGYumo6i4EKTEPuBvJwK8f8EiExOm0nZFrLq+bTbWKNzus8cGGWVR 7hB370MznvHh25s9GTdYLYLwa7ieIJU7/5zBJebePCI4M+vIIUka7+sD+L2HIAvf5YqX F/lMJU2e15DUNdWWWwga1Yr8s0MfvS1JkvP+LfDbw1TwsPgkM3vshR0Ig3zlBynz9bX7 D54A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=+t6kfCjvQiDL8r1qJvd+8QlpafsTcpsPq6mZIgSZ3b0=; b=A5mx8AdE62dFwr6nC4UahGEH1FewR/s1ov1Gw5MclxHcTr7yudhITXrVy+eRdiMgoy CG9mN3DiTxzHkgu7+QzdOs4mRib1KRIEdFUdtB3CeAVEBd37SEIZiLmYtgJNtTp5UdlG 7Qp39WAau/TZy43d244O3CQ+A/030EsFCdG6//8xFZr+iRFo37D14kIR3u+vkttkeEQ1 f1z4tiwDdDWotqMAv3ENkmrIaKuJXgt/At1RlKdVfBsV4G42agAaQUuZ5SiF3Dq9qpzh nuveRVmy5/mOXvlOcDWgI+UyI5eKGWgNTysXgqDfcImQ/BxkjDEZp6XUWPcuwKPqEOa9 CGNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="HdfD/OL3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si6178475edn.502.2020.05.04.01.18.18; Mon, 04 May 2020 01:18:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b="HdfD/OL3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728142AbgEDIQt (ORCPT + 99 others); Mon, 4 May 2020 04:16:49 -0400 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:10304 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727878AbgEDIQt (ORCPT ); Mon, 4 May 2020 04:16:49 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 04 May 2020 01:16:36 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 04 May 2020 01:16:49 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 04 May 2020 01:16:49 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 4 May 2020 08:16:48 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 4 May 2020 08:16:48 +0000 Received: from audio.nvidia.com (Not Verified[10.24.34.185]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 04 May 2020 01:16:48 -0700 From: Sameer Pujar To: , CC: , , , , , , , , , , , Sameer Pujar Subject: [PATCH 1/3] ALSA: hda/tegra: correct number of SDO lines for Tegra194 Date: Mon, 4 May 2020 13:46:14 +0530 Message-ID: <1588580176-2801-2-git-send-email-spujar@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588580176-2801-1-git-send-email-spujar@nvidia.com> References: <1588580176-2801-1-git-send-email-spujar@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1588580196; bh=+t6kfCjvQiDL8r1qJvd+8QlpafsTcpsPq6mZIgSZ3b0=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Type; b=HdfD/OL36bhYPiDNI63wTPpBKDNmqOQe+eT5Pjd3/NGNjEPNpjdCRA6TcO1Ncqef0 ep4/e3E5hFrfxS3YJlnJMU0ib1NMw2khzw3IByMzYjXOSU0ikQzW4NMWE33by5OBDs bjRBjSJdaKgeHsscXR3BvjobO1kaGp+a04BIMgNHDYMzJ35k0PYW+5z9Kp/m5+C8sc UlAkP5p1aK9X1zh0TkOAUoKmMP1mXisziko4bL7dU+M2+hy4pknuDkn7lrivuTqOXu b+Fl7G/CKKXp4xtPC6PzT5ZofrzOo/ggiPyDp8+YbAqnXSWMTPbDMgPbC65hcnR9za h7ysBosqw7dhw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Tegra194 supports 4 SDO lines but GCAP register indicates 2 lines. Thus it does not reflect the true capability of the HW. This patch presents a workaround by updating NSDO value accordingly in T_AZA_DBG_CFG_2 register. Signed-off-by: Sameer Pujar --- sound/pci/hda/hda_tegra.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 773992a..45dc544 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -52,10 +52,21 @@ #define HDA_IPFS_INTR_MASK 0x188 #define HDA_IPFS_EN_INTR (1 << 16) +/* FPCI */ +#define FPCI_DBG_CFG_2 0x10F4 +#define FPCI_GCAP_NSDO_SHIFT 18 +#define FPCI_GCAP_NSDO_MASK (0x3 << FPCI_GCAP_NSDO_SHIFT) + /* max number of SDs */ #define NUM_CAPTURE_SD 1 #define NUM_PLAYBACK_SD 1 +/* + * Tegra194 does not reflect correct number of SDO lines. Below macro + * is used to update the GCAP register to workaround the issue. + */ +#define TEGRA194_NUM_SDO_LINES 4 + struct hda_tegra { struct azx chip; struct device *dev; @@ -275,6 +286,7 @@ static int hda_tegra_init_clk(struct hda_tegra *hda) static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) { + struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); struct hdac_bus *bus = azx_bus(chip); struct snd_card *card = chip->card; int err; @@ -298,6 +310,26 @@ static int hda_tegra_first_init(struct azx *chip, struct platform_device *pdev) bus->irq = irq_id; card->sync_irq = bus->irq; + /* + * Tegra194 has 4 SDO lines and the STRIPE can be used to + * indicate how many of the SDO lines the stream should be + * striped. But GCAP register does not reflect the true + * capability of HW. Below workaround helps to fix this. + * + * GCAP_NSDO is bits 19:18 in T_AZA_DBG_CFG_2, + * 0 for 1 SDO, 1 for 2 SDO, 2 for 4 SDO lines. + */ + if (of_device_is_compatible(np, "nvidia,tegra194-hda")) { + u32 val; + + dev_info(card->dev, "Override SDO lines to %u\n", + TEGRA194_NUM_SDO_LINES); + + val = readl(hda->regs + FPCI_DBG_CFG_2) & ~FPCI_GCAP_NSDO_MASK; + val |= (TEGRA194_NUM_SDO_LINES >> 1) << FPCI_GCAP_NSDO_SHIFT; + writel(val, hda->regs + FPCI_DBG_CFG_2); + } + gcap = azx_readw(chip, GCAP); dev_dbg(card->dev, "chipset global capabilities = 0x%x\n", gcap); @@ -408,6 +440,7 @@ static int hda_tegra_create(struct snd_card *card, static const struct of_device_id hda_tegra_match[] = { { .compatible = "nvidia,tegra30-hda" }, + { .compatible = "nvidia,tegra194-hda" }, {}, }; MODULE_DEVICE_TABLE(of, hda_tegra_match); -- 2.7.4