Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: qcom_hidma: allow ACPI/DT parameters to be overridden

Parameters like maximum read/write request size and the maximum
number of active transactions are currently configured in DT/ACPI.

This patch allows a user to override these to fine tune performance
for their application.

Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>

authored by

Sinan Kaya and committed by
Vinod Koul
13058e33 ccc07729

+51 -3
+5 -2
drivers/dma/qcom/hidma.c
··· 1 1 /* 2 2 * Qualcomm Technologies HIDMA DMA engine interface 3 3 * 4 - * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 795 795 device_property_read_u32(&pdev->dev, "desc-count", 796 796 &dmadev->nr_descriptors); 797 797 798 - if (!dmadev->nr_descriptors && nr_desc_prm) 798 + if (nr_desc_prm) { 799 + dev_info(&pdev->dev, "overriding number of descriptors as %d\n", 800 + nr_desc_prm); 799 801 dmadev->nr_descriptors = nr_desc_prm; 802 + } 800 803 801 804 if (!dmadev->nr_descriptors) 802 805 dmadev->nr_descriptors = HIDMA_NR_DEFAULT_DESC;
+46 -1
drivers/dma/qcom/hidma_mgmt.c
··· 1 1 /* 2 2 * Qualcomm Technologies HIDMA DMA engine Management interface 3 3 * 4 - * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved. 4 + * Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License version 2 and ··· 48 48 49 49 #define HIDMA_AUTOSUSPEND_TIMEOUT 2000 50 50 #define HIDMA_MAX_CHANNEL_WEIGHT 15 51 + 52 + static unsigned int max_write_request; 53 + module_param(max_write_request, uint, 0644); 54 + MODULE_PARM_DESC(max_write_request, 55 + "maximum write burst (default: ACPI/DT value)"); 56 + 57 + static unsigned int max_read_request; 58 + module_param(max_read_request, uint, 0644); 59 + MODULE_PARM_DESC(max_read_request, 60 + "maximum read burst (default: ACPI/DT value)"); 61 + 62 + static unsigned int max_wr_xactions; 63 + module_param(max_wr_xactions, uint, 0644); 64 + MODULE_PARM_DESC(max_wr_xactions, 65 + "maximum number of write transactions (default: ACPI/DT value)"); 66 + 67 + static unsigned int max_rd_xactions; 68 + module_param(max_rd_xactions, uint, 0644); 69 + MODULE_PARM_DESC(max_rd_xactions, 70 + "maximum number of read transactions (default: ACPI/DT value)"); 51 71 52 72 int hidma_mgmt_setup(struct hidma_mgmt_dev *mgmtdev) 53 73 { ··· 227 207 goto out; 228 208 } 229 209 210 + if (max_write_request) { 211 + dev_info(&pdev->dev, "overriding max-write-burst-bytes: %d\n", 212 + max_write_request); 213 + mgmtdev->max_write_request = max_write_request; 214 + } else 215 + max_write_request = mgmtdev->max_write_request; 216 + 230 217 rc = device_property_read_u32(&pdev->dev, "max-read-burst-bytes", 231 218 &mgmtdev->max_read_request); 232 219 if (rc) { 233 220 dev_err(&pdev->dev, "max-read-burst-bytes missing\n"); 234 221 goto out; 235 222 } 223 + if (max_read_request) { 224 + dev_info(&pdev->dev, "overriding max-read-burst-bytes: %d\n", 225 + max_read_request); 226 + mgmtdev->max_read_request = max_read_request; 227 + } else 228 + max_read_request = mgmtdev->max_read_request; 236 229 237 230 rc = device_property_read_u32(&pdev->dev, "max-write-transactions", 238 231 &mgmtdev->max_wr_xactions); ··· 253 220 dev_err(&pdev->dev, "max-write-transactions missing\n"); 254 221 goto out; 255 222 } 223 + if (max_wr_xactions) { 224 + dev_info(&pdev->dev, "overriding max-write-transactions: %d\n", 225 + max_wr_xactions); 226 + mgmtdev->max_wr_xactions = max_wr_xactions; 227 + } else 228 + max_wr_xactions = mgmtdev->max_wr_xactions; 256 229 257 230 rc = device_property_read_u32(&pdev->dev, "max-read-transactions", 258 231 &mgmtdev->max_rd_xactions); ··· 266 227 dev_err(&pdev->dev, "max-read-transactions missing\n"); 267 228 goto out; 268 229 } 230 + if (max_rd_xactions) { 231 + dev_info(&pdev->dev, "overriding max-read-transactions: %d\n", 232 + max_rd_xactions); 233 + mgmtdev->max_rd_xactions = max_rd_xactions; 234 + } else 235 + max_rd_xactions = mgmtdev->max_rd_xactions; 269 236 270 237 mgmtdev->priority = devm_kcalloc(&pdev->dev, 271 238 mgmtdev->dma_channels,