Lines Matching +full:mux +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0
3 * phy-can-transceiver.c - phy driver for CAN transceivers
5 * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com
14 #include <linux/mux/consumer.h>
35 if (can_transceiver_phy->mux_state) { in can_transceiver_phy_power_on()
36 ret = mux_state_select(can_transceiver_phy->mux_state); in can_transceiver_phy_power_on()
38 dev_err(&phy->dev, "Failed to select CAN mux: %d\n", ret); in can_transceiver_phy_power_on()
42 if (can_transceiver_phy->standby_gpio) in can_transceiver_phy_power_on()
43 gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 0); in can_transceiver_phy_power_on()
44 if (can_transceiver_phy->enable_gpio) in can_transceiver_phy_power_on()
45 gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 1); in can_transceiver_phy_power_on()
55 if (can_transceiver_phy->standby_gpio) in can_transceiver_phy_power_off()
56 gpiod_set_value_cansleep(can_transceiver_phy->standby_gpio, 1); in can_transceiver_phy_power_off()
57 if (can_transceiver_phy->enable_gpio) in can_transceiver_phy_power_off()
58 gpiod_set_value_cansleep(can_transceiver_phy->enable_gpio, 0); in can_transceiver_phy_power_off()
59 if (can_transceiver_phy->mux_state) in can_transceiver_phy_power_off()
60 mux_state_deselect(can_transceiver_phy->mux_state); in can_transceiver_phy_power_off()
99 struct device *dev = &pdev->dev; in can_transceiver_phy_probe()
111 return -ENOMEM; in can_transceiver_phy_probe()
113 match = of_match_node(can_transceiver_phy_ids, pdev->dev.of_node); in can_transceiver_phy_probe()
114 drvdata = match->data; in can_transceiver_phy_probe()
116 if (of_property_read_bool(dev->of_node, "mux-states")) { in can_transceiver_phy_probe()
121 return dev_err_probe(&pdev->dev, PTR_ERR(mux_state), in can_transceiver_phy_probe()
122 "failed to get mux\n"); in can_transceiver_phy_probe()
123 can_transceiver_phy->mux_state = mux_state; in can_transceiver_phy_probe()
126 phy = devm_phy_create(dev, dev->of_node, in can_transceiver_phy_probe()
133 err = device_property_read_u32(dev, "max-bitrate", &max_bitrate); in can_transceiver_phy_probe()
134 if ((err != -EINVAL) && !max_bitrate) in can_transceiver_phy_probe()
136 phy->attrs.max_link_rate = max_bitrate; in can_transceiver_phy_probe()
138 can_transceiver_phy->generic_phy = phy; in can_transceiver_phy_probe()
140 if (drvdata->flags & CAN_TRANSCEIVER_STB_PRESENT) { in can_transceiver_phy_probe()
144 can_transceiver_phy->standby_gpio = standby_gpio; in can_transceiver_phy_probe()
147 if (drvdata->flags & CAN_TRANSCEIVER_EN_PRESENT) { in can_transceiver_phy_probe()
151 can_transceiver_phy->enable_gpio = enable_gpio; in can_transceiver_phy_probe()
154 phy_set_drvdata(can_transceiver_phy->generic_phy, can_transceiver_phy); in can_transceiver_phy_probe()
164 .name = "can-transceiver-phy",
172 MODULE_AUTHOR("Aswath Govindraju <a-govindraju@ti.com>");