Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1394885 > unrolled thread
| Started by | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| First post | 2016-05-05 07:40 +0200 |
| Last post | 2016-05-09 16:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v8 5/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver Lu Baolu <baolu.lu@linux.intel.com> - 2016-05-05 07:40 +0200
Re: [PATCH v8 5/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver Lee Jones <lee.jones@linaro.org> - 2016-05-09 16:30 +0200
| From | Lu Baolu <baolu.lu@linux.intel.com> |
|---|---|
| Date | 2016-05-05 07:40 +0200 |
| Subject | [PATCH v8 5/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver |
| Message-ID | <rvkb0-23G-9@gated-at.bofh.it> |
Some Intel platforms have an USB port mux controlled by GPIOs.
There's a single ACPI platform device that provides 1) USB ID
extcon device; 2) USB vbus regulator device; and 3) USB port
switch device. This MFD driver will split these 3 devices for
their respective drivers.
[baolu: removed .owner per platform_no_drv_owner.cocci]
Suggested-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Felipe Balbi <balbi@kernel.org>
---
drivers/mfd/Kconfig | 8 +++++
drivers/mfd/Makefile | 1 +
drivers/mfd/intel-vuport.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 98 insertions(+)
create mode 100644 drivers/mfd/intel-vuport.c
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index eea61e3..7e115ab 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1578,5 +1578,13 @@ config MFD_VEXPRESS_SYSREG
System Registers are the platform configuration block
on the ARM Ltd. Versatile Express board.
+config MFD_INTEL_VUPORT
+ tristate "Intel virtual USB port controller"
+ select MFD_CORE
+ depends on X86 && ACPI
+ help
+ Say Y here to enable support for Intel's dual role port mux
+ controlled by GPIOs.
+
endmenu
endif
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 5eaa6465d..65b0518 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -203,3 +203,4 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
+obj-$(CONFIG_MFD_INTEL_VUPORT) += intel-vuport.o
diff --git a/drivers/mfd/intel-vuport.c b/drivers/mfd/intel-vuport.c
new file mode 100644
index 0000000..fa84ed7
--- /dev/null
+++ b/drivers/mfd/intel-vuport.c
@@ -0,0 +1,89 @@
+/*
+ * MFD driver for Intel virtual USB port
+ *
+ * Copyright(c) 2016 Intel Corporation.
+ * Author: Lu Baolu <baolu.lu@linux.intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/acpi.h>
+#include <linux/gpio.h>
+#include <linux/mfd/core.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+
+/* ACPI GPIO Mappings */
+static const struct acpi_gpio_params id_gpio = { 0, 0, false };
+static const struct acpi_gpio_params vbus_gpio = { 1, 0, false };
+static const struct acpi_gpio_params mux_gpio = { 2, 0, false };
+static const struct acpi_gpio_mapping acpi_usb_gpios[] = {
+ { "id-gpios", &id_gpio, 1 },
+ { "gpio-gpios", &vbus_gpio, 1 },
+ { "usb_mux-gpios", &mux_gpio, 1 },
+ { },
+};
+
+static struct property_entry reg_properties[] = {
+ PROPERTY_ENTRY_STRING("supply-name", "regulator-usb-gpio"),
+ { },
+};
+
+static const struct property_set reg_properties_pset = {
+ .properties = reg_properties,
+};
+
+static const struct mfd_cell intel_vuport_mfd_cells[] = {
+ { .name = "extcon-usb-gpio", },
+ {
+ .name = "reg-fixed-voltage",
+ .pset = ®_properties_pset,
+ },
+ { .name = "intel-mux-gpio", },
+};
+
+static int vuport_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ int ret;
+
+ ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_usb_gpios);
+ if (ret)
+ return ret;
+
+ return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
+ intel_vuport_mfd_cells,
+ ARRAY_SIZE(intel_vuport_mfd_cells), NULL, 0,
+ NULL);
+}
+
+static int vuport_remove(struct platform_device *pdev)
+{
+ mfd_remove_devices(&pdev->dev);
+ acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
+
+ return 0;
+}
+
+static struct acpi_device_id vuport_acpi_match[] = {
+ { "INT3496" },
+ { }
+};
+MODULE_DEVICE_TABLE(acpi, vuport_acpi_match);
+
+static struct platform_driver vuport_driver = {
+ .driver = {
+ .name = "intel-vuport",
+ .acpi_match_table = ACPI_PTR(vuport_acpi_match),
+ },
+ .probe = vuport_probe,
+ .remove = vuport_remove,
+};
+
+module_platform_driver(vuport_driver);
+
+MODULE_AUTHOR("Lu Baolu <baolu.lu@linux.intel.com>");
+MODULE_DESCRIPTION("Intel virtual USB port");
+MODULE_LICENSE("GPL v2");
--
2.1.4
[toc] | [next] | [standalone]
| From | Lee Jones <lee.jones@linaro.org> |
|---|---|
| Date | 2016-05-09 16:30 +0200 |
| Subject | Re: [PATCH v8 5/7] mfd: intel_vuport: Add Intel virtual USB port MFD Driver |
| Message-ID | <rwUm6-7na-25@gated-at.bofh.it> |
| In reply to | #1394885 |
On Thu, 05 May 2016, Lu Baolu wrote:
> Some Intel platforms have an USB port mux controlled by GPIOs.
> There's a single ACPI platform device that provides 1) USB ID
> extcon device; 2) USB vbus regulator device; and 3) USB port
> switch device. This MFD driver will split these 3 devices for
> their respective drivers.
>
> [baolu: removed .owner per platform_no_drv_owner.cocci]
> Suggested-by: David Cohen <david.a.cohen@linux.intel.com>
> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
> Reviewed-by: Felipe Balbi <balbi@kernel.org>
> ---
> drivers/mfd/Kconfig | 8 +++++
> drivers/mfd/Makefile | 1 +
> drivers/mfd/intel-vuport.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 98 insertions(+)
> create mode 100644 drivers/mfd/intel-vuport.c
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index eea61e3..7e115ab 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1578,5 +1578,13 @@ config MFD_VEXPRESS_SYSREG
> System Registers are the platform configuration block
> on the ARM Ltd. Versatile Express board.
>
> +config MFD_INTEL_VUPORT
> + tristate "Intel virtual USB port controller"
> + select MFD_CORE
> + depends on X86 && ACPI
> + help
> + Say Y here to enable support for Intel's dual role port mux
> + controlled by GPIOs.
> +
> endmenu
> endif
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 5eaa6465d..65b0518 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -203,3 +203,4 @@ intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
> intel-soc-pmic-$(CONFIG_INTEL_PMC_IPC) += intel_soc_pmic_bxtwc.o
> obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
> obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
> +obj-$(CONFIG_MFD_INTEL_VUPORT) += intel-vuport.o
> diff --git a/drivers/mfd/intel-vuport.c b/drivers/mfd/intel-vuport.c
> new file mode 100644
> index 0000000..fa84ed7
> --- /dev/null
> +++ b/drivers/mfd/intel-vuport.c
> @@ -0,0 +1,89 @@
> +/*
> + * MFD driver for Intel virtual USB port
> + *
> + * Copyright(c) 2016 Intel Corporation.
> + * Author: Lu Baolu <baolu.lu@linux.intel.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/acpi.h>
> +#include <linux/gpio.h>
> +#include <linux/mfd/core.h>
> +#include <linux/property.h>
> +#include <linux/platform_device.h>
> +
> +/* ACPI GPIO Mappings */
> +static const struct acpi_gpio_params id_gpio = { 0, 0, false };
> +static const struct acpi_gpio_params vbus_gpio = { 1, 0, false };
> +static const struct acpi_gpio_params mux_gpio = { 2, 0, false };
> +static const struct acpi_gpio_mapping acpi_usb_gpios[] = {
> + { "id-gpios", &id_gpio, 1 },
> + { "gpio-gpios", &vbus_gpio, 1 },
> + { "usb_mux-gpios", &mux_gpio, 1 },
> + { },
> +};
> +
> +static struct property_entry reg_properties[] = {
> + PROPERTY_ENTRY_STRING("supply-name", "regulator-usb-gpio"),
> + { },
> +};
> +
> +static const struct property_set reg_properties_pset = {
> + .properties = reg_properties,
> +};
> +
> +static const struct mfd_cell intel_vuport_mfd_cells[] = {
> + { .name = "extcon-usb-gpio", },
> + {
> + .name = "reg-fixed-voltage",
> + .pset = ®_properties_pset,
> + },
> + { .name = "intel-mux-gpio", },
> +};
> +
> +static int vuport_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + int ret;
> +
> + ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev), acpi_usb_gpios);
> + if (ret)
> + return ret;
> +
> + return mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
> + intel_vuport_mfd_cells,
> + ARRAY_SIZE(intel_vuport_mfd_cells), NULL, 0,
> + NULL);
> +}
> +
> +static int vuport_remove(struct platform_device *pdev)
> +{
> + mfd_remove_devices(&pdev->dev);
> + acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
> +
> + return 0;
> +}
> +
> +static struct acpi_device_id vuport_acpi_match[] = {
> + { "INT3496" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(acpi, vuport_acpi_match);
> +
> +static struct platform_driver vuport_driver = {
> + .driver = {
> + .name = "intel-vuport",
> + .acpi_match_table = ACPI_PTR(vuport_acpi_match),
> + },
> + .probe = vuport_probe,
> + .remove = vuport_remove,
> +};
> +
> +module_platform_driver(vuport_driver);
> +
> +MODULE_AUTHOR("Lu Baolu <baolu.lu@linux.intel.com>");
> +MODULE_DESCRIPTION("Intel virtual USB port");
> +MODULE_LICENSE("GPL v2");
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web