// SPDX-License-Identifier: GPL-2.0 /* * CLx support * * Copyright (C) 2020 - 2023, Intel Corporation * Authors: Gil Fine <[email protected]> * Mika Westerberg <[email protected]> */ #include <linux/module.h> #include "tb.h" static bool clx_enabled = …; module_param_named(clx, clx_enabled, bool, 0444); MODULE_PARM_DESC(…) …; static const char *clx_name(unsigned int clx) { … } static int tb_port_pm_secondary_set(struct tb_port *port, bool secondary) { … } static int tb_port_pm_secondary_enable(struct tb_port *port) { … } static int tb_port_pm_secondary_disable(struct tb_port *port) { … } /* Called for USB4 or Titan Ridge routers only */ static bool tb_port_clx_supported(struct tb_port *port, unsigned int clx) { … } static int tb_port_clx_set(struct tb_port *port, unsigned int clx, bool enable) { … } static int tb_port_clx_disable(struct tb_port *port, unsigned int clx) { … } static int tb_port_clx_enable(struct tb_port *port, unsigned int clx) { … } static int tb_port_clx(struct tb_port *port) { … } /** * tb_port_clx_is_enabled() - Is given CL state enabled * @port: USB4 port to check * @clx: Mask of CL states to check * * Returns true if any of the given CL states is enabled for @port. */ bool tb_port_clx_is_enabled(struct tb_port *port, unsigned int clx) { … } /** * tb_switch_clx_is_supported() - Is CLx supported on this type of router * @sw: The router to check CLx support for */ static bool tb_switch_clx_is_supported(const struct tb_switch *sw) { … } /** * tb_switch_clx_init() - Initialize router CL states * @sw: Router * * Can be called for any router. Initializes the current CL state by * reading it from the hardware. * * Returns %0 in case of success and negative errno in case of failure. */ int tb_switch_clx_init(struct tb_switch *sw) { … } static int tb_switch_pm_secondary_resolve(struct tb_switch *sw) { … } static int tb_switch_mask_clx_objections(struct tb_switch *sw) { … } static bool validate_mask(unsigned int clx) { … } /** * tb_switch_clx_enable() - Enable CLx on upstream port of specified router * @sw: Router to enable CLx for * @clx: The CLx state to enable * * CLx is enabled only if both sides of the link support CLx, and if both sides * of the link are not configured as two single lane links and only if the link * is not inter-domain link. The complete set of conditions is described in CM * Guide 1.0 section 8.1. * * Returns %0 on success or an error code on failure. */ int tb_switch_clx_enable(struct tb_switch *sw, unsigned int clx) { … } /** * tb_switch_clx_disable() - Disable CLx on upstream port of specified router * @sw: Router to disable CLx for * * Disables all CL states of the given router. Can be called on any * router and if the states were not enabled already does nothing. * * Returns the CL states that were disabled or negative errno in case of * failure. */ int tb_switch_clx_disable(struct tb_switch *sw) { … }