OSDN Git Service

Merge tag 'v4.4.207' into 10
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / pinctrl / qcom / pinctrl-ssbi-gpio.c
index a0904e4..661448e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2015, Sony Mobile Communications AB.
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013, 2018 The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -23,6 +23,7 @@
 #include <linux/gpio.h>
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
 
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 
@@ -378,7 +379,7 @@ static int pm8xxx_pin_config_set(struct pinctrl_dev *pctldev,
                        banks |= BIT(0);
                        break;
                case PM8XXX_QCOM_DRIVE_STRENGH:
-                       if (arg > PMIC_GPIO_STRENGTH_LOW) {
+                       if (arg > PM8921_GPIO_STRENGTH_LOW) {
                                dev_err(pctrl->dev, "invalid drive strength\n");
                                return -EINVAL;
                        }
@@ -664,11 +665,12 @@ static int pm8xxx_pin_populate(struct pm8xxx_gpio *pctrl,
 }
 
 static const struct of_device_id pm8xxx_gpio_of_match[] = {
-       { .compatible = "qcom,pm8018-gpio", .data = (void *)6 },
-       { .compatible = "qcom,pm8038-gpio", .data = (void *)12 },
-       { .compatible = "qcom,pm8058-gpio", .data = (void *)40 },
-       { .compatible = "qcom,pm8917-gpio", .data = (void *)38 },
-       { .compatible = "qcom,pm8921-gpio", .data = (void *)44 },
+       { .compatible = "qcom,pm8018-gpio" },
+       { .compatible = "qcom,pm8038-gpio" },
+       { .compatible = "qcom,pm8058-gpio" },
+       { .compatible = "qcom,pm8917-gpio" },
+       { .compatible = "qcom,pm8921-gpio" },
+       { .compatible = "qcom,ssbi-gpio" },
        { },
 };
 MODULE_DEVICE_TABLE(of, pm8xxx_gpio_of_match);
@@ -679,14 +681,19 @@ static int pm8xxx_gpio_probe(struct platform_device *pdev)
        struct pinctrl_pin_desc *pins;
        struct pm8xxx_gpio *pctrl;
        int ret;
-       int i;
+       int i, npins;
 
        pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
        if (!pctrl)
                return -ENOMEM;
 
        pctrl->dev = &pdev->dev;
-       pctrl->npins = (unsigned long)of_device_get_match_data(&pdev->dev);
+       npins = platform_irq_count(pdev);
+       if (!npins)
+               return -EINVAL;
+       if (npins < 0)
+               return npins;
+       pctrl->npins = npins;
 
        pctrl->regmap = dev_get_regmap(pdev->dev.parent, NULL);
        if (!pctrl->regmap) {