mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
thunderbolt: Get rid of tb_switch_enable_tmu_1st_child()
This is better to be part of the software connection manager flows in tb.c. Also name the new function tb_increase_tmu_accuracy() to match what it actually does. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
701e73a823
commit
7d283f4148
3 changed files with 34 additions and 40 deletions
|
@ -240,6 +240,38 @@ static void tb_discover_dp_resources(struct tb *tb)
|
|||
}
|
||||
}
|
||||
|
||||
static int tb_increase_switch_tmu_accuracy(struct device *dev, void *data)
|
||||
{
|
||||
struct tb_switch *sw;
|
||||
|
||||
sw = tb_to_switch(dev);
|
||||
if (sw) {
|
||||
tb_switch_tmu_configure(sw, TB_SWITCH_TMU_RATE_HIFI,
|
||||
tb_switch_is_clx_enabled(sw, TB_CL1));
|
||||
if (tb_switch_tmu_enable(sw))
|
||||
tb_sw_warn(sw, "failed to increase TMU rate\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tb_increase_tmu_accuracy(struct tb_tunnel *tunnel)
|
||||
{
|
||||
struct tb_switch *sw;
|
||||
|
||||
if (!tunnel)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Once first DP tunnel is established we change the TMU
|
||||
* accuracy of first depth child routers (and the host router)
|
||||
* to the highest. This is needed for the DP tunneling to work
|
||||
* but also allows CL0s.
|
||||
*/
|
||||
sw = tunnel->tb->root_switch;
|
||||
device_for_each_child(&sw->dev, NULL, tb_increase_switch_tmu_accuracy);
|
||||
}
|
||||
|
||||
static void tb_switch_discover_tunnels(struct tb_switch *sw,
|
||||
struct list_head *list,
|
||||
bool alloc_hopids)
|
||||
|
@ -253,13 +285,7 @@ static void tb_switch_discover_tunnels(struct tb_switch *sw,
|
|||
switch (port->config.type) {
|
||||
case TB_TYPE_DP_HDMI_IN:
|
||||
tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids);
|
||||
/*
|
||||
* In case of DP tunnel exists, change host router's
|
||||
* 1st children TMU mode to HiFi for CL0s to work.
|
||||
*/
|
||||
if (tunnel)
|
||||
tb_switch_enable_tmu_1st_child(tb->root_switch,
|
||||
TB_SWITCH_TMU_RATE_HIFI);
|
||||
tb_increase_tmu_accuracy(tunnel);
|
||||
break;
|
||||
|
||||
case TB_TYPE_PCIE_DOWN:
|
||||
|
@ -1263,8 +1289,7 @@ static void tb_tunnel_dp(struct tb *tb)
|
|||
* In case of DP tunnel exists, change host router's 1st children
|
||||
* TMU mode to HiFi for CL0s to work.
|
||||
*/
|
||||
tb_switch_enable_tmu_1st_child(tb->root_switch, TB_SWITCH_TMU_RATE_HIFI);
|
||||
|
||||
tb_increase_tmu_accuracy(tunnel);
|
||||
return;
|
||||
|
||||
err_free:
|
||||
|
|
|
@ -990,8 +990,6 @@ int tb_switch_tmu_enable(struct tb_switch *sw);
|
|||
void tb_switch_tmu_configure(struct tb_switch *sw,
|
||||
enum tb_switch_tmu_rate rate,
|
||||
bool unidirectional);
|
||||
void tb_switch_enable_tmu_1st_child(struct tb_switch *sw,
|
||||
enum tb_switch_tmu_rate rate);
|
||||
/**
|
||||
* tb_switch_tmu_is_enabled() - Checks if the specified TMU mode is enabled
|
||||
* @sw: Router whose TMU mode to check
|
||||
|
|
|
@ -731,32 +731,3 @@ void tb_switch_tmu_configure(struct tb_switch *sw,
|
|||
sw->tmu.unidirectional_request = unidirectional;
|
||||
sw->tmu.rate_request = rate;
|
||||
}
|
||||
|
||||
static int tb_switch_tmu_config_enable(struct device *dev, void *rate)
|
||||
{
|
||||
if (tb_is_switch(dev)) {
|
||||
struct tb_switch *sw = tb_to_switch(dev);
|
||||
|
||||
tb_switch_tmu_configure(sw, *(enum tb_switch_tmu_rate *)rate,
|
||||
tb_switch_is_clx_enabled(sw, TB_CL1));
|
||||
if (tb_switch_tmu_enable(sw))
|
||||
tb_sw_dbg(sw, "fail switching TMU mode for 1st depth router\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* tb_switch_enable_tmu_1st_child - Configure and enable TMU for 1st chidren
|
||||
* @sw: The router to configure and enable it's children TMU
|
||||
* @rate: Rate of the TMU to configure the router's chidren to
|
||||
*
|
||||
* Configures and enables the TMU mode of 1st depth children of the specified
|
||||
* router to the specified rate.
|
||||
*/
|
||||
void tb_switch_enable_tmu_1st_child(struct tb_switch *sw,
|
||||
enum tb_switch_tmu_rate rate)
|
||||
{
|
||||
device_for_each_child(&sw->dev, &rate,
|
||||
tb_switch_tmu_config_enable);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue