diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-19 13:57:29 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-07-19 13:59:54 +0200 |
commit | 3d3e9b0db608608c049d286418f0c62c592ad280 (patch) | |
tree | b3b7d0fc324fff8f652774b11705ec751beb5889 /drivers | |
parent | 1583afd4b0ef45ebdddb36f9dd390d96915a7f4f (diff) | |
download | linux-3d3e9b0db608608c049d286418f0c62c592ad280.tar.bz2 |
Revert "platform/chrome: cros_typec_switch: Add switch driver"
This reverts commit e54369058f3da181fcc4c893f224a0c5a8a526b6.
The chrome platform driver changes need to come in through the platform
tree due to some api changes that showed up there that cause build
errors in linux-next
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/20220719160821.5e68e30b@oak.ozlabs.ibm.com
Cc: Prashant Malani <pmalani@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/platform/chrome/Kconfig | 11 | ||||
-rw-r--r-- | drivers/platform/chrome/Makefile | 1 | ||||
-rw-r--r-- | drivers/platform/chrome/cros_typec_switch.c | 170 |
3 files changed, 0 insertions, 182 deletions
diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig index c62a514a087f..717299cbccac 100644 --- a/drivers/platform/chrome/Kconfig +++ b/drivers/platform/chrome/Kconfig @@ -265,17 +265,6 @@ config CHROMEOS_PRIVACY_SCREEN this should probably always be built into the kernel to avoid or minimize drm probe deferral. -config CROS_TYPEC_SWITCH - tristate "ChromeOS EC Type-C Switch Control" - depends on MFD_CROS_EC_DEV && TYPEC - default MFD_CROS_EC_DEV - help - If you say Y here, you get support for configuring the Chrome OS EC Type C - muxes and retimers. - - To compile this driver as a module, choose M here: the module will be - called cros_typec_switch. - source "drivers/platform/chrome/wilco_ec/Kconfig" endif # CHROMEOS_PLATFORMS diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Makefile index 0dcaf6a7ed27..52f5a2dde8b8 100644 --- a/drivers/platform/chrome/Makefile +++ b/drivers/platform/chrome/Makefile @@ -12,7 +12,6 @@ obj-$(CONFIG_CHROMEOS_TBMC) += chromeos_tbmc.o obj-$(CONFIG_CROS_EC) += cros_ec.o obj-$(CONFIG_CROS_EC_I2C) += cros_ec_i2c.o obj-$(CONFIG_CROS_EC_ISHTP) += cros_ec_ishtp.o -obj-$(CONFIG_CROS_TYPEC_SWITCH) += cros_typec_switch.o obj-$(CONFIG_CROS_EC_RPMSG) += cros_ec_rpmsg.o obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o cros_ec_lpcs-objs := cros_ec_lpc.o cros_ec_lpc_mec.o diff --git a/drivers/platform/chrome/cros_typec_switch.c b/drivers/platform/chrome/cros_typec_switch.c deleted file mode 100644 index 0d319e315d57..000000000000 --- a/drivers/platform/chrome/cros_typec_switch.c +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright 2022 Google LLC - * - * This driver provides the ability to configure Type C muxes and retimers which are controlled by - * the Chrome OS EC. - */ - -#include <linux/acpi.h> -#include <linux/module.h> -#include <linux/platform_data/cros_ec_commands.h> -#include <linux/platform_device.h> -#include <linux/usb/typec_retimer.h> - -#define DRV_NAME "cros-typec-switch" - -/* Handles and other relevant data required for each port's switches. */ -struct cros_typec_port { - int port_num; - struct typec_retimer *retimer; - struct cros_typec_switch_data *sdata; -}; - -/* Driver-specific data. */ -struct cros_typec_switch_data { - struct device *dev; - struct cros_ec_device *ec; - struct cros_typec_port *ports[EC_USB_PD_MAX_PORTS]; -}; - -static int cros_typec_retimer_set(struct typec_retimer *retimer, struct typec_retimer_state *state) -{ - return 0; -} - -static void cros_typec_unregister_switches(struct cros_typec_switch_data *sdata) -{ - int i; - - for (i = 0; i < EC_USB_PD_MAX_PORTS; i++) { - if (!sdata->ports[i]) - continue; - typec_retimer_unregister(sdata->ports[i]->retimer); - } -} - -static int cros_typec_register_retimer(struct cros_typec_port *port, struct fwnode_handle *fwnode) -{ - struct typec_retimer_desc retimer_desc = { - .fwnode = fwnode, - .drvdata = port, - .name = fwnode_get_name(fwnode), - .set = cros_typec_retimer_set, - }; - - port->retimer = typec_retimer_register(port->sdata->dev, &retimer_desc); - if (IS_ERR(port->retimer)) - return PTR_ERR(port->retimer); - - return 0; -} - -static int cros_typec_register_switches(struct cros_typec_switch_data *sdata) -{ - struct cros_typec_port *port = NULL; - struct device *dev = sdata->dev; - struct fwnode_handle *fwnode; - struct acpi_device *adev; - unsigned long long index; - int ret = 0; - int nports; - - nports = device_get_child_node_count(dev); - if (nports == 0) { - dev_err(dev, "No switch devices found.\n"); - return -ENODEV; - } - - device_for_each_child_node(dev, fwnode) { - port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); - if (!port) { - ret = -ENOMEM; - goto err_switch; - } - - adev = to_acpi_device_node(fwnode); - if (!adev) { - dev_err(fwnode->dev, "Couldn't get ACPI device handle\n"); - ret = -ENODEV; - goto err_switch; - } - - ret = acpi_evaluate_integer(adev->handle, "_ADR", NULL, &index); - if (ACPI_FAILURE(ret)) { - dev_err(fwnode->dev, "_ADR wasn't evaluated\n"); - ret = -ENODATA; - goto err_switch; - } - - if (index < 0 || index >= EC_USB_PD_MAX_PORTS) { - dev_err(fwnode->dev, "Invalid port index number: %llu", index); - ret = -EINVAL; - goto err_switch; - } - port->sdata = sdata; - port->port_num = index; - sdata->ports[index] = port; - - ret = cros_typec_register_retimer(port, fwnode); - if (ret) { - dev_err(dev, "Retimer switch register failed\n"); - goto err_switch; - } - - dev_dbg(dev, "Retimer switch registered for index %llu\n", index); - } - - return 0; -err_switch: - cros_typec_unregister_switches(sdata); - return ret; -} - -static int cros_typec_switch_probe(struct platform_device *pdev) -{ - struct device *dev = &pdev->dev; - struct cros_typec_switch_data *sdata; - - sdata = devm_kzalloc(dev, sizeof(*sdata), GFP_KERNEL); - if (!sdata) - return -ENOMEM; - - sdata->dev = dev; - sdata->ec = dev_get_drvdata(pdev->dev.parent); - - platform_set_drvdata(pdev, sdata); - - return cros_typec_register_switches(sdata); -} - -static int cros_typec_switch_remove(struct platform_device *pdev) -{ - struct cros_typec_switch_data *sdata = platform_get_drvdata(pdev); - - cros_typec_unregister_switches(sdata); - return 0; -} - -#ifdef CONFIG_ACPI -static const struct acpi_device_id cros_typec_switch_acpi_id[] = { - { "GOOG001A", 0 }, - {} -}; -MODULE_DEVICE_TABLE(acpi, cros_typec_switch_acpi_id); -#endif - -static struct platform_driver cros_typec_switch_driver = { - .driver = { - .name = DRV_NAME, - .acpi_match_table = ACPI_PTR(cros_typec_switch_acpi_id), - }, - .probe = cros_typec_switch_probe, - .remove = cros_typec_switch_remove, -}; - -module_platform_driver(cros_typec_switch_driver); - -MODULE_AUTHOR("Prashant Malani <pmalani@chromium.org>"); -MODULE_DESCRIPTION("Chrome OS EC Type C Switch control"); -MODULE_LICENSE("GPL"); |