bool swap_data_lanes;
struct typec_switch *typec_switch;
+ struct typec_mux *typec_mux;
struct mutex lock; /* protect non-concurrent retimer & switch */
static int nb7vpq904m_retimer_set(struct typec_retimer *retimer, struct typec_retimer_state *state)
{
struct nb7vpq904m *nb7 = typec_retimer_get_drvdata(retimer);
+ struct typec_mux_state mux_state;
int ret = 0;
mutex_lock(&nb7->lock);
mutex_unlock(&nb7->lock);
- return ret;
+ if (ret)
+ return ret;
+
+ mux_state.alt = state->alt;
+ mux_state.data = state->data;
+ mux_state.mode = state->mode;
+
+ return typec_mux_set(nb7->typec_mux, &mux_state);
}
static const struct regmap_config nb7_regmap = {
return dev_err_probe(dev, PTR_ERR(nb7->typec_switch),
"failed to acquire orientation-switch\n");
+ nb7->typec_mux = fwnode_typec_mux_get(dev->fwnode);
+ if (IS_ERR(nb7->typec_mux)) {
+ ret = dev_err_probe(dev, PTR_ERR(nb7->typec_mux),
+ "Failed to acquire mode-switch\n");
+ goto err_switch_put;
+ }
+
ret = nb7vpq904m_parse_data_lanes_mapping(nb7);
if (ret)
- goto err_switch_put;
+ goto err_mux_put;
ret = regulator_enable(nb7->vcc_supply);
if (ret)
gpiod_set_value(nb7->enable_gpio, 0);
regulator_disable(nb7->vcc_supply);
+err_mux_put:
+ typec_mux_put(nb7->typec_mux);
+
err_switch_put:
typec_switch_put(nb7->typec_switch);
regulator_disable(nb7->vcc_supply);
+ typec_mux_put(nb7->typec_mux);
typec_switch_put(nb7->typec_switch);
}