aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSinan Kaya <okaya@codeaurora.org>2017-12-13 02:20:52 -0500
committerVinod Koul <vinod.koul@intel.com>2017-12-13 03:42:10 -0500
commit95fbfb7aa28d05e7d1799de40ea606db52770562 (patch)
tree66ef1f3d4da64bf0332d573dab32a185e533f228
parentafc996a368a58606ac946715fcef60f25c75d483 (diff)
dmaengine: qcom_hidma: Add support for the new revision
Add support for probing the newer HW and also organize MSI capable hardware into an array for maintenance reasons. Signed-off-by: Sinan Kaya <okaya@codeaurora.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/qcom/hidma.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c
index e3669850aef4..c146c6d3832e 100644
--- a/drivers/dma/qcom/hidma.c
+++ b/drivers/dma/qcom/hidma.c
@@ -50,6 +50,7 @@
50#include <linux/slab.h> 50#include <linux/slab.h>
51#include <linux/spinlock.h> 51#include <linux/spinlock.h>
52#include <linux/of_dma.h> 52#include <linux/of_dma.h>
53#include <linux/of_device.h>
53#include <linux/property.h> 54#include <linux/property.h>
54#include <linux/delay.h> 55#include <linux/delay.h>
55#include <linux/acpi.h> 56#include <linux/acpi.h>
@@ -104,6 +105,9 @@ static unsigned int nr_desc_prm;
104module_param(nr_desc_prm, uint, 0644); 105module_param(nr_desc_prm, uint, 0644);
105MODULE_PARM_DESC(nr_desc_prm, "number of descriptors (default: 0)"); 106MODULE_PARM_DESC(nr_desc_prm, "number of descriptors (default: 0)");
106 107
108enum hidma_cap {
109 HIDMA_MSI_CAP = 1,
110};
107 111
108/* process completed descriptors */ 112/* process completed descriptors */
109static void hidma_process_completed(struct hidma_chan *mchan) 113static void hidma_process_completed(struct hidma_chan *mchan)
@@ -736,25 +740,12 @@ static int hidma_request_msi(struct hidma_dev *dmadev,
736#endif 740#endif
737} 741}
738 742
739static bool hidma_msi_capable(struct device *dev) 743static bool hidma_test_capability(struct device *dev, enum hidma_cap test_cap)
740{ 744{
741 struct acpi_device *adev = ACPI_COMPANION(dev); 745 enum hidma_cap cap;
742 const char *of_compat;
743 int ret = -EINVAL;
744
745 if (!adev || acpi_disabled) {
746 ret = device_property_read_string(dev, "compatible",
747 &of_compat);
748 if (ret)
749 return false;
750 746
751 ret = strcmp(of_compat, "qcom,hidma-1.1"); 747 cap = (enum hidma_cap) device_get_match_data(dev);
752 } else { 748 return cap ? ((cap & test_cap) > 0) : 0;
753#ifdef CONFIG_ACPI
754 ret = strcmp(acpi_device_hid(adev), "QCOM8062");
755#endif
756 }
757 return ret == 0;
758} 749}
759 750
760static int hidma_probe(struct platform_device *pdev) 751static int hidma_probe(struct platform_device *pdev)
@@ -834,8 +825,7 @@ static int hidma_probe(struct platform_device *pdev)
834 * Determine the MSI capability of the platform. Old HW doesn't 825 * Determine the MSI capability of the platform. Old HW doesn't
835 * support MSI. 826 * support MSI.
836 */ 827 */
837 msi = hidma_msi_capable(&pdev->dev); 828 msi = hidma_test_capability(&pdev->dev, HIDMA_MSI_CAP);
838
839 device_property_read_u32(&pdev->dev, "desc-count", 829 device_property_read_u32(&pdev->dev, "desc-count",
840 &dmadev->nr_descriptors); 830 &dmadev->nr_descriptors);
841 831
@@ -953,7 +943,8 @@ static int hidma_remove(struct platform_device *pdev)
953#if IS_ENABLED(CONFIG_ACPI) 943#if IS_ENABLED(CONFIG_ACPI)
954static const struct acpi_device_id hidma_acpi_ids[] = { 944static const struct acpi_device_id hidma_acpi_ids[] = {
955 {"QCOM8061"}, 945 {"QCOM8061"},
956 {"QCOM8062"}, 946 {"QCOM8062", HIDMA_MSI_CAP},
947 {"QCOM8063", HIDMA_MSI_CAP},
957 {}, 948 {},
958}; 949};
959MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids); 950MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids);
@@ -961,7 +952,8 @@ MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids);
961 952
962static const struct of_device_id hidma_match[] = { 953static const struct of_device_id hidma_match[] = {
963 {.compatible = "qcom,hidma-1.0",}, 954 {.compatible = "qcom,hidma-1.0",},
964 {.compatible = "qcom,hidma-1.1",}, 955 {.compatible = "qcom,hidma-1.1", .data = (void *)(HIDMA_MSI_CAP),},
956 {.compatible = "qcom,hidma-1.2", .data = (void *)(HIDMA_MSI_CAP),},
965 {}, 957 {},
966}; 958};
967MODULE_DEVICE_TABLE(of, hidma_match); 959MODULE_DEVICE_TABLE(of, hidma_match);