From patchwork Thu Aug 6 14:25:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 6960321 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8941CC05AC for ; Thu, 6 Aug 2015 14:30:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7233D20695 for ; Thu, 6 Aug 2015 14:30:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1383920274 for ; Thu, 6 Aug 2015 14:30:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 257A32617A5; Thu, 6 Aug 2015 16:30:34 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 0EE1326067D; Thu, 6 Aug 2015 16:26:06 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 681EF26067A; Thu, 6 Aug 2015 16:26:04 +0200 (CEST) Received: from mail-yk0-f176.google.com (mail-yk0-f176.google.com [209.85.160.176]) by alsa0.perex.cz (Postfix) with ESMTP id 5BD6F260593 for ; Thu, 6 Aug 2015 16:25:27 +0200 (CEST) Received: by ykax123 with SMTP id x123so63810739yka.1 for ; Thu, 06 Aug 2015 07:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HAl+t9N0IOp5a4BQdQLaQLZHQc1P2p/0T/849uwXoGE=; b=BVucWQZ7gWRPB3ktNOJ1ofzL4AzaB2z4EPRvVmAXkQ7iJ8lGVYLS9nQKsUQvg4heNr c7tqBx45e3eoY6+tHKSx8XwT9woZLwbxMq8VF9kpj3S+uWjNWyY/ASGeFMg0gdoU+1DS IAkWUrEXGrfAquaXvyP/cUbqR8q7qbDwXP5ZWPF2N6Qv7JisaCV1f/aP9cRW7gmU283K HTZ0OmY/Wxvv822aSYHWBpGZCcyGGQyD714rA5/iqXfcoplNkzLbPcJe8z7WExtoz98U cAP4pWWUqy25ct+f098wWZdSRr51zYCiPSiJUzdJHxU8wUBxBf6mvJMD5KA6lSDkMWV1 tOpw== X-Received: by 10.170.111.16 with SMTP id d16mr1963794ykb.29.1438871126802; Thu, 06 Aug 2015 07:25:26 -0700 (PDT) Received: from localhost.localdomain (static-74-96-105-49.washdc.fios.verizon.net. [74.96.105.49]) by smtp.gmail.com with ESMTPSA id k128sm6182789ywe.11.2015.08.06.07.25.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Aug 2015 07:25:26 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: broonie@kernel.org, airlied@gmail.com, dri-devel@lists.freedesktop.org, alsa-devel@alsa-project.org Date: Thu, 6 Aug 2015 10:25:09 -0400 Message-Id: <1438871112-25946-9-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1438871112-25946-1-git-send-email-alexander.deucher@amd.com> References: <1438871112-25946-1-git-send-email-alexander.deucher@amd.com> Cc: tiwai@suse.de, Maruthi Srinivas Bayyavarapu , lgirdwood@gmail.com Subject: [alsa-devel] [PATCH 09/12] drm/amd: remove bitfield usage in ACP IP module X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Maruthi Srinivas Bayyavarapu Replaced usage of bitfield logic with alternative Signed-off-by: Maruthi Bayyavarapu Reviewed- by: Alex Deucher --- drivers/gpu/drm/amd/acp/acp_hw.c | 61 +++++++++++++++++----------------------- drivers/gpu/drm/amd/acp/acp_hw.h | 22 +-------------- 2 files changed, 27 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/amd/acp/acp_hw.c b/drivers/gpu/drm/amd/acp/acp_hw.c index 7ee2aa6..744d908 100644 --- a/drivers/gpu/drm/amd/acp/acp_hw.c +++ b/drivers/gpu/drm/amd/acp/acp_hw.c @@ -131,7 +131,7 @@ static void config_dma_descriptor_in_sram(struct amd_acp_device *acp_dev, cgs_write_register(acp_prv->cgs_device, mmACP_SRBM_Targ_Idx_Addr, (sram_offset + 8)); cgs_write_register(acp_prv->cgs_device, mmACP_SRBM_Targ_Idx_Data, - descr_info->size_xfer_dir.val); + descr_info->xfer_val); } /* Initialize the DMA descriptor information for transfer between @@ -147,48 +147,44 @@ static void set_acp_sysmem_dma_descriptors(struct amd_acp_device *acp_dev, num_descr = 2; - dmadscr[0].size_xfer_dir.val = (u32) 0x0; + dmadscr[0].xfer_val = 0; if (direction == STREAM_PLAYBACK) { dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH12; dmadscr[0].dest = ACP_SHARED_RAM_BANK_1_ADDRESS + (size / 2); dmadscr[0].src = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS + (pte_offset * PAGE_SIZE_4K); - dmadscr[0].size_xfer_dir.s.trans_direction = - ACP_DMA_ATTRIBUTES_DAGB_ONION_TO_SHAREDMEM; - dmadscr[0].size_xfer_dir.s.size = (size / 2); - dmadscr[0].size_xfer_dir.s.ioc = (u32) 0x0; + dmadscr[0].xfer_val |= (DISABLE << 22) | + (ACP_DMA_ATTRIBUTES_DAGB_ONION_TO_SHAREDMEM << 16) | + (size / 2); } else { dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH14; dmadscr[0].src = ACP_SHARED_RAM_BANK_5_ADDRESS; dmadscr[0].dest = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS + (pte_offset * PAGE_SIZE_4K); - dmadscr[0].size_xfer_dir.s.trans_direction = - ACP_DMA_ATTRIBUTES_SHAREDMEM_TO_DAGB_ONION; - dmadscr[0].size_xfer_dir.s.size = size / 2; - dmadscr[0].size_xfer_dir.s.ioc = (u32) 0x1; + dmadscr[0].xfer_val |= + (ENABLE << 22) | + (ACP_DMA_ATTRIBUTES_SHAREDMEM_TO_DAGB_ONION << 16) | + (size / 2); } config_dma_descriptor_in_sram(acp_dev, dma_dscr_idx, &dmadscr[0]); - dmadscr[1].size_xfer_dir.val = (u32) 0x0; + dmadscr[1].xfer_val = 0; if (direction == STREAM_PLAYBACK) { dma_dscr_idx = PLAYBACK_END_DMA_DESCR_CH12; dmadscr[1].dest = ACP_SHARED_RAM_BANK_1_ADDRESS; dmadscr[1].src = ACP_INTERNAL_APERTURE_WINDOW_0_ADDRESS + (pte_offset * PAGE_SIZE_4K) + (size / 2); - dmadscr[1].size_xfer_dir.s.trans_direction = - ACP_DMA_ATTRIBUTES_DAGB_ONION_TO_SHAREDMEM; - dmadscr[1].size_xfer_dir.s.size = (size / 2); - dmadscr[1].size_xfer_dir.s.ioc = (u32) 0x0; + dmadscr[1].xfer_val |= (DISABLE << 22) | + (ACP_DMA_ATTRIBUTES_DAGB_ONION_TO_SHAREDMEM << 16) | + (size / 2); } else { dma_dscr_idx = CAPTURE_END_DMA_DESCR_CH14; - dmadscr[1].size_xfer_dir.s.trans_direction = - ACP_DMA_ATTRIBUTES_SHAREDMEM_TO_DAGB_ONION; - dmadscr[1].size_xfer_dir.val = (u32) 0x0; dmadscr[1].dest = dmadscr[0].dest + (size / 2); dmadscr[1].src = dmadscr[0].src + (size / 2); - dmadscr[1].size_xfer_dir.s.size = (size / 2); - dmadscr[1].size_xfer_dir.s.ioc = (u32) 0x1; + dmadscr[1].xfer_val |= (ENABLE << 22) | + (ACP_DMA_ATTRIBUTES_SHAREDMEM_TO_DAGB_ONION << 16) | + (size / 2); } config_dma_descriptor_in_sram(acp_dev, dma_dscr_idx, &dmadscr[1]); @@ -221,37 +217,32 @@ static void set_acp_to_i2s_dma_descriptors(struct amd_acp_device *acp_dev, num_descr = 2; - dmadscr[0].size_xfer_dir.val = (u32) 0x0; + dmadscr[0].xfer_val = 0; if (direction == STREAM_PLAYBACK) { dma_dscr_idx = PLAYBACK_START_DMA_DESCR_CH13; dmadscr[0].src = ACP_SHARED_RAM_BANK_1_ADDRESS; - dmadscr[0].size_xfer_dir.s.trans_direction = TO_ACP_I2S_1; - dmadscr[0].size_xfer_dir.s.size = (size / 2); - dmadscr[0].size_xfer_dir.s.ioc = (u32) 0x1; + dmadscr[0].xfer_val |= (ENABLE << 22) | (TO_ACP_I2S_1 << 16) | + (size / 2); } else { dma_dscr_idx = CAPTURE_START_DMA_DESCR_CH15; dmadscr[0].dest = ACP_SHARED_RAM_BANK_5_ADDRESS; - dmadscr[0].size_xfer_dir.s.trans_direction = FROM_ACP_I2S_1; - dmadscr[0].size_xfer_dir.s.size = (size / 2); - dmadscr[0].size_xfer_dir.s.ioc = (u32) 0x1; + dmadscr[0].xfer_val |= (ENABLE << 22) | + (FROM_ACP_I2S_1 << 16) | (size / 2); } config_dma_descriptor_in_sram(acp_dev, dma_dscr_idx, &dmadscr[0]); - dmadscr[1].size_xfer_dir.val = (u32) 0x0; + dmadscr[1].xfer_val = 0; if (direction == STREAM_PLAYBACK) { dma_dscr_idx = PLAYBACK_END_DMA_DESCR_CH13; dmadscr[1].src = dmadscr[0].src + (size / 2); - dmadscr[1].size_xfer_dir.s.trans_direction = TO_ACP_I2S_1; - dmadscr[1].size_xfer_dir.s.size = (size / 2); - dmadscr[1].size_xfer_dir.s.ioc = (u32) 0x1; - + dmadscr[1].xfer_val |= (ENABLE << 22) | (TO_ACP_I2S_1 << 16) | + (size / 2); } else { dma_dscr_idx = CAPTURE_END_DMA_DESCR_CH15; dmadscr[1].dest = dmadscr[0].dest + (size / 2); - dmadscr[1].size_xfer_dir.s.trans_direction = FROM_ACP_I2S_1; - dmadscr[1].size_xfer_dir.s.size = (size / 2); - dmadscr[1].size_xfer_dir.s.ioc = (u32) 0x1; + dmadscr[1].xfer_val |= (ENABLE << 22) | + (FROM_ACP_I2S_1 << 16) | (size / 2); } config_dma_descriptor_in_sram(acp_dev, dma_dscr_idx, &dmadscr[1]); diff --git a/drivers/gpu/drm/amd/acp/acp_hw.h b/drivers/gpu/drm/amd/acp/acp_hw.h index b58349c..e3a102c 100644 --- a/drivers/gpu/drm/amd/acp/acp_hw.h +++ b/drivers/gpu/drm/amd/acp/acp_hw.h @@ -73,26 +73,6 @@ enum { ACP_DMA_ATTRIBUTES_FORCE_SIZE = 0xF }; -typedef struct acp_dma_dscr_size_transfer_direction { - /* Specifies the number of bytes need to be transferred - * from source to destination memory. */ - u32 size:16; - /* Specifies transfer direction. */ - u32 trans_direction:4; - /* reserved. */ - u32 reserved1:2; - /* Specifies the IOC enable or not for descriptor. */ - /* Defaultly this will be 0, for the last descriptor, make it Enable */ - u32 ioc:1; - /* reserved. */ - u32 reserved2:9; -} acp_dma_dscr_size_transfer_direction_t; - -typedef union { - u32 val:32; - acp_dma_dscr_size_transfer_direction_t s; -} acp_dma_dscr_size_transfer_direction_u; - typedef struct acp_dma_dscr_transfer { /* Specifies the source memory location for the DMA data transfer. */ u32 src; @@ -103,7 +83,7 @@ typedef struct acp_dma_dscr_transfer { /* Specifies the number of bytes need to be transferred * from source to destination memory.Transfer direction & IOC enable */ - acp_dma_dscr_size_transfer_direction_u size_xfer_dir; + u32 xfer_val; /** Reserved for future use */ u32 reserved; } acp_dma_dscr_transfer_t;