Lines Matching refs:rc
25 static int uwb_radio_select_channel(struct uwb_rc *rc) in uwb_radio_select_channel() argument
31 if (rc->active_pals == 0) in uwb_radio_select_channel()
33 if (rc->beaconing_forced) in uwb_radio_select_channel()
34 return rc->beaconing_forced; in uwb_radio_select_channel()
42 static void uwb_radio_channel_changed(struct uwb_rc *rc, int channel) in uwb_radio_channel_changed() argument
46 list_for_each_entry(pal, &rc->pals, node) { in uwb_radio_channel_changed()
62 static int uwb_radio_change_channel(struct uwb_rc *rc, int channel) in uwb_radio_change_channel() argument
65 struct device *dev = &rc->uwb_dev.dev; in uwb_radio_change_channel()
68 channel, rc->beaconing); in uwb_radio_change_channel()
71 uwb_radio_channel_changed(rc, channel); in uwb_radio_change_channel()
73 if (channel != rc->beaconing) { in uwb_radio_change_channel()
74 if (rc->beaconing != -1 && channel != -1) { in uwb_radio_change_channel()
79 ret = uwb_radio_change_channel(rc, -1); in uwb_radio_change_channel()
83 ret = uwb_rc_beacon(rc, channel, 0); in uwb_radio_change_channel()
87 uwb_radio_channel_changed(rc, rc->beaconing); in uwb_radio_change_channel()
101 struct uwb_rc *rc = pal->rc; in uwb_radio_start() local
104 mutex_lock(&rc->uwb_dev.mutex); in uwb_radio_start()
108 rc->active_pals++; in uwb_radio_start()
109 ret = uwb_radio_change_channel(rc, uwb_radio_select_channel(rc)); in uwb_radio_start()
112 mutex_unlock(&rc->uwb_dev.mutex); in uwb_radio_start()
125 struct uwb_rc *rc = pal->rc; in uwb_radio_stop() local
127 mutex_lock(&rc->uwb_dev.mutex); in uwb_radio_stop()
130 rc->active_pals--; in uwb_radio_stop()
131 uwb_radio_change_channel(rc, uwb_radio_select_channel(rc)); in uwb_radio_stop()
135 mutex_unlock(&rc->uwb_dev.mutex); in uwb_radio_stop()
145 int uwb_radio_force_channel(struct uwb_rc *rc, int channel) in uwb_radio_force_channel() argument
149 mutex_lock(&rc->uwb_dev.mutex); in uwb_radio_force_channel()
151 rc->beaconing_forced = channel; in uwb_radio_force_channel()
152 ret = uwb_radio_change_channel(rc, uwb_radio_select_channel(rc)); in uwb_radio_force_channel()
154 mutex_unlock(&rc->uwb_dev.mutex); in uwb_radio_force_channel()
165 int uwb_radio_setup(struct uwb_rc *rc) in uwb_radio_setup() argument
167 return uwb_rc_reset(rc); in uwb_radio_setup()
177 void uwb_radio_reset_state(struct uwb_rc *rc) in uwb_radio_reset_state() argument
181 mutex_lock(&rc->uwb_dev.mutex); in uwb_radio_reset_state()
183 list_for_each_entry(pal, &rc->pals, node) { in uwb_radio_reset_state()
191 rc->beaconing = -1; in uwb_radio_reset_state()
192 rc->scanning = -1; in uwb_radio_reset_state()
194 mutex_unlock(&rc->uwb_dev.mutex); in uwb_radio_reset_state()
203 void uwb_radio_shutdown(struct uwb_rc *rc) in uwb_radio_shutdown() argument
205 uwb_radio_reset_state(rc); in uwb_radio_shutdown()
206 uwb_rc_reset(rc); in uwb_radio_shutdown()