Message ID | 1509989180-22617-2-git-send-email-okaya@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 06/11/17 17:26, Sinan Kaya wrote: > Add support for probing the newer HW. > > Signed-off-by: Sinan Kaya <okaya@codeaurora.org> > --- > drivers/dma/qcom/hidma.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c > index e366985..29d6aaa 100644 > --- a/drivers/dma/qcom/hidma.c > +++ b/drivers/dma/qcom/hidma.c > @@ -749,9 +749,13 @@ static bool hidma_msi_capable(struct device *dev) > return false; > > ret = strcmp(of_compat, "qcom,hidma-1.1"); > + if (ret) > + ret = strcmp(of_compat, "qcom,hidma-1.2"); > } else { > #ifdef CONFIG_ACPI > ret = strcmp(acpi_device_hid(adev), "QCOM8062"); > + if (ret) > + ret = strcmp(acpi_device_hid(adev), "QCOM8063"); This string-juggling looks to have already hit the point at which it doesn't scale well - it would be a lot nicer to make use of of_device_get_match_data() and the ACPI equivalent to abstract the version-specific data appropriately. Robin. > #endif > } > return ret == 0; > @@ -954,6 +958,7 @@ static int hidma_remove(struct platform_device *pdev) > static const struct acpi_device_id hidma_acpi_ids[] = { > {"QCOM8061"}, > {"QCOM8062"}, > + {"QCOM8063"}, > {}, > }; > MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids); > @@ -962,6 +967,7 @@ static int hidma_remove(struct platform_device *pdev) > static const struct of_device_id hidma_match[] = { > {.compatible = "qcom,hidma-1.0",}, > {.compatible = "qcom,hidma-1.1",}, > + {.compatible = "qcom,hidma-1.2",}, > {}, > }; > MODULE_DEVICE_TABLE(of, hidma_match); >
On 11/6/2017 1:03 PM, Robin Murphy wrote: >> #ifdef CONFIG_ACPI >> ret = strcmp(acpi_device_hid(adev), "QCOM8062"); >> + if (ret) >> + ret = strcmp(acpi_device_hid(adev), "QCOM8063"); > This string-juggling looks to have already hit the point at which it > doesn't scale well - it would be a lot nicer to make use of > of_device_get_match_data() and the ACPI equivalent to abstract the > version-specific data appropriately. Sure, let me do some research.
On 11/6/2017 1:15 PM, Sinan Kaya wrote: > On 11/6/2017 1:03 PM, Robin Murphy wrote: >>> #ifdef CONFIG_ACPI >>> ret = strcmp(acpi_device_hid(adev), "QCOM8062"); >>> + if (ret) >>> + ret = strcmp(acpi_device_hid(adev), "QCOM8063"); >> This string-juggling looks to have already hit the point at which it >> doesn't scale well - it would be a lot nicer to make use of >> of_device_get_match_data() and the ACPI equivalent to abstract the >> version-specific data appropriately. > > Sure, let me do some research. > I just wanted to double check here. This is what I can do: 1. Maintain different match tables for different driver capabilities. 2. Instead of doing open-coded strcmp, I can do match against different tables using acpi_match_device/of_match_device. Hope this works for you.
On Mon, Nov 06, 2017 at 05:09:29PM -0500, Sinan Kaya wrote: > On 11/6/2017 1:15 PM, Sinan Kaya wrote: > > On 11/6/2017 1:03 PM, Robin Murphy wrote: > >>> #ifdef CONFIG_ACPI > >>> ret = strcmp(acpi_device_hid(adev), "QCOM8062"); > >>> + if (ret) > >>> + ret = strcmp(acpi_device_hid(adev), "QCOM8063"); > >> This string-juggling looks to have already hit the point at which it > >> doesn't scale well - it would be a lot nicer to make use of > >> of_device_get_match_data() and the ACPI equivalent to abstract the > >> version-specific data appropriately. > > > > Sure, let me do some research. > > > > I just wanted to double check here. > > This is what I can do: > 1. Maintain different match tables for different driver capabilities. > 2. Instead of doing open-coded strcmp, I can do match against different tables > using acpi_match_device/of_match_device. > > Hope this works for you. Sounds better to me. You should have common match where capabilities are same.
diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index e366985..29d6aaa 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c @@ -749,9 +749,13 @@ static bool hidma_msi_capable(struct device *dev) return false; ret = strcmp(of_compat, "qcom,hidma-1.1"); + if (ret) + ret = strcmp(of_compat, "qcom,hidma-1.2"); } else { #ifdef CONFIG_ACPI ret = strcmp(acpi_device_hid(adev), "QCOM8062"); + if (ret) + ret = strcmp(acpi_device_hid(adev), "QCOM8063"); #endif } return ret == 0; @@ -954,6 +958,7 @@ static int hidma_remove(struct platform_device *pdev) static const struct acpi_device_id hidma_acpi_ids[] = { {"QCOM8061"}, {"QCOM8062"}, + {"QCOM8063"}, {}, }; MODULE_DEVICE_TABLE(acpi, hidma_acpi_ids); @@ -962,6 +967,7 @@ static int hidma_remove(struct platform_device *pdev) static const struct of_device_id hidma_match[] = { {.compatible = "qcom,hidma-1.0",}, {.compatible = "qcom,hidma-1.1",}, + {.compatible = "qcom,hidma-1.2",}, {}, }; MODULE_DEVICE_TABLE(of, hidma_match);
Add support for probing the newer HW. Signed-off-by: Sinan Kaya <okaya@codeaurora.org> --- drivers/dma/qcom/hidma.c | 6 ++++++ 1 file changed, 6 insertions(+)