Searched refs:adap (Results 1 - 200 of 290) sorted by relevance

12

/linux-4.4.14/drivers/media/usb/dvb-usb/
H A Ddvb-usb-dvb.c14 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; dvb_usb_ctrl_feed() local
17 if (adap == NULL) dvb_usb_ctrl_feed()
20 if ((adap->active_fe < 0) || dvb_usb_ctrl_feed()
21 (adap->active_fe >= adap->num_frontends_initialized)) { dvb_usb_ctrl_feed()
25 newfeedcount = adap->feedcount + (onoff ? 1 : -1); dvb_usb_ctrl_feed()
30 usb_urb_kill(&adap->fe_adap[adap->active_fe].stream); dvb_usb_ctrl_feed()
32 if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { dvb_usb_ctrl_feed()
33 ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 0); dvb_usb_ctrl_feed()
41 adap->feedcount = newfeedcount; dvb_usb_ctrl_feed()
45 adap->fe_adap[adap->active_fe].pid_filtering ? dvb_usb_ctrl_feed()
48 if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER && dvb_usb_ctrl_feed()
49 adap->fe_adap[adap->active_fe].pid_filtering && dvb_usb_ctrl_feed()
50 adap->props.fe[adap->active_fe].pid_filter != NULL) dvb_usb_ctrl_feed()
51 adap->props.fe[adap->active_fe].pid_filter(adap, dvbdmxfeed->index, dvbdmxfeed->pid, onoff); dvb_usb_ctrl_feed()
56 if (adap->feedcount == onoff && adap->feedcount > 0) { dvb_usb_ctrl_feed()
58 usb_urb_submit(&adap->fe_adap[adap->active_fe].stream); dvb_usb_ctrl_feed()
61 if (adap->props.fe[adap->active_fe].caps & DVB_USB_ADAP_HAS_PID_FILTER && dvb_usb_ctrl_feed()
62 adap->props.fe[adap->active_fe].caps & dvb_usb_ctrl_feed()
64 adap->props.fe[adap->active_fe].pid_filter_ctrl != NULL) { dvb_usb_ctrl_feed()
65 ret = adap->props.fe[adap->active_fe].pid_filter_ctrl(adap, dvb_usb_ctrl_feed()
66 adap->fe_adap[adap->active_fe].pid_filtering); dvb_usb_ctrl_feed()
73 if (adap->props.fe[adap->active_fe].streaming_ctrl != NULL) { dvb_usb_ctrl_feed()
74 ret = adap->props.fe[adap->active_fe].streaming_ctrl(adap, 1); dvb_usb_ctrl_feed()
98 static void dvb_usb_media_device_register(struct dvb_usb_adapter *adap) dvb_usb_media_device_register() argument
102 struct dvb_usb_device *d = adap->dev; dvb_usb_media_device_register()
126 dvb_register_media_controller(&adap->dvb_adap, mdev); dvb_usb_media_device_register()
132 static void dvb_usb_media_device_unregister(struct dvb_usb_adapter *adap) dvb_usb_media_device_unregister() argument
135 if (!adap->dvb_adap.mdev) dvb_usb_media_device_unregister()
138 media_device_unregister(adap->dvb_adap.mdev); dvb_usb_media_device_unregister()
139 kfree(adap->dvb_adap.mdev); dvb_usb_media_device_unregister()
140 adap->dvb_adap.mdev = NULL; dvb_usb_media_device_unregister()
144 int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap, short *adapter_nums) dvb_usb_adapter_dvb_init() argument
147 int ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name, dvb_usb_adapter_dvb_init()
148 adap->dev->owner, &adap->dev->udev->dev, dvb_usb_adapter_dvb_init()
155 adap->dvb_adap.priv = adap; dvb_usb_adapter_dvb_init()
157 dvb_usb_media_device_register(adap); dvb_usb_adapter_dvb_init()
159 if (adap->dev->props.read_mac_address) { dvb_usb_adapter_dvb_init()
160 if (adap->dev->props.read_mac_address(adap->dev, adap->dvb_adap.proposed_mac) == 0) dvb_usb_adapter_dvb_init()
161 info("MAC address: %pM", adap->dvb_adap.proposed_mac); dvb_usb_adapter_dvb_init()
167 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; dvb_usb_adapter_dvb_init()
168 adap->demux.priv = adap; dvb_usb_adapter_dvb_init()
170 adap->demux.filternum = 0; dvb_usb_adapter_dvb_init()
171 for (i = 0; i < adap->props.num_frontends; i++) { dvb_usb_adapter_dvb_init()
172 if (adap->demux.filternum < adap->fe_adap[i].max_feed_count) dvb_usb_adapter_dvb_init()
173 adap->demux.filternum = adap->fe_adap[i].max_feed_count; dvb_usb_adapter_dvb_init()
175 adap->demux.feednum = adap->demux.filternum; dvb_usb_adapter_dvb_init()
176 adap->demux.start_feed = dvb_usb_start_feed; dvb_usb_adapter_dvb_init()
177 adap->demux.stop_feed = dvb_usb_stop_feed; dvb_usb_adapter_dvb_init()
178 adap->demux.write_to_decoder = NULL; dvb_usb_adapter_dvb_init()
179 if ((ret = dvb_dmx_init(&adap->demux)) < 0) { dvb_usb_adapter_dvb_init()
184 adap->dmxdev.filternum = adap->demux.filternum; dvb_usb_adapter_dvb_init()
185 adap->dmxdev.demux = &adap->demux.dmx; dvb_usb_adapter_dvb_init()
186 adap->dmxdev.capabilities = 0; dvb_usb_adapter_dvb_init()
187 if ((ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap)) < 0) { dvb_usb_adapter_dvb_init()
192 if ((ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, dvb_usb_adapter_dvb_init()
193 &adap->demux.dmx)) < 0) { dvb_usb_adapter_dvb_init()
198 adap->state |= DVB_USB_ADAP_STATE_DVB; dvb_usb_adapter_dvb_init()
202 dvb_dmxdev_release(&adap->dmxdev); dvb_usb_adapter_dvb_init()
204 dvb_dmx_release(&adap->demux); dvb_usb_adapter_dvb_init()
206 dvb_usb_media_device_unregister(adap); dvb_usb_adapter_dvb_init()
207 dvb_unregister_adapter(&adap->dvb_adap); dvb_usb_adapter_dvb_init()
212 int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap) dvb_usb_adapter_dvb_exit() argument
214 if (adap->state & DVB_USB_ADAP_STATE_DVB) { dvb_usb_adapter_dvb_exit()
216 dvb_net_release(&adap->dvb_net); dvb_usb_adapter_dvb_exit()
217 adap->demux.dmx.close(&adap->demux.dmx); dvb_usb_adapter_dvb_exit()
218 dvb_dmxdev_release(&adap->dmxdev); dvb_usb_adapter_dvb_exit()
219 dvb_dmx_release(&adap->demux); dvb_usb_adapter_dvb_exit()
220 dvb_usb_media_device_unregister(adap); dvb_usb_adapter_dvb_exit()
221 dvb_unregister_adapter(&adap->dvb_adap); dvb_usb_adapter_dvb_exit()
222 adap->state &= ~DVB_USB_ADAP_STATE_DVB; dvb_usb_adapter_dvb_exit()
229 struct dvb_usb_adapter *adap = fe->dvb->priv; dvb_usb_set_active_fe() local
231 int ret = (adap->props.frontend_ctrl) ? dvb_usb_set_active_fe()
232 adap->props.frontend_ctrl(fe, onoff) : 0; dvb_usb_set_active_fe()
239 adap->active_fe = fe->id; dvb_usb_set_active_fe()
246 struct dvb_usb_adapter *adap = fe->dvb->priv; dvb_usb_fe_wakeup() local
248 dvb_usb_device_power_ctrl(adap->dev, 1); dvb_usb_fe_wakeup()
252 if (adap->fe_adap[fe->id].fe_init) dvb_usb_fe_wakeup()
253 adap->fe_adap[fe->id].fe_init(fe); dvb_usb_fe_wakeup()
260 struct dvb_usb_adapter *adap = fe->dvb->priv; dvb_usb_fe_sleep() local
262 if (adap->fe_adap[fe->id].fe_sleep) dvb_usb_fe_sleep()
263 adap->fe_adap[fe->id].fe_sleep(fe); dvb_usb_fe_sleep()
267 return dvb_usb_device_power_ctrl(adap->dev, 0); dvb_usb_fe_sleep()
270 int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap) dvb_usb_adapter_frontend_init() argument
275 for (i = 0; i < adap->props.num_frontends; i++) { dvb_usb_adapter_frontend_init()
277 if (adap->props.fe[i].frontend_attach == NULL) { dvb_usb_adapter_frontend_init()
280 adap->dev->desc->name, adap->id, i); dvb_usb_adapter_frontend_init()
285 ret = adap->props.fe[i].frontend_attach(adap); dvb_usb_adapter_frontend_init()
286 if (ret || adap->fe_adap[i].fe == NULL) { dvb_usb_adapter_frontend_init()
290 adap->dev->desc->name); dvb_usb_adapter_frontend_init()
295 adap->fe_adap[i].fe->id = i; dvb_usb_adapter_frontend_init()
298 adap->fe_adap[i].fe_init = adap->fe_adap[i].fe->ops.init; dvb_usb_adapter_frontend_init()
299 adap->fe_adap[i].fe->ops.init = dvb_usb_fe_wakeup; dvb_usb_adapter_frontend_init()
300 adap->fe_adap[i].fe_sleep = adap->fe_adap[i].fe->ops.sleep; dvb_usb_adapter_frontend_init()
301 adap->fe_adap[i].fe->ops.sleep = dvb_usb_fe_sleep; dvb_usb_adapter_frontend_init()
303 if (dvb_register_frontend(&adap->dvb_adap, adap->fe_adap[i].fe)) { dvb_usb_adapter_frontend_init()
305 dvb_frontend_detach(adap->fe_adap[i].fe); dvb_usb_adapter_frontend_init()
306 adap->fe_adap[i].fe = NULL; dvb_usb_adapter_frontend_init()
316 if (adap->props.fe[i].tuner_attach != NULL) dvb_usb_adapter_frontend_init()
317 adap->props.fe[i].tuner_attach(adap); dvb_usb_adapter_frontend_init()
319 adap->num_frontends_initialized++; dvb_usb_adapter_frontend_init()
322 dvb_create_media_graph(&adap->dvb_adap); dvb_usb_adapter_frontend_init()
327 int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap) dvb_usb_adapter_frontend_exit() argument
329 int i = adap->num_frontends_initialized - 1; dvb_usb_adapter_frontend_exit()
333 if (adap->fe_adap[i].fe != NULL) { dvb_usb_adapter_frontend_exit()
334 dvb_unregister_frontend(adap->fe_adap[i].fe); dvb_usb_adapter_frontend_exit()
335 dvb_frontend_detach(adap->fe_adap[i].fe); dvb_usb_adapter_frontend_exit()
338 adap->num_frontends_initialized = 0; dvb_usb_adapter_frontend_exit()
H A Ddvb-usb-urb.c71 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete() local
72 if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_usb_data_complete()
73 dvb_dmx_swfilter(&adap->demux, buffer, length); dvb_usb_data_complete()
78 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete_204() local
79 if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_usb_data_complete_204()
80 dvb_dmx_swfilter_204(&adap->demux, buffer, length); dvb_usb_data_complete_204()
86 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete_raw() local
87 if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB) dvb_usb_data_complete_raw()
88 dvb_dmx_swfilter_raw(&adap->demux, buffer, length); dvb_usb_data_complete_raw()
91 int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap) dvb_usb_adapter_stream_init() argument
94 for (i = 0; i < adap->props.num_frontends; i++) { dvb_usb_adapter_stream_init()
96 adap->fe_adap[i].stream.udev = adap->dev->udev; dvb_usb_adapter_stream_init()
97 if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS) dvb_usb_adapter_stream_init()
98 adap->fe_adap[i].stream.complete = dvb_usb_adapter_stream_init()
101 if (adap->props.fe[i].caps & DVB_USB_ADAP_RECEIVES_RAW_PAYLOAD) dvb_usb_adapter_stream_init()
102 adap->fe_adap[i].stream.complete = dvb_usb_adapter_stream_init()
105 adap->fe_adap[i].stream.complete = dvb_usb_data_complete; dvb_usb_adapter_stream_init()
106 adap->fe_adap[i].stream.user_priv = adap; dvb_usb_adapter_stream_init()
107 ret = usb_urb_init(&adap->fe_adap[i].stream, dvb_usb_adapter_stream_init()
108 &adap->props.fe[i].stream); dvb_usb_adapter_stream_init()
115 int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap) dvb_usb_adapter_stream_exit() argument
118 for (i = 0; i < adap->props.num_frontends; i++) dvb_usb_adapter_stream_exit()
119 usb_urb_exit(&adap->fe_adap[i].stream); dvb_usb_adapter_stream_exit()
H A Ddib0700_devices.c86 static int bristol_frontend_attach(struct dvb_usb_adapter *adap) bristol_frontend_attach() argument
88 struct dib0700_state *st = adap->dev->priv; bristol_frontend_attach()
89 if (adap->id == 0) { bristol_frontend_attach()
90 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); bristol_frontend_attach()
91 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); bristol_frontend_attach()
92 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); bristol_frontend_attach()
93 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); bristol_frontend_attach()
96 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); bristol_frontend_attach()
98 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); bristol_frontend_attach()
100 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) { bristol_frontend_attach()
101 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10); bristol_frontend_attach()
105 st->mt2060_if1[adap->id] = 1220; bristol_frontend_attach()
106 return (adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, bristol_frontend_attach()
107 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0; bristol_frontend_attach()
110 static int eeprom_read(struct i2c_adapter *adap,u8 adrs,u8 *pval) eeprom_read() argument
116 if (i2c_transfer(adap, msg, 2) != 2) return -EREMOTEIO; eeprom_read()
120 static int bristol_tuner_attach(struct dvb_usb_adapter *adap) bristol_tuner_attach() argument
122 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; bristol_tuner_attach()
123 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); bristol_tuner_attach()
126 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && bristol_tuner_attach()
127 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_500_2)) { bristol_tuner_attach()
128 if (!eeprom_read(prim_i2c,0x59 + adap->id,&a)) if1=1220+a; bristol_tuner_attach()
130 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, bristol_tuner_attach()
131 &bristol_mt2060_config[adap->id], if1) == NULL ? bristol_tuner_attach()
274 static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap) stk7700P2_frontend_attach() argument
276 struct dib0700_adapter_state *state = adap->priv; stk7700P2_frontend_attach()
281 if (adap->id == 0) { stk7700P2_frontend_attach()
282 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk7700P2_frontend_attach()
284 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7700P2_frontend_attach()
285 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk7700P2_frontend_attach()
286 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk7700P2_frontend_attach()
287 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7700P2_frontend_attach()
289 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk7700P2_frontend_attach()
291 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, stk7700P2_frontend_attach()
300 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, stk7700P2_frontend_attach()
301 0x80 + (adap->id << 1), stk7700P2_frontend_attach()
302 &stk7700d_dib7000p_mt2266_config[adap->id]); stk7700P2_frontend_attach()
304 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7700P2_frontend_attach()
307 static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap) stk7700d_frontend_attach() argument
309 struct dib0700_adapter_state *state = adap->priv; stk7700d_frontend_attach()
314 if (adap->id == 0) { stk7700d_frontend_attach()
315 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk7700d_frontend_attach()
317 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7700d_frontend_attach()
318 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk7700d_frontend_attach()
319 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk7700d_frontend_attach()
320 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7700d_frontend_attach()
322 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk7700d_frontend_attach()
324 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7700d_frontend_attach()
325 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7700d_frontend_attach()
334 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, stk7700d_frontend_attach()
335 0x80 + (adap->id << 1), stk7700d_frontend_attach()
336 &stk7700d_dib7000p_mt2266_config[adap->id]); stk7700d_frontend_attach()
338 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7700d_frontend_attach()
341 static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) stk7700d_tuner_attach() argument
344 struct dib0700_adapter_state *state = adap->priv; stk7700d_tuner_attach()
346 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, stk7700d_tuner_attach()
348 return dvb_attach(mt2266_attach, adap->fe_adap[0].fe, tun_i2c, stk7700d_tuner_attach()
349 &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0; stk7700d_tuner_attach()
423 struct dvb_usb_adapter *adap = ptr; stk7700ph_xc3028_callback() local
424 struct dib0700_adapter_state *state = adap->priv; stk7700ph_xc3028_callback()
429 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0); stk7700ph_xc3028_callback()
431 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); stk7700ph_xc3028_callback()
454 static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) stk7700ph_frontend_attach() argument
456 struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; stk7700ph_frontend_attach()
457 struct dib0700_adapter_state *state = adap->priv; stk7700ph_frontend_attach()
464 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); stk7700ph_frontend_attach()
466 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk7700ph_frontend_attach()
468 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7700ph_frontend_attach()
469 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk7700ph_frontend_attach()
470 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk7700ph_frontend_attach()
471 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7700ph_frontend_attach()
473 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk7700ph_frontend_attach()
475 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7700ph_frontend_attach()
478 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, stk7700ph_frontend_attach()
486 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, stk7700ph_frontend_attach()
489 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7700ph_frontend_attach()
492 static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) stk7700ph_tuner_attach() argument
495 struct dib0700_adapter_state *state = adap->priv; stk7700ph_tuner_attach()
497 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, stk7700ph_tuner_attach()
503 adap->fe_adap[0].fe->callback = stk7700ph_xc3028_callback; stk7700ph_tuner_attach()
505 return dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &stk7700ph_xc3028_config) stk7700ph_tuner_attach()
700 static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap) stk7700p_frontend_attach() argument
702 struct dib0700_state *st = adap->dev->priv; stk7700p_frontend_attach()
703 struct dib0700_adapter_state *state = adap->priv; stk7700p_frontend_attach()
710 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7700p_frontend_attach()
711 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(50); stk7700p_frontend_attach()
713 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10); stk7700p_frontend_attach()
714 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7700p_frontend_attach()
716 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10); stk7700p_frontend_attach()
717 dib0700_ctrl_clock(adap->dev, 72, 1); stk7700p_frontend_attach()
718 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(100); stk7700p_frontend_attach()
720 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7700p_frontend_attach()
724 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap)) { stk7700p_frontend_attach()
725 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 18, &stk7700p_dib7000p_config); stk7700p_frontend_attach()
729 adap->fe_adap[0].fe = dvb_attach(dib7000m_attach, &adap->dev->i2c_adap, 18, &stk7700p_dib7000m_config); stk7700p_frontend_attach()
732 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7700p_frontend_attach()
739 static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap) stk7700p_tuner_attach() argument
741 struct i2c_adapter *prim_i2c = &adap->dev->i2c_adap; stk7700p_tuner_attach()
742 struct dib0700_state *st = adap->dev->priv; stk7700p_tuner_attach()
744 struct dib0700_adapter_state *state = adap->priv; stk7700p_tuner_attach()
748 if (adap->dev->udev->descriptor.idVendor == cpu_to_le16(USB_VID_HAUPPAUGE) && stk7700p_tuner_attach()
749 adap->dev->udev->descriptor.idProduct == cpu_to_le16(USB_PID_HAUPPAUGE_NOVA_T_STICK)) { stk7700p_tuner_attach()
753 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); stk7700p_tuner_attach()
755 tun_i2c = dib7000m_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); stk7700p_tuner_attach()
757 return dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk7700p_mt2060_config, stk7700p_tuner_attach()
797 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7070_tuner_reset() local
798 struct dib0700_adapter_state *state = adap->priv; dib7070_tuner_reset()
806 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7070_tuner_sleep() local
807 struct dib0700_adapter_state *state = adap->priv; dib7070_tuner_sleep()
843 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7070_set_param_override() local
844 struct dib0700_adapter_state *state = adap->priv; dib7070_set_param_override()
861 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7770_set_param_override() local
862 struct dib0700_adapter_state *state = adap->priv; dib7770_set_param_override()
882 static int dib7770p_tuner_attach(struct dvb_usb_adapter *adap) dib7770p_tuner_attach() argument
884 struct dib0700_adapter_state *st = adap->priv; dib7770p_tuner_attach()
885 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, dib7770p_tuner_attach()
888 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, dib7770p_tuner_attach()
892 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; dib7770p_tuner_attach()
893 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7770_set_param_override; dib7770p_tuner_attach()
897 static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) dib7070p_tuner_attach() argument
899 struct dib0700_adapter_state *st = adap->priv; dib7070p_tuner_attach()
900 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); dib7070p_tuner_attach()
902 if (adap->id == 0) { dib7070p_tuner_attach()
903 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[0]) == NULL) dib7070p_tuner_attach()
906 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, &dib7070p_dib0070_config[1]) == NULL) dib7070p_tuner_attach()
910 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; dib7070p_tuner_attach()
911 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; dib7070p_tuner_attach()
983 static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) stk7070p_frontend_attach() argument
985 struct usb_device_descriptor *p = &adap->dev->udev->descriptor; stk7070p_frontend_attach()
986 struct dib0700_adapter_state *state = adap->priv; stk7070p_frontend_attach()
993 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); stk7070p_frontend_attach()
995 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk7070p_frontend_attach()
997 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7070p_frontend_attach()
998 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk7070p_frontend_attach()
999 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk7070p_frontend_attach()
1000 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7070p_frontend_attach()
1002 dib0700_ctrl_clock(adap->dev, 72, 1); stk7070p_frontend_attach()
1005 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk7070p_frontend_attach()
1007 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7070p_frontend_attach()
1009 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, stk7070p_frontend_attach()
1017 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, stk7070p_frontend_attach()
1019 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7070p_frontend_attach()
1041 static int stk7770p_frontend_attach(struct dvb_usb_adapter *adap) stk7770p_frontend_attach() argument
1043 struct usb_device_descriptor *p = &adap->dev->udev->descriptor; stk7770p_frontend_attach()
1044 struct dib0700_adapter_state *state = adap->priv; stk7770p_frontend_attach()
1051 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); stk7770p_frontend_attach()
1053 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk7770p_frontend_attach()
1055 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk7770p_frontend_attach()
1056 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk7770p_frontend_attach()
1057 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk7770p_frontend_attach()
1058 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk7770p_frontend_attach()
1060 dib0700_ctrl_clock(adap->dev, 72, 1); stk7770p_frontend_attach()
1063 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk7770p_frontend_attach()
1065 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7770p_frontend_attach()
1067 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, stk7770p_frontend_attach()
1075 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, stk7770p_frontend_attach()
1077 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7770p_frontend_attach()
1231 struct dvb_usb_adapter *adap = fe->dvb->priv; dib80xx_tuner_reset() local
1232 struct dib0700_adapter_state *state = adap->priv; dib80xx_tuner_reset()
1239 struct dvb_usb_adapter *adap = fe->dvb->priv; dib80xx_tuner_sleep() local
1240 struct dib0700_adapter_state *state = adap->priv; dib80xx_tuner_sleep()
1285 struct dvb_usb_adapter *adap = fe->dvb->priv; dib807x_set_param_override() local
1286 struct dib0700_adapter_state *state = adap->priv; dib807x_set_param_override()
1304 static int dib807x_tuner_attach(struct dvb_usb_adapter *adap) dib807x_tuner_attach() argument
1306 struct dib0700_adapter_state *st = adap->priv; dib807x_tuner_attach()
1307 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, dib807x_tuner_attach()
1310 if (adap->id == 0) { dib807x_tuner_attach()
1311 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, dib807x_tuner_attach()
1315 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, dib807x_tuner_attach()
1320 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; dib807x_tuner_attach()
1321 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib807x_set_param_override; dib807x_tuner_attach()
1342 static int stk807x_frontend_attach(struct dvb_usb_adapter *adap) stk807x_frontend_attach() argument
1344 struct dib0700_adapter_state *state = adap->priv; stk807x_frontend_attach()
1349 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk807x_frontend_attach()
1351 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk807x_frontend_attach()
1352 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk807x_frontend_attach()
1353 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk807x_frontend_attach()
1355 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk807x_frontend_attach()
1357 dib0700_ctrl_clock(adap->dev, 72, 1); stk807x_frontend_attach()
1360 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk807x_frontend_attach()
1362 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk807x_frontend_attach()
1364 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, stk807x_frontend_attach()
1367 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, stk807x_frontend_attach()
1370 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk807x_frontend_attach()
1374 static int stk807xpvr_frontend_attach0(struct dvb_usb_adapter *adap) stk807xpvr_frontend_attach0() argument
1376 struct dib0700_adapter_state *state = adap->priv; stk807xpvr_frontend_attach0()
1381 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); stk807xpvr_frontend_attach0()
1383 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1385 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1386 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1387 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1389 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk807xpvr_frontend_attach0()
1391 dib0700_ctrl_clock(adap->dev, 72, 1); stk807xpvr_frontend_attach0()
1394 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1396 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk807xpvr_frontend_attach0()
1399 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x22, 0x80, 0); stk807xpvr_frontend_attach0()
1401 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, stk807xpvr_frontend_attach0()
1404 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk807xpvr_frontend_attach0()
1407 static int stk807xpvr_frontend_attach1(struct dvb_usb_adapter *adap) stk807xpvr_frontend_attach1() argument
1409 struct dib0700_adapter_state *state = adap->priv; stk807xpvr_frontend_attach1()
1415 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x12, 0x82, 0); stk807xpvr_frontend_attach1()
1417 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, stk807xpvr_frontend_attach1()
1420 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk807xpvr_frontend_attach1()
1537 struct dvb_usb_adapter *adap = fe->dvb->priv; dib8090_get_adc_power() local
1538 struct dib0700_adapter_state *state = adap->priv; dib8090_get_adc_power()
1651 struct dvb_usb_adapter *adap = fe->dvb->priv; dib8096_set_param_override() local
1652 struct dib0700_adapter_state *state = adap->priv; dib8096_set_param_override()
1734 static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) dib809x_tuner_attach() argument
1736 struct dib0700_adapter_state *st = adap->priv; dib809x_tuner_attach()
1737 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); dib809x_tuner_attach()
1739 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) dib809x_tuner_attach()
1742 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; dib809x_tuner_attach()
1743 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; dib809x_tuner_attach()
1747 static int stk809x_frontend_attach(struct dvb_usb_adapter *adap) stk809x_frontend_attach() argument
1749 struct dib0700_adapter_state *state = adap->priv; stk809x_frontend_attach()
1754 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk809x_frontend_attach()
1756 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk809x_frontend_attach()
1757 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk809x_frontend_attach()
1758 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk809x_frontend_attach()
1760 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk809x_frontend_attach()
1762 dib0700_ctrl_clock(adap->dev, 72, 1); stk809x_frontend_attach()
1765 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk809x_frontend_attach()
1767 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk809x_frontend_attach()
1769 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, 0x80, 0); stk809x_frontend_attach()
1771 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); stk809x_frontend_attach()
1773 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk809x_frontend_attach()
1776 static int nim8096md_tuner_attach(struct dvb_usb_adapter *adap) nim8096md_tuner_attach() argument
1778 struct dib0700_adapter_state *st = adap->priv; nim8096md_tuner_attach()
1780 struct dvb_frontend *fe_slave = st->dib8000_ops.get_slave_frontend(adap->fe_adap[0].fe, 1); nim8096md_tuner_attach()
1786 fe_slave->dvb = adap->fe_adap[0].fe->dvb; nim8096md_tuner_attach()
1789 tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); nim8096md_tuner_attach()
1790 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) nim8096md_tuner_attach()
1793 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; nim8096md_tuner_attach()
1794 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override; nim8096md_tuner_attach()
1799 static int nim8096md_frontend_attach(struct dvb_usb_adapter *adap) nim8096md_frontend_attach() argument
1802 struct dib0700_adapter_state *state = adap->priv; nim8096md_frontend_attach()
1807 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); nim8096md_frontend_attach()
1809 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); nim8096md_frontend_attach()
1811 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); nim8096md_frontend_attach()
1812 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); nim8096md_frontend_attach()
1813 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); nim8096md_frontend_attach()
1815 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); nim8096md_frontend_attach()
1817 dib0700_ctrl_clock(adap->dev, 72, 1); nim8096md_frontend_attach()
1820 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); nim8096md_frontend_attach()
1822 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); nim8096md_frontend_attach()
1824 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, 0x80, 0); nim8096md_frontend_attach()
1826 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x80, &dib809x_dib8000_config[0]); nim8096md_frontend_attach()
1827 if (adap->fe_adap[0].fe == NULL) nim8096md_frontend_attach()
1834 fe_slave = state->dib8000_ops.init(&adap->dev->i2c_adap, 0x82, &dib809x_dib8000_config[1]); nim8096md_frontend_attach()
1835 state->dib8000_ops.set_slave_frontend(adap->fe_adap[0].fe, fe_slave); nim8096md_frontend_attach()
2097 struct dvb_usb_adapter *adap = fe->dvb->priv; dib8096p_agc_startup() local
2098 struct dib0700_adapter_state *state = adap->priv; dib8096p_agc_startup()
2119 dib0700_set_i2c_speed(adap->dev, 200); dib8096p_agc_startup()
2122 dib0700_set_i2c_speed(adap->dev, 1000); dib8096p_agc_startup()
2127 static int tfe8096p_frontend_attach(struct dvb_usb_adapter *adap) tfe8096p_frontend_attach() argument
2129 struct dib0700_state *st = adap->dev->priv; tfe8096p_frontend_attach()
2131 struct dib0700_adapter_state *state = adap->priv; tfe8096p_frontend_attach()
2136 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); tfe8096p_frontend_attach()
2140 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); tfe8096p_frontend_attach()
2142 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); tfe8096p_frontend_attach()
2143 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); tfe8096p_frontend_attach()
2144 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); tfe8096p_frontend_attach()
2146 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); tfe8096p_frontend_attach()
2148 dib0700_ctrl_clock(adap->dev, 72, 1); tfe8096p_frontend_attach()
2151 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); tfe8096p_frontend_attach()
2153 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); tfe8096p_frontend_attach()
2155 state->dib8000_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80, 1); tfe8096p_frontend_attach()
2157 adap->fe_adap[0].fe = state->dib8000_ops.init(&adap->dev->i2c_adap, tfe8096p_frontend_attach()
2160 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; tfe8096p_frontend_attach()
2163 static int tfe8096p_tuner_attach(struct dvb_usb_adapter *adap) tfe8096p_tuner_attach() argument
2165 struct dib0700_adapter_state *st = adap->priv; tfe8096p_tuner_attach()
2166 struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_tuner(adap->fe_adap[0].fe); tfe8096p_tuner_attach()
2172 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, tfe8096p_tuner_attach()
2176 st->dib8000_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); tfe8096p_tuner_attach()
2178 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; tfe8096p_tuner_attach()
2179 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096p_agc_startup; tfe8096p_tuner_attach()
2366 static int stk9090m_frontend_attach(struct dvb_usb_adapter *adap) stk9090m_frontend_attach() argument
2368 struct dib0700_adapter_state *state = adap->priv; stk9090m_frontend_attach()
2369 struct dib0700_state *st = adap->dev->priv; stk9090m_frontend_attach()
2373 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); stk9090m_frontend_attach()
2376 dib0700_set_i2c_speed(adap->dev, 340); stk9090m_frontend_attach()
2378 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); stk9090m_frontend_attach()
2380 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); stk9090m_frontend_attach()
2381 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); stk9090m_frontend_attach()
2382 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); stk9090m_frontend_attach()
2383 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); stk9090m_frontend_attach()
2385 dib0700_ctrl_clock(adap->dev, 72, 1); stk9090m_frontend_attach()
2388 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); stk9090m_frontend_attach()
2390 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk9090m_frontend_attach()
2392 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, 0x80); stk9090m_frontend_attach()
2394 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { stk9090m_frontend_attach()
2403 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &stk9090m_config); stk9090m_frontend_attach()
2405 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk9090m_frontend_attach()
2408 static int dib9090_tuner_attach(struct dvb_usb_adapter *adap) dib9090_tuner_attach() argument
2410 struct dib0700_adapter_state *state = adap->priv; dib9090_tuner_attach()
2411 struct i2c_adapter *i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); dib9090_tuner_attach()
2420 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &dib9090_dib0090_config) == NULL) dib9090_tuner_attach()
2422 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); dib9090_tuner_attach()
2425 dib0700_set_i2c_speed(adap->dev, 1500); dib9090_tuner_attach()
2426 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) dib9090_tuner_attach()
2432 static int nim9090md_frontend_attach(struct dvb_usb_adapter *adap) nim9090md_frontend_attach() argument
2434 struct dib0700_adapter_state *state = adap->priv; nim9090md_frontend_attach()
2435 struct dib0700_state *st = adap->dev->priv; nim9090md_frontend_attach()
2441 dib0700_get_version(adap->dev, NULL, NULL, &fw_version, NULL); nim9090md_frontend_attach()
2444 dib0700_set_i2c_speed(adap->dev, 340); nim9090md_frontend_attach()
2446 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); nim9090md_frontend_attach()
2448 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); nim9090md_frontend_attach()
2449 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); nim9090md_frontend_attach()
2450 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); nim9090md_frontend_attach()
2451 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); nim9090md_frontend_attach()
2453 dib0700_ctrl_clock(adap->dev, 72, 1); nim9090md_frontend_attach()
2456 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); nim9090md_frontend_attach()
2458 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); nim9090md_frontend_attach()
2460 if (request_firmware(&state->frontend_firmware, "dib9090.fw", &adap->dev->udev->dev)) { nim9090md_frontend_attach()
2471 dib9000_i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, 0x80); nim9090md_frontend_attach()
2472 adap->fe_adap[0].fe = dvb_attach(dib9000_attach, &adap->dev->i2c_adap, 0x80, &nim9090md_config[0]); nim9090md_frontend_attach()
2474 if (adap->fe_adap[0].fe == NULL) nim9090md_frontend_attach()
2477 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_3_4, 0); nim9090md_frontend_attach()
2481 dib9000_set_slave_frontend(adap->fe_adap[0].fe, fe_slave); nim9090md_frontend_attach()
2486 static int nim9090md_tuner_attach(struct dvb_usb_adapter *adap) nim9090md_tuner_attach() argument
2488 struct dib0700_adapter_state *state = adap->priv; nim9090md_tuner_attach()
2498 i2c = dib9000_get_tuner_interface(adap->fe_adap[0].fe); nim9090md_tuner_attach()
2499 if (dvb_attach(dib0090_fw_register, adap->fe_adap[0].fe, i2c, &nim9090md_dib0090_config[0]) == NULL) nim9090md_tuner_attach()
2501 i2c = dib9000_get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_1_2, 0); nim9090md_tuner_attach()
2505 dib0700_set_i2c_speed(adap->dev, 1500); nim9090md_tuner_attach()
2506 if (dib9000_firmware_post_pll_init(adap->fe_adap[0].fe) < 0) nim9090md_tuner_attach()
2509 fe_slave = dib9000_get_slave_frontend(adap->fe_adap[0].fe, 1); nim9090md_tuner_attach()
2511 i2c = dib9000_get_component_bus_interface(adap->fe_adap[0].fe); nim9090md_tuner_attach()
2517 fe_slave->dvb = adap->fe_adap[0].fe->dvb; nim9090md_tuner_attach()
2518 dib9000_fw_set_component_bus_speed(adap->fe_adap[0].fe, 1500); nim9090md_tuner_attach()
2603 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7090_agc_startup() local
2604 struct dib0700_adapter_state *state = adap->priv; dib7090_agc_startup()
2639 struct dvb_usb_adapter *adap = fe->dvb->priv; tfe7790p_update_lna() local
2640 struct dib0700_adapter_state *state = adap->priv; tfe7790p_update_lna()
2794 struct dvb_usb_adapter *adap = fe->dvb->priv; tfe7090p_pvr_update_lna() local
2795 struct dib0700_adapter_state *state = adap->priv; tfe7090p_pvr_update_lna()
3018 static int nim7090_frontend_attach(struct dvb_usb_adapter *adap) nim7090_frontend_attach() argument
3020 struct dib0700_adapter_state *state = adap->priv; nim7090_frontend_attach()
3025 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); nim7090_frontend_attach()
3027 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); nim7090_frontend_attach()
3028 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); nim7090_frontend_attach()
3029 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); nim7090_frontend_attach()
3030 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); nim7090_frontend_attach()
3033 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); nim7090_frontend_attach()
3035 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); nim7090_frontend_attach()
3037 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x10, &nim7090_dib7000p_config) != 0) { nim7090_frontend_attach()
3042 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &nim7090_dib7000p_config); nim7090_frontend_attach()
3044 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; nim7090_frontend_attach()
3047 static int nim7090_tuner_attach(struct dvb_usb_adapter *adap) nim7090_tuner_attach() argument
3049 struct dib0700_adapter_state *st = adap->priv; nim7090_tuner_attach()
3050 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); nim7090_tuner_attach()
3056 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &nim7090_dib0090_config) == NULL) nim7090_tuner_attach()
3059 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); nim7090_tuner_attach()
3061 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; nim7090_tuner_attach()
3062 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; nim7090_tuner_attach()
3066 static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) tfe7090pvr_frontend0_attach() argument
3068 struct dib0700_state *st = adap->dev->priv; tfe7090pvr_frontend0_attach()
3069 struct dib0700_adapter_state *state = adap->priv; tfe7090pvr_frontend0_attach()
3077 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3079 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3080 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3081 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3082 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); tfe7090pvr_frontend0_attach()
3085 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3087 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); tfe7090pvr_frontend0_attach()
3090 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 0x20, &tfe7090pvr_dib7000p_config[0]) != 0) { tfe7090pvr_frontend0_attach()
3096 dib0700_set_i2c_speed(adap->dev, 340); tfe7090pvr_frontend0_attach()
3097 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); tfe7090pvr_frontend0_attach()
3098 if (adap->fe_adap[0].fe == NULL) tfe7090pvr_frontend0_attach()
3101 state->dib7000p_ops.slave_reset(adap->fe_adap[0].fe); tfe7090pvr_frontend0_attach()
3106 static int tfe7090pvr_frontend1_attach(struct dvb_usb_adapter *adap) tfe7090pvr_frontend1_attach() argument
3109 struct dib0700_adapter_state *state = adap->priv; tfe7090pvr_frontend1_attach()
3111 if (adap->dev->adapter[0].fe_adap[0].fe == NULL) { tfe7090pvr_frontend1_attach()
3119 i2c = state->dib7000p_ops.get_i2c_master(adap->dev->adapter[0].fe_adap[0].fe, DIBX000_I2C_INTERFACE_GPIO_6_7, 1); tfe7090pvr_frontend1_attach()
3126 adap->fe_adap[0].fe = state->dib7000p_ops.init(i2c, 0x92, &tfe7090pvr_dib7000p_config[1]); tfe7090pvr_frontend1_attach()
3127 dib0700_set_i2c_speed(adap->dev, 200); tfe7090pvr_frontend1_attach()
3129 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; tfe7090pvr_frontend1_attach()
3132 static int tfe7090pvr_tuner0_attach(struct dvb_usb_adapter *adap) tfe7090pvr_tuner0_attach() argument
3134 struct dib0700_adapter_state *st = adap->priv; tfe7090pvr_tuner0_attach()
3135 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); tfe7090pvr_tuner0_attach()
3141 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[0]) == NULL) tfe7090pvr_tuner0_attach()
3144 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); tfe7090pvr_tuner0_attach()
3146 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; tfe7090pvr_tuner0_attach()
3147 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; tfe7090pvr_tuner0_attach()
3151 static int tfe7090pvr_tuner1_attach(struct dvb_usb_adapter *adap) tfe7090pvr_tuner1_attach() argument
3153 struct dib0700_adapter_state *st = adap->priv; tfe7090pvr_tuner1_attach()
3154 struct i2c_adapter *tun_i2c = st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); tfe7090pvr_tuner1_attach()
3160 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &tfe7090pvr_dib0090_config[1]) == NULL) tfe7090pvr_tuner1_attach()
3163 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); tfe7090pvr_tuner1_attach()
3165 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; tfe7090pvr_tuner1_attach()
3166 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; tfe7090pvr_tuner1_attach()
3170 static int tfe7790p_frontend_attach(struct dvb_usb_adapter *adap) tfe7790p_frontend_attach() argument
3172 struct dib0700_state *st = adap->dev->priv; tfe7790p_frontend_attach()
3173 struct dib0700_adapter_state *state = adap->priv; tfe7790p_frontend_attach()
3181 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); tfe7790p_frontend_attach()
3183 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); tfe7790p_frontend_attach()
3184 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); tfe7790p_frontend_attach()
3185 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); tfe7790p_frontend_attach()
3186 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); tfe7790p_frontend_attach()
3188 dib0700_ctrl_clock(adap->dev, 72, 1); tfe7790p_frontend_attach()
3189 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); tfe7790p_frontend_attach()
3191 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); tfe7790p_frontend_attach()
3193 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, tfe7790p_frontend_attach()
3200 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, tfe7790p_frontend_attach()
3203 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; tfe7790p_frontend_attach()
3206 static int tfe7790p_tuner_attach(struct dvb_usb_adapter *adap) tfe7790p_tuner_attach() argument
3208 struct dib0700_adapter_state *st = adap->priv; tfe7790p_tuner_attach()
3210 st->dib7000p_ops.get_i2c_tuner(adap->fe_adap[0].fe); tfe7790p_tuner_attach()
3217 if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, tfe7790p_tuner_attach()
3221 st->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); tfe7790p_tuner_attach()
3223 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; tfe7790p_tuner_attach()
3224 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7090_agc_startup; tfe7790p_tuner_attach()
3276 static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) stk7070pd_frontend_attach0() argument
3278 struct dib0700_adapter_state *state = adap->priv; stk7070pd_frontend_attach0()
3283 stk7070pd_init(adap->dev); stk7070pd_frontend_attach0()
3286 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); stk7070pd_frontend_attach0()
3288 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_frontend_attach0()
3296 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]); stk7070pd_frontend_attach0()
3297 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7070pd_frontend_attach0()
3300 static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) stk7070pd_frontend_attach1() argument
3302 struct dib0700_adapter_state *state = adap->priv; stk7070pd_frontend_attach1()
3307 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x82, &stk7070pd_dib7000p_config[1]); stk7070pd_frontend_attach1()
3308 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; stk7070pd_frontend_attach1()
3314 struct dvb_usb_adapter *adap = fe->dvb->priv; novatd_read_status_override() local
3315 struct dvb_usb_device *dev = adap->dev; novatd_read_status_override()
3322 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, novatd_read_status_override()
3330 struct dvb_usb_adapter *adap = fe->dvb->priv; novatd_sleep_override() local
3331 struct dvb_usb_device *dev = adap->dev; novatd_sleep_override()
3335 dib0700_set_gpio(dev, adap->id == 0 ? GPIO1 : GPIO0, GPIO_OUT, 0); novatd_sleep_override()
3346 static int novatd_frontend_attach(struct dvb_usb_adapter *adap) novatd_frontend_attach() argument
3348 struct dvb_usb_device *dev = adap->dev; novatd_frontend_attach()
3350 struct dib0700_adapter_state *state = adap->priv; novatd_frontend_attach()
3355 if (adap->id == 0) { novatd_frontend_attach()
3372 adap->fe_adap[0].fe = state->dib7000p_ops.init(&dev->i2c_adap, novatd_frontend_attach()
3373 adap->id == 0 ? 0x80 : 0x82, novatd_frontend_attach()
3374 &stk7070pd_dib7000p_config[adap->id]); novatd_frontend_attach()
3376 if (adap->fe_adap[0].fe == NULL) novatd_frontend_attach()
3379 st->read_status = adap->fe_adap[0].fe->ops.read_status; novatd_frontend_attach()
3380 adap->fe_adap[0].fe->ops.read_status = novatd_read_status_override; novatd_frontend_attach()
3381 st->sleep = adap->fe_adap[0].fe->ops.sleep; novatd_frontend_attach()
3382 adap->fe_adap[0].fe->ops.sleep = novatd_sleep_override; novatd_frontend_attach()
3409 static int s5h1411_frontend_attach(struct dvb_usb_adapter *adap) s5h1411_frontend_attach() argument
3411 struct dib0700_state *st = adap->dev->priv; s5h1411_frontend_attach()
3420 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0); s5h1411_frontend_attach()
3421 dib0700_set_gpio(adap->dev, GPIO3, GPIO_OUT, 0); s5h1411_frontend_attach()
3422 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); s5h1411_frontend_attach()
3424 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); s5h1411_frontend_attach()
3426 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); s5h1411_frontend_attach()
3428 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); s5h1411_frontend_attach()
3429 dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); s5h1411_frontend_attach()
3430 dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); s5h1411_frontend_attach()
3431 dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); s5h1411_frontend_attach()
3432 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 0); s5h1411_frontend_attach()
3436 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); s5h1411_frontend_attach()
3439 adap->fe_adap[0].fe = dvb_attach(s5h1411_attach, &pinnacle_801e_config, s5h1411_frontend_attach()
3440 &adap->dev->i2c_adap); s5h1411_frontend_attach()
3441 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; s5h1411_frontend_attach()
3447 struct dvb_usb_adapter *adap = priv; dib0700_xc5000_tuner_callback() local
3451 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 0); dib0700_xc5000_tuner_callback()
3453 dib0700_set_gpio(adap->dev, GPIO1, GPIO_OUT, 1); dib0700_xc5000_tuner_callback()
3468 static int xc5000_tuner_attach(struct dvb_usb_adapter *adap) xc5000_tuner_attach() argument
3471 adap->fe_adap[0].fe->callback = dib0700_xc5000_tuner_callback; xc5000_tuner_attach()
3473 return dvb_attach(xc5000_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, xc5000_tuner_attach()
3481 struct dvb_usb_adapter *adap = priv; dib0700_xc4000_tuner_callback() local
3482 struct dib0700_adapter_state *state = adap->priv; dib0700_xc4000_tuner_callback()
3486 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 0); dib0700_xc4000_tuner_callback()
3488 state->dib7000p_ops.set_gpio(adap->fe_adap[0].fe, 8, 0, 1); dib0700_xc4000_tuner_callback()
3571 static int pctv340e_frontend_attach(struct dvb_usb_adapter *adap) pctv340e_frontend_attach() argument
3573 struct dib0700_state *st = adap->dev->priv; pctv340e_frontend_attach()
3574 struct dib0700_adapter_state *state = adap->priv; pctv340e_frontend_attach()
3580 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); pctv340e_frontend_attach()
3582 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); pctv340e_frontend_attach()
3586 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); pctv340e_frontend_attach()
3588 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); pctv340e_frontend_attach()
3591 dib0700_set_gpio(adap->dev, GPIO8, GPIO_OUT, 1); pctv340e_frontend_attach()
3594 dib0700_set_gpio(adap->dev, GPIO2, GPIO_OUT, 1); pctv340e_frontend_attach()
3597 dib0700_ctrl_clock(adap->dev, 72, 1); pctv340e_frontend_attach()
3601 if (state->dib7000p_ops.dib7000pc_detection(&adap->dev->i2c_adap) == 0) { pctv340e_frontend_attach()
3607 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x12, pctv340e_frontend_attach()
3611 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; pctv340e_frontend_attach()
3622 static int xc4000_tuner_attach(struct dvb_usb_adapter *adap) xc4000_tuner_attach() argument
3625 struct dib0700_adapter_state *state = adap->priv; xc4000_tuner_attach()
3628 tun_i2c = state->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, xc4000_tuner_attach()
3636 adap->fe_adap[0].fe->callback = dib0700_xc4000_tuner_callback; xc4000_tuner_attach()
3638 return dvb_attach(xc4000_attach, adap->fe_adap[0].fe, tun_i2c, xc4000_tuner_attach()
3671 static int lgdt3305_frontend_attach(struct dvb_usb_adapter *adap) lgdt3305_frontend_attach() argument
3673 struct dib0700_state *st = adap->dev->priv; lgdt3305_frontend_attach()
3681 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); lgdt3305_frontend_attach()
3683 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); lgdt3305_frontend_attach()
3687 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); lgdt3305_frontend_attach()
3689 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); lgdt3305_frontend_attach()
3691 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); lgdt3305_frontend_attach()
3694 adap->fe_adap[0].fe = dvb_attach(lgdt3305_attach, lgdt3305_frontend_attach()
3696 &adap->dev->i2c_adap); lgdt3305_frontend_attach()
3698 return adap->fe_adap[0].fe == NULL ? -ENODEV : 0; lgdt3305_frontend_attach()
3701 static int mxl5007t_tuner_attach(struct dvb_usb_adapter *adap) mxl5007t_tuner_attach() argument
3703 return dvb_attach(mxl5007t_attach, adap->fe_adap[0].fe, mxl5007t_tuner_attach()
3704 &adap->dev->i2c_adap, 0x60, mxl5007t_tuner_attach()
H A Ddibusb-common.c26 int dibusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) dibusb_streaming_ctrl() argument
28 if (adap->priv != NULL) { dibusb_streaming_ctrl()
29 struct dibusb_state *st = adap->priv; dibusb_streaming_ctrl()
31 if (st->ops.fifo_ctrl(adap->fe_adap[0].fe, onoff)) { dibusb_streaming_ctrl()
40 int dibusb_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) dibusb_pid_filter() argument
42 if (adap->priv != NULL) { dibusb_pid_filter()
43 struct dibusb_state *st = adap->priv; dibusb_pid_filter()
45 st->ops.pid_ctrl(adap->fe_adap[0].fe, dibusb_pid_filter()
52 int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) dibusb_pid_filter_ctrl() argument
54 if (adap->priv != NULL) { dibusb_pid_filter_ctrl()
55 struct dibusb_state *st = adap->priv; dibusb_pid_filter_ctrl()
57 if (st->ops.pid_parse(adap->fe_adap[0].fe, onoff) < 0) dibusb_pid_filter_ctrl()
77 int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) dibusb2_0_streaming_ctrl() argument
82 if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0) dibusb2_0_streaming_ctrl()
88 if ((ret = dvb_usb_generic_write(adap->dev,b,2)) < 0) dibusb2_0_streaming_ctrl()
94 return dvb_usb_generic_write(adap->dev,b,3); dibusb2_0_streaming_ctrl()
137 static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) dibusb_i2c_xfer() argument
139 struct dvb_usb_device *d = i2c_get_adapdata(adap); dibusb_i2c_xfer()
259 int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap) dibusb_dib3000mc_frontend_attach() argument
261 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && dibusb_dib3000mc_frontend_attach()
262 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == dibusb_dib3000mc_frontend_attach()
267 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, dibusb_dib3000mc_frontend_attach()
268 &adap->dev->i2c_adap, dibusb_dib3000mc_frontend_attach()
271 if ((adap->fe_adap[0].fe) == NULL) dibusb_dib3000mc_frontend_attach()
272 adap->fe_adap[0].fe = dvb_attach(dib3000mc_attach, dibusb_dib3000mc_frontend_attach()
273 &adap->dev->i2c_adap, dibusb_dib3000mc_frontend_attach()
276 if ((adap->fe_adap[0].fe) != NULL) { dibusb_dib3000mc_frontend_attach()
277 if (adap->priv != NULL) { dibusb_dib3000mc_frontend_attach()
278 struct dibusb_state *st = adap->priv; dibusb_dib3000mc_frontend_attach()
292 int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap) dibusb_dib3000mc_tuner_attach() argument
294 struct dibusb_state *st = adap->priv; dibusb_dib3000mc_tuner_attach()
300 if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_LITEON && dibusb_dib3000mc_tuner_attach()
301 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_LITEON_DVB_T_WARM) { dibusb_dib3000mc_tuner_attach()
303 dibusb_read_eeprom_byte(adap->dev,0x7E,&a); dibusb_dib3000mc_tuner_attach()
304 dibusb_read_eeprom_byte(adap->dev,0x7F,&b); dibusb_dib3000mc_tuner_attach()
313 } else if (le16_to_cpu(adap->dev->udev->descriptor.idVendor) == USB_VID_DIBCOM && dibusb_dib3000mc_tuner_attach()
314 le16_to_cpu(adap->dev->udev->descriptor.idProduct) == USB_PID_DIBCOM_MOD3001_WARM) { dibusb_dib3000mc_tuner_attach()
316 dibusb_read_eeprom_byte(adap->dev, 7, &desc); dibusb_dib3000mc_tuner_attach()
320 dibusb_read_eeprom_byte(adap->dev, a, &desc); dibusb_dib3000mc_tuner_attach()
330 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe_adap[0].fe, 1); dibusb_dib3000mc_tuner_attach()
331 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) { dibusb_dib3000mc_tuner_attach()
333 if (dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, tun_i2c, DVB_PLL_ENV57H1XD5) == NULL) dibusb_dib3000mc_tuner_attach()
338 dib3000mc_set_config(adap->fe_adap[0].fe, &stk3000p_dib3000p_config); dibusb_dib3000mc_tuner_attach()
H A Dvp702x.c155 static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass) vp702x_set_pld_mode() argument
158 struct vp702x_device_state *st = adap->dev->priv; vp702x_set_pld_mode()
166 ret = vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e, vp702x_set_pld_mode()
172 static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state) vp702x_set_pld_state() argument
175 struct vp702x_device_state *st = adap->dev->priv; vp702x_set_pld_state()
182 ret = vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f, vp702x_set_pld_state()
190 static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff) vp702x_set_pid() argument
192 struct vp702x_adapter_state *st = adap->priv; vp702x_set_pid()
193 struct vp702x_device_state *dst = adap->dev->priv; vp702x_set_pid()
205 vp702x_set_pld_state(adap, st->pid_filter_state); vp702x_set_pid()
211 vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16); vp702x_set_pid()
212 vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16); vp702x_set_pid()
220 static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap) vp702x_init_pid_filter() argument
222 struct vp702x_adapter_state *st = adap->priv; vp702x_init_pid_filter()
223 struct vp702x_device_state *dst = adap->dev->priv; vp702x_init_pid_filter()
231 vp702x_set_pld_mode(adap, 1); /* bypass */ vp702x_init_pid_filter()
234 vp702x_set_pid(adap, 0xffff, i, 1); vp702x_init_pid_filter()
239 vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10); vp702x_init_pid_filter()
240 vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10); vp702x_init_pid_filter()
241 vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10); vp702x_init_pid_filter()
248 static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) vp702x_streaming_ctrl() argument
309 static int vp702x_frontend_attach(struct dvb_usb_adapter *adap) vp702x_frontend_attach() argument
313 vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0); vp702x_frontend_attach()
315 if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, vp702x_frontend_attach()
322 vp702x_init_pid_filter(adap); vp702x_frontend_attach()
324 adap->fe_adap[0].fe = vp702x_fe_attach(adap->dev); vp702x_frontend_attach()
325 vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 1, 7, NULL, 0); vp702x_frontend_attach()
H A Ddvb-usb-init.c31 struct dvb_usb_adapter *adap; dvb_usb_adapter_init() local
35 adap = &d->adapter[n]; dvb_usb_adapter_init()
36 adap->dev = d; dvb_usb_adapter_init()
37 adap->id = n; dvb_usb_adapter_init()
39 memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); dvb_usb_adapter_init()
41 for (o = 0; o < adap->props.num_frontends; o++) { dvb_usb_adapter_init()
42 struct dvb_usb_adapter_fe_properties *props = &adap->props.fe[o]; dvb_usb_adapter_init()
52 adap->fe_adap[o].pid_filtering = 1; dvb_usb_adapter_init()
53 adap->fe_adap[o].max_feed_count = props->pid_filter_count; dvb_usb_adapter_init()
56 adap->fe_adap[o].pid_filtering = 0; dvb_usb_adapter_init()
57 adap->fe_adap[o].max_feed_count = 255; dvb_usb_adapter_init()
60 if (!adap->fe_adap[o].pid_filtering && dvb_usb_adapter_init()
64 adap->fe_adap[o].pid_filtering = 1; dvb_usb_adapter_init()
65 adap->fe_adap[o].max_feed_count = props->pid_filter_count; dvb_usb_adapter_init()
69 adap->fe_adap[o].priv = kzalloc(props->size_of_priv, GFP_KERNEL); dvb_usb_adapter_init()
70 if (adap->fe_adap[o].priv == NULL) { dvb_usb_adapter_init()
77 if (adap->props.size_of_priv > 0) { dvb_usb_adapter_init()
78 adap->priv = kzalloc(adap->props.size_of_priv, GFP_KERNEL); dvb_usb_adapter_init()
79 if (adap->priv == NULL) { dvb_usb_adapter_init()
85 if ((ret = dvb_usb_adapter_stream_init(adap)) || dvb_usb_adapter_init()
86 (ret = dvb_usb_adapter_dvb_init(adap, adapter_nrs)) || dvb_usb_adapter_init()
87 (ret = dvb_usb_adapter_frontend_init(adap))) { dvb_usb_adapter_init()
92 if (adap->fe_adap[1].fe) dvb_usb_adapter_init()
93 adap->dvb_adap.mfe_shared = 1; dvb_usb_adapter_init()
H A Ddvb-usb-common.h37 extern int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap);
38 extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap);
43 extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap,
45 extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap);
46 extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap);
47 extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap);
H A Dcxusb.c150 static int cxusb_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], cxusb_i2c_xfer() argument
153 struct dvb_usb_device *d = i2c_get_adapdata(adap); cxusb_i2c_xfer()
350 static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) cxusb_streaming_ctrl() argument
354 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0); cxusb_streaming_ctrl()
356 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0); cxusb_streaming_ctrl()
361 static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) cxusb_aver_streaming_ctrl() argument
364 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0); cxusb_aver_streaming_ctrl()
366 cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF, cxusb_aver_streaming_ctrl()
418 struct dvb_usb_adapter *adap, int onoff) cxusb_d680_dmb_streaming_ctrl()
422 cxusb_d680_dmb_drain_video(adap->dev); cxusb_d680_dmb_streaming_ctrl()
423 return cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, cxusb_d680_dmb_streaming_ctrl()
426 int ret = cxusb_ctrl_msg(adap->dev, cxusb_d680_dmb_streaming_ctrl()
772 static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) cxusb_fmd1216me_tuner_attach() argument
774 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, cxusb_fmd1216me_tuner_attach()
775 &adap->dev->i2c_adap, 0x61, cxusb_fmd1216me_tuner_attach()
780 static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap) cxusb_dee1601_tuner_attach() argument
782 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, cxusb_dee1601_tuner_attach()
787 static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap) cxusb_lgz201_tuner_attach() argument
789 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_LG_Z201); cxusb_lgz201_tuner_attach()
793 static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap) cxusb_dtt7579_tuner_attach() argument
795 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, cxusb_dtt7579_tuner_attach()
800 static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap) cxusb_lgh064f_tuner_attach() argument
802 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, cxusb_lgh064f_tuner_attach()
803 &adap->dev->i2c_adap, 0x61, TUNER_LG_TDVS_H06XF); cxusb_lgh064f_tuner_attach()
810 struct dvb_usb_adapter *adap = ptr; dvico_bluebird_xc2028_callback() local
811 struct dvb_usb_device *d = adap->dev; dvico_bluebird_xc2028_callback()
830 static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap) cxusb_dvico_xc3028_tuner_attach() argument
834 .i2c_adap = &adap->dev->i2c_adap, cxusb_dvico_xc3028_tuner_attach()
844 adap->fe_adap[0].fe->callback = dvico_bluebird_xc2028_callback; cxusb_dvico_xc3028_tuner_attach()
846 fe = dvb_attach(xc2028_attach, adap->fe_adap[0].fe, &cfg); cxusb_dvico_xc3028_tuner_attach()
855 static int cxusb_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) cxusb_mxl5003s_tuner_attach() argument
857 dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, cxusb_mxl5003s_tuner_attach()
858 &adap->dev->i2c_adap, &aver_a868r_tuner); cxusb_mxl5003s_tuner_attach()
862 static int cxusb_d680_dmb_tuner_attach(struct dvb_usb_adapter *adap) cxusb_d680_dmb_tuner_attach() argument
865 fe = dvb_attach(mxl5005s_attach, adap->fe_adap[0].fe, cxusb_d680_dmb_tuner_attach()
866 &adap->dev->i2c_adap, &d680_dmb_tuner); cxusb_d680_dmb_tuner_attach()
870 static int cxusb_mygica_d689_tuner_attach(struct dvb_usb_adapter *adap) cxusb_mygica_d689_tuner_attach() argument
873 fe = dvb_attach(max2165_attach, adap->fe_adap[0].fe, cxusb_mygica_d689_tuner_attach()
874 &adap->dev->i2c_adap, &mygica_d689_max2165_cfg); cxusb_mygica_d689_tuner_attach()
878 static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap) cxusb_cx22702_frontend_attach() argument
881 if (usb_set_interface(adap->dev->udev, 0, 6) < 0) cxusb_cx22702_frontend_attach()
884 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1); cxusb_cx22702_frontend_attach()
886 adap->fe_adap[0].fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, cxusb_cx22702_frontend_attach()
887 &adap->dev->i2c_adap); cxusb_cx22702_frontend_attach()
888 if ((adap->fe_adap[0].fe) != NULL) cxusb_cx22702_frontend_attach()
894 static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) cxusb_lgdt3303_frontend_attach() argument
896 if (usb_set_interface(adap->dev->udev, 0, 7) < 0) cxusb_lgdt3303_frontend_attach()
899 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_lgdt3303_frontend_attach()
901 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, cxusb_lgdt3303_frontend_attach()
903 &adap->dev->i2c_adap); cxusb_lgdt3303_frontend_attach()
904 if ((adap->fe_adap[0].fe) != NULL) cxusb_lgdt3303_frontend_attach()
910 static int cxusb_aver_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap) cxusb_aver_lgdt3303_frontend_attach() argument
912 adap->fe_adap[0].fe = dvb_attach(lgdt330x_attach, &cxusb_aver_lgdt3303_config, cxusb_aver_lgdt3303_frontend_attach()
913 &adap->dev->i2c_adap); cxusb_aver_lgdt3303_frontend_attach()
914 if (adap->fe_adap[0].fe != NULL) cxusb_aver_lgdt3303_frontend_attach()
920 static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap) cxusb_mt352_frontend_attach() argument
923 if (usb_set_interface(adap->dev->udev, 0, 0) < 0) cxusb_mt352_frontend_attach()
926 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_mt352_frontend_attach()
928 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_config, cxusb_mt352_frontend_attach()
929 &adap->dev->i2c_adap); cxusb_mt352_frontend_attach()
930 if ((adap->fe_adap[0].fe) != NULL) cxusb_mt352_frontend_attach()
936 static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap) cxusb_dee1601_frontend_attach() argument
938 if (usb_set_interface(adap->dev->udev, 0, 0) < 0) cxusb_dee1601_frontend_attach()
941 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_dee1601_frontend_attach()
943 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, cxusb_dee1601_frontend_attach()
944 &adap->dev->i2c_adap); cxusb_dee1601_frontend_attach()
945 if ((adap->fe_adap[0].fe) != NULL) cxusb_dee1601_frontend_attach()
948 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, cxusb_dee1601_frontend_attach()
950 &adap->dev->i2c_adap); cxusb_dee1601_frontend_attach()
951 if ((adap->fe_adap[0].fe) != NULL) cxusb_dee1601_frontend_attach()
957 static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) cxusb_dualdig4_frontend_attach() argument
964 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) cxusb_dualdig4_frontend_attach()
967 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_dualdig4_frontend_attach()
970 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); cxusb_dualdig4_frontend_attach()
971 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); cxusb_dualdig4_frontend_attach()
972 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); cxusb_dualdig4_frontend_attach()
974 adap->fe_adap[0].fe = cxusb_dualdig4_frontend_attach()
977 &adap->dev->i2c_adap); cxusb_dualdig4_frontend_attach()
978 if ((adap->fe_adap[0].fe) == NULL) cxusb_dualdig4_frontend_attach()
982 for (i = 0; adap->dev->props.rc.legacy.rc_map_table != NULL && i < 5; i++) { cxusb_dualdig4_frontend_attach()
984 if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) cxusb_dualdig4_frontend_attach()
990 adap->dev->props.rc.legacy.rc_map_table = NULL; cxusb_dualdig4_frontend_attach()
1080 static int cxusb_dualdig4_rev2_frontend_attach(struct dvb_usb_adapter *adap) cxusb_dualdig4_rev2_frontend_attach() argument
1082 struct dib0700_adapter_state *state = adap->priv; cxusb_dualdig4_rev2_frontend_attach()
1084 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) cxusb_dualdig4_rev2_frontend_attach()
1087 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_dualdig4_rev2_frontend_attach()
1089 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); cxusb_dualdig4_rev2_frontend_attach()
1094 if (state->dib7000p_ops.i2c_enumeration(&adap->dev->i2c_adap, 1, 18, cxusb_dualdig4_rev2_frontend_attach()
1100 adap->fe_adap[0].fe = state->dib7000p_ops.init(&adap->dev->i2c_adap, 0x80, cxusb_dualdig4_rev2_frontend_attach()
1102 if (adap->fe_adap[0].fe == NULL) cxusb_dualdig4_rev2_frontend_attach()
1110 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7070_tuner_reset() local
1111 struct dib0700_adapter_state *state = adap->priv; dib7070_tuner_reset()
1131 struct dvb_usb_adapter *adap = fe->dvb->priv; dib7070_set_param_override() local
1132 struct dib0700_adapter_state *state = adap->priv; dib7070_set_param_override()
1147 static int cxusb_dualdig4_rev2_tuner_attach(struct dvb_usb_adapter *adap) cxusb_dualdig4_rev2_tuner_attach() argument
1149 struct dib0700_adapter_state *st = adap->priv; cxusb_dualdig4_rev2_tuner_attach()
1157 tun_i2c = st->dib7000p_ops.get_i2c_master(adap->fe_adap[0].fe, cxusb_dualdig4_rev2_tuner_attach()
1160 if (dvb_attach(dib0070_attach, adap->fe_adap[0].fe, tun_i2c, cxusb_dualdig4_rev2_tuner_attach()
1164 st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; cxusb_dualdig4_rev2_tuner_attach()
1165 adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib7070_set_param_override; cxusb_dualdig4_rev2_tuner_attach()
1169 static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) cxusb_nano2_frontend_attach() argument
1171 if (usb_set_interface(adap->dev->udev, 0, 1) < 0) cxusb_nano2_frontend_attach()
1174 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); cxusb_nano2_frontend_attach()
1177 cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); cxusb_nano2_frontend_attach()
1178 cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); cxusb_nano2_frontend_attach()
1179 cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); cxusb_nano2_frontend_attach()
1181 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, cxusb_nano2_frontend_attach()
1183 &adap->dev->i2c_adap); cxusb_nano2_frontend_attach()
1184 if ((adap->fe_adap[0].fe) != NULL) cxusb_nano2_frontend_attach()
1187 adap->fe_adap[0].fe = dvb_attach(mt352_attach, cxusb_nano2_frontend_attach()
1189 &adap->dev->i2c_adap); cxusb_nano2_frontend_attach()
1190 if ((adap->fe_adap[0].fe) != NULL) cxusb_nano2_frontend_attach()
1210 static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) cxusb_d680_dmb_frontend_attach() argument
1212 struct dvb_usb_device *d = adap->dev; cxusb_d680_dmb_frontend_attach()
1247 adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap); cxusb_d680_dmb_frontend_attach()
1248 if (adap->fe_adap[0].fe == NULL) cxusb_d680_dmb_frontend_attach()
1268 static int cxusb_mygica_d689_frontend_attach(struct dvb_usb_adapter *adap) cxusb_mygica_d689_frontend_attach() argument
1270 struct dvb_usb_device *d = adap->dev; cxusb_mygica_d689_frontend_attach()
1298 adap->fe_adap[0].fe = dvb_attach(atbm8830_attach, &mygica_d689_atbm8830_cfg, cxusb_mygica_d689_frontend_attach()
1300 if (adap->fe_adap[0].fe == NULL) cxusb_mygica_d689_frontend_attach()
1306 static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap) cxusb_mygica_t230_frontend_attach() argument
1308 struct dvb_usb_device *d = adap->dev; cxusb_mygica_t230_frontend_attach()
1331 si2168_config.fe = &adap->fe_adap[0].fe; cxusb_mygica_t230_frontend_attach()
1352 si2157_config.fe = adap->fe_adap[0].fe; cxusb_mygica_t230_frontend_attach()
417 cxusb_d680_dmb_streaming_ctrl( struct dvb_usb_adapter *adap, int onoff) cxusb_d680_dmb_streaming_ctrl() argument
H A Ddibusb-mb.c21 struct dvb_usb_adapter *adap = fe->dvb->priv; dib3000mb_i2c_gate_ctrl() local
22 struct dibusb_state *st = adap->priv; dib3000mb_i2c_gate_ctrl()
27 static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap) dibusb_dib3000mb_frontend_attach() argument
30 struct dibusb_state *st = adap->priv; dibusb_dib3000mb_frontend_attach()
34 adap->fe_adap[0].fe = dvb_attach(dib3000mb_attach, &demod_cfg, dibusb_dib3000mb_frontend_attach()
35 &adap->dev->i2c_adap, &st->ops); dibusb_dib3000mb_frontend_attach()
36 if ((adap->fe_adap[0].fe) == NULL) dibusb_dib3000mb_frontend_attach()
39 adap->fe_adap[0].fe->ops.i2c_gate_ctrl = dib3000mb_i2c_gate_ctrl; dibusb_dib3000mb_frontend_attach()
44 static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap) dibusb_thomson_tuner_attach() argument
46 struct dibusb_state *st = adap->priv; dibusb_thomson_tuner_attach()
50 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, dibusb_thomson_tuner_attach()
55 static int dibusb_panasonic_tuner_attach(struct dvb_usb_adapter *adap) dibusb_panasonic_tuner_attach() argument
57 struct dibusb_state *st = adap->priv; dibusb_panasonic_tuner_attach()
61 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, dibusb_panasonic_tuner_attach()
69 static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap) dibusb_tuner_probe_and_attach() argument
77 struct dibusb_state *st = adap->priv; dibusb_tuner_probe_and_attach()
82 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) dibusb_tuner_probe_and_attach()
83 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 1); dibusb_tuner_probe_and_attach()
85 if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) { dibusb_tuner_probe_and_attach()
90 if (adap->fe_adap[0].fe->ops.i2c_gate_ctrl) dibusb_tuner_probe_and_attach()
91 adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, 0); dibusb_tuner_probe_and_attach()
95 ret = dibusb_thomson_tuner_attach(adap); dibusb_tuner_probe_and_attach()
98 ret = dibusb_panasonic_tuner_attach(adap); dibusb_tuner_probe_and_attach()
H A Dttusb2.c368 static int ttusb2_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) ttusb2_i2c_xfer() argument
370 struct dvb_usb_device *d = i2c_get_adapdata(adap); ttusb2_i2c_xfer()
506 static int ttusb2_frontend_tda10086_attach(struct dvb_usb_adapter *adap) ttusb2_frontend_tda10086_attach() argument
508 if (usb_set_interface(adap->dev->udev,0,3) < 0) ttusb2_frontend_tda10086_attach()
511 if ((adap->fe_adap[0].fe = dvb_attach(tda10086_attach, &tda10086_config, &adap->dev->i2c_adap)) == NULL) { ttusb2_frontend_tda10086_attach()
521 struct dvb_usb_adapter *adap = fe->dvb->priv; ttusb2_ct3650_i2c_gate_ctrl() local
523 return adap->fe_adap[0].fe->ops.i2c_gate_ctrl(adap->fe_adap[0].fe, enable); ttusb2_ct3650_i2c_gate_ctrl()
526 static int ttusb2_frontend_tda10023_attach(struct dvb_usb_adapter *adap) ttusb2_frontend_tda10023_attach() argument
528 if (usb_set_interface(adap->dev->udev, 0, 3) < 0) ttusb2_frontend_tda10023_attach()
531 if (adap->fe_adap[0].fe == NULL) { ttusb2_frontend_tda10023_attach()
533 adap->fe_adap[0].fe = dvb_attach(tda10023_attach, ttusb2_frontend_tda10023_attach()
534 &tda10023_config, &adap->dev->i2c_adap, 0x48); ttusb2_frontend_tda10023_attach()
536 if (adap->fe_adap[0].fe == NULL) { ttusb2_frontend_tda10023_attach()
540 tt3650_ci_init(adap); ttusb2_frontend_tda10023_attach()
542 adap->fe_adap[1].fe = dvb_attach(tda10048_attach, ttusb2_frontend_tda10023_attach()
543 &tda10048_config, &adap->dev->i2c_adap); ttusb2_frontend_tda10023_attach()
545 if (adap->fe_adap[1].fe == NULL) { ttusb2_frontend_tda10023_attach()
551 adap->fe_adap[1].fe->ops.i2c_gate_ctrl = ttusb2_ct3650_i2c_gate_ctrl; ttusb2_frontend_tda10023_attach()
558 static int ttusb2_tuner_tda827x_attach(struct dvb_usb_adapter *adap) ttusb2_tuner_tda827x_attach() argument
563 if (adap->fe_adap[1].fe == NULL) ttusb2_tuner_tda827x_attach()
564 fe = adap->fe_adap[0].fe; ttusb2_tuner_tda827x_attach()
566 fe = adap->fe_adap[1].fe; ttusb2_tuner_tda827x_attach()
569 if (dvb_attach(tda827x_attach, fe, 0x61, &adap->dev->i2c_adap, &tda827x_config) == NULL) { ttusb2_tuner_tda827x_attach()
576 static int ttusb2_tuner_tda826x_attach(struct dvb_usb_adapter *adap) ttusb2_tuner_tda826x_attach() argument
578 if (dvb_attach(tda826x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, 0) == NULL) { ttusb2_tuner_tda826x_attach()
583 if (dvb_attach(lnbp21_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, 0, 0) == NULL) { ttusb2_tuner_tda826x_attach()
H A Ddigitv.c50 static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) digitv_i2c_xfer() argument
52 struct dvb_usb_device *d = i2c_get_adapdata(adap); digitv_i2c_xfer()
123 struct dvb_usb_adapter *adap = fe->dvb->priv; digitv_nxt6000_tuner_set_params() local
129 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); digitv_nxt6000_tuner_set_params()
136 static int digitv_frontend_attach(struct dvb_usb_adapter *adap) digitv_frontend_attach() argument
138 struct digitv_state *st = adap->dev->priv; digitv_frontend_attach()
140 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &digitv_mt352_config, digitv_frontend_attach()
141 &adap->dev->i2c_adap); digitv_frontend_attach()
142 if ((adap->fe_adap[0].fe) != NULL) { digitv_frontend_attach()
146 adap->fe_adap[0].fe = dvb_attach(nxt6000_attach, digitv_frontend_attach()
148 &adap->dev->i2c_adap); digitv_frontend_attach()
149 if ((adap->fe_adap[0].fe) != NULL) { digitv_frontend_attach()
156 static int digitv_tuner_attach(struct dvb_usb_adapter *adap) digitv_tuner_attach() argument
158 struct digitv_state *st = adap->dev->priv; digitv_tuner_attach()
160 if (!dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, NULL, DVB_PLL_TDED4)) digitv_tuner_attach()
164 adap->fe_adap[0].fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; digitv_tuner_attach()
H A Ddtv5100.c70 static int dtv5100_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], dtv5100_i2c_xfer() argument
73 struct dvb_usb_device *d = i2c_get_adapdata(adap); dtv5100_i2c_xfer()
116 static int dtv5100_frontend_attach(struct dvb_usb_adapter *adap) dtv5100_frontend_attach() argument
118 adap->fe_adap[0].fe = dvb_attach(zl10353_attach, &dtv5100_zl10353_config, dtv5100_frontend_attach()
119 &adap->dev->i2c_adap); dtv5100_frontend_attach()
120 if (adap->fe_adap[0].fe == NULL) dtv5100_frontend_attach()
124 adap->fe_adap[0].fe->ops.i2c_gate_ctrl = NULL; dtv5100_frontend_attach()
133 static int dtv5100_tuner_attach(struct dvb_usb_adapter *adap) dtv5100_tuner_attach() argument
136 adap->fe_adap[0].fe, &adap->dev->i2c_adap, dtv5100_tuner_attach()
H A Dfriio.c109 static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], gl861_i2c_xfer() argument
112 struct dvb_usb_device *d = i2c_get_adapdata(adap); gl861_i2c_xfer()
145 static int friio_ext_ctl(struct dvb_usb_adapter *adap, friio_ext_ctl() argument
168 ret = gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
170 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
173 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
175 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
183 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
185 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
191 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
193 ret += gl861_i2c_xfer(&adap->dev->i2c_adap, &msg, 1); friio_ext_ctl()
200 static int friio_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
382 static int friio_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) friio_streaming_ctrl() argument
390 ret = friio_ext_ctl(adap, 0x6400ff64, 1); friio_streaming_ctrl()
392 ret = friio_ext_ctl(adap, 0x96ff00ff, 1); friio_streaming_ctrl()
401 static int friio_frontend_attach(struct dvb_usb_adapter *adap) friio_frontend_attach() argument
403 if (friio_initialize(adap->dev) < 0) friio_frontend_attach()
406 adap->fe_adap[0].fe = jdvbt90502_attach(adap->dev); friio_frontend_attach()
407 if (adap->fe_adap[0].fe == NULL) friio_frontend_attach()
H A Dm920x.c256 static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) m920x_i2c_xfer() argument
258 struct dvb_usb_device *d = i2c_get_adapdata(adap); m920x_i2c_xfer()
345 static int m920x_update_filters(struct dvb_usb_adapter *adap) m920x_update_filters() argument
347 struct m920x_state *m = adap->dev->priv; m920x_update_filters()
348 int enabled = m->filtering_enabled[adap->id]; m920x_update_filters()
350 int ep = adap->props.fe[0].stream.endpoint; m920x_update_filters()
353 if (m->filters[adap->id][i] == 8192) m920x_update_filters()
357 if ((ret = m920x_set_filter(adap->dev, ep, 1, enabled)) != 0) m920x_update_filters()
361 if ((ret = m920x_set_filter(adap->dev, ep, i + 2, 0)) != 0) m920x_update_filters()
367 if (m->filters[adap->id][i] == 0) m920x_update_filters()
370 if ((ret = m920x_set_filter(adap->dev, ep, filter + 2, m->filters[adap->id][i])) != 0) m920x_update_filters()
380 static int m920x_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) m920x_pid_filter_ctrl() argument
382 struct m920x_state *m = adap->dev->priv; m920x_pid_filter_ctrl()
384 m->filtering_enabled[adap->id] = onoff ? 1 : 0; m920x_pid_filter_ctrl()
386 return m920x_update_filters(adap); m920x_pid_filter_ctrl()
389 static int m920x_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) m920x_pid_filter() argument
391 struct m920x_state *m = adap->dev->priv; m920x_pid_filter()
393 m->filters[adap->id][index] = onoff ? pid : 0; m920x_pid_filter()
395 return m920x_update_filters(adap); m920x_pid_filter()
561 static int m920x_mt352_frontend_attach(struct dvb_usb_adapter *adap) m920x_mt352_frontend_attach() argument
565 adap->fe_adap[0].fe = dvb_attach(mt352_attach, m920x_mt352_frontend_attach()
567 &adap->dev->i2c_adap); m920x_mt352_frontend_attach()
568 if ((adap->fe_adap[0].fe) == NULL) m920x_mt352_frontend_attach()
574 static int m920x_mt352_frontend_attach_vp7049(struct dvb_usb_adapter *adap) m920x_mt352_frontend_attach_vp7049() argument
596 ret = m920x_write_seq(adap->dev->udev, M9206_CORE, vp7049_fe_init_seq); m920x_mt352_frontend_attach_vp7049()
602 return m920x_mt352_frontend_attach(adap); m920x_mt352_frontend_attach_vp7049()
605 static int m920x_tda10046_08_frontend_attach(struct dvb_usb_adapter *adap) m920x_tda10046_08_frontend_attach() argument
609 adap->fe_adap[0].fe = dvb_attach(tda10046_attach, m920x_tda10046_08_frontend_attach()
611 &adap->dev->i2c_adap); m920x_tda10046_08_frontend_attach()
612 if ((adap->fe_adap[0].fe) == NULL) m920x_tda10046_08_frontend_attach()
618 static int m920x_tda10046_0b_frontend_attach(struct dvb_usb_adapter *adap) m920x_tda10046_0b_frontend_attach() argument
622 adap->fe_adap[0].fe = dvb_attach(tda10046_attach, m920x_tda10046_0b_frontend_attach()
624 &adap->dev->i2c_adap); m920x_tda10046_0b_frontend_attach()
625 if ((adap->fe_adap[0].fe) == NULL) m920x_tda10046_0b_frontend_attach()
631 static int m920x_qt1010_tuner_attach(struct dvb_usb_adapter *adap) m920x_qt1010_tuner_attach() argument
635 if (dvb_attach(qt1010_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, &m920x_qt1010_config) == NULL) m920x_qt1010_tuner_attach()
641 static int m920x_tda8275_60_tuner_attach(struct dvb_usb_adapter *adap) m920x_tda8275_60_tuner_attach() argument
645 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x60, &adap->dev->i2c_adap, NULL) == NULL) m920x_tda8275_60_tuner_attach()
651 static int m920x_tda8275_61_tuner_attach(struct dvb_usb_adapter *adap) m920x_tda8275_61_tuner_attach() argument
655 if (dvb_attach(tda827x_attach, adap->fe_adap[0].fe, 0x61, &adap->dev->i2c_adap, NULL) == NULL) m920x_tda8275_61_tuner_attach()
661 static int m920x_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap) m920x_fmd1216me_tuner_attach() argument
663 dvb_attach(simple_tuner_attach, adap->fe_adap[0].fe, m920x_fmd1216me_tuner_attach()
664 &adap->dev->i2c_adap, 0x61, m920x_fmd1216me_tuner_attach()
669 static int m920x_mt2060_tuner_attach(struct dvb_usb_adapter *adap) m920x_mt2060_tuner_attach() argument
673 if (dvb_attach(mt2060_attach, adap->fe_adap[0].fe, &adap->dev->i2c_adap, m920x_mt2060_tuner_attach()
H A Daz6027.c366 static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) az6027_streaming_ctrl() argument
381 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_streaming_ctrl()
786 struct dvb_usb_adapter *adap = fe->dvb->priv; az6027_set_voltage() local
803 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); az6027_set_voltage()
808 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); az6027_set_voltage()
813 i2c_transfer(&adap->dev->i2c_adap, &i2c_msg, 1); az6027_set_voltage()
823 static int az6027_frontend_poweron(struct dvb_usb_adapter *adap) az6027_frontend_poweron() argument
836 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_frontend_poweron()
842 static int az6027_frontend_reset(struct dvb_usb_adapter *adap) az6027_frontend_reset() argument
856 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_frontend_reset()
866 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_frontend_reset()
877 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_frontend_reset()
885 static int az6027_frontend_tsbypass(struct dvb_usb_adapter *adap, int onoff) az6027_frontend_tsbypass() argument
899 ret = az6027_usb_out_op(adap->dev, req, value, index, NULL, blen); az6027_frontend_tsbypass()
906 static int az6027_frontend_attach(struct dvb_usb_adapter *adap) az6027_frontend_attach() argument
909 az6027_frontend_poweron(adap); az6027_frontend_attach()
910 az6027_frontend_reset(adap); az6027_frontend_attach()
912 deb_info("adap = %p, dev = %p\n", adap, adap->dev); az6027_frontend_attach()
913 adap->fe_adap[0].fe = stb0899_attach(&az6027_stb0899_config, &adap->dev->i2c_adap); az6027_frontend_attach()
915 if (adap->fe_adap[0].fe) { az6027_frontend_attach()
917 if (stb6100_attach(adap->fe_adap[0].fe, &az6027_stb6100_config, &adap->dev->i2c_adap)) { az6027_frontend_attach()
919 adap->fe_adap[0].fe->ops.set_voltage = az6027_set_voltage; az6027_frontend_attach()
920 az6027_ci_init(adap); az6027_frontend_attach()
922 adap->fe_adap[0].fe = NULL; az6027_frontend_attach()
927 az6027_frontend_tsbypass(adap, 0); az6027_frontend_attach()
953 static int az6027_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) az6027_i2c_xfer() argument
955 struct dvb_usb_device *d = i2c_get_adapdata(adap); az6027_i2c_xfer()
H A Dumt-010.c55 static int umt_mt352_frontend_attach(struct dvb_usb_adapter *adap) umt_mt352_frontend_attach() argument
63 adap->fe_adap[0].fe = dvb_attach(mt352_attach, &umt_config, &adap->dev->i2c_adap); umt_mt352_frontend_attach()
68 static int umt_tuner_attach (struct dvb_usb_adapter *adap) umt_tuner_attach() argument
70 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x61, NULL, DVB_PLL_TUA6034); umt_tuner_attach()
H A DcinergyT2-core.c51 static int cinergyt2_streaming_ctrl(struct dvb_usb_adapter *adap, int enable) cinergyt2_streaming_ctrl() argument
55 return dvb_usb_generic_rw(adap->dev, buf, sizeof(buf), result, cinergyt2_streaming_ctrl()
66 static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) cinergyt2_frontend_attach() argument
72 adap->fe_adap[0].fe = cinergyt2_fe_attach(adap->dev); cinergyt2_frontend_attach()
74 ret = dvb_usb_generic_rw(adap->dev, query, sizeof(query), state, cinergyt2_frontend_attach()
82 cinergyt2_usb_device = adap->dev; cinergyt2_frontend_attach()
H A Ddib0700_core.c164 static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, dib0700_i2c_xfer_new() argument
170 struct dvb_usb_device *d = i2c_get_adapdata(adap); dib0700_i2c_xfer_new()
267 static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, dib0700_i2c_xfer_legacy() argument
270 struct dvb_usb_device *d = i2c_get_adapdata(adap); dib0700_i2c_xfer_legacy()
317 static int dib0700_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, dib0700_i2c_xfer() argument
320 struct dvb_usb_device *d = i2c_get_adapdata(adap); dib0700_i2c_xfer()
325 return dib0700_i2c_xfer_new(adap, msg, num); dib0700_i2c_xfer()
328 return dib0700_i2c_xfer_legacy(adap, msg, num); dib0700_i2c_xfer()
548 int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) dib0700_streaming_ctrl() argument
550 struct dib0700_state *st = adap->dev->priv; dib0700_streaming_ctrl()
556 ret = dib0700_set_usb_xfer_len(adap->dev, dib0700_streaming_ctrl()
564 mutex_lock(&adap->dev->usb_mutex); dib0700_streaming_ctrl()
578 deb_info("modifying (%d) streaming state for %d\n", onoff, adap->id); dib0700_streaming_ctrl()
581 if ((adap->fe_adap[0].stream.props.endpoint != 2) dib0700_streaming_ctrl()
582 && (adap->fe_adap[0].stream.props.endpoint != 3)) { dib0700_streaming_ctrl()
583 deb_info("the endpoint number (%i) is not correct, use the adapter id instead", adap->fe_adap[0].stream.props.endpoint); dib0700_streaming_ctrl()
585 st->channel_state |= 1 << (adap->id); dib0700_streaming_ctrl()
587 st->channel_state |= 1 << ~(adap->id); dib0700_streaming_ctrl()
590 st->channel_state |= 1 << (adap->fe_adap[0].stream.props.endpoint-2); dib0700_streaming_ctrl()
592 st->channel_state |= 1 << (3-adap->fe_adap[0].stream.props.endpoint); dib0700_streaming_ctrl()
599 ret = dib0700_ctrl_wr(adap->dev, st->buf, 4); dib0700_streaming_ctrl()
600 mutex_unlock(&adap->dev->usb_mutex); dib0700_streaming_ctrl()
H A Dopera1.c134 static int opera1_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], opera1_i2c_xfer() argument
137 struct dvb_usb_device *d = i2c_get_adapdata(adap); opera1_i2c_xfer()
277 static int opera1_tuner_attach(struct dvb_usb_adapter *adap) opera1_tuner_attach() argument
280 dvb_pll_attach, adap->fe_adap[0].fe, 0xc0>>1, opera1_tuner_attach()
281 &adap->dev->i2c_adap, DVB_PLL_OPERA1 opera1_tuner_attach()
296 static int opera1_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) opera1_streaming_ctrl() argument
305 i2c_transfer(&adap->dev->i2c_adap, start_tuner, 1); opera1_streaming_ctrl()
309 static int opera1_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, opera1_pid_filter() argument
322 i2c_transfer(&adap->dev->i2c_adap, msg, 1); opera1_pid_filter()
326 static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) opera1_pid_filter_control() argument
339 i2c_transfer(&adap->dev->i2c_adap, msg, 1); opera1_pid_filter_control()
H A Ddtt200u.c33 static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) dtt200u_streaming_ctrl() argument
38 dvb_usb_generic_write(adap->dev, b_streaming, 2); dtt200u_streaming_ctrl()
41 dvb_usb_generic_write(adap->dev, &b_rst_pid, 1); dtt200u_streaming_ctrl()
45 static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff) dtt200u_pid_filter() argument
55 return dvb_usb_generic_write(adap->dev, b_pid, 4); dtt200u_pid_filter()
91 static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap) dtt200u_frontend_attach() argument
93 adap->fe_adap[0].fe = dtt200u_fe_attach(adap->dev); dtt200u_frontend_attach()
H A Ddw2102.c170 static int dw2102_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], dw2102_i2c_transfer() argument
173 struct dvb_usb_device *d = i2c_get_adapdata(adap); dw2102_i2c_transfer()
243 static int dw2102_serit_i2c_transfer(struct i2c_adapter *adap, dw2102_serit_i2c_transfer() argument
246 struct dvb_usb_device *d = i2c_get_adapdata(adap); dw2102_serit_i2c_transfer()
298 static int dw2102_earda_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) dw2102_earda_i2c_transfer() argument
300 struct dvb_usb_device *d = i2c_get_adapdata(adap); dw2102_earda_i2c_transfer()
397 static int dw2104_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], int num) dw2104_i2c_transfer() argument
399 struct dvb_usb_device *d = i2c_get_adapdata(adap); dw2104_i2c_transfer()
496 static int dw3101_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], dw3101_i2c_transfer() argument
499 struct dvb_usb_device *d = i2c_get_adapdata(adap); dw3101_i2c_transfer()
576 static int s6x0_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], s6x0_i2c_transfer() argument
579 struct dvb_usb_device *d = i2c_get_adapdata(adap); s6x0_i2c_transfer()
710 static int su3000_i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[], su3000_i2c_transfer() argument
713 struct dvb_usb_device *d = i2c_get_adapdata(adap); su3000_i2c_transfer()
878 static int su3000_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) su3000_streaming_ctrl() argument
889 i2c_transfer(&adap->dev->i2c_adap, &msg, 1); su3000_streaming_ctrl()
1504 static int tt_s2_4600_frontend_attach(struct dvb_usb_adapter *adap) tt_s2_4600_frontend_attach() argument
1506 struct dvb_usb_device *d = adap->dev; tt_s2_4600_frontend_attach()
1547 adap->fe_adap[0].fe = dvb_attach(m88ds3103_attach, tt_s2_4600_frontend_attach()
1551 if (adap->fe_adap[0].fe == NULL) tt_s2_4600_frontend_attach()
1555 ts2020_config.fe = adap->fe_adap[0].fe; tt_s2_4600_frontend_attach()
1563 dvb_frontend_detach(adap->fe_adap[0].fe); tt_s2_4600_frontend_attach()
1569 dvb_frontend_detach(adap->fe_adap[0].fe); tt_s2_4600_frontend_attach()
1574 adap->fe_adap[0].fe->ops.read_signal_strength = tt_s2_4600_frontend_attach()
1575 adap->fe_adap[0].fe->ops.tuner_ops.get_rf_strength; tt_s2_4600_frontend_attach()
1580 state->fe_read_status = adap->fe_adap[0].fe->ops.read_status; tt_s2_4600_frontend_attach()
1581 adap->fe_adap[0].fe->ops.read_status = tt_s2_4600_read_status; tt_s2_4600_frontend_attach()
1588 static int dw2102_tuner_attach(struct dvb_usb_adapter *adap) dw2102_tuner_attach() argument
1590 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, dw2102_tuner_attach()
1591 &adap->dev->i2c_adap, DVB_PLL_OPERA1); dw2102_tuner_attach()
1595 static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) dw3101_tuner_attach() argument
1597 dvb_attach(dvb_pll_attach, adap->fe_adap[0].fe, 0x60, dw3101_tuner_attach()
1598 &adap->dev->i2c_adap, DVB_PLL_TUA6034); dw3101_tuner_attach()
H A Dvp7045.c198 static int vp7045_frontend_attach(struct dvb_usb_adapter *adap) vp7045_frontend_attach() argument
202 vp7045_usb_op(adap->dev,VENDOR_STRING_READ,NULL,0,buf,20,0); vp7045_frontend_attach()
206 vp7045_usb_op(adap->dev,PRODUCT_STRING_READ,NULL,0,buf,20,0); vp7045_frontend_attach()
210 vp7045_usb_op(adap->dev,FW_VERSION_READ,NULL,0,buf,20,0); vp7045_frontend_attach()
217 adap->fe_adap[0].fe = vp7045_fe_attach(adap->dev); vp7045_frontend_attach()
H A Daf9005.c413 static int af9005_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], af9005_i2c_xfer() argument
418 struct dvb_usb_device *d = i2c_get_adapdata(adap); af9005_i2c_xfer()
798 static int af9005_frontend_attach(struct dvb_usb_adapter *adap) af9005_frontend_attach() argument
807 struct usb_device *udev = adap->dev->udev; af9005_frontend_attach()
813 af9005_read_eeprom(adap->dev, i, buf, 8); af9005_frontend_attach()
818 adap->fe_adap[0].fe = af9005_fe_attach(adap->dev); af9005_frontend_attach()
881 static int af9005_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) af9005_pid_filter_control() argument
887 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 1); af9005_pid_filter_control()
891 af9005_write_register_bits(adap->dev, af9005_pid_filter_control()
896 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 1); af9005_pid_filter_control()
899 af9005_write_ofdm_register(adap->dev, XD_MP2IF_DMX_CTRL, 0); af9005_pid_filter_control()
906 static int af9005_pid_filter(struct dvb_usb_adapter *adap, int index, af9005_pid_filter() argument
916 if (adap->feedcount == 1) { af9005_pid_filter()
918 ret = af9005_pid_filter_control(adap, onoff); af9005_pid_filter()
923 af9005_write_ofdm_register(adap->dev, af9005_pid_filter()
929 af9005_write_ofdm_register(adap->dev, af9005_pid_filter()
936 if (adap->feedcount == 0) { af9005_pid_filter()
938 ret = af9005_pid_filter_control(adap, onoff); af9005_pid_filter()
943 ret = af9005_write_ofdm_register(adap->dev, XD_MP2IF_PID_IDX, cmd); af9005_pid_filter()
H A Dgp8psk.c226 static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) gp8psk_streaming_ctrl() argument
228 return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0); gp8psk_streaming_ctrl()
231 static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap) gp8psk_frontend_attach() argument
233 adap->fe_adap[0].fe = gp8psk_fe_attach(adap->dev); gp8psk_frontend_attach()
/linux-4.4.14/sound/soc/codecs/
H A Dl3.c30 static void sendbyte(struct l3_pins *adap, unsigned int byte) sendbyte() argument
35 adap->setclk(0); sendbyte()
36 udelay(adap->data_hold); sendbyte()
37 adap->setdat(byte & 1); sendbyte()
38 udelay(adap->data_setup); sendbyte()
39 adap->setclk(1); sendbyte()
40 udelay(adap->clock_high); sendbyte()
50 static void sendbytes(struct l3_pins *adap, const u8 *buf, sendbytes() argument
57 udelay(adap->mode_hold); sendbytes()
58 adap->setmode(0); sendbytes()
59 udelay(adap->mode); sendbytes()
61 adap->setmode(1); sendbytes()
62 udelay(adap->mode_setup); sendbytes()
63 sendbyte(adap, buf[i]); sendbytes()
67 int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len) l3_write() argument
69 adap->setclk(1); l3_write()
70 adap->setdat(1); l3_write()
71 adap->setmode(1); l3_write()
72 udelay(adap->mode); l3_write()
74 adap->setmode(0); l3_write()
75 udelay(adap->mode_setup); l3_write()
76 sendbyte(adap, addr); l3_write()
77 udelay(adap->mode_hold); l3_write()
79 sendbytes(adap, data, len); l3_write()
81 adap->setclk(1); l3_write()
82 adap->setdat(1); l3_write()
83 adap->setmode(0); l3_write()
/linux-4.4.14/drivers/media/pci/pt3/
H A Dpt3_dma.c33 int pt3_stop_dma(struct pt3_adapter *adap) pt3_stop_dma() argument
35 struct pt3_board *pt3 = adap->dvb_adap.priv; pt3_stop_dma()
40 base = get_dma_base(adap->adap_idx); pt3_stop_dma()
55 int pt3_start_dma(struct pt3_adapter *adap) pt3_start_dma() argument
57 struct pt3_board *pt3 = adap->dvb_adap.priv; pt3_start_dma()
58 u32 base = get_dma_base(adap->adap_idx); pt3_start_dma()
61 iowrite32(lower_32_bits(adap->desc_buf[0].b_addr), pt3_start_dma()
63 iowrite32(upper_32_bits(adap->desc_buf[0].b_addr), pt3_start_dma()
70 static u8 *next_unit(struct pt3_adapter *adap, int *idx, int *ofs) next_unit() argument
76 if (*idx == adap->num_bufs) next_unit()
79 return &adap->buffer[*idx].data[*ofs]; next_unit()
82 int pt3_proc_dma(struct pt3_adapter *adap) pt3_proc_dma() argument
86 idx = adap->buf_idx; pt3_proc_dma()
87 ofs = adap->buf_ofs; pt3_proc_dma()
89 if (adap->buffer[idx].data[ofs] == PT3_BUF_CANARY) pt3_proc_dma()
92 while (*next_unit(adap, &idx, &ofs) != PT3_BUF_CANARY) { pt3_proc_dma()
95 p = &adap->buffer[adap->buf_idx].data[adap->buf_ofs]; pt3_proc_dma()
96 if (adap->num_discard > 0) pt3_proc_dma()
97 adap->num_discard--; pt3_proc_dma()
98 else if (adap->buf_ofs + PT3_ACCESS_UNIT > DATA_BUF_SZ) { pt3_proc_dma()
99 dvb_dmx_swfilter_packets(&adap->demux, p, pt3_proc_dma()
100 (DATA_BUF_SZ - adap->buf_ofs) / TS_PACKET_SZ); pt3_proc_dma()
101 dvb_dmx_swfilter_packets(&adap->demux, pt3_proc_dma()
102 adap->buffer[idx].data, ofs / TS_PACKET_SZ); pt3_proc_dma()
104 dvb_dmx_swfilter_packets(&adap->demux, p, pt3_proc_dma()
108 adap->buf_idx = idx; pt3_proc_dma()
109 adap->buf_ofs = ofs; pt3_proc_dma()
114 void pt3_init_dmabuf(struct pt3_adapter *adap) pt3_init_dmabuf() argument
121 p = adap->buffer[0].data; pt3_init_dmabuf()
123 while (idx < adap->num_bufs) { pt3_init_dmabuf()
129 p = adap->buffer[idx].data; pt3_init_dmabuf()
132 adap->buf_idx = 0; pt3_init_dmabuf()
133 adap->buf_ofs = 0; pt3_init_dmabuf()
136 void pt3_free_dmabuf(struct pt3_adapter *adap) pt3_free_dmabuf() argument
141 pt3 = adap->dvb_adap.priv; pt3_free_dmabuf()
142 for (i = 0; i < adap->num_bufs; i++) pt3_free_dmabuf()
144 adap->buffer[i].data, adap->buffer[i].b_addr); pt3_free_dmabuf()
145 adap->num_bufs = 0; pt3_free_dmabuf()
147 for (i = 0; i < adap->num_desc_bufs; i++) pt3_free_dmabuf()
149 adap->desc_buf[i].descs, adap->desc_buf[i].b_addr); pt3_free_dmabuf()
150 adap->num_desc_bufs = 0; pt3_free_dmabuf()
154 int pt3_alloc_dmabuf(struct pt3_adapter *adap) pt3_alloc_dmabuf() argument
164 pt3 = adap->dvb_adap.priv; pt3_alloc_dmabuf()
165 adap->num_bufs = 0; pt3_alloc_dmabuf()
166 adap->num_desc_bufs = 0; pt3_alloc_dmabuf()
169 &adap->buffer[i].b_addr, GFP_KERNEL); pt3_alloc_dmabuf()
172 adap->buffer[i].data = p; pt3_alloc_dmabuf()
173 adap->num_bufs++; pt3_alloc_dmabuf()
175 pt3_init_dmabuf(adap); pt3_alloc_dmabuf()
181 DIV_ROUND_UP(adap->num_bufs * DATA_BUF_XFERS, DESCS_IN_PAGE); pt3_alloc_dmabuf()
187 adap->num_desc_bufs++; pt3_alloc_dmabuf()
188 adap->desc_buf[i].descs = p; pt3_alloc_dmabuf()
189 adap->desc_buf[i].b_addr = desc_addr; pt3_alloc_dmabuf()
192 d = &adap->desc_buf[i - 1].descs[DESCS_IN_PAGE - 1]; pt3_alloc_dmabuf()
197 data_addr = adap->buffer[idx].b_addr + ofs; pt3_alloc_dmabuf()
198 d = &adap->desc_buf[i].descs[j]; pt3_alloc_dmabuf()
211 if (idx >= adap->num_bufs) { pt3_alloc_dmabuf()
212 desc_addr = adap->desc_buf[0].b_addr; pt3_alloc_dmabuf()
223 pt3_free_dmabuf(adap); pt3_alloc_dmabuf()
H A Dpt3.c100 pt3_demod_write(struct pt3_adapter *adap, const struct reg_val *data, int num) pt3_demod_write() argument
106 msg.addr = adap->i2c_demod->addr; pt3_demod_write()
111 ret = i2c_transfer(adap->i2c_demod->adapter, &msg, 1); pt3_demod_write()
158 struct pt3_adapter *adap; pt3_set_lna() local
165 adap = pt3_find_adapter(fe); pt3_set_lna()
167 if (val == LNA_AUTO || val == adap->cur_lna) pt3_set_lna()
170 pt3 = adap->dvb_adap.priv; pt3_set_lna()
187 adap->cur_lna = (val != 0); pt3_set_lna()
193 struct pt3_adapter *adap; pt3_set_voltage() local
199 adap = pt3_find_adapter(fe); pt3_set_voltage()
201 if (on == adap->cur_lnb) pt3_set_voltage()
203 adap->cur_lnb = on; pt3_set_voltage()
204 pt3 = adap->dvb_adap.priv; pt3_set_voltage()
445 struct pt3_adapter *adap = data; pt3_fetch_thread() local
453 pt3_init_dmabuf(adap); pt3_fetch_thread()
454 adap->num_discard = PT3_INITIAL_BUF_DROPS; pt3_fetch_thread()
456 dev_dbg(adap->dvb_adap.device, "PT3: [%s] started\n", pt3_fetch_thread()
457 adap->thread->comm); pt3_fetch_thread()
461 adap->num_discard = PT3_INITIAL_BUF_DROPS; pt3_fetch_thread()
463 pt3_proc_dma(adap); pt3_fetch_thread()
471 dev_dbg(adap->dvb_adap.device, "PT3: [%s] exited\n", pt3_fetch_thread()
472 adap->thread->comm); pt3_fetch_thread()
473 adap->thread = NULL; pt3_fetch_thread()
477 static int pt3_start_streaming(struct pt3_adapter *adap) pt3_start_streaming() argument
482 thread = kthread_run(pt3_fetch_thread, adap, "pt3-ad%i-dmx%i", pt3_start_streaming()
483 adap->dvb_adap.num, adap->dmxdev.dvbdev->id); pt3_start_streaming()
487 dev_warn(adap->dvb_adap.device, pt3_start_streaming()
488 "PT3 (adap:%d, dmx:%d): failed to start kthread\n", pt3_start_streaming()
489 adap->dvb_adap.num, adap->dmxdev.dvbdev->id); pt3_start_streaming()
492 adap->thread = thread; pt3_start_streaming()
494 return pt3_start_dma(adap); pt3_start_streaming()
497 static int pt3_stop_streaming(struct pt3_adapter *adap) pt3_stop_streaming() argument
501 ret = pt3_stop_dma(adap); pt3_stop_streaming()
503 dev_warn(adap->dvb_adap.device, pt3_stop_streaming()
504 "PT3: failed to stop streaming of adap:%d/FE:%d\n", pt3_stop_streaming()
505 adap->dvb_adap.num, adap->fe->id); pt3_stop_streaming()
508 ret = kthread_stop(adap->thread); pt3_stop_streaming()
514 struct pt3_adapter *adap; pt3_start_feed() local
519 adap = container_of(feed->demux, struct pt3_adapter, demux); pt3_start_feed()
520 adap->num_feeds++; pt3_start_feed()
521 if (adap->thread) pt3_start_feed()
523 if (adap->num_feeds != 1) { pt3_start_feed()
524 dev_warn(adap->dvb_adap.device, pt3_start_feed()
525 "%s: unmatched start/stop_feed in adap:%i/dmx:%i\n", pt3_start_feed()
526 __func__, adap->dvb_adap.num, adap->dmxdev.dvbdev->id); pt3_start_feed()
527 adap->num_feeds = 1; pt3_start_feed()
530 return pt3_start_streaming(adap); pt3_start_feed()
536 struct pt3_adapter *adap; pt3_stop_feed() local
538 adap = container_of(feed->demux, struct pt3_adapter, demux); pt3_stop_feed()
540 adap->num_feeds--; pt3_stop_feed()
541 if (adap->num_feeds > 0 || !adap->thread) pt3_stop_feed()
543 adap->num_feeds = 0; pt3_stop_feed()
545 return pt3_stop_streaming(adap); pt3_stop_feed()
552 struct pt3_adapter *adap; pt3_alloc_adapter() local
555 adap = kzalloc(sizeof(*adap), GFP_KERNEL); pt3_alloc_adapter()
556 if (!adap) pt3_alloc_adapter()
559 pt3->adaps[index] = adap; pt3_alloc_adapter()
560 adap->adap_idx = index; pt3_alloc_adapter()
563 ret = dvb_register_adapter(&adap->dvb_adap, "PT3 DVB", pt3_alloc_adapter()
570 da = &adap->dvb_adap; pt3_alloc_adapter()
574 adap->dvb_adap.priv = pt3; pt3_alloc_adapter()
575 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; pt3_alloc_adapter()
576 adap->demux.priv = adap; pt3_alloc_adapter()
577 adap->demux.feednum = 256; pt3_alloc_adapter()
578 adap->demux.filternum = 256; pt3_alloc_adapter()
579 adap->demux.start_feed = pt3_start_feed; pt3_alloc_adapter()
580 adap->demux.stop_feed = pt3_stop_feed; pt3_alloc_adapter()
581 ret = dvb_dmx_init(&adap->demux); pt3_alloc_adapter()
587 adap->dmxdev.filternum = 256; pt3_alloc_adapter()
588 adap->dmxdev.demux = &adap->demux.dmx; pt3_alloc_adapter()
589 ret = dvb_dmxdev_init(&adap->dmxdev, da); pt3_alloc_adapter()
595 ret = pt3_alloc_dmabuf(adap); pt3_alloc_adapter()
604 pt3_free_dmabuf(adap); pt3_alloc_adapter()
605 dvb_dmxdev_release(&adap->dmxdev); pt3_alloc_adapter()
607 dvb_dmx_release(&adap->demux); pt3_alloc_adapter()
612 kfree(adap); pt3_alloc_adapter()
619 struct pt3_adapter *adap; pt3_cleanup_adapter() local
622 adap = pt3->adaps[index]; pt3_cleanup_adapter()
623 if (adap == NULL) pt3_cleanup_adapter()
627 if (adap->thread) pt3_cleanup_adapter()
628 pt3_stop_streaming(adap); pt3_cleanup_adapter()
630 dmx = &adap->demux.dmx; pt3_cleanup_adapter()
632 if (adap->fe) { pt3_cleanup_adapter()
633 adap->fe->callback = NULL; pt3_cleanup_adapter()
634 if (adap->fe->frontend_priv) pt3_cleanup_adapter()
635 dvb_unregister_frontend(adap->fe); pt3_cleanup_adapter()
636 if (adap->i2c_tuner) { pt3_cleanup_adapter()
637 module_put(adap->i2c_tuner->dev.driver->owner); pt3_cleanup_adapter()
638 i2c_unregister_device(adap->i2c_tuner); pt3_cleanup_adapter()
640 if (adap->i2c_demod) { pt3_cleanup_adapter()
641 module_put(adap->i2c_demod->dev.driver->owner); pt3_cleanup_adapter()
642 i2c_unregister_device(adap->i2c_demod); pt3_cleanup_adapter()
645 pt3_free_dmabuf(adap); pt3_cleanup_adapter()
646 dvb_dmxdev_release(&adap->dmxdev); pt3_cleanup_adapter()
647 dvb_dmx_release(&adap->demux); pt3_cleanup_adapter()
649 dvb_unregister_adapter(&adap->dvb_adap); pt3_cleanup_adapter()
650 kfree(adap); pt3_cleanup_adapter()
661 struct pt3_adapter *adap; pt3_suspend() local
664 adap = pt3->adaps[i]; pt3_suspend()
665 if (adap->num_feeds > 0) pt3_suspend()
666 pt3_stop_dma(adap); pt3_suspend()
667 dvb_frontend_suspend(adap->fe); pt3_suspend()
668 pt3_free_dmabuf(adap); pt3_suspend()
681 struct pt3_adapter *adap; pt3_resume() local
693 adap = pt3->adaps[i]; pt3_resume()
694 dvb_frontend_resume(adap->fe); pt3_resume()
695 ret = pt3_alloc_dmabuf(adap); pt3_resume()
700 if (adap->num_feeds > 0) pt3_resume()
701 pt3_start_dma(adap); pt3_resume()
H A Dpt3.h173 extern int pt3_alloc_dmabuf(struct pt3_adapter *adap);
174 extern void pt3_init_dmabuf(struct pt3_adapter *adap);
175 extern void pt3_free_dmabuf(struct pt3_adapter *adap);
176 extern int pt3_start_dma(struct pt3_adapter *adap);
177 extern int pt3_stop_dma(struct pt3_adapter *adap);
178 extern int pt3_proc_dma(struct pt3_adapter *adap);
180 extern int pt3_i2c_master_xfer(struct i2c_adapter *adap,
182 extern u32 pt3_i2c_functionality(struct i2c_adapter *adap);
H A Dpt3_i2c.c202 pt3_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) pt3_i2c_master_xfer() argument
209 pt3 = i2c_get_adapdata(adap); pt3_i2c_master_xfer()
237 u32 pt3_i2c_functionality(struct i2c_adapter *adap) pt3_i2c_functionality() argument
/linux-4.4.14/drivers/media/usb/pvrusb2/
H A Dpvrusb2-dvb.c34 static int pvr2_dvb_feed_func(struct pvr2_dvb_adapter *adap) pvr2_dvb_feed_func() argument
44 stream = adap->channel.stream->stream; pvr2_dvb_feed_func()
57 &adap->demux, pvr2_dvb_feed_func()
58 adap->buffer_storage[ pvr2_dvb_feed_func()
79 adap->buffer_wait_data, pvr2_dvb_feed_func()
104 static void pvr2_dvb_notify(struct pvr2_dvb_adapter *adap) pvr2_dvb_notify() argument
106 wake_up(&adap->buffer_wait_data); pvr2_dvb_notify()
109 static void pvr2_dvb_stream_end(struct pvr2_dvb_adapter *adap) pvr2_dvb_stream_end() argument
114 if (adap->thread) { pvr2_dvb_stream_end()
115 kthread_stop(adap->thread); pvr2_dvb_stream_end()
116 adap->thread = NULL; pvr2_dvb_stream_end()
119 if (adap->channel.stream) { pvr2_dvb_stream_end()
120 stream = adap->channel.stream->stream; pvr2_dvb_stream_end()
125 pvr2_hdw_set_streaming(adap->channel.hdw, 0); pvr2_dvb_stream_end()
129 pvr2_channel_claim_stream(&adap->channel, NULL); pvr2_dvb_stream_end()
132 if (adap->stream_run) { pvr2_dvb_stream_end()
134 if (!(adap->buffer_storage[idx])) continue; pvr2_dvb_stream_end()
135 kfree(adap->buffer_storage[idx]); pvr2_dvb_stream_end()
136 adap->buffer_storage[idx] = NULL; pvr2_dvb_stream_end()
138 adap->stream_run = 0; pvr2_dvb_stream_end()
142 static int pvr2_dvb_stream_do_start(struct pvr2_dvb_adapter *adap) pvr2_dvb_stream_do_start() argument
144 struct pvr2_context *pvr = adap->channel.mc_head; pvr2_dvb_stream_do_start()
150 if (adap->stream_run) return -EIO; pvr2_dvb_stream_do_start()
152 ret = pvr2_channel_claim_stream(&adap->channel, &pvr->video_stream); pvr2_dvb_stream_do_start()
156 stream = adap->channel.stream->stream; pvr2_dvb_stream_do_start()
159 adap->buffer_storage[idx] = kmalloc(PVR2_DVB_BUFFER_SIZE, pvr2_dvb_stream_do_start()
161 if (!(adap->buffer_storage[idx])) return -ENOMEM; pvr2_dvb_stream_do_start()
165 (pvr2_stream_callback) pvr2_dvb_notify, adap); pvr2_dvb_stream_do_start()
173 adap->buffer_storage[idx], pvr2_dvb_stream_do_start()
177 ret = pvr2_hdw_set_streaming(adap->channel.hdw, 1); pvr2_dvb_stream_do_start()
185 adap->thread = kthread_run(pvr2_dvb_feed_thread, adap, "pvrusb2-dvb"); pvr2_dvb_stream_do_start()
187 if (IS_ERR(adap->thread)) { pvr2_dvb_stream_do_start()
188 ret = PTR_ERR(adap->thread); pvr2_dvb_stream_do_start()
189 adap->thread = NULL; pvr2_dvb_stream_do_start()
193 adap->stream_run = !0; pvr2_dvb_stream_do_start()
198 static int pvr2_dvb_stream_start(struct pvr2_dvb_adapter *adap) pvr2_dvb_stream_start() argument
200 int ret = pvr2_dvb_stream_do_start(adap); pvr2_dvb_stream_start()
201 if (ret < 0) pvr2_dvb_stream_end(adap); pvr2_dvb_stream_start()
207 struct pvr2_dvb_adapter *adap = dvbdmxfeed->demux->priv; pvr2_dvb_ctrl_feed() local
210 if (adap == NULL) return -ENODEV; pvr2_dvb_ctrl_feed()
212 mutex_lock(&adap->lock); pvr2_dvb_ctrl_feed()
215 if (!adap->feedcount) { pvr2_dvb_ctrl_feed()
218 ret = pvr2_dvb_stream_start(adap); pvr2_dvb_ctrl_feed()
221 (adap->feedcount)++; pvr2_dvb_ctrl_feed()
222 } else if (adap->feedcount > 0) { pvr2_dvb_ctrl_feed()
223 (adap->feedcount)--; pvr2_dvb_ctrl_feed()
224 if (!adap->feedcount) { pvr2_dvb_ctrl_feed()
227 pvr2_dvb_stream_end(adap); pvr2_dvb_ctrl_feed()
231 mutex_unlock(&adap->lock); pvr2_dvb_ctrl_feed()
250 struct pvr2_dvb_adapter *adap = fe->dvb->priv; pvr2_dvb_bus_ctrl() local
252 &adap->channel, pvr2_dvb_bus_ctrl()
256 static int pvr2_dvb_adapter_init(struct pvr2_dvb_adapter *adap) pvr2_dvb_adapter_init() argument
260 ret = dvb_register_adapter(&adap->dvb_adap, "pvrusb2-dvb", pvr2_dvb_adapter_init()
262 &adap->channel.hdw->usb_dev->dev, pvr2_dvb_adapter_init()
269 adap->dvb_adap.priv = adap; pvr2_dvb_adapter_init()
271 adap->demux.dmx.capabilities = DMX_TS_FILTERING | pvr2_dvb_adapter_init()
274 adap->demux.priv = adap; pvr2_dvb_adapter_init()
275 adap->demux.filternum = 256; pvr2_dvb_adapter_init()
276 adap->demux.feednum = 256; pvr2_dvb_adapter_init()
277 adap->demux.start_feed = pvr2_dvb_start_feed; pvr2_dvb_adapter_init()
278 adap->demux.stop_feed = pvr2_dvb_stop_feed; pvr2_dvb_adapter_init()
279 adap->demux.write_to_decoder = NULL; pvr2_dvb_adapter_init()
281 ret = dvb_dmx_init(&adap->demux); pvr2_dvb_adapter_init()
288 adap->dmxdev.filternum = adap->demux.filternum; pvr2_dvb_adapter_init()
289 adap->dmxdev.demux = &adap->demux.dmx; pvr2_dvb_adapter_init()
290 adap->dmxdev.capabilities = 0; pvr2_dvb_adapter_init()
292 ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap); pvr2_dvb_adapter_init()
299 dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx); pvr2_dvb_adapter_init()
304 dvb_dmx_release(&adap->demux); pvr2_dvb_adapter_init()
306 dvb_unregister_adapter(&adap->dvb_adap); pvr2_dvb_adapter_init()
311 static int pvr2_dvb_adapter_exit(struct pvr2_dvb_adapter *adap) pvr2_dvb_adapter_exit() argument
314 dvb_net_release(&adap->dvb_net); pvr2_dvb_adapter_exit()
315 adap->demux.dmx.close(&adap->demux.dmx); pvr2_dvb_adapter_exit()
316 dvb_dmxdev_release(&adap->dmxdev); pvr2_dvb_adapter_exit()
317 dvb_dmx_release(&adap->demux); pvr2_dvb_adapter_exit()
318 dvb_unregister_adapter(&adap->dvb_adap); pvr2_dvb_adapter_exit()
322 static int pvr2_dvb_frontend_init(struct pvr2_dvb_adapter *adap) pvr2_dvb_frontend_init() argument
324 struct pvr2_hdw *hdw = adap->channel.hdw; pvr2_dvb_frontend_init()
334 &adap->channel, pvr2_dvb_frontend_init()
350 if ((dvb_props->frontend_attach(adap) == 0) && (adap->fe)) { pvr2_dvb_frontend_init()
352 if (dvb_register_frontend(&adap->dvb_adap, adap->fe)) { pvr2_dvb_frontend_init()
355 dvb_frontend_detach(adap->fe); pvr2_dvb_frontend_init()
356 adap->fe = NULL; pvr2_dvb_frontend_init()
362 dvb_props->tuner_attach(adap); pvr2_dvb_frontend_init()
364 if (adap->fe->ops.analog_ops.standby) pvr2_dvb_frontend_init()
365 adap->fe->ops.analog_ops.standby(adap->fe); pvr2_dvb_frontend_init()
368 adap->fe->ops.ts_bus_ctrl = pvr2_dvb_bus_ctrl; pvr2_dvb_frontend_init()
378 pvr2_channel_limit_inputs(&adap->channel, 0); pvr2_dvb_frontend_init()
382 static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap) pvr2_dvb_frontend_exit() argument
384 if (adap->fe != NULL) { pvr2_dvb_frontend_exit()
385 dvb_unregister_frontend(adap->fe); pvr2_dvb_frontend_exit()
386 dvb_frontend_detach(adap->fe); pvr2_dvb_frontend_exit()
391 static void pvr2_dvb_destroy(struct pvr2_dvb_adapter *adap) pvr2_dvb_destroy() argument
393 pvr2_dvb_stream_end(adap); pvr2_dvb_destroy()
394 pvr2_dvb_frontend_exit(adap); pvr2_dvb_destroy()
395 pvr2_dvb_adapter_exit(adap); pvr2_dvb_destroy()
396 pvr2_channel_done(&adap->channel); pvr2_dvb_destroy()
397 kfree(adap); pvr2_dvb_destroy()
402 struct pvr2_dvb_adapter *adap; pvr2_dvb_internal_check() local
403 adap = container_of(chp, struct pvr2_dvb_adapter, channel); pvr2_dvb_internal_check()
404 if (!adap->channel.mc_head->disconnect_flag) return; pvr2_dvb_internal_check()
405 pvr2_dvb_destroy(adap); pvr2_dvb_internal_check()
411 struct pvr2_dvb_adapter *adap; pvr2_dvb_create() local
417 adap = kzalloc(sizeof(*adap), GFP_KERNEL); pvr2_dvb_create()
418 if (!adap) return adap; pvr2_dvb_create()
419 pvr2_channel_init(&adap->channel, pvr); pvr2_dvb_create()
420 adap->channel.check_func = pvr2_dvb_internal_check; pvr2_dvb_create()
421 init_waitqueue_head(&adap->buffer_wait_data); pvr2_dvb_create()
422 mutex_init(&adap->lock); pvr2_dvb_create()
423 ret = pvr2_dvb_adapter_init(adap); pvr2_dvb_create()
425 ret = pvr2_dvb_frontend_init(adap); pvr2_dvb_create()
427 return adap; pvr2_dvb_create()
430 pvr2_dvb_adapter_exit(adap); pvr2_dvb_create()
432 pvr2_channel_done(&adap->channel); pvr2_dvb_create()
H A Dpvrusb2-devattr.c194 static int pvr2_lgdt3303_attach(struct pvr2_dvb_adapter *adap) pvr2_lgdt3303_attach() argument
196 adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3303_config, pvr2_lgdt3303_attach()
197 &adap->channel.hdw->i2c_adap); pvr2_lgdt3303_attach()
198 if (adap->fe) pvr2_lgdt3303_attach()
204 static int pvr2_lgh06xf_attach(struct pvr2_dvb_adapter *adap) pvr2_lgh06xf_attach() argument
206 dvb_attach(simple_tuner_attach, adap->fe, pvr2_lgh06xf_attach()
207 &adap->channel.hdw->i2c_adap, 0x61, pvr2_lgh06xf_attach()
254 static int pvr2_lgdt3302_attach(struct pvr2_dvb_adapter *adap) pvr2_lgdt3302_attach() argument
256 adap->fe = dvb_attach(lgdt330x_attach, &pvr2_lgdt3302_config, pvr2_lgdt3302_attach()
257 &adap->channel.hdw->i2c_adap); pvr2_lgdt3302_attach()
258 if (adap->fe) pvr2_lgdt3302_attach()
264 static int pvr2_fcv1236d_attach(struct pvr2_dvb_adapter *adap) pvr2_fcv1236d_attach() argument
266 dvb_attach(simple_tuner_attach, adap->fe, pvr2_fcv1236d_attach()
267 &adap->channel.hdw->i2c_adap, 0x61, pvr2_fcv1236d_attach()
340 static int pvr2_tda10048_attach(struct pvr2_dvb_adapter *adap) pvr2_tda10048_attach() argument
342 adap->fe = dvb_attach(tda10048_attach, &hauppauge_tda10048_config, pvr2_tda10048_attach()
343 &adap->channel.hdw->i2c_adap); pvr2_tda10048_attach()
344 if (adap->fe) pvr2_tda10048_attach()
350 static int pvr2_73xxx_tda18271_8295_attach(struct pvr2_dvb_adapter *adap) pvr2_73xxx_tda18271_8295_attach() argument
352 dvb_attach(tda829x_attach, adap->fe, pvr2_73xxx_tda18271_8295_attach()
353 &adap->channel.hdw->i2c_adap, 0x42, pvr2_73xxx_tda18271_8295_attach()
355 dvb_attach(tda18271_attach, adap->fe, 0x60, pvr2_73xxx_tda18271_8295_attach()
356 &adap->channel.hdw->i2c_adap, pvr2_73xxx_tda18271_8295_attach()
438 static int pvr2_s5h1409_attach(struct pvr2_dvb_adapter *adap) pvr2_s5h1409_attach() argument
440 adap->fe = dvb_attach(s5h1409_attach, &pvr2_s5h1409_config, pvr2_s5h1409_attach()
441 &adap->channel.hdw->i2c_adap); pvr2_s5h1409_attach()
442 if (adap->fe) pvr2_s5h1409_attach()
448 static int pvr2_s5h1411_attach(struct pvr2_dvb_adapter *adap) pvr2_s5h1411_attach() argument
450 adap->fe = dvb_attach(s5h1411_attach, &pvr2_s5h1411_config, pvr2_s5h1411_attach()
451 &adap->channel.hdw->i2c_adap); pvr2_s5h1411_attach()
452 if (adap->fe) pvr2_s5h1411_attach()
458 static int pvr2_tda18271_8295_attach(struct pvr2_dvb_adapter *adap) pvr2_tda18271_8295_attach() argument
460 dvb_attach(tda829x_attach, adap->fe, pvr2_tda18271_8295_attach()
461 &adap->channel.hdw->i2c_adap, 0x42, pvr2_tda18271_8295_attach()
463 dvb_attach(tda18271_attach, adap->fe, 0x60, pvr2_tda18271_8295_attach()
464 &adap->channel.hdw->i2c_adap, pvr2_tda18271_8295_attach()
/linux-4.4.14/drivers/video/fbdev/mb862xx/
H A Dmb862xx-i2c.c21 static int mb862xx_i2c_wait_event(struct i2c_adapter *adap) mb862xx_i2c_wait_event() argument
23 struct mb862xxfb_par *par = adap->algo_data; mb862xx_i2c_wait_event()
36 static int mb862xx_i2c_do_address(struct i2c_adapter *adap, int addr) mb862xx_i2c_do_address() argument
38 struct mb862xxfb_par *par = adap->algo_data; mb862xx_i2c_do_address()
43 if (!mb862xx_i2c_wait_event(adap)) mb862xx_i2c_do_address()
49 static int mb862xx_i2c_write_byte(struct i2c_adapter *adap, u8 byte) mb862xx_i2c_write_byte() argument
51 struct mb862xxfb_par *par = adap->algo_data; mb862xx_i2c_write_byte()
55 if (!mb862xx_i2c_wait_event(adap)) mb862xx_i2c_write_byte()
60 static int mb862xx_i2c_read_byte(struct i2c_adapter *adap, u8 *byte, int last) mb862xx_i2c_read_byte() argument
62 struct mb862xxfb_par *par = adap->algo_data; mb862xx_i2c_read_byte()
65 if (!mb862xx_i2c_wait_event(adap)) mb862xx_i2c_read_byte()
71 static void mb862xx_i2c_stop(struct i2c_adapter *adap) mb862xx_i2c_stop() argument
73 struct mb862xxfb_par *par = adap->algo_data; mb862xx_i2c_stop()
80 static int mb862xx_i2c_read(struct i2c_adapter *adap, struct i2c_msg *m) mb862xx_i2c_read() argument
86 if (!mb862xx_i2c_read_byte(adap, &m->buf[i], i == last)) { mb862xx_i2c_read()
94 static int mb862xx_i2c_write(struct i2c_adapter *adap, struct i2c_msg *m) mb862xx_i2c_write() argument
99 if (!mb862xx_i2c_write_byte(adap, m->buf[i])) { mb862xx_i2c_write()
107 static int mb862xx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, mb862xx_xfer() argument
110 struct mb862xxfb_par *par = adap->algo_data; mb862xx_xfer()
127 err = mb862xx_i2c_do_address(adap, addr); mb862xx_xfer()
131 err = mb862xx_i2c_read(adap, m); mb862xx_xfer()
133 err = mb862xx_i2c_write(adap, m); mb862xx_xfer()
137 mb862xx_i2c_stop(adap); mb862xx_xfer()
142 static u32 mb862xx_func(struct i2c_adapter *adap) mb862xx_func() argument
163 par->adap = &mb862xx_i2c_adapter; mb862xx_i2c_init()
165 ret = i2c_add_adapter(par->adap); mb862xx_i2c_init()
175 if (par->adap) { mb862xx_i2c_exit()
176 i2c_del_adapter(par->adap); mb862xx_i2c_exit()
177 par->adap = NULL; mb862xx_i2c_exit()
/linux-4.4.14/drivers/net/ethernet/chelsio/cxgb3/
H A Dmc5.c128 struct adapter *adap = mc5->adapter; init_mask_data_array() local
135 unsigned int server_base = t3_read_reg(adap, A_MC5_DB_SERVER_INDEX); init_mask_data_array()
143 dbgi_wr_data3(adap, 0, 0, 0); init_mask_data_array()
145 if (mc5_write(adap, data_array_base + (i << addr_shift), init_mask_data_array()
150 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff); init_mask_data_array()
153 t3_write_reg(adap, A_MC5_DB_DBGI_REQ_DATA0, init_mask_data_array()
156 if (mc5_write(adap, mask_array_base + (i << addr_shift), init_mask_data_array()
166 struct adapter *adap = mc5->adapter; init_idt52100() local
168 t3_write_reg(adap, A_MC5_DB_RSP_LATENCY, init_idt52100()
170 t3_write_reg(adap, A_MC5_DB_PART_ID_INDEX, 2); init_idt52100()
176 t3_write_reg(adap, A_MC5_DB_POPEN_DATA_WR_CMD, IDT_CMD_WRITE); init_idt52100()
177 t3_write_reg(adap, A_MC5_DB_POPEN_MASK_WR_CMD, IDT_CMD_WRITE); init_idt52100()
178 t3_write_reg(adap, A_MC5_DB_AOPEN_SRCH_CMD, IDT_CMD_SEARCH); init_idt52100()
179 t3_write_reg(adap, A_MC5_DB_AOPEN_LRN_CMD, IDT_CMD_LEARN); init_idt52100()
180 t3_write_reg(adap, A_MC5_DB_SYN_SRCH_CMD, IDT_CMD_SEARCH | 0x6000); init_idt52100()
181 t3_write_reg(adap, A_MC5_DB_SYN_LRN_CMD, IDT_CMD_LEARN); init_idt52100()
182 t3_write_reg(adap, A_MC5_DB_ACK_SRCH_CMD, IDT_CMD_SEARCH); init_idt52100()
183 t3_write_reg(adap, A_MC5_DB_ACK_LRN_CMD, IDT_CMD_LEARN); init_idt52100()
184 t3_write_reg(adap, A_MC5_DB_ILOOKUP_CMD, IDT_CMD_SEARCH); init_idt52100()
185 t3_write_reg(adap, A_MC5_DB_ELOOKUP_CMD, IDT_CMD_SEARCH | 0x7000); init_idt52100()
186 t3_write_reg(adap, A_MC5_DB_DATA_WRITE_CMD, IDT_CMD_WRITE); init_idt52100()
187 t3_write_reg(adap, A_MC5_DB_DATA_READ_CMD, IDT_CMD_READ); init_idt52100()
190 t3_write_reg(adap, A_MC5_DB_DBGI_CONFIG, DBGI_MODE_IDT52100); init_idt52100()
193 dbgi_wr_data3(adap, IDT_LAR_MODE144, 0, 0); init_idt52100()
194 if (mc5_write(adap, IDT_LAR_ADR0, IDT_CMD_WRITE)) init_idt52100()
198 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0); init_idt52100()
199 if (mc5_write(adap, IDT_SSR0_ADR0, IDT_CMD_WRITE) || init_idt52100()
200 mc5_write(adap, IDT_SSR1_ADR0, IDT_CMD_WRITE)) init_idt52100()
206 dbgi_wr_data3(adap, 0xfffffff9, 0xffffffff, 0xff); init_idt52100()
208 dbgi_wr_data3(adap, 0xfffffff9, 0xffff8007, 0xff); init_idt52100()
210 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff); init_idt52100()
212 if (mc5_write(adap, IDT_GMR_BASE_ADR0 + i, IDT_CMD_WRITE)) init_idt52100()
217 dbgi_wr_data3(adap, 1, 0, 0); init_idt52100()
218 if (mc5_write(adap, IDT_SCR_ADR0, IDT_CMD_WRITE)) init_idt52100()
230 struct adapter *adap = mc5->adapter; init_idt43102() local
232 t3_write_reg(adap, A_MC5_DB_RSP_LATENCY, init_idt43102()
233 adap->params.rev == 0 ? V_RDLAT(0xd) | V_SRCHLAT(0x11) : init_idt43102()
240 t3_write_reg(adap, A_MC5_DB_POPEN_DATA_WR_CMD, IDT4_CMD_WRITE); init_idt43102()
241 t3_write_reg(adap, A_MC5_DB_POPEN_MASK_WR_CMD, IDT4_CMD_WRITE); init_idt43102()
242 t3_write_reg(adap, A_MC5_DB_AOPEN_SRCH_CMD, init_idt43102()
244 t3_write_reg(adap, A_MC5_DB_SYN_SRCH_CMD, IDT4_CMD_SEARCH144); init_idt43102()
245 t3_write_reg(adap, A_MC5_DB_ACK_SRCH_CMD, IDT4_CMD_SEARCH144 | 0x3800); init_idt43102()
246 t3_write_reg(adap, A_MC5_DB_ILOOKUP_CMD, IDT4_CMD_SEARCH144 | 0x3800); init_idt43102()
247 t3_write_reg(adap, A_MC5_DB_ELOOKUP_CMD, IDT4_CMD_SEARCH144 | 0x800); init_idt43102()
248 t3_write_reg(adap, A_MC5_DB_DATA_WRITE_CMD, IDT4_CMD_WRITE); init_idt43102()
249 t3_write_reg(adap, A_MC5_DB_DATA_READ_CMD, IDT4_CMD_READ); init_idt43102()
251 t3_write_reg(adap, A_MC5_DB_PART_ID_INDEX, 3); init_idt43102()
254 t3_write_reg(adap, A_MC5_DB_DBGI_CONFIG, DBGI_MODE_IDT52100); init_idt43102()
257 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff); init_idt43102()
259 if (mc5_write(adap, IDT4_GMR_BASE0 + i, IDT4_CMD_WRITE)) init_idt43102()
263 if (mc5_write(adap, IDT4_GMR_BASE2 + i, IDT4_CMD_WRITE)) init_idt43102()
266 dbgi_wr_data3(adap, 0xfffffff9, 0xffffffff, 0xff); init_idt43102()
267 if (mc5_write(adap, IDT4_GMR_BASE1, IDT4_CMD_WRITE) || init_idt43102()
268 mc5_write(adap, IDT4_GMR_BASE1 + 1, IDT4_CMD_WRITE) || init_idt43102()
269 mc5_write(adap, IDT4_GMR_BASE1 + 4, IDT4_CMD_WRITE)) init_idt43102()
272 dbgi_wr_data3(adap, 0xfffffff9, 0xffff8007, 0xff); init_idt43102()
273 if (mc5_write(adap, IDT4_GMR_BASE1 + 5, IDT4_CMD_WRITE)) init_idt43102()
277 dbgi_wr_data3(adap, 0xf0000000, 0, 0); init_idt43102()
278 if (mc5_write(adap, IDT4_SCR_ADR0, IDT4_CMD_WRITE)) init_idt43102()
313 struct adapter *adap = mc5->adapter; t3_mc5_init() local
322 cfg = t3_read_reg(adap, A_MC5_DB_CONFIG) & ~F_TMMODE; t3_mc5_init()
324 t3_write_reg(adap, A_MC5_DB_CONFIG, cfg); t3_mc5_init()
325 if (t3_wait_op_done(adap, A_MC5_DB_CONFIG, F_TMRDY, 1, 500, 0)) { t3_mc5_init()
326 CH_ERR(adap, "TCAM reset timed out\n"); t3_mc5_init()
330 t3_write_reg(adap, A_MC5_DB_ROUTING_TABLE_INDEX, tcam_size - nroutes); t3_mc5_init()
331 t3_write_reg(adap, A_MC5_DB_FILTER_TABLE, t3_mc5_init()
333 t3_write_reg(adap, A_MC5_DB_SERVER_INDEX, t3_mc5_init()
339 t3_write_reg(adap, A_MC5_DB_DBGI_REQ_ADDR1, 0); t3_mc5_init()
340 t3_write_reg(adap, A_MC5_DB_DBGI_REQ_ADDR2, 0); t3_mc5_init()
352 CH_ERR(adap, "Unsupported TCAM type %d\n", mc5->part_type); t3_mc5_init()
369 struct adapter *adap = mc5->adapter; t3_mc5_intr_handler() local
370 u32 cause = t3_read_reg(adap, A_MC5_DB_INT_CAUSE); t3_mc5_intr_handler()
373 CH_ALERT(adap, "MC5 parity error\n"); t3_mc5_intr_handler()
378 CH_ALERT(adap, "MC5 request queue parity error\n"); t3_mc5_intr_handler()
383 CH_ALERT(adap, "MC5 dispatch queue parity error\n"); t3_mc5_intr_handler()
396 t3_fatal_err(adap); t3_mc5_intr_handler()
398 t3_write_reg(adap, A_MC5_DB_INT_CAUSE, cause); t3_mc5_intr_handler()
H A Dxgmac.c54 struct adapter *adap = mac->adapter; xaui_serdes_reset() local
57 t3_write_reg(adap, ctrl, adap->params.vpd.xauicfg[macidx(mac)] | xaui_serdes_reset()
61 t3_read_reg(adap, ctrl); xaui_serdes_reset()
65 t3_set_reg_field(adap, ctrl, clear[i], 0); xaui_serdes_reset()
99 struct adapter *adap = mac->adapter; t3_mac_reset() local
102 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_); t3_mac_reset()
103 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ t3_mac_reset()
105 t3_write_regs(adap, mac_reset_avp, ARRAY_SIZE(mac_reset_avp), oft); t3_mac_reset()
106 t3_set_reg_field(adap, A_XGM_RXFIFO_CFG + oft, t3_mac_reset()
108 uses_xaui(adap) ? 0 : F_RXSTRFRWRD); t3_mac_reset()
109 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + oft, 0, F_UNDERUNFIX); t3_mac_reset()
111 if (uses_xaui(adap)) { t3_mac_reset()
112 if (adap->params.rev == 0) { t3_mac_reset()
113 t3_set_reg_field(adap, A_XGM_SERDES_CTRL + oft, 0, t3_mac_reset()
115 if (t3_wait_op_done(adap, A_XGM_SERDES_STATUS1 + oft, t3_mac_reset()
117 CH_ERR(adap, t3_mac_reset()
122 t3_set_reg_field(adap, A_XGM_SERDES_CTRL + oft, 0, t3_mac_reset()
128 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + oft, t3_mac_reset()
133 if (is_10G(adap)) t3_mac_reset()
135 else if (uses_xaui(adap)) t3_mac_reset()
139 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val); t3_mac_reset()
140 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ t3_mac_reset()
141 if ((val & F_PCS_RESET_) && adap->params.rev) { t3_mac_reset()
152 struct adapter *adap = mac->adapter; t3b2_mac_reset() local
158 t3_set_reg_field(adap, A_MPS_CFG, F_PORT0ACTIVE, 0); t3b2_mac_reset()
160 t3_set_reg_field(adap, A_MPS_CFG, F_PORT1ACTIVE, 0); t3b2_mac_reset()
163 t3_set_reg_field(adap, A_MPS_CFG, F_ENFORCEPKT, 0); t3b2_mac_reset()
165 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, 0); t3b2_mac_reset()
167 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, F_MAC_RESET_); t3b2_mac_reset()
168 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ t3b2_mac_reset()
171 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); t3b2_mac_reset()
172 store = t3_read_reg(adap, A_TP_TX_DROP_CFG_CH0 + idx); t3b2_mac_reset()
177 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); t3b2_mac_reset()
178 t3_write_reg(adap, A_TP_PIO_DATA, 0xc0000011); t3b2_mac_reset()
182 if (t3_wait_op_done(adap, A_XGM_RX_MAX_PKT_SIZE_ERR_CNT + oft, t3b2_mac_reset()
184 CH_ERR(adap, "MAC %d Rx fifo drain failed\n", t3b2_mac_reset()
189 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, 0); t3b2_mac_reset()
190 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ t3b2_mac_reset()
193 if (is_10G(adap)) t3b2_mac_reset()
195 else if (uses_xaui(adap)) t3b2_mac_reset()
199 t3_write_reg(adap, A_XGM_RESET_CTRL + oft, val); t3b2_mac_reset()
200 t3_read_reg(adap, A_XGM_RESET_CTRL + oft); /* flush */ t3b2_mac_reset()
201 if ((val & F_PCS_RESET_) && adap->params.rev) { t3b2_mac_reset()
205 t3_write_reg(adap, A_XGM_RX_CFG + oft, t3b2_mac_reset()
210 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); t3b2_mac_reset()
211 t3_write_reg(adap, A_TP_PIO_DATA, store); t3b2_mac_reset()
214 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT0ACTIVE); t3b2_mac_reset()
216 t3_set_reg_field(adap, A_MPS_CFG, 0, F_PORT1ACTIVE); t3b2_mac_reset()
219 t3_set_reg_field(adap, A_MPS_CFG, F_ENFORCEPKT, 1); t3b2_mac_reset()
222 t3_set_reg_field(adap, A_MPS_CFG, F_ENFORCEPKT, 1); t3b2_mac_reset()
303 struct adapter *adap = mac->adapter; t3_mac_set_rx_mode() local
306 val = t3_read_reg(adap, A_XGM_RX_CFG + oft) & ~F_COPYALLFRAMES; t3_mac_set_rx_mode()
309 t3_write_reg(adap, A_XGM_RX_CFG + oft, val); t3_mac_set_rx_mode()
332 t3_write_reg(adap, A_XGM_RX_HASH_LOW + oft, hash_lo);
333 t3_write_reg(adap, A_XGM_RX_HASH_HIGH + oft, hash_hi);
350 struct adapter *adap = mac->adapter; t3_mac_set_mtu() local
362 t3_write_reg(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, mtu); t3_mac_set_mtu()
364 if (adap->params.rev >= T3_REV_B2 && t3_mac_set_mtu()
365 (t3_read_reg(adap, A_XGM_RX_CTRL + mac->offset) & F_RXEN)) { t3_mac_set_mtu()
367 v = t3_read_reg(adap, A_XGM_RX_CFG + mac->offset); t3_mac_set_mtu()
368 t3_set_reg_field(adap, A_XGM_RX_CFG + mac->offset, t3_mac_set_mtu()
371 reg = adap->params.rev == T3_REV_B2 ? t3_mac_set_mtu()
375 if (t3_wait_op_done(adap, reg + mac->offset, t3_mac_set_mtu()
377 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); t3_mac_set_mtu()
381 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, t3_mac_set_mtu()
384 t3_write_reg(adap, A_XGM_RX_CFG + mac->offset, v); t3_mac_set_mtu()
387 t3_set_reg_field(adap, A_XGM_RX_MAX_PKT_SIZE + mac->offset, t3_mac_set_mtu()
397 v = t3_read_reg(adap, A_XGM_RXFIFO_CFG + mac->offset); t3_mac_set_mtu()
404 t3_write_reg(adap, A_XGM_RXFIFO_CFG + mac->offset, v); t3_mac_set_mtu()
407 thres = (adap->params.vpd.cclk * 1000) / 15625; t3_mac_set_mtu()
409 if (is_10G(adap)) t3_mac_set_mtu()
413 ipg = (adap->params.rev == T3_REV_C) ? 0 : 1; t3_mac_set_mtu()
414 t3_set_reg_field(adap, A_XGM_TXFIFO_CFG + mac->offset, t3_mac_set_mtu()
418 if (adap->params.rev > 0) { t3_mac_set_mtu()
419 divisor = (adap->params.rev == T3_REV_C) ? 64 : 8; t3_mac_set_mtu()
420 t3_write_reg(adap, A_XGM_PAUSE_TIMER + mac->offset, t3_mac_set_mtu()
423 t3_write_reg(adap, A_XGM_TX_PAUSE_QUANTA + mac->offset, t3_mac_set_mtu()
431 struct adapter *adap = mac->adapter; t3_mac_set_speed_duplex_fc() local
448 t3_set_reg_field(adap, A_XGM_PORT_CFG + oft, t3_mac_set_speed_duplex_fc()
452 val = t3_read_reg(adap, A_XGM_RXFIFO_CFG + oft); t3_mac_set_speed_duplex_fc()
456 G_RXMAXPKTSIZE(t3_read_reg(adap, t3_mac_set_speed_duplex_fc()
460 t3_write_reg(adap, A_XGM_RXFIFO_CFG + oft, val); t3_mac_set_speed_duplex_fc()
462 t3_set_reg_field(adap, A_XGM_TX_CFG + oft, F_TXPAUSEEN, t3_mac_set_speed_duplex_fc()
470 struct adapter *adap = mac->adapter; t3_mac_enable() local
475 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CFG_CH0 + idx); t3_mac_enable()
476 t3_write_reg(adap, A_TP_PIO_DATA, t3_mac_enable()
477 adap->params.rev == T3_REV_C ? t3_mac_enable()
479 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_MODE); t3_mac_enable()
480 t3_set_reg_field(adap, A_TP_PIO_DATA, 1 << idx, t3_mac_enable()
481 adap->params.rev == T3_REV_C ? 0 : 1 << idx); t3_mac_enable()
483 t3_write_reg(adap, A_XGM_TX_CTRL + oft, F_TXEN); t3_mac_enable()
485 t3_write_reg(adap, A_TP_PIO_ADDR, A_TP_TX_DROP_CNT_CH0 + idx); t3_mac_enable()
487 mac->tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, t3_mac_enable()
489 mac->tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, t3_mac_enable()
494 mac->rx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, t3_mac_enable()
502 t3_write_reg(adap, A_XGM_RX_CTRL + oft, F_RXEN); t3_mac_enable()
508 struct adapter *adap = mac->adapter; t3_mac_disable() local
511 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); t3_mac_disable()
520 t3_write_reg(adap, A_XGM_RX_CTRL + mac->offset, 0); t3_mac_disable()
521 if (is_10G(adap)) t3_mac_disable()
523 else if (uses_xaui(adap)) t3_mac_disable()
534 struct adapter *adap = mac->adapter; t3b2_mac_watchdog_task() local
544 tx_xcnt = (G_TXSPI4SOPCNT(t3_read_reg(adap, t3b2_mac_watchdog_task()
548 t3_write_reg(adap, A_TP_PIO_ADDR, t3b2_mac_watchdog_task()
550 tx_tcnt = (G_TXDROPCNTCH0RCVD(t3_read_reg(adap, t3b2_mac_watchdog_task()
579 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, 0); t3b2_mac_watchdog_task()
580 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */ t3b2_mac_watchdog_task()
581 t3_write_reg(adap, A_XGM_TX_CTRL + mac->offset, mac->txen); t3b2_mac_watchdog_task()
582 t3_read_reg(adap, A_XGM_TX_CTRL + mac->offset); /* flush */ t3b2_mac_watchdog_task()
H A Dcxgb3_main.c199 void t3_os_link_fault(struct adapter *adap, int port_id, int state) t3_os_link_fault() argument
201 struct net_device *dev = adap->port[port_id]; t3_os_link_fault()
212 disable_tx_fifo_drain(adap, pi); t3_os_link_fault()
215 t3_xgm_intr_disable(adap, pi->port_id); t3_os_link_fault()
216 t3_read_reg(adap, A_XGM_INT_STATUS + t3_os_link_fault()
218 t3_write_reg(adap, t3_os_link_fault()
222 t3_set_reg_field(adap, t3_os_link_fault()
226 t3_xgm_intr_enable(adap, pi->port_id); t3_os_link_fault()
233 enable_tx_fifo_drain(adap, pi); t3_os_link_fault()
315 void t3_os_phymod_changed(struct adapter *adap, int port_id) t3_os_phymod_changed() argument
321 const struct net_device *dev = adap->port[port_id]; t3_os_phymod_changed()
382 static void name_msix_vecs(struct adapter *adap) name_msix_vecs() argument
384 int i, j, msi_idx = 1, n = sizeof(adap->msix_info[0].desc) - 1; name_msix_vecs()
386 snprintf(adap->msix_info[0].desc, n, "%s", adap->name); name_msix_vecs()
387 adap->msix_info[0].desc[n] = 0; name_msix_vecs()
389 for_each_port(adap, j) { for_each_port()
390 struct net_device *d = adap->port[j]; for_each_port()
394 snprintf(adap->msix_info[msi_idx].desc, n, for_each_port()
396 adap->msix_info[msi_idx].desc[n] = 0; for_each_port()
401 static int request_msix_data_irqs(struct adapter *adap) request_msix_data_irqs() argument
405 for_each_port(adap, i) { for_each_port()
406 int nqsets = adap2pinfo(adap, i)->nqsets; for_each_port()
409 err = request_irq(adap->msix_info[qidx + 1].vec, for_each_port()
410 t3_intr_handler(adap, for_each_port()
411 adap->sge.qs[qidx]. for_each_port()
413 adap->msix_info[qidx + 1].desc, for_each_port()
414 &adap->sge.qs[qidx]); for_each_port()
417 free_irq(adap->msix_info[qidx + 1].vec, for_each_port()
418 &adap->sge.qs[qidx]); for_each_port()
443 static int await_mgmt_replies(struct adapter *adap, unsigned long init_cnt, await_mgmt_replies() argument
448 while (adap->sge.qs[0].rspq.offload_pkts < init_cnt + n) { await_mgmt_replies()
456 static int init_tp_parity(struct adapter *adap) init_tp_parity() argument
461 unsigned long cnt = adap->sge.qs[0].rspq.offload_pkts; init_tp_parity()
463 t3_tp_set_offload_mode(adap, 1); init_tp_parity()
470 skb = adap->nofail_skb; init_tp_parity()
480 t3_mgmt_tx(adap, skb); init_tp_parity()
481 if (skb == adap->nofail_skb) { init_tp_parity()
482 await_mgmt_replies(adap, cnt, i + 1); init_tp_parity()
483 adap->nofail_skb = alloc_skb(sizeof(*greq), GFP_KERNEL); init_tp_parity()
484 if (!adap->nofail_skb) init_tp_parity()
494 skb = adap->nofail_skb; init_tp_parity()
503 t3_mgmt_tx(adap, skb); init_tp_parity()
504 if (skb == adap->nofail_skb) { init_tp_parity()
505 await_mgmt_replies(adap, cnt, 16 + i + 1); init_tp_parity()
506 adap->nofail_skb = alloc_skb(sizeof(*greq), GFP_KERNEL); init_tp_parity()
507 if (!adap->nofail_skb) init_tp_parity()
517 skb = adap->nofail_skb; init_tp_parity()
526 t3_mgmt_tx(adap, skb); init_tp_parity()
527 if (skb == adap->nofail_skb) { init_tp_parity()
528 await_mgmt_replies(adap, cnt, 16 + 2048 + i + 1); init_tp_parity()
529 adap->nofail_skb = alloc_skb(sizeof(*greq), GFP_KERNEL); init_tp_parity()
530 if (!adap->nofail_skb) init_tp_parity()
537 skb = adap->nofail_skb; init_tp_parity()
546 t3_mgmt_tx(adap, skb); init_tp_parity()
548 i = await_mgmt_replies(adap, cnt, 16 + 2048 + 2048 + 1); init_tp_parity()
549 if (skb == adap->nofail_skb) { init_tp_parity()
550 i = await_mgmt_replies(adap, cnt, 16 + 2048 + 2048 + 1); init_tp_parity()
551 adap->nofail_skb = alloc_skb(sizeof(*greq), GFP_KERNEL); init_tp_parity()
554 t3_tp_set_offload_mode(adap, 0); init_tp_parity()
558 t3_tp_set_offload_mode(adap, 0); init_tp_parity()
564 * @adap: the adapter
573 static void setup_rss(struct adapter *adap) setup_rss() argument
576 unsigned int nq0 = adap2pinfo(adap, 0)->nqsets; setup_rss()
577 unsigned int nq1 = adap->port[1] ? adap2pinfo(adap, 1)->nqsets : 1; setup_rss()
590 t3_config_rss(adap, F_RQFEEDBACKENABLE | F_TNLLKPEN | F_TNLMAPEN | setup_rss()
595 static void ring_dbs(struct adapter *adap) ring_dbs() argument
600 struct sge_qset *qs = &adap->sge.qs[i]; ring_dbs()
602 if (qs->adap) ring_dbs()
604 t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | V_EGRCNTX(qs->txq[j].cntxt_id)); ring_dbs()
608 static void init_napi(struct adapter *adap) init_napi() argument
613 struct sge_qset *qs = &adap->sge.qs[i]; init_napi()
615 if (qs->adap) init_napi()
625 adap->flags |= NAPI_INIT; init_napi()
633 static void quiesce_rx(struct adapter *adap) quiesce_rx() argument
638 if (adap->sge.qs[i].adap) quiesce_rx()
639 napi_disable(&adap->sge.qs[i].napi); quiesce_rx()
642 static void enable_all_napi(struct adapter *adap) enable_all_napi() argument
646 if (adap->sge.qs[i].adap) enable_all_napi()
647 napi_enable(&adap->sge.qs[i].napi); enable_all_napi()
652 * @adap: the adapter
658 static int setup_sge_qsets(struct adapter *adap) setup_sge_qsets() argument
663 if (adap->params.rev > 0 && !(adap->flags & USING_MSI)) setup_sge_qsets()
666 for_each_port(adap, i) { for_each_port()
667 struct net_device *dev = adap->port[i]; for_each_port()
670 pi->qs = &adap->sge.qs[pi->first_qset]; for_each_port()
672 err = t3_sge_alloc_qset(adap, qset_idx, 1, for_each_port()
673 (adap->flags & USING_MSIX) ? qset_idx + 1 : for_each_port()
675 &adap->params.sge.qset[qset_idx], ntxq, dev, for_each_port()
678 t3_free_sge_resources(adap); for_each_port()
727 struct adapter *adap = pi->adapter; \
739 struct adapter *adap = pi->adapter; set_nfilters() local
740 int min_tids = is_offload(adap) ? MC5_MIN_TIDS : 0; set_nfilters()
742 if (adap->flags & FULL_INIT_DONE) set_nfilters()
744 if (val && adap->params.rev == 0) set_nfilters()
746 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers - set_nfilters()
749 adap->params.mc5.nfilters = val; set_nfilters()
762 struct adapter *adap = pi->adapter; set_nservers() local
764 if (adap->flags & FULL_INIT_DONE) set_nservers()
766 if (val > t3_mc5_size(&adap->mc5) - adap->params.mc5.nfilters - set_nservers()
769 adap->params.mc5.nservers = val; set_nservers()
787 CXGB3_ATTR_R(cam_size, t3_mc5_size(&adap->mc5));
788 CXGB3_ATTR_RW(nfilters, adap->params.mc5.nfilters, store_nfilters);
789 CXGB3_ATTR_RW(nservers, adap->params.mc5.nservers, store_nservers);
804 struct adapter *adap = pi->adapter; tm_attr_show() local
810 t3_write_reg(adap, A_TP_TM_PIO_ADDR, addr); tm_attr_show()
811 v = t3_read_reg(adap, A_TP_TM_PIO_DATA); tm_attr_show()
819 v = (adap->params.vpd.cclk * 1000) / cpt; tm_attr_show()
830 struct adapter *adap = pi->adapter; tm_attr_store() local
843 ret = t3_config_sched(adap, val, sched); tm_attr_store()
939 static int send_pktsched_cmd(struct adapter *adap, int sched, int qidx, int lo, send_pktsched_cmd() argument
948 skb = adap->nofail_skb; send_pktsched_cmd()
960 ret = t3_mgmt_tx(adap, skb); send_pktsched_cmd()
961 if (skb == adap->nofail_skb) { send_pktsched_cmd()
962 adap->nofail_skb = alloc_skb(sizeof(struct cpl_set_tcb_field), send_pktsched_cmd()
964 if (!adap->nofail_skb) send_pktsched_cmd()
971 static int bind_qsets(struct adapter *adap) bind_qsets() argument
975 for_each_port(adap, i) { for_each_port()
976 const struct port_info *pi = adap2pinfo(adap, i); for_each_port()
979 int ret = send_pktsched_cmd(adap, 1, for_each_port()
1072 static int upgrade_fw(struct adapter *adap) upgrade_fw() argument
1076 struct device *dev = &adap->pdev->dev; upgrade_fw()
1084 ret = t3_load_fw(adap, fw->data, fw->size); upgrade_fw()
1113 static int update_tpsram(struct adapter *adap) update_tpsram() argument
1117 struct device *dev = &adap->pdev->dev; update_tpsram()
1121 rev = t3rev2char(adap); update_tpsram()
1134 ret = t3_check_tpsram(adap, tpsram->data, tpsram->size); update_tpsram()
1138 ret = t3_set_proto_sram(adap, tpsram->data); update_tpsram()
1158 * @adap: the adapter
1165 static void t3_synchronize_rx(struct adapter *adap, const struct port_info *p) t3_synchronize_rx() argument
1170 struct sge_rspq *q = &adap->sge.qs[i].rspq; t3_synchronize_rx()
1209 static int cxgb_up(struct adapter *adap) cxgb_up() argument
1213 if (!(adap->flags & FULL_INIT_DONE)) { cxgb_up()
1214 err = t3_check_fw_version(adap); cxgb_up()
1216 err = upgrade_fw(adap); cxgb_up()
1217 CH_WARN(adap, "FW upgrade to %d.%d.%d %s\n", cxgb_up()
1222 err = t3_check_tpsram_version(adap); cxgb_up()
1224 err = update_tpsram(adap); cxgb_up()
1225 CH_WARN(adap, "TP upgrade to %d.%d.%d %s\n", cxgb_up()
1235 t3_intr_clear(adap); cxgb_up()
1237 err = t3_init_hw(adap, 0); cxgb_up()
1241 t3_set_reg_field(adap, A_TP_PARA_REG5, 0, F_RXDDPOFFINIT); cxgb_up()
1242 t3_write_reg(adap, A_ULPRX_TDDP_PSZ, V_HPZ0(PAGE_SHIFT - 12)); cxgb_up()
1244 err = setup_sge_qsets(adap); cxgb_up()
1248 for_each_port(adap, i) cxgb_up()
1249 cxgb_vlan_mode(adap->port[i], adap->port[i]->features); cxgb_up()
1251 setup_rss(adap); cxgb_up()
1252 if (!(adap->flags & NAPI_INIT)) cxgb_up()
1253 init_napi(adap); cxgb_up()
1255 t3_start_sge_timers(adap); cxgb_up()
1256 adap->flags |= FULL_INIT_DONE; cxgb_up()
1259 t3_intr_clear(adap); cxgb_up()
1261 if (adap->flags & USING_MSIX) { cxgb_up()
1262 name_msix_vecs(adap); cxgb_up()
1263 err = request_irq(adap->msix_info[0].vec, cxgb_up()
1265 adap->msix_info[0].desc, adap); cxgb_up()
1269 err = request_msix_data_irqs(adap); cxgb_up()
1271 free_irq(adap->msix_info[0].vec, adap); cxgb_up()
1274 } else if ((err = request_irq(adap->pdev->irq, cxgb_up()
1275 t3_intr_handler(adap, cxgb_up()
1276 adap->sge.qs[0].rspq. cxgb_up()
1278 (adap->flags & USING_MSI) ? cxgb_up()
1280 adap->name, adap))) cxgb_up()
1283 enable_all_napi(adap); cxgb_up()
1284 t3_sge_start(adap); cxgb_up()
1285 t3_intr_enable(adap); cxgb_up()
1287 if (adap->params.rev >= T3_REV_C && !(adap->flags & TP_PARITY_INIT) && cxgb_up()
1288 is_offload(adap) && init_tp_parity(adap) == 0) cxgb_up()
1289 adap->flags |= TP_PARITY_INIT; cxgb_up()
1291 if (adap->flags & TP_PARITY_INIT) { cxgb_up()
1292 t3_write_reg(adap, A_TP_INT_CAUSE, cxgb_up()
1294 t3_write_reg(adap, A_TP_INT_ENABLE, 0x7fbfffff); cxgb_up()
1297 if (!(adap->flags & QUEUES_BOUND)) { cxgb_up()
1298 int ret = bind_qsets(adap); cxgb_up()
1301 CH_ERR(adap, "failed to bind qsets, err %d\n", ret); cxgb_up()
1302 t3_intr_disable(adap); cxgb_up()
1303 free_irq_resources(adap); cxgb_up()
1307 adap->flags |= QUEUES_BOUND; cxgb_up()
1313 CH_ERR(adap, "request_irq failed, err %d\n", err); cxgb_up()
1334 static void schedule_chk_task(struct adapter *adap) schedule_chk_task() argument
1338 timeo = adap->params.linkpoll_period ? schedule_chk_task()
1339 (HZ * adap->params.linkpoll_period) / 10 : schedule_chk_task()
1340 adap->params.stats_update_period * HZ; schedule_chk_task()
1342 queue_delayed_work(cxgb3_wq, &adap->adap_check_task, timeo); schedule_chk_task()
3056 static void set_nqsets(struct adapter *adap) set_nqsets() argument
3060 int hwports = adap->params.nports; set_nqsets()
3061 int nqsets = adap->msix_nvectors - 1; set_nqsets()
3063 if (adap->params.rev > 0 && adap->flags & USING_MSIX) { set_nqsets()
3075 for_each_port(adap, i) { for_each_port()
3076 struct port_info *pi = adap2pinfo(adap, i); for_each_port()
3082 dev_info(&adap->pdev->dev, for_each_port()
3087 static int cxgb_enable_msix(struct adapter *adap) cxgb_enable_msix() argument
3097 vectors = pci_enable_msix_range(adap->pdev, entries, cxgb_enable_msix()
3098 adap->params.nports + 1, vectors); cxgb_enable_msix()
3103 adap->msix_info[i].vec = entries[i].vector; cxgb_enable_msix()
3104 adap->msix_nvectors = vectors; cxgb_enable_msix()
3109 static void print_port_info(struct adapter *adap, const struct adapter_info *ai) print_port_info() argument
3118 if (is_pcie(adap)) print_port_info()
3120 pci_variant[adap->params.pci.variant], print_port_info()
3121 adap->params.pci.width); print_port_info()
3124 pci_variant[adap->params.pci.variant], print_port_info()
3125 adap->params.pci.speed, adap->params.pci.width); print_port_info()
3127 for_each_port(adap, i) { for_each_port()
3128 struct net_device *dev = adap->port[i]; for_each_port()
3131 if (!test_bit(i, &adap->registered_device_map)) for_each_port()
3135 is_offload(adap) ? "R" : "", adap->params.rev, buf, for_each_port()
3136 (adap->flags & USING_MSIX) ? " MSI-X" : for_each_port()
3137 (adap->flags & USING_MSI) ? " MSI" : ""); for_each_port()
3138 if (adap->name == dev->name && adap->params.vpd.mclk) for_each_port()
3140 adap->name, t3_mc7_size(&adap->cm) >> 20, for_each_port()
3141 t3_mc7_size(&adap->pmtx) >> 20, for_each_port()
3142 t3_mc7_size(&adap->pmrx) >> 20, for_each_port()
3143 adap->params.vpd.sn); for_each_port()
H A Dt3_hw.c114 * @adap: the adapter
124 static void t3_read_indirect(struct adapter *adap, unsigned int addr_reg, t3_read_indirect() argument
129 t3_write_reg(adap, addr_reg, start_idx); t3_read_indirect()
130 *vals++ = t3_read_reg(adap, data_reg); t3_read_indirect()
152 struct adapter *adap = mc7->adapter; t3_mc7_bd_read() local
166 t3_write_reg(adap, mc7->offset + A_MC7_BD_ADDR, start); t3_mc7_bd_read()
167 t3_write_reg(adap, mc7->offset + A_MC7_BD_OP, 0); t3_mc7_bd_read()
168 val = t3_read_reg(adap, mc7->offset + A_MC7_BD_OP); t3_mc7_bd_read()
170 val = t3_read_reg(adap, t3_mc7_bd_read()
175 val = t3_read_reg(adap, mc7->offset + A_MC7_BD_DATA1); t3_mc7_bd_read()
177 val64 = t3_read_reg(adap, t3_mc7_bd_read()
196 static void mi1_init(struct adapter *adap, const struct adapter_info *ai) mi1_init() argument
198 u32 clkdiv = adap->params.vpd.cclk / (2 * adap->params.vpd.mdc) - 1; mi1_init()
201 t3_write_reg(adap, A_MI1_CFG, val); mi1_init()
1139 * @adap: the adapter
1146 int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr, t3_cim_ctl_blk_read() argument
1151 if (t3_read_reg(adap, A_CIM_HOST_ACC_CTRL) & F_HOSTBUSY) t3_cim_ctl_blk_read()
1155 t3_write_reg(adap, A_CIM_HOST_ACC_CTRL, CIM_CTL_BASE + addr); t3_cim_ctl_blk_read()
1156 ret = t3_wait_op_done(adap, A_CIM_HOST_ACC_CTRL, F_HOSTBUSY, t3_cim_ctl_blk_read()
1159 *valp++ = t3_read_reg(adap, A_CIM_HOST_ACC_DATA); t3_cim_ctl_blk_read()
1810 static int mac_intr_handler(struct adapter *adap, unsigned int idx) mac_intr_handler() argument
1812 struct cmac *mac = &adap2pinfo(adap, idx)->mac; mac_intr_handler()
1819 u32 cause = t3_read_reg(adap, A_XGM_INT_CAUSE + mac->offset) & mac_intr_handler()
1824 CH_ALERT(adap, "port%d: MAC TX FIFO parity error\n", idx); mac_intr_handler()
1828 CH_ALERT(adap, "port%d: MAC RX FIFO parity error\n", idx); mac_intr_handler()
1841 t3_set_reg_field(adap, mac_intr_handler()
1846 t3_os_link_fault_handler(adap, idx); mac_intr_handler()
1850 t3_fatal_err(adap); mac_intr_handler()
1852 t3_write_reg(adap, A_XGM_INT_CAUSE + mac->offset, cause); mac_intr_handler()
1940 static unsigned int calc_gpio_intr(struct adapter *adap) calc_gpio_intr() argument
1944 for_each_port(adap, i) calc_gpio_intr()
1945 if ((adap2pinfo(adap, i)->phy.caps & SUPPORTED_IRQ) && calc_gpio_intr()
1946 adapter_info(adap)->gpio_intr[i]) calc_gpio_intr()
1947 gpi_intr |= 1 << adapter_info(adap)->gpio_intr[i]; calc_gpio_intr()
2173 static int clear_sge_ctxt(struct adapter *adap, unsigned int id, clear_sge_ctxt() argument
2176 t3_write_reg(adap, A_SG_CONTEXT_DATA0, 0); clear_sge_ctxt()
2177 t3_write_reg(adap, A_SG_CONTEXT_DATA1, 0); clear_sge_ctxt()
2178 t3_write_reg(adap, A_SG_CONTEXT_DATA2, 0); clear_sge_ctxt()
2179 t3_write_reg(adap, A_SG_CONTEXT_DATA3, 0); clear_sge_ctxt()
2180 t3_write_reg(adap, A_SG_CONTEXT_MASK0, 0xffffffff); clear_sge_ctxt()
2181 t3_write_reg(adap, A_SG_CONTEXT_MASK1, 0xffffffff); clear_sge_ctxt()
2182 t3_write_reg(adap, A_SG_CONTEXT_MASK2, 0xffffffff); clear_sge_ctxt()
2183 t3_write_reg(adap, A_SG_CONTEXT_MASK3, 0xffffffff); clear_sge_ctxt()
2184 t3_write_reg(adap, A_SG_CONTEXT_CMD, clear_sge_ctxt()
2186 return t3_wait_op_done(adap, A_SG_CONTEXT_CMD, F_CONTEXT_CMD_BUSY, clear_sge_ctxt()
2530 * @adap: the adapter
2535 void t3_tp_set_offload_mode(struct adapter *adap, int enable) t3_tp_set_offload_mode() argument
2537 if (is_offload(adap) || !enable) t3_tp_set_offload_mode()
2538 t3_set_reg_field(adap, A_TP_IN_CONFIG, F_NICMODE, t3_tp_set_offload_mode()
2559 #define mem_region(adap, start, size, reg) \
2560 t3_write_reg((adap), A_ ## reg, (start)); \
2565 * @adap: the adapter
2571 static void partition_mem(struct adapter *adap, const struct tp_params *p) partition_mem() argument
2573 unsigned int m, pstructs, tids = t3_mc5_size(&adap->mc5); partition_mem()
2576 if (adap->params.rev > 0) { partition_mem()
2589 t3_write_reg(adap, A_TP_PMM_SIZE, partition_mem()
2592 t3_write_reg(adap, A_TP_PMM_TX_BASE, 0); partition_mem()
2593 t3_write_reg(adap, A_TP_PMM_TX_PAGE_SIZE, p->tx_pg_size); partition_mem()
2594 t3_write_reg(adap, A_TP_PMM_TX_MAX_PAGE, p->tx_num_pgs); partition_mem()
2595 t3_set_reg_field(adap, A_TP_PARA_REG3, V_TXDATAACKIDX(M_TXDATAACKIDX), partition_mem()
2598 t3_write_reg(adap, A_TP_PMM_RX_BASE, 0); partition_mem()
2599 t3_write_reg(adap, A_TP_PMM_RX_PAGE_SIZE, p->rx_pg_size); partition_mem()
2600 t3_write_reg(adap, A_TP_PMM_RX_MAX_PAGE, p->rx_num_pgs); partition_mem()
2606 t3_write_reg(adap, A_TP_CMM_MM_MAX_PSTRUCT, pstructs); partition_mem()
2609 mem_region(adap, m, (64 << 10) * 64, SG_EGR_CNTX_BADDR); partition_mem()
2610 mem_region(adap, m, (64 << 10) * 64, SG_CQ_CONTEXT_BADDR); partition_mem()
2611 t3_write_reg(adap, A_TP_CMM_TIMER_BASE, V_CMTIMERMAXNUM(timers) | m); partition_mem()
2613 mem_region(adap, m, pstructs * 64, TP_CMM_MM_BASE); partition_mem()
2614 mem_region(adap, m, 64 * (pstructs / 24), TP_CMM_MM_PS_FLST_BASE); partition_mem()
2615 mem_region(adap, m, 64 * (p->rx_num_pgs / 24), TP_CMM_MM_RX_FLST_BASE); partition_mem()
2616 mem_region(adap, m, 64 * (p->tx_num_pgs / 24), TP_CMM_MM_TX_FLST_BASE); partition_mem()
2619 t3_write_reg(adap, A_CIM_SDRAM_BASE_ADDR, m); partition_mem()
2620 t3_write_reg(adap, A_CIM_SDRAM_ADDR_SIZE, p->cm_size - m); partition_mem()
2623 m = t3_mc5_size(&adap->mc5) - adap->params.mc5.nservers - partition_mem()
2624 adap->params.mc5.nfilters - adap->params.mc5.nroutes; partition_mem()
2626 adap->params.mc5.nservers += m - tids; partition_mem()
2629 static inline void tp_wr_indirect(struct adapter *adap, unsigned int addr, tp_wr_indirect() argument
2632 t3_write_reg(adap, A_TP_PIO_ADDR, addr); tp_wr_indirect()
2633 t3_write_reg(adap, A_TP_PIO_DATA, val); tp_wr_indirect()
2636 static void tp_config(struct adapter *adap, const struct tp_params *p) tp_config() argument
2638 t3_write_reg(adap, A_TP_GLOBAL_CONFIG, F_TXPACINGENABLE | F_PATHMTU | tp_config()
2641 t3_write_reg(adap, A_TP_TCP_OPTIONS, V_MTUDEFAULT(576) | tp_config()
2644 t3_write_reg(adap, A_TP_DACK_CONFIG, V_AUTOSTATE3(1) | tp_config()
2648 t3_set_reg_field(adap, A_TP_IN_CONFIG, F_RXFBARBPRIO | F_TXFBARBPRIO, tp_config()
2650 t3_write_reg(adap, A_TP_TX_RESOURCE_LIMIT, 0x18141814); tp_config()
2651 t3_write_reg(adap, A_TP_PARA_REG4, 0x5050105); tp_config()
2652 t3_set_reg_field(adap, A_TP_PARA_REG6, 0, tp_config()
2653 adap->params.rev > 0 ? F_ENABLEESND : tp_config()
2656 t3_set_reg_field(adap, A_TP_PC_CONFIG, tp_config()
2660 t3_set_reg_field(adap, A_TP_PC_CONFIG2, F_CHDRAFULL, tp_config()
2663 t3_write_reg(adap, A_TP_PROXY_FLOW_CNTL, 1080); tp_config()
2664 t3_write_reg(adap, A_TP_PROXY_FLOW_CNTL, 1000); tp_config()
2666 if (adap->params.rev > 0) { tp_config()
2667 tp_wr_indirect(adap, A_TP_EGRESS_CONFIG, F_REWRITEFORCETOSIZE); tp_config()
2668 t3_set_reg_field(adap, A_TP_PARA_REG3, F_TXPACEAUTO, tp_config()
2670 t3_set_reg_field(adap, A_TP_PC_CONFIG, F_LOCKTID, F_LOCKTID); tp_config()
2671 t3_set_reg_field(adap, A_TP_PARA_REG3, 0, F_TXPACEAUTOSTRICT); tp_config()
2673 t3_set_reg_field(adap, A_TP_PARA_REG3, 0, F_TXPACEFIXED); tp_config()
2675 if (adap->params.rev == T3_REV_C) tp_config()
2676 t3_set_reg_field(adap, A_TP_PC_CONFIG, tp_config()
2680 t3_write_reg(adap, A_TP_TX_MOD_QUEUE_WEIGHT1, 0); tp_config()
2681 t3_write_reg(adap, A_TP_TX_MOD_QUEUE_WEIGHT0, 0); tp_config()
2682 t3_write_reg(adap, A_TP_MOD_CHANNEL_WEIGHT, 0); tp_config()
2683 t3_write_reg(adap, A_TP_MOD_RATE_LIMIT, 0xf2200000); tp_config()
2695 * @adap: the adapter to set
2701 static void tp_set_timers(struct adapter *adap, unsigned int core_clk) tp_set_timers() argument
2708 t3_write_reg(adap, A_TP_TIMER_RESOLUTION, V_TIMERRESOLUTION(tre) | tp_set_timers()
2711 t3_write_reg(adap, A_TP_DACK_TIMER, tp_set_timers()
2713 t3_write_reg(adap, A_TP_TCP_BACKOFF_REG0, 0x3020100); tp_set_timers()
2714 t3_write_reg(adap, A_TP_TCP_BACKOFF_REG1, 0x7060504); tp_set_timers()
2715 t3_write_reg(adap, A_TP_TCP_BACKOFF_REG2, 0xb0a0908); tp_set_timers()
2716 t3_write_reg(adap, A_TP_TCP_BACKOFF_REG3, 0xf0e0d0c); tp_set_timers()
2717 t3_write_reg(adap, A_TP_SHIFT_CNT, V_SYNSHIFTMAX(6) | tp_set_timers()
2724 t3_write_reg(adap, A_TP_MSL, adap->params.rev > 0 ? 0 : 2 SECONDS); tp_set_timers()
2725 t3_write_reg(adap, A_TP_RXT_MIN, tps / (1000 / TP_RTO_MIN)); tp_set_timers()
2726 t3_write_reg(adap, A_TP_RXT_MAX, 64 SECONDS); tp_set_timers()
2727 t3_write_reg(adap, A_TP_PERS_MIN, 5 SECONDS); tp_set_timers()
2728 t3_write_reg(adap, A_TP_PERS_MAX, 64 SECONDS); tp_set_timers()
2729 t3_write_reg(adap, A_TP_KEEP_IDLE, 7200 SECONDS); tp_set_timers()
2730 t3_write_reg(adap, A_TP_KEEP_INTVL, 75 SECONDS); tp_set_timers()
2731 t3_write_reg(adap, A_TP_INIT_SRTT, 3 SECONDS); tp_set_timers()
2732 t3_write_reg(adap, A_TP_FINWAIT2_TIMER, 600 SECONDS); tp_set_timers()
2739 * @adap: the adapter
2745 static int t3_tp_set_coalescing_size(struct adapter *adap, t3_tp_set_coalescing_size() argument
2753 val = t3_read_reg(adap, A_TP_PARA_REG3); t3_tp_set_coalescing_size()
2761 t3_write_reg(adap, A_TP_PARA_REG2, V_RXCOALESCESIZE(size) | t3_tp_set_coalescing_size()
2764 t3_write_reg(adap, A_TP_PARA_REG3, val); t3_tp_set_coalescing_size()
2770 * @adap: the adapter
2776 static void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size) t3_tp_set_max_rxsize() argument
2778 t3_write_reg(adap, A_TP_PARA_REG7, t3_tp_set_max_rxsize()
2852 * @adap: the adapter
2862 void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS], t3_load_mtus() argument
2880 t3_write_reg(adap, A_TP_MTU_TABLE, t3_load_mtus()
2889 t3_write_reg(adap, A_TP_CCTRL_TABLE, (i << 21) | t3_load_mtus()
2897 * @adap: the adapter
2902 void t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps) t3_tp_get_mib_stats() argument
2904 t3_read_indirect(adap, A_TP_MIB_INDEX, A_TP_MIB_RDATA, (u32 *) tps, t3_tp_get_mib_stats()
2908 #define ulp_region(adap, name, start, len) \
2909 t3_write_reg((adap), A_ULPRX_ ## name ## _LLIMIT, (start)); \
2910 t3_write_reg((adap), A_ULPRX_ ## name ## _ULIMIT, \
2914 #define ulptx_region(adap, name, start, len) \
2915 t3_write_reg((adap), A_ULPTX_ ## name ## _LLIMIT, (start)); \
2916 t3_write_reg((adap), A_ULPTX_ ## name ## _ULIMIT, \
2919 static void ulp_config(struct adapter *adap, const struct tp_params *p) ulp_config() argument
2923 ulp_region(adap, ISCSI, m, p->chan_rx_size / 8); ulp_config()
2924 ulp_region(adap, TDDP, m, p->chan_rx_size / 8); ulp_config()
2925 ulptx_region(adap, TPT, m, p->chan_rx_size / 4); ulp_config()
2926 ulp_region(adap, STAG, m, p->chan_rx_size / 4); ulp_config()
2927 ulp_region(adap, RQ, m, p->chan_rx_size / 4); ulp_config()
2928 ulptx_region(adap, PBL, m, p->chan_rx_size / 4); ulp_config()
2929 ulp_region(adap, PBL, m, p->chan_rx_size / 4); ulp_config()
2930 t3_write_reg(adap, A_ULPRX_TDDP_TAGMASK, 0xffffffff); ulp_config()
2940 int t3_set_proto_sram(struct adapter *adap, const u8 *data) t3_set_proto_sram() argument
2946 t3_write_reg(adap, A_TP_EMBED_OP_FIELD5, be32_to_cpu(*buf++)); t3_set_proto_sram()
2947 t3_write_reg(adap, A_TP_EMBED_OP_FIELD4, be32_to_cpu(*buf++)); t3_set_proto_sram()
2948 t3_write_reg(adap, A_TP_EMBED_OP_FIELD3, be32_to_cpu(*buf++)); t3_set_proto_sram()
2949 t3_write_reg(adap, A_TP_EMBED_OP_FIELD2, be32_to_cpu(*buf++)); t3_set_proto_sram()
2950 t3_write_reg(adap, A_TP_EMBED_OP_FIELD1, be32_to_cpu(*buf++)); t3_set_proto_sram()
2952 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, i << 1 | 1 << 31); t3_set_proto_sram()
2953 if (t3_wait_op_done(adap, A_TP_EMBED_OP_FIELD0, 1, 1, 5, 1)) t3_set_proto_sram()
2956 t3_write_reg(adap, A_TP_EMBED_OP_FIELD0, 0); t3_set_proto_sram()
2996 * @adap: the adapter
3002 int t3_config_sched(struct adapter *adap, unsigned int kbps, int sched) t3_config_sched() argument
3005 unsigned int clk = adap->params.vpd.cclk * 1000; t3_config_sched()
3027 t3_write_reg(adap, A_TP_TM_PIO_ADDR, t3_config_sched()
3029 v = t3_read_reg(adap, A_TP_TM_PIO_DATA); t3_config_sched()
3034 t3_write_reg(adap, A_TP_TM_PIO_DATA, v); t3_config_sched()
3038 static int tp_init(struct adapter *adap, const struct tp_params *p) tp_init() argument
3042 tp_config(adap, p); tp_init()
3043 t3_set_vlan_accel(adap, 3, 0); tp_init()
3045 if (is_offload(adap)) { tp_init()
3046 tp_set_timers(adap, adap->params.vpd.cclk * 1000); tp_init()
3047 t3_write_reg(adap, A_TP_RESET, F_FLSTINITENABLE); tp_init()
3048 busy = t3_wait_op_done(adap, A_TP_RESET, F_FLSTINITENABLE, tp_init()
3051 CH_ERR(adap, "TP initialization timed out\n"); tp_init()
3055 t3_write_reg(adap, A_TP_RESET, F_TPRESET); tp_init()
3063 static void chan_init_hw(struct adapter *adap, unsigned int chan_map) chan_init_hw() argument
3068 t3_set_reg_field(adap, A_ULPRX_CTL, F_ROUND_ROBIN, 0); chan_init_hw()
3069 t3_set_reg_field(adap, A_ULPTX_CONFIG, F_CFG_RR_ARB, 0); chan_init_hw()
3070 t3_write_reg(adap, A_MPS_CFG, F_TPRXPORTEN | F_ENFORCEPKT | chan_init_hw()
3073 t3_write_reg(adap, A_PM1_TX_CFG, chan_init_hw()
3076 t3_set_reg_field(adap, A_ULPRX_CTL, 0, F_ROUND_ROBIN); chan_init_hw()
3077 t3_set_reg_field(adap, A_ULPTX_CONFIG, 0, F_CFG_RR_ARB); chan_init_hw()
3078 t3_write_reg(adap, A_ULPTX_DMA_WEIGHT, chan_init_hw()
3080 t3_write_reg(adap, A_MPS_CFG, F_TPTXPORT0EN | F_TPTXPORT1EN | chan_init_hw()
3083 t3_write_reg(adap, A_PM1_TX_CFG, 0x80008000); chan_init_hw()
3084 t3_set_reg_field(adap, A_TP_PC_CONFIG, 0, F_TXTOSQUEUEMAPMODE); chan_init_hw()
3085 t3_write_reg(adap, A_TP_TX_MOD_QUEUE_REQ_MAP, chan_init_hw()
3088 t3_write_reg(adap, A_TP_TX_MOD_QUE_TABLE, chan_init_hw()
3273 static void config_pcie(struct adapter *adap) config_pcie() argument
3292 pcie_capability_read_word(adap->pdev, PCI_EXP_DEVCTL, &val); config_pcie()
3295 pci_read_config_word(adap->pdev, 0x2, &devid); config_pcie()
3297 pcie_capability_write_word(adap->pdev, PCI_EXP_DEVCTL, config_pcie()
3303 pcie_capability_read_word(adap->pdev, PCI_EXP_LNKCTL, &val); config_pcie()
3305 fst_trn_tx = G_NUMFSTTRNSEQ(t3_read_reg(adap, A_PCIE_PEX_CTRL0)); config_pcie()
3306 fst_trn_rx = adap->params.rev == 0 ? fst_trn_tx : config_pcie()
3307 G_NUMFSTTRNSEQRX(t3_read_reg(adap, A_PCIE_MODE)); config_pcie()
3308 log2_width = fls(adap->params.pci.width) - 1; config_pcie()
3314 if (adap->params.rev == 0) config_pcie()
3315 t3_set_reg_field(adap, A_PCIE_PEX_CTRL1, config_pcie()
3319 t3_set_reg_field(adap, A_PCIE_PEX_CTRL1, V_ACKLAT(M_ACKLAT), config_pcie()
3322 t3_set_reg_field(adap, A_PCIE_PEX_CTRL0, V_REPLAYLMT(M_REPLAYLMT), config_pcie()
3325 t3_write_reg(adap, A_PCIE_PEX_ERR, 0xffffffff); config_pcie()
3326 t3_set_reg_field(adap, A_PCIE_CFG, 0, config_pcie()
3586 static int init_parity(struct adapter *adap) init_parity() argument
3590 if (t3_read_reg(adap, A_SG_CONTEXT_CMD) & F_CONTEXT_CMD_BUSY) init_parity()
3594 err = clear_sge_ctxt(adap, i, F_EGRESS); init_parity()
3596 err = clear_sge_ctxt(adap, i, F_EGRESS); init_parity()
3598 err = clear_sge_ctxt(adap, i, F_RESPONSEQ); init_parity()
3602 t3_write_reg(adap, A_CIM_IBQ_DBG_DATA, 0); init_parity()
3605 t3_write_reg(adap, A_CIM_IBQ_DBG_CFG, F_IBQDBGEN | init_parity()
3608 err = t3_wait_op_done(adap, A_CIM_IBQ_DBG_CFG, init_parity()
H A Dsge.c480 static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) ring_fl_db() argument
485 t3_write_reg(adap, A_SG_KDOORBELL, V_EGRCNTX(q->cntxt_id)); ring_fl_db()
500 static int refill_fl(struct adapter *adap, struct sge_fl *q, int n, gfp_t gfp) refill_fl() argument
511 if (unlikely(alloc_pg_chunk(adap, q, sd, gfp, refill_fl()
520 pci_dma_sync_single_for_device(adap->pdev, mapping, refill_fl()
533 q->gen, adap->pdev); refill_fl()
535 clear_rx_desc(adap->pdev, q, sd); refill_fl()
553 ring_fl_db(adap, q); refill_fl()
558 static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl) __refill_fl() argument
560 refill_fl(adap, fl, min(MAX_RX_REFILL, fl->size - fl->credits), __refill_fl()
573 static void recycle_rx_buf(struct adapter *adap, struct sge_fl *q, recycle_rx_buf() argument
593 ring_fl_db(adap, q); recycle_rx_buf()
645 if (q->adap && t3_reset_qset()
646 !(q->adap->flags & NAPI_INIT)) { t3_reset_qset()
651 q->adap = NULL; t3_reset_qset()
766 * @adap: the adapter that received the packet
779 static struct sk_buff *get_packet(struct adapter *adap, struct sge_fl *fl, get_packet() argument
792 pci_dma_sync_single_for_cpu(adap->pdev, get_packet()
796 pci_dma_sync_single_for_device(adap->pdev, get_packet()
802 recycle_rx_buf(adap, fl, fl->cidx); get_packet()
807 refill_fl(adap, fl, min(MAX_RX_REFILL, fl->size - fl->credits - 1), get_packet()
812 pci_unmap_single(adap->pdev, dma_unmap_addr(sd, dma_addr), get_packet()
816 __refill_fl(adap, fl); get_packet()
822 * @adap: the adapter that received the packet
838 static struct sk_buff *get_packet_pg(struct adapter *adap, struct sge_fl *fl, get_packet_pg() argument
852 pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len, get_packet_pg()
855 pci_dma_sync_single_for_device(adap->pdev, dma_addr, get_packet_pg()
862 recycle_rx_buf(adap, fl, fl->cidx); get_packet_pg()
881 pci_dma_sync_single_for_cpu(adap->pdev, dma_addr, len, get_packet_pg()
885 pci_unmap_page(adap->pdev, get_packet_pg()
997 * @adap: the adapter
1007 static inline void check_ring_tx_db(struct adapter *adap, struct sge_txq *q) check_ring_tx_db() argument
1013 t3_write_reg(adap, A_SG_KDOORBELL, check_ring_tx_db()
1018 t3_write_reg(adap, A_SG_KDOORBELL, check_ring_tx_db()
1126 * @adap: the adapter
1137 static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, write_tx_pkt_wr() argument
1199 sgl_flits = make_sgl(skb, sgp, skb->data, skb_headlen(skb), adap->pdev); write_tx_pkt_wr()
1226 struct adapter *adap = pi->adapter; t3_eth_xmit() local
1245 reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); t3_eth_xmit()
1252 dev_err(&adap->pdev->dev, t3_eth_xmit()
1315 write_tx_pkt_wr(adap, skb, pi, pidx, gen, q, ndesc, compl); t3_eth_xmit()
1316 check_ring_tx_db(adap, q); t3_eth_xmit()
1354 * @adap: the adapter
1370 static inline int check_desc_avail(struct adapter *adap, struct sge_txq *q, check_desc_avail() argument
1417 * @adap: the adapter
1425 static int ctrl_xmit(struct adapter *adap, struct sge_txq *q, ctrl_xmit() argument
1443 ret = check_desc_avail(adap, q, skb, 1, TXQ_CTRL); ctrl_xmit()
1461 t3_write_reg(adap, A_SG_KDOORBELL, ctrl_xmit()
1505 t3_write_reg(qs->adap, A_SG_KDOORBELL, restart_ctrlq()
1512 int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb) t3_mgmt_tx() argument
1516 ret = ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], skb); t3_mgmt_tx()
1568 * @adap: the adapter
1578 static void write_ofld_wr(struct adapter *adap, struct sk_buff *skb, write_ofld_wr() argument
1604 adap->pdev); write_ofld_wr()
1606 setup_deferred_unmapping(skb, adap->pdev, sgp, sgl_flits); write_ofld_wr()
1637 * @adap: the adapter
1643 static int ofld_xmit(struct adapter *adap, struct sge_txq *q, ofld_xmit() argument
1650 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); ofld_xmit()
1652 ret = check_desc_avail(adap, q, skb, ndesc, TXQ_OFLD); ofld_xmit()
1672 write_ofld_wr(adap, skb, q, pidx, gen, ndesc); ofld_xmit()
1673 check_ring_tx_db(adap, q); ofld_xmit()
1689 struct adapter *adap = pi->adapter; restart_offloadq() local
1692 again: reclaim_completed_tx(adap, q, TX_RECLAIM_CHUNK); restart_offloadq()
1720 write_ofld_wr(adap, skb, q, pidx, gen, ndesc); restart_offloadq()
1730 t3_write_reg(adap, A_SG_KDOORBELL, restart_offloadq()
1769 struct adapter *adap = tdev2adap(tdev); t3_offload_tx() local
1770 struct sge_qset *qs = &adap->sge.qs[queue_set(skb)]; t3_offload_tx()
1773 return ctrl_xmit(adap, &qs->txq[TXQ_CTRL], skb); t3_offload_tx()
1775 return ofld_xmit(adap, &qs->txq[TXQ_OFLD], skb); t3_offload_tx()
1834 struct adapter *adapter = qs->adap; ofld_poll()
2004 * @adap: the adapter
2013 static void rx_eth(struct adapter *adap, struct sge_rspq *rq, rx_eth() argument
2021 skb->protocol = eth_type_trans(skb, adap->port[p->iff]); rx_eth()
2029 skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); rx_eth()
2054 * @adap: the adapter
2063 static void lro_add_page(struct adapter *adap, struct sge_qset *qs, lro_add_page() argument
2081 pci_dma_sync_single_for_cpu(adap->pdev, lro_add_page()
2088 pci_unmap_page(adap->pdev, lro_add_page()
2131 skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]); lro_add_page()
2185 static void check_ring_db(struct adapter *adap, struct sge_qset *qs, check_ring_db() argument
2194 t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | check_ring_db()
2205 t3_write_reg(adap, A_SG_KDOORBELL, F_SELEGRCNTX | check_ring_db()
2242 * @adap: the adapter
2255 static int process_responses(struct adapter *adap, struct sge_qset *qs, process_responses() argument
2314 __refill_fl(adap, fl); process_responses()
2316 lro_add_page(adap, qs, fl, process_responses()
2322 skb = get_packet_pg(adap, fl, q, process_responses()
2328 skb = get_packet(adap, fl, G_RSPD_LEN(len), process_responses()
2356 refill_rspq(adap, q, q->credits); process_responses()
2366 rx_eth(adap, q, skb, ethpad, lro); process_responses()
2372 ngathered = rx_offload(&adap->tdev, q, skb, process_responses()
2383 deliver_partial_bundle(&adap->tdev, q, offload_skbs, ngathered); process_responses()
2386 check_ring_db(adap, qs, sleeping); process_responses()
2413 struct adapter *adap = qs->adap; napi_rx_handler() local
2414 int work_done = process_responses(adap, qs, budget); napi_rx_handler()
2433 t3_write_reg(adap, A_SG_GTS, V_RSPQ(qs->rspq.cntxt_id) | napi_rx_handler()
2450 * @adap: the adapter
2462 static int process_pure_responses(struct adapter *adap, struct sge_qset *qs, process_pure_responses() argument
2486 refill_rspq(adap, q, q->credits); process_pure_responses()
2495 check_ring_db(adap, qs, sleeping); process_pure_responses()
2506 * @adap: the adapter
2519 static inline int handle_responses(struct adapter *adap, struct sge_rspq *q) handle_responses() argument
2527 if (is_pure_response(r) && process_pure_responses(adap, qs, r) == 0) { handle_responses()
2528 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | handle_responses()
2543 struct adapter *adap = qs->adap; t3_sge_intr_msix() local
2547 if (process_responses(adap, qs, -1) == 0) t3_sge_intr_msix()
2549 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | t3_sge_intr_msix()
2566 if (handle_responses(qs->adap, q) < 0) t3_sge_intr_msix_napi()
2581 struct adapter *adap = cookie; t3_intr_msi() local
2582 struct sge_rspq *q = &adap->sge.qs[0].rspq; t3_intr_msi()
2586 if (process_responses(adap, &adap->sge.qs[0], -1)) { t3_intr_msi()
2587 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q->cntxt_id) | t3_intr_msi()
2592 if (adap->params.nports == 2 && t3_intr_msi()
2593 process_responses(adap, &adap->sge.qs[1], -1)) { t3_intr_msi()
2594 struct sge_rspq *q1 = &adap->sge.qs[1].rspq; t3_intr_msi()
2596 t3_write_reg(adap, A_SG_GTS, V_RSPQ(q1->cntxt_id) | t3_intr_msi()
2602 if (!new_packets && t3_slow_intr_handler(adap) == 0) t3_intr_msi()
2631 struct adapter *adap = cookie; t3_intr_msi_napi() local
2632 struct sge_rspq *q = &adap->sge.qs[0].rspq; t3_intr_msi_napi()
2636 new_packets = rspq_check_napi(&adap->sge.qs[0]); t3_intr_msi_napi()
2637 if (adap->params.nports == 2) t3_intr_msi_napi()
2638 new_packets += rspq_check_napi(&adap->sge.qs[1]); t3_intr_msi_napi()
2639 if (!new_packets && t3_slow_intr_handler(adap) == 0) t3_intr_msi_napi()
2649 static inline int process_responses_gts(struct adapter *adap, process_responses_gts() argument
2654 work = process_responses(adap, rspq_to_qset(rq), -1); process_responses_gts()
2655 t3_write_reg(adap, A_SG_GTS, V_RSPQ(rq->cntxt_id) | process_responses_gts()
2669 struct adapter *adap = cookie; t3_intr() local
2670 struct sge_rspq *q0 = &adap->sge.qs[0].rspq; t3_intr()
2671 struct sge_rspq *q1 = &adap->sge.qs[1].rspq; t3_intr()
2676 w1 = adap->params.nports == 2 && t3_intr()
2680 t3_write_reg(adap, A_PL_CLI, 0); t3_intr()
2681 t3_read_reg(adap, A_PL_CLI); /* flush */ t3_intr()
2684 process_responses_gts(adap, q0); t3_intr()
2687 process_responses_gts(adap, q1); t3_intr()
2691 work_done = t3_slow_intr_handler(adap); t3_intr()
2707 struct adapter *adap = cookie; t3b_intr() local
2708 struct sge_rspq *q0 = &adap->sge.qs[0].rspq; t3b_intr()
2710 t3_write_reg(adap, A_PL_CLI, 0); t3b_intr()
2711 map = t3_read_reg(adap, A_SG_DATA_INTR); t3b_intr()
2719 t3_slow_intr_handler(adap); t3b_intr()
2722 process_responses_gts(adap, q0); t3b_intr()
2725 process_responses_gts(adap, &adap->sge.qs[1].rspq); t3b_intr()
2741 struct adapter *adap = cookie; t3b_intr_napi() local
2742 struct sge_qset *qs0 = &adap->sge.qs[0]; t3b_intr_napi()
2745 t3_write_reg(adap, A_PL_CLI, 0); t3b_intr_napi()
2746 map = t3_read_reg(adap, A_SG_DATA_INTR); t3b_intr_napi()
2754 t3_slow_intr_handler(adap); t3b_intr_napi()
2760 napi_schedule(&adap->sge.qs[1].napi); t3b_intr_napi()
2768 * @adap: the adapter
2775 irq_handler_t t3_intr_handler(struct adapter *adap, int polling) t3_intr_handler() argument
2777 if (adap->flags & USING_MSIX) t3_intr_handler()
2779 if (adap->flags & USING_MSI) t3_intr_handler()
2781 if (adap->params.rev > 0) t3_intr_handler()
2860 struct adapter *adap = pi->adapter; sge_timer_tx() local
2865 tbd[TXQ_ETH] = reclaim_completed_tx(adap, &qs->txq[TXQ_ETH], sge_timer_tx()
2871 tbd[TXQ_OFLD] = reclaim_completed_tx(adap, &qs->txq[TXQ_OFLD], sge_timer_tx()
2901 struct adapter *adap = pi->adapter; sge_timer_rx() local
2904 lock = adap->params.rev > 0 ? sge_timer_rx()
2905 &qs->rspq.lock : &adap->sge.qs[0].rspq.lock; sge_timer_rx()
2913 if (adap->params.rev < 4) { sge_timer_rx()
2914 status = t3_read_reg(adap, A_SG_RSPQ_FL_STATUS); sge_timer_rx()
2920 refill_rspq(adap, &qs->rspq, 1); sge_timer_rx()
2922 t3_write_reg(adap, A_SG_RSPQ_FL_STATUS, sge_timer_rx()
2929 __refill_fl(adap, &qs->fl[0]); sge_timer_rx()
2931 __refill_fl(adap, &qs->fl[1]); sge_timer_rx()
3105 q->adap = adapter; t3_sge_alloc_qset()
3141 * @adap: the adapter
3145 void t3_start_sge_timers(struct adapter *adap) t3_start_sge_timers() argument
3150 struct sge_qset *q = &adap->sge.qs[i]; t3_start_sge_timers()
3162 * @adap: the adapter
3166 void t3_stop_sge_timers(struct adapter *adap) t3_stop_sge_timers() argument
3171 struct sge_qset *q = &adap->sge.qs[i]; t3_stop_sge_timers()
3182 * @adap: the adapter
3186 void t3_free_sge_resources(struct adapter *adap) t3_free_sge_resources() argument
3191 t3_free_qset(adap, &adap->sge.qs[i]); t3_free_sge_resources()
3196 * @adap: the adapter
3201 void t3_sge_start(struct adapter *adap) t3_sge_start() argument
3203 t3_set_reg_field(adap, A_SG_CONTROL, F_GLOBALENABLE, F_GLOBALENABLE); t3_sge_start()
3208 * @adap: the adapter
3219 void t3_sge_stop(struct adapter *adap) t3_sge_stop() argument
3221 t3_set_reg_field(adap, A_SG_CONTROL, F_GLOBALENABLE, 0); t3_sge_stop()
3226 struct sge_qset *qs = &adap->sge.qs[i]; t3_sge_stop()
3236 * @adap: the adapter
3244 void t3_sge_init(struct adapter *adap, struct sge_params *p) t3_sge_init() argument
3246 unsigned int ctrl, ups = ffs(pci_resource_len(adap->pdev, 2) >> 12); t3_sge_init()
3255 if (adap->params.rev > 0) { t3_sge_init()
3256 if (!(adap->flags & (USING_MSIX | USING_MSI))) t3_sge_init()
3259 t3_write_reg(adap, A_SG_CONTROL, ctrl); t3_sge_init()
3260 t3_write_reg(adap, A_SG_EGR_RCQ_DRB_THRSH, V_HIRCQDRBTHRSH(512) | t3_sge_init()
3262 t3_write_reg(adap, A_SG_TIMER_TICK, core_ticks_per_usec(adap) / 10); t3_sge_init()
3263 t3_write_reg(adap, A_SG_CMDQ_CREDIT_TH, V_THRESHOLD(32) | t3_sge_init()
3264 V_TIMEOUT(200 * core_ticks_per_usec(adap))); t3_sge_init()
3265 t3_write_reg(adap, A_SG_HI_DRB_HI_THRSH, t3_sge_init()
3266 adap->params.rev < T3_REV_C ? 1000 : 500); t3_sge_init()
3267 t3_write_reg(adap, A_SG_HI_DRB_LO_THRSH, 256); t3_sge_init()
3268 t3_write_reg(adap, A_SG_LO_DRB_HI_THRSH, 1000); t3_sge_init()
3269 t3_write_reg(adap, A_SG_LO_DRB_LO_THRSH, 256); t3_sge_init()
3270 t3_write_reg(adap, A_SG_OCO_BASE, V_BASE1(0xfff)); t3_sge_init()
3271 t3_write_reg(adap, A_SG_DRB_PRI_THRESH, 63 * 1024); t3_sge_init()
3276 * @adap: the associated adapter
3283 void t3_sge_prep(struct adapter *adap, struct sge_params *p) t3_sge_prep() argument
3293 q->polling = adap->params.rev > 0; t3_sge_prep()
3304 spin_lock_init(&adap->sge.reg_lock); t3_sge_prep()
H A Dadapter.h201 struct adapter *adap; member in struct:sge_qset
285 static inline struct port_info *adap2pinfo(struct adapter *adap, int idx) adap2pinfo() argument
287 return netdev_priv(adap->port[idx]); adap2pinfo()
292 struct adapter *adap = phy->adapter; phy2portid() local
293 struct port_info *port0 = adap2pinfo(adap, 0); phy2portid()
312 void t3_os_phymod_changed(struct adapter *adap, int port_id);
316 void t3_sge_start(struct adapter *adap);
317 void t3_sge_stop(struct adapter *adap);
318 void t3_start_sge_timers(struct adapter *adap);
319 void t3_stop_sge_timers(struct adapter *adap);
320 void t3_free_sge_resources(struct adapter *adap);
322 irq_handler_t t3_intr_handler(struct adapter *adap, int polling);
324 int t3_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
H A Dcommon.h44 #define CH_ERR(adap, fmt, ...) dev_err(&adap->pdev->dev, fmt, ##__VA_ARGS__)
45 #define CH_WARN(adap, fmt, ...) dev_warn(&adap->pdev->dev, fmt, ##__VA_ARGS__)
46 #define CH_ALERT(adap, fmt, ...) dev_alert(&adap->pdev->dev, fmt, ##__VA_ARGS__)
615 #define adapter_info(adap) ((adap)->params.info)
617 static inline int uses_xaui(const struct adapter *adap) uses_xaui() argument
619 return adapter_info(adap)->caps & SUPPORTED_AUI; uses_xaui()
622 static inline int is_10G(const struct adapter *adap) is_10G() argument
624 return adapter_info(adap)->caps & SUPPORTED_10000baseT_Full; is_10G()
627 static inline int is_offload(const struct adapter *adap) is_offload() argument
629 return adap->params.offload; is_offload()
632 static inline unsigned int core_ticks_per_usec(const struct adapter *adap) core_ticks_per_usec() argument
634 return adap->params.vpd.cclk / 1000; core_ticks_per_usec()
637 static inline unsigned int is_pcie(const struct adapter *adap) is_pcie() argument
639 return adap->params.pci.variant == PCI_VARIANT_PCIE; is_pcie()
642 void t3_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
686 int t3_set_proto_sram(struct adapter *adap, const u8 *data);
700 int t3_cim_ctl_blk_read(struct adapter *adap, unsigned int addr,
724 void t3_tp_set_offload_mode(struct adapter *adap, int enable);
725 void t3_tp_get_mib_stats(struct adapter *adap, struct tp_mib_stats *tps);
726 void t3_load_mtus(struct adapter *adap, unsigned short mtus[NMTUS],
732 int t3_config_sched(struct adapter *adap, unsigned int kbps, int sched);
734 void t3_sge_prep(struct adapter *adap, struct sge_params *p);
735 void t3_sge_init(struct adapter *adap, struct sge_params *p);
/linux-4.4.14/drivers/i2c/algos/
H A Di2c-algo-pca.c35 #define pca_outw(adap, reg, val) adap->write_byte(adap->data, reg, val)
36 #define pca_inw(adap, reg) adap->read_byte(adap->data, reg)
38 #define pca_status(adap) pca_inw(adap, I2C_PCA_STA)
39 #define pca_clock(adap) adap->i2c_clock
40 #define pca_set_con(adap, val) pca_outw(adap, I2C_PCA_CON, val)
41 #define pca_get_con(adap) pca_inw(adap, I2C_PCA_CON)
42 #define pca_wait(adap) adap->wait_for_completion(adap->data)
44 static void pca_reset(struct i2c_algo_pca_data *adap) pca_reset() argument
46 if (adap->chip == I2C_PCA_CHIP_9665) { pca_reset()
50 pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET); pca_reset()
51 pca_outw(adap, I2C_PCA_IND, 0xA5); pca_reset()
52 pca_outw(adap, I2C_PCA_IND, 0x5A); pca_reset()
54 adap->reset_chip(adap->data); pca_reset()
63 static int pca_start(struct i2c_algo_pca_data *adap) pca_start() argument
65 int sta = pca_get_con(adap); pca_start()
69 pca_set_con(adap, sta); pca_start()
70 return pca_wait(adap); pca_start()
78 static int pca_repeated_start(struct i2c_algo_pca_data *adap) pca_repeated_start() argument
80 int sta = pca_get_con(adap); pca_repeated_start()
84 pca_set_con(adap, sta); pca_repeated_start()
85 return pca_wait(adap); pca_repeated_start()
97 static void pca_stop(struct i2c_algo_pca_data *adap) pca_stop() argument
99 int sta = pca_get_con(adap); pca_stop()
103 pca_set_con(adap, sta); pca_stop()
111 static int pca_address(struct i2c_algo_pca_data *adap, pca_address() argument
114 int sta = pca_get_con(adap); pca_address()
123 pca_outw(adap, I2C_PCA_DAT, addr); pca_address()
126 pca_set_con(adap, sta); pca_address()
128 return pca_wait(adap); pca_address()
136 static int pca_tx_byte(struct i2c_algo_pca_data *adap, pca_tx_byte() argument
139 int sta = pca_get_con(adap); pca_tx_byte()
141 pca_outw(adap, I2C_PCA_DAT, b); pca_tx_byte()
144 pca_set_con(adap, sta); pca_tx_byte()
146 return pca_wait(adap); pca_tx_byte()
154 static void pca_rx_byte(struct i2c_algo_pca_data *adap, pca_rx_byte() argument
157 *b = pca_inw(adap, I2C_PCA_DAT); pca_rx_byte()
166 static int pca_rx_ack(struct i2c_algo_pca_data *adap, pca_rx_ack() argument
169 int sta = pca_get_con(adap); pca_rx_ack()
176 pca_set_con(adap, sta); pca_rx_ack()
177 return pca_wait(adap); pca_rx_ack()
184 struct i2c_algo_pca_data *adap = i2c_adap->algo_data; pca_xfer() local
193 while ((state = pca_status(adap)) != 0xf8) { pca_xfer()
229 state = pca_status(adap); pca_xfer()
236 completed = pca_start(adap); pca_xfer()
241 completed = pca_address(adap, msg); pca_xfer()
247 completed = pca_tx_byte(adap, pca_xfer()
254 pca_stop(adap); pca_xfer()
256 completed = pca_repeated_start(adap); pca_xfer()
261 pca_stop(adap); pca_xfer()
266 completed = pca_rx_ack(adap, msg->len > 1); pca_xfer()
271 pca_rx_byte(adap, &msg->buf[numbytes], 1); pca_xfer()
273 completed = pca_rx_ack(adap, pca_xfer()
279 pca_stop(adap); pca_xfer()
281 completed = pca_repeated_start(adap); pca_xfer()
286 pca_stop(adap); pca_xfer()
292 pca_stop(adap); pca_xfer()
306 pca_start(adap); pca_xfer()
311 pca_rx_byte(adap, &msg->buf[numbytes], 0); pca_xfer()
314 pca_stop(adap); pca_xfer()
316 completed = pca_repeated_start(adap); pca_xfer()
321 pca_stop(adap); pca_xfer()
327 pca_reset(adap); pca_xfer()
331 pca_reset(adap); pca_xfer()
335 pca_reset(adap); pca_xfer()
350 curmsg, num, pca_status(adap), pca_xfer()
351 pca_get_con(adap)); pca_xfer()
355 static u32 pca_func(struct i2c_adapter *adap) pca_func() argument
365 static unsigned int pca_probe_chip(struct i2c_adapter *adap) pca_probe_chip() argument
367 struct i2c_algo_pca_data *pca_data = adap->algo_data; pca_probe_chip()
379 printk(KERN_INFO "%s: PCA9665 detected.\n", adap->name); pca_probe_chip()
382 printk(KERN_INFO "%s: PCA9564 detected.\n", adap->name); pca_probe_chip()
388 static int pca_init(struct i2c_adapter *adap) pca_init() argument
390 struct i2c_algo_pca_data *pca_data = adap->algo_data; pca_init()
392 adap->algo = &pca_algo; pca_init()
394 if (pca_probe_chip(adap) == I2C_PCA_CHIP_9564) { pca_init()
427 " Using default 59kHz.\n", adap->name); pca_init()
434 " Use the nominal frequency.\n", adap->name); pca_init()
441 adap->name, freqs[clock]); pca_init()
461 " Using 1265.8kHz.\n", adap->name); pca_init()
467 " Using 60.3kHz.\n", adap->name); pca_init()
513 "%s: Clock frequency is %dHz\n", adap->name, clock * 100); pca_init()
532 int i2c_pca_add_bus(struct i2c_adapter *adap) i2c_pca_add_bus() argument
536 rval = pca_init(adap); i2c_pca_add_bus()
540 return i2c_add_adapter(adap); i2c_pca_add_bus()
544 int i2c_pca_add_numbered_bus(struct i2c_adapter *adap) i2c_pca_add_numbered_bus() argument
548 rval = pca_init(adap); i2c_pca_add_numbered_bus()
552 return i2c_add_numbered_adapter(adap); i2c_pca_add_numbered_bus()
H A Di2c-algo-pcf.c47 #define set_pcf(adap, ctl, val) adap->setpcf(adap->data, ctl, val)
48 #define get_pcf(adap, ctl) adap->getpcf(adap->data, ctl)
49 #define get_own(adap) adap->getown(adap->data)
50 #define get_clock(adap) adap->getclock(adap->data)
51 #define i2c_outb(adap, val) adap->setpcf(adap->data, 0, val)
52 #define i2c_inb(adap) adap->getpcf(adap->data, 0)
56 static void i2c_start(struct i2c_algo_pcf_data *adap) i2c_start() argument
59 set_pcf(adap, 1, I2C_PCF_START); i2c_start()
62 static void i2c_repstart(struct i2c_algo_pcf_data *adap) i2c_repstart() argument
65 set_pcf(adap, 1, I2C_PCF_REPSTART); i2c_repstart()
68 static void i2c_stop(struct i2c_algo_pcf_data *adap) i2c_stop() argument
71 set_pcf(adap, 1, I2C_PCF_STOP); i2c_stop()
74 static void handle_lab(struct i2c_algo_pcf_data *adap, const int *status) handle_lab() argument
85 set_pcf(adap, 1, I2C_PCF_PIN); handle_lab()
86 set_pcf(adap, 1, I2C_PCF_ESO); handle_lab()
96 if (adap->lab_mdelay) handle_lab()
97 mdelay(adap->lab_mdelay); handle_lab()
101 get_pcf(adap, 1))); handle_lab()
104 static int wait_for_bb(struct i2c_algo_pcf_data *adap) wait_for_bb() argument
110 status = get_pcf(adap, 1); wait_for_bb()
114 status = get_pcf(adap, 1); wait_for_bb()
125 static int wait_for_pin(struct i2c_algo_pcf_data *adap, int *status) wait_for_pin() argument
130 *status = get_pcf(adap, 1); wait_for_pin()
133 adap->waitforpin(adap->data); wait_for_pin()
134 *status = get_pcf(adap, 1); wait_for_pin()
137 handle_lab(adap, status); wait_for_pin()
158 static int pcf_init_8584 (struct i2c_algo_pcf_data *adap) pcf_init_8584() argument
163 get_pcf(adap, 1))); pcf_init_8584()
166 set_pcf(adap, 1, I2C_PCF_PIN); pcf_init_8584()
171 if (((temp = get_pcf(adap, 1)) & 0x7f) != (0)) { pcf_init_8584()
177 i2c_outb(adap, get_own(adap)); pcf_init_8584()
179 if ((temp = i2c_inb(adap)) != get_own(adap)) { pcf_init_8584()
185 set_pcf(adap, 1, I2C_PCF_PIN | I2C_PCF_ES1); pcf_init_8584()
187 if (((temp = get_pcf(adap, 1)) & 0x7f) != I2C_PCF_ES1) { pcf_init_8584()
193 i2c_outb(adap, get_clock(adap)); pcf_init_8584()
195 if (((temp = i2c_inb(adap)) & 0x1f) != get_clock(adap)) { pcf_init_8584()
201 set_pcf(adap, 1, I2C_PCF_IDLE); pcf_init_8584()
204 if ((temp = get_pcf(adap, 1)) != (I2C_PCF_PIN | I2C_PCF_BB)) { pcf_init_8584()
217 struct i2c_algo_pcf_data *adap = i2c_adap->algo_data; pcf_sendbytes() local
223 i2c_outb(adap, buf[wrcount]); pcf_sendbytes()
224 timeout = wait_for_pin(adap, &status); pcf_sendbytes()
229 i2c_stop(adap); pcf_sendbytes()
234 i2c_stop(adap); pcf_sendbytes()
240 i2c_stop(adap); pcf_sendbytes()
242 i2c_repstart(adap); pcf_sendbytes()
251 struct i2c_algo_pcf_data *adap = i2c_adap->algo_data; pcf_readbytes() local
257 if ((wfp = wait_for_pin(adap, &status))) { pcf_readbytes()
261 i2c_stop(adap); pcf_readbytes()
267 i2c_stop(adap); pcf_readbytes()
273 set_pcf(adap, 1, I2C_PCF_ESO); pcf_readbytes()
276 i2c_stop(adap); pcf_readbytes()
278 i2c_repstart(adap); pcf_readbytes()
282 buf[i - 1] = i2c_inb(adap); pcf_readbytes()
284 i2c_inb(adap); /* dummy read */ pcf_readbytes()
291 static int pcf_doAddress(struct i2c_algo_pcf_data *adap, pcf_doAddress() argument
302 i2c_outb(adap, addr); pcf_doAddress()
311 struct i2c_algo_pcf_data *adap = i2c_adap->algo_data; pcf_xfer() local
316 if (adap->xfer_begin) pcf_xfer()
317 adap->xfer_begin(adap->data); pcf_xfer()
320 timeout = wait_for_bb(adap); pcf_xfer()
335 ret = pcf_doAddress(adap, pmsg); pcf_xfer()
339 i2c_start(adap); pcf_xfer()
342 timeout = wait_for_pin(adap, &status); pcf_xfer()
349 i2c_stop(adap); pcf_xfer()
358 i2c_stop(adap); pcf_xfer()
391 if (adap->xfer_end) pcf_xfer()
392 adap->xfer_end(adap->data); pcf_xfer()
396 static u32 pcf_func(struct i2c_adapter *adap) pcf_func() argument
411 int i2c_pcf_add_bus(struct i2c_adapter *adap) i2c_pcf_add_bus() argument
413 struct i2c_algo_pcf_data *pcf_adap = adap->algo_data; i2c_pcf_add_bus()
416 DEB2(dev_dbg(&adap->dev, "hw routines registered.\n")); i2c_pcf_add_bus()
419 adap->algo = &pcf_algo; i2c_pcf_add_bus()
424 rval = i2c_add_adapter(adap); i2c_pcf_add_bus()
H A Di2c-algo-bit.c57 #define setsda(adap, val) adap->setsda(adap->data, val)
58 #define setscl(adap, val) adap->setscl(adap->data, val)
59 #define getsda(adap) adap->getsda(adap->data)
60 #define getscl(adap) adap->getscl(adap->data)
62 static inline void sdalo(struct i2c_algo_bit_data *adap) sdalo() argument
64 setsda(adap, 0); sdalo()
65 udelay((adap->udelay + 1) / 2); sdalo()
68 static inline void sdahi(struct i2c_algo_bit_data *adap) sdahi() argument
70 setsda(adap, 1); sdahi()
71 udelay((adap->udelay + 1) / 2); sdahi()
74 static inline void scllo(struct i2c_algo_bit_data *adap) scllo() argument
76 setscl(adap, 0); scllo()
77 udelay(adap->udelay / 2); scllo()
84 static int sclhi(struct i2c_algo_bit_data *adap) sclhi() argument
88 setscl(adap, 1); sclhi()
91 if (!adap->getscl) sclhi()
95 while (!getscl(adap)) { sclhi()
101 if (time_after(jiffies, start + adap->timeout)) { sclhi()
105 if (getscl(adap)) sclhi()
118 udelay(adap->udelay); sclhi()
124 static void i2c_start(struct i2c_algo_bit_data *adap) i2c_start() argument
127 setsda(adap, 0); i2c_start()
128 udelay(adap->udelay); i2c_start()
129 scllo(adap); i2c_start()
132 static void i2c_repstart(struct i2c_algo_bit_data *adap) i2c_repstart() argument
135 sdahi(adap); i2c_repstart()
136 sclhi(adap); i2c_repstart()
137 setsda(adap, 0); i2c_repstart()
138 udelay(adap->udelay); i2c_repstart()
139 scllo(adap); i2c_repstart()
143 static void i2c_stop(struct i2c_algo_bit_data *adap) i2c_stop() argument
146 sdalo(adap); i2c_stop()
147 sclhi(adap); i2c_stop()
148 setsda(adap, 1); i2c_stop()
149 udelay(adap->udelay); i2c_stop()
166 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; i2c_outb() local
171 setsda(adap, sb); i2c_outb()
172 udelay((adap->udelay + 1) / 2); i2c_outb()
173 if (sclhi(adap) < 0) { /* timed out */ i2c_outb()
179 * if (sb && !getsda(adap)) -> ouch! Get out of here. i2c_outb()
184 scllo(adap); i2c_outb()
186 sdahi(adap); i2c_outb()
187 if (sclhi(adap) < 0) { /* timeout */ i2c_outb()
196 ack = !getsda(adap); /* ack: sda is pulled low -> success */ i2c_outb()
200 scllo(adap); i2c_outb()
212 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; i2c_inb() local
215 sdahi(adap); i2c_inb()
217 if (sclhi(adap) < 0) { /* timeout */ i2c_inb()
223 if (getsda(adap)) i2c_inb()
225 setscl(adap, 0); i2c_inb()
226 udelay(i == 7 ? adap->udelay / 2 : adap->udelay); i2c_inb()
238 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; test_bus() local
242 if (adap->pre_xfer) { test_bus()
243 ret = adap->pre_xfer(i2c_adap); test_bus()
248 if (adap->getscl == NULL) test_bus()
251 sda = getsda(adap); test_bus()
252 scl = (adap->getscl == NULL) ? 1 : getscl(adap); test_bus()
260 sdalo(adap); test_bus()
261 sda = getsda(adap); test_bus()
262 scl = (adap->getscl == NULL) ? 1 : getscl(adap); test_bus()
273 sdahi(adap); test_bus()
274 sda = getsda(adap); test_bus()
275 scl = (adap->getscl == NULL) ? 1 : getscl(adap); test_bus()
286 scllo(adap); test_bus()
287 sda = getsda(adap); test_bus()
288 scl = (adap->getscl == NULL) ? 0 : getscl(adap); test_bus()
299 sclhi(adap); test_bus()
300 sda = getsda(adap); test_bus()
301 scl = (adap->getscl == NULL) ? 1 : getscl(adap); test_bus()
312 if (adap->post_xfer) test_bus()
313 adap->post_xfer(i2c_adap); test_bus()
318 sdahi(adap); test_bus()
319 sclhi(adap); test_bus()
321 if (adap->post_xfer) test_bus()
322 adap->post_xfer(i2c_adap); test_bus()
340 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; try_address() local
348 i2c_stop(adap); try_address()
349 udelay(adap->udelay); try_address()
352 i2c_start(adap); try_address()
405 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; acknak() local
409 setsda(adap, 0); acknak()
410 udelay((adap->udelay + 1) / 2); acknak()
411 if (sclhi(adap) < 0) { /* timeout */ acknak()
415 scllo(adap); acknak()
483 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; bit_doAddress() local
511 i2c_repstart(adap); bit_doAddress()
539 struct i2c_algo_bit_data *adap = i2c_adap->algo_data; bit_xfer() local
543 if (adap->pre_xfer) { bit_xfer()
544 ret = adap->pre_xfer(i2c_adap); bit_xfer()
550 i2c_start(adap); bit_xfer()
558 i2c_repstart(adap); bit_xfer()
596 i2c_stop(adap); bit_xfer()
598 if (adap->post_xfer) bit_xfer()
599 adap->post_xfer(i2c_adap); bit_xfer()
603 static u32 bit_func(struct i2c_adapter *adap) bit_func() argument
623 static int __i2c_bit_add_bus(struct i2c_adapter *adap, __i2c_bit_add_bus() argument
626 struct i2c_algo_bit_data *bit_adap = adap->algo_data; __i2c_bit_add_bus()
630 ret = test_bus(adap); __i2c_bit_add_bus()
636 adap->algo = &i2c_bit_algo; __i2c_bit_add_bus()
637 adap->retries = 3; __i2c_bit_add_bus()
639 ret = add_adapter(adap); __i2c_bit_add_bus()
645 dev_warn(&adap->dev, "Not I2C compliant: can't read SCL\n"); __i2c_bit_add_bus()
646 dev_warn(&adap->dev, "Bus may be unreliable\n"); __i2c_bit_add_bus()
651 int i2c_bit_add_bus(struct i2c_adapter *adap) i2c_bit_add_bus() argument
653 return __i2c_bit_add_bus(adap, i2c_add_adapter); i2c_bit_add_bus()
657 int i2c_bit_add_numbered_bus(struct i2c_adapter *adap) i2c_bit_add_numbered_bus() argument
659 return __i2c_bit_add_bus(adap, i2c_add_numbered_adapter); i2c_bit_add_numbered_bus()
/linux-4.4.14/drivers/media/usb/dvb-usb-v2/
H A Ddvb_usb_core.c218 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete() local
219 dvb_dmx_swfilter(&adap->demux, buf, len); dvb_usb_data_complete()
225 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete_204() local
226 dvb_dmx_swfilter_204(&adap->demux, buf, len); dvb_usb_data_complete_204()
232 struct dvb_usb_adapter *adap = stream->user_priv; dvb_usb_data_complete_raw() local
233 dvb_dmx_swfilter_raw(&adap->demux, buf, len); dvb_usb_data_complete_raw()
236 static int dvb_usbv2_adapter_stream_init(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_stream_init() argument
238 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, dvb_usbv2_adapter_stream_init()
239 adap->id); dvb_usbv2_adapter_stream_init()
241 adap->stream.udev = adap_to_d(adap)->udev; dvb_usbv2_adapter_stream_init()
242 adap->stream.user_priv = adap; dvb_usbv2_adapter_stream_init()
243 adap->stream.complete = dvb_usb_data_complete; dvb_usbv2_adapter_stream_init()
245 return usb_urb_initv2(&adap->stream, &adap->props->stream); dvb_usbv2_adapter_stream_init()
248 static int dvb_usbv2_adapter_stream_exit(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_stream_exit() argument
250 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, dvb_usbv2_adapter_stream_exit()
251 adap->id); dvb_usbv2_adapter_stream_exit()
253 return usb_urb_exitv2(&adap->stream); dvb_usbv2_adapter_stream_exit()
258 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; dvb_usb_start_feed() local
259 struct dvb_usb_device *d = adap_to_d(adap); dvb_usb_start_feed()
263 "%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: %04x (%04d) at index %d\n", dvb_usb_start_feed()
264 __func__, adap->id, adap->active_fe, dvbdmxfeed->type, dvb_usb_start_feed()
265 adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid, dvb_usb_start_feed()
269 wait_on_bit(&adap->state_bits, ADAP_INIT, TASK_UNINTERRUPTIBLE); dvb_usb_start_feed()
271 if (adap->active_fe == -1) dvb_usb_start_feed()
275 if (adap->feed_count++ > 0) dvb_usb_start_feed()
279 set_bit(ADAP_STREAMING, &adap->state_bits); dvb_usb_start_feed()
283 memcpy(&stream_props, &adap->props->stream, dvb_usb_start_feed()
285 ret = d->props->get_stream_config(adap->fe[adap->active_fe], dvb_usb_start_feed()
286 &adap->ts_type, &stream_props); dvb_usb_start_feed()
292 stream_props = adap->props->stream; dvb_usb_start_feed()
295 switch (adap->ts_type) { dvb_usb_start_feed()
297 adap->stream.complete = dvb_usb_data_complete_204; dvb_usb_start_feed()
300 adap->stream.complete = dvb_usb_data_complete_raw; dvb_usb_start_feed()
304 adap->stream.complete = dvb_usb_data_complete; dvb_usb_start_feed()
309 usb_urb_submitv2(&adap->stream, &stream_props); dvb_usb_start_feed()
312 if (adap->pid_filtering && adap->props->pid_filter_ctrl) { dvb_usb_start_feed()
313 ret = adap->props->pid_filter_ctrl(adap, 1); dvb_usb_start_feed()
322 ret = d->props->streaming_ctrl(adap->fe[adap->active_fe], 1); dvb_usb_start_feed()
331 if (adap->pid_filtering && adap->props->pid_filter) { dvb_usb_start_feed()
332 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, dvb_usb_start_feed()
346 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv; dvb_usb_stop_feed() local
347 struct dvb_usb_device *d = adap_to_d(adap); dvb_usb_stop_feed()
350 "%s: adap=%d active_fe=%d feed_type=%d setting pid [%s]: %04x (%04d) at index %d\n", dvb_usb_stop_feed()
351 __func__, adap->id, adap->active_fe, dvbdmxfeed->type, dvb_usb_stop_feed()
352 adap->pid_filtering ? "yes" : "no", dvbdmxfeed->pid, dvb_usb_stop_feed()
355 if (adap->active_fe == -1) dvb_usb_stop_feed()
359 if (adap->pid_filtering && adap->props->pid_filter) { dvb_usb_stop_feed()
360 ret = adap->props->pid_filter(adap, dvbdmxfeed->index, dvb_usb_stop_feed()
368 if (--adap->feed_count > 0) dvb_usb_stop_feed()
373 ret = d->props->streaming_ctrl(adap->fe[adap->active_fe], 0); dvb_usb_stop_feed()
381 if (adap->pid_filtering && adap->props->pid_filter_ctrl) { dvb_usb_stop_feed()
382 ret = adap->props->pid_filter_ctrl(adap, 0); dvb_usb_stop_feed()
390 usb_urb_killv2(&adap->stream); dvb_usb_stop_feed()
393 clear_bit(ADAP_STREAMING, &adap->state_bits); dvb_usb_stop_feed()
395 wake_up_bit(&adap->state_bits, ADAP_STREAMING); dvb_usb_stop_feed()
403 static void dvb_usbv2_media_device_register(struct dvb_usb_adapter *adap) dvb_usbv2_media_device_register() argument
407 struct dvb_usb_device *d = adap_to_d(adap); dvb_usbv2_media_device_register()
432 dvb_register_media_controller(&adap->dvb_adap, mdev); dvb_usbv2_media_device_register()
439 static void dvb_usbv2_media_device_unregister(struct dvb_usb_adapter *adap) dvb_usbv2_media_device_unregister() argument
443 if (!adap->dvb_adap.mdev) dvb_usbv2_media_device_unregister()
446 media_device_unregister(adap->dvb_adap.mdev); dvb_usbv2_media_device_unregister()
447 kfree(adap->dvb_adap.mdev); dvb_usbv2_media_device_unregister()
448 adap->dvb_adap.mdev = NULL; dvb_usbv2_media_device_unregister()
453 static int dvb_usbv2_adapter_dvb_init(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_dvb_init() argument
456 struct dvb_usb_device *d = adap_to_d(adap); dvb_usbv2_adapter_dvb_init()
458 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); dvb_usbv2_adapter_dvb_init()
460 ret = dvb_register_adapter(&adap->dvb_adap, d->name, d->props->owner, dvb_usbv2_adapter_dvb_init()
468 adap->dvb_adap.priv = adap; dvb_usbv2_adapter_dvb_init()
470 dvb_usbv2_media_device_register(adap); dvb_usbv2_adapter_dvb_init()
473 ret = d->props->read_mac_address(adap, dvb_usbv2_adapter_dvb_init()
474 adap->dvb_adap.proposed_mac); dvb_usbv2_adapter_dvb_init()
479 KBUILD_MODNAME, adap->dvb_adap.proposed_mac); dvb_usbv2_adapter_dvb_init()
482 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; dvb_usbv2_adapter_dvb_init()
483 adap->demux.priv = adap; dvb_usbv2_adapter_dvb_init()
484 adap->demux.filternum = 0; dvb_usbv2_adapter_dvb_init()
485 adap->demux.filternum = adap->max_feed_count; dvb_usbv2_adapter_dvb_init()
486 adap->demux.feednum = adap->demux.filternum; dvb_usbv2_adapter_dvb_init()
487 adap->demux.start_feed = dvb_usb_start_feed; dvb_usbv2_adapter_dvb_init()
488 adap->demux.stop_feed = dvb_usb_stop_feed; dvb_usbv2_adapter_dvb_init()
489 adap->demux.write_to_decoder = NULL; dvb_usbv2_adapter_dvb_init()
490 ret = dvb_dmx_init(&adap->demux); dvb_usbv2_adapter_dvb_init()
497 adap->dmxdev.filternum = adap->demux.filternum; dvb_usbv2_adapter_dvb_init()
498 adap->dmxdev.demux = &adap->demux.dmx; dvb_usbv2_adapter_dvb_init()
499 adap->dmxdev.capabilities = 0; dvb_usbv2_adapter_dvb_init()
500 ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap); dvb_usbv2_adapter_dvb_init()
507 ret = dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx); dvb_usbv2_adapter_dvb_init()
516 dvb_dmxdev_release(&adap->dmxdev); dvb_usbv2_adapter_dvb_init()
518 dvb_dmx_release(&adap->demux); dvb_usbv2_adapter_dvb_init()
520 dvb_usbv2_media_device_unregister(adap); dvb_usbv2_adapter_dvb_init()
521 dvb_unregister_adapter(&adap->dvb_adap); dvb_usbv2_adapter_dvb_init()
523 adap->dvb_adap.priv = NULL; dvb_usbv2_adapter_dvb_init()
527 static int dvb_usbv2_adapter_dvb_exit(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_dvb_exit() argument
529 dev_dbg(&adap_to_d(adap)->udev->dev, "%s: adap=%d\n", __func__, dvb_usbv2_adapter_dvb_exit()
530 adap->id); dvb_usbv2_adapter_dvb_exit()
532 if (adap->dvb_adap.priv) { dvb_usbv2_adapter_dvb_exit()
533 dvb_net_release(&adap->dvb_net); dvb_usbv2_adapter_dvb_exit()
534 adap->demux.dmx.close(&adap->demux.dmx); dvb_usbv2_adapter_dvb_exit()
535 dvb_dmxdev_release(&adap->dmxdev); dvb_usbv2_adapter_dvb_exit()
536 dvb_dmx_release(&adap->demux); dvb_usbv2_adapter_dvb_exit()
537 dvb_usbv2_media_device_unregister(adap); dvb_usbv2_adapter_dvb_exit()
538 dvb_unregister_adapter(&adap->dvb_adap); dvb_usbv2_adapter_dvb_exit()
572 struct dvb_usb_adapter *adap = fe->dvb->priv; dvb_usb_fe_init() local
573 struct dvb_usb_device *d = adap_to_d(adap); dvb_usb_fe_init()
574 dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id, dvb_usb_fe_init()
577 if (!adap->suspend_resume_active) { dvb_usb_fe_init()
578 adap->active_fe = fe->id; dvb_usb_fe_init()
579 set_bit(ADAP_INIT, &adap->state_bits); dvb_usb_fe_init()
592 if (adap->fe_init[fe->id]) { dvb_usb_fe_init()
593 ret = adap->fe_init[fe->id](fe); dvb_usb_fe_init()
598 if (!adap->suspend_resume_active) { dvb_usb_fe_init()
599 clear_bit(ADAP_INIT, &adap->state_bits); dvb_usb_fe_init()
601 wake_up_bit(&adap->state_bits, ADAP_INIT); dvb_usb_fe_init()
611 struct dvb_usb_adapter *adap = fe->dvb->priv; dvb_usb_fe_sleep() local
612 struct dvb_usb_device *d = adap_to_d(adap); dvb_usb_fe_sleep()
613 dev_dbg(&d->udev->dev, "%s: adap=%d fe=%d\n", __func__, adap->id, dvb_usb_fe_sleep()
616 if (!adap->suspend_resume_active) { dvb_usb_fe_sleep()
617 set_bit(ADAP_SLEEP, &adap->state_bits); dvb_usb_fe_sleep()
618 wait_on_bit(&adap->state_bits, ADAP_STREAMING, dvb_usb_fe_sleep()
622 if (adap->fe_sleep[fe->id]) { dvb_usb_fe_sleep()
623 ret = adap->fe_sleep[fe->id](fe); dvb_usb_fe_sleep()
638 if (!adap->suspend_resume_active) { dvb_usb_fe_sleep()
639 adap->active_fe = -1; dvb_usb_fe_sleep()
640 clear_bit(ADAP_SLEEP, &adap->state_bits); dvb_usb_fe_sleep()
642 wake_up_bit(&adap->state_bits, ADAP_SLEEP); dvb_usb_fe_sleep()
649 static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_frontend_init() argument
652 struct dvb_usb_device *d = adap_to_d(adap); dvb_usbv2_adapter_frontend_init()
653 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); dvb_usbv2_adapter_frontend_init()
655 memset(adap->fe, 0, sizeof(adap->fe)); dvb_usbv2_adapter_frontend_init()
656 adap->active_fe = -1; dvb_usbv2_adapter_frontend_init()
659 ret = d->props->frontend_attach(adap); dvb_usbv2_adapter_frontend_init()
673 for (i = 0; i < MAX_NO_OF_FE_PER_ADAP && adap->fe[i]; i++) { dvb_usbv2_adapter_frontend_init()
674 adap->fe[i]->id = i; dvb_usbv2_adapter_frontend_init()
676 adap->fe_init[i] = adap->fe[i]->ops.init; dvb_usbv2_adapter_frontend_init()
677 adap->fe[i]->ops.init = dvb_usb_fe_init; dvb_usbv2_adapter_frontend_init()
678 adap->fe_sleep[i] = adap->fe[i]->ops.sleep; dvb_usbv2_adapter_frontend_init()
679 adap->fe[i]->ops.sleep = dvb_usb_fe_sleep; dvb_usbv2_adapter_frontend_init()
681 ret = dvb_register_frontend(&adap->dvb_adap, adap->fe[i]); dvb_usbv2_adapter_frontend_init()
693 ret = d->props->tuner_attach(adap); dvb_usbv2_adapter_frontend_init()
701 dvb_create_media_graph(&adap->dvb_adap); dvb_usbv2_adapter_frontend_init()
707 dvb_unregister_frontend(adap->fe[i]); dvb_usbv2_adapter_frontend_init()
711 if (adap->fe[i]) { dvb_usbv2_adapter_frontend_init()
712 dvb_frontend_detach(adap->fe[i]); dvb_usbv2_adapter_frontend_init()
713 adap->fe[i] = NULL; dvb_usbv2_adapter_frontend_init()
722 static int dvb_usbv2_adapter_frontend_exit(struct dvb_usb_adapter *adap) dvb_usbv2_adapter_frontend_exit() argument
725 struct dvb_usb_device *d = adap_to_d(adap); dvb_usbv2_adapter_frontend_exit()
727 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, adap->id); dvb_usbv2_adapter_frontend_exit()
730 if (adap->fe[i]) { dvb_usbv2_adapter_frontend_exit()
731 dvb_unregister_frontend(adap->fe[i]); dvb_usbv2_adapter_frontend_exit()
732 dvb_frontend_detach(adap->fe[i]); dvb_usbv2_adapter_frontend_exit()
737 ret = d->props->tuner_detach(adap); dvb_usbv2_adapter_frontend_exit()
745 ret = d->props->frontend_detach(adap); dvb_usbv2_adapter_frontend_exit()
758 struct dvb_usb_adapter *adap; dvb_usbv2_adapter_init() local
772 adap = &d->adapter[i]; dvb_usbv2_adapter_init()
773 adap->id = i; dvb_usbv2_adapter_init()
774 adap->props = &d->props->adapter[i]; dvb_usbv2_adapter_init()
778 !(adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER)) { dvb_usbv2_adapter_init()
785 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) || dvb_usbv2_adapter_init()
786 (adap->props->caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { dvb_usbv2_adapter_init()
790 adap->props->pid_filter_count); dvb_usbv2_adapter_init()
791 adap->pid_filtering = 1; dvb_usbv2_adapter_init()
792 adap->max_feed_count = adap->props->pid_filter_count; dvb_usbv2_adapter_init()
797 adap->pid_filtering = 0; dvb_usbv2_adapter_init()
798 adap->max_feed_count = 255; dvb_usbv2_adapter_init()
801 if (!adap->pid_filtering && dvb_usb_force_pid_filter_usage && dvb_usbv2_adapter_init()
802 adap->props->caps & DVB_USB_ADAP_HAS_PID_FILTER) { dvb_usbv2_adapter_init()
806 adap->pid_filtering = 1; dvb_usbv2_adapter_init()
807 adap->max_feed_count = adap->props->pid_filter_count; dvb_usbv2_adapter_init()
810 ret = dvb_usbv2_adapter_stream_init(adap); dvb_usbv2_adapter_init()
814 ret = dvb_usbv2_adapter_dvb_init(adap); dvb_usbv2_adapter_init()
818 ret = dvb_usbv2_adapter_frontend_init(adap); dvb_usbv2_adapter_init()
823 if (adap->fe[1]) dvb_usbv2_adapter_init()
824 adap->dvb_adap.mfe_shared = 1; dvb_usbv2_adapter_init()
H A Dgl861.c53 static int gl861_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], gl861_i2c_xfer() argument
56 struct dvb_usb_device *d = i2c_get_adapdata(adap); gl861_i2c_xfer()
99 static int gl861_frontend_attach(struct dvb_usb_adapter *adap) gl861_frontend_attach() argument
102 adap->fe[0] = dvb_attach(zl10353_attach, &gl861_zl10353_config, gl861_frontend_attach()
103 &adap_to_d(adap)->i2c_adap); gl861_frontend_attach()
104 if (adap->fe[0] == NULL) gl861_frontend_attach()
114 static int gl861_tuner_attach(struct dvb_usb_adapter *adap) gl861_tuner_attach() argument
117 adap->fe[0], &adap_to_d(adap)->i2c_adap, gl861_tuner_attach()
H A Dlmedm04.c263 static void lme2510_update_stats(struct dvb_usb_adapter *adap) lme2510_update_stats() argument
265 struct lme2510_state *st = adap_to_priv(adap); lme2510_update_stats()
266 struct dvb_frontend *fe = adap->fe[0]; lme2510_update_stats()
318 struct dvb_usb_adapter *adap = lme_urb->context; lme2510_int_response() local
319 struct lme2510_state *st = adap_to_priv(adap); lme2510_int_response()
351 if (!adap_to_d(adap)->rc_dev) lme2510_int_response()
360 rc_keydown(adap_to_d(adap)->rc_dev, RC_TYPE_NEC, key, 0); lme2510_int_response()
397 lme2510_update_stats(adap); lme2510_int_response()
418 static int lme2510_int_read(struct dvb_usb_adapter *adap) lme2510_int_read() argument
420 struct dvb_usb_device *d = adap_to_d(adap); lme2510_int_read()
421 struct lme2510_state *lme_int = adap_to_priv(adap); lme2510_int_read()
441 adap, lme2510_int_read()
458 static int lme2510_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) lme2510_pid_filter_ctrl() argument
460 struct dvb_usb_device *d = adap_to_d(adap); lme2510_pid_filter_ctrl()
461 struct lme2510_state *st = adap_to_priv(adap); lme2510_pid_filter_ctrl()
484 static int lme2510_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, lme2510_pid_filter() argument
487 struct dvb_usb_device *d = adap_to_d(adap); lme2510_pid_filter()
532 static int lme2510_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], lme2510_i2c_xfer() argument
535 struct dvb_usb_device *d = i2c_get_adapdata(adap); lme2510_i2c_xfer()
609 struct dvb_usb_adapter *adap = fe_to_adap(fe); lme2510_streaming_ctrl() local
610 struct dvb_usb_device *d = adap_to_d(adap); lme2510_streaming_ctrl()
611 struct lme2510_state *st = adap_to_priv(adap); lme2510_streaming_ctrl()
935 struct dvb_usb_adapter *adap = fe_to_adap(fe); dm04_read_status() local
939 lme2510_update_stats(adap); dm04_read_status()
1001 static int lme_name(struct dvb_usb_adapter *adap) lme_name() argument
1003 struct dvb_usb_device *d = adap_to_d(adap); lme_name()
1004 struct lme2510_state *st = adap_to_priv(adap); lme_name()
1008 char *name = adap->fe[0]->ops.info.name; lme_name()
1016 static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap) dm04_lme2510_frontend_attach() argument
1018 struct dvb_usb_device *d = adap_to_d(adap); dm04_lme2510_frontend_attach()
1027 adap->fe[0] = dvb_attach(tda10086_attach, dm04_lme2510_frontend_attach()
1029 if (adap->fe[0]) { dm04_lme2510_frontend_attach()
1043 adap->fe[0] = dvb_attach(stv0299_attach, dm04_lme2510_frontend_attach()
1045 if (adap->fe[0]) { dm04_lme2510_frontend_attach()
1059 adap->fe[0] = dvb_attach(stv0288_attach, &lme_config, dm04_lme2510_frontend_attach()
1062 if (adap->fe[0]) { dm04_lme2510_frontend_attach()
1076 adap->fe[0] = dvb_attach(m88rs2000_attach, dm04_lme2510_frontend_attach()
1079 if (adap->fe[0]) { dm04_lme2510_frontend_attach()
1081 dvb_attach(ts2020_attach, adap->fe[0], &ts2020_config, dm04_lme2510_frontend_attach()
1088 adap->fe[0]->ops.set_voltage; dm04_lme2510_frontend_attach()
1093 if (adap->fe[0] == NULL) { dm04_lme2510_frontend_attach()
1099 if (adap->fe[0]) { dm04_lme2510_frontend_attach()
1100 dvb_frontend_detach(adap->fe[0]); dm04_lme2510_frontend_attach()
1101 adap->fe[0] = NULL; dm04_lme2510_frontend_attach()
1107 st->fe_read_status = adap->fe[0]->ops.read_status; dm04_lme2510_frontend_attach()
1108 st->fe_read_signal_strength = adap->fe[0]->ops.read_signal_strength; dm04_lme2510_frontend_attach()
1109 st->fe_read_snr = adap->fe[0]->ops.read_snr; dm04_lme2510_frontend_attach()
1110 st->fe_read_ber = adap->fe[0]->ops.read_ber; dm04_lme2510_frontend_attach()
1111 st->fe_read_ucblocks = adap->fe[0]->ops.read_ucblocks; dm04_lme2510_frontend_attach()
1113 adap->fe[0]->ops.read_status = dm04_read_status; dm04_lme2510_frontend_attach()
1114 adap->fe[0]->ops.read_signal_strength = dm04_read_signal_strength; dm04_lme2510_frontend_attach()
1115 adap->fe[0]->ops.read_snr = dm04_read_snr; dm04_lme2510_frontend_attach()
1116 adap->fe[0]->ops.read_ber = dm04_read_ber; dm04_lme2510_frontend_attach()
1117 adap->fe[0]->ops.read_ucblocks = dm04_read_ucblocks; dm04_lme2510_frontend_attach()
1118 adap->fe[0]->ops.set_voltage = dm04_lme2510_set_voltage; dm04_lme2510_frontend_attach()
1120 ret = lme_name(adap); dm04_lme2510_frontend_attach()
1124 static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap) dm04_lme2510_tuner() argument
1126 struct dvb_usb_device *d = adap_to_d(adap); dm04_lme2510_tuner()
1127 struct lme2510_state *st = adap_to_priv(adap); dm04_lme2510_tuner()
1133 if (dvb_attach(tda826x_attach, adap->fe[0], 0x60, dm04_lme2510_tuner()
1138 if (dvb_attach(ix2505v_attach , adap->fe[0], &lme_tuner, dm04_lme2510_tuner()
1143 if (dvb_attach(dvb_pll_attach , adap->fe[0], 0x60, dm04_lme2510_tuner()
1163 ret = lme2510_int_read(adap); dm04_lme2510_tuner()
1221 struct dvb_usb_adapter *adap = fe_to_adap(fe); lme2510_get_stream_config() local
1224 if (adap == NULL) lme2510_get_stream_config()
1227 d = adap_to_d(adap); lme2510_get_stream_config()
1231 adap->pid_filtering = true; lme2510_get_stream_config()
1232 adap->max_feed_count = 15; lme2510_get_stream_config()
1252 struct dvb_usb_adapter *adap = &d->adapter[0]; lme2510_exit_int() local
1255 if (adap != NULL) { lme2510_exit_int()
1256 lme2510_kill_urb(&adap->stream); lme2510_exit_int()
H A Ddvbsky.c113 static int dvbsky_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], dvbsky_i2c_xfer() argument
116 struct dvb_usb_device *d = i2c_get_adapdata(adap); dvbsky_i2c_xfer()
255 static int dvbsky_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6]) dvbsky_read_mac_addr() argument
257 struct dvb_usb_device *d = adap_to_d(adap); dvbsky_read_mac_addr()
310 static int dvbsky_s960_attach(struct dvb_usb_adapter *adap) dvbsky_s960_attach() argument
312 struct dvbsky_state *state = adap_to_priv(adap); dvbsky_s960_attach()
313 struct dvb_usb_device *d = adap_to_d(adap); dvbsky_s960_attach()
323 adap->fe[0] = dvb_attach(m88ds3103_attach, dvbsky_s960_attach()
327 if (!adap->fe[0]) { dvbsky_s960_attach()
334 ts2020_config.fe = adap->fe[0]; dvbsky_s960_attach()
342 dvb_frontend_detach(adap->fe[0]); dvbsky_s960_attach()
349 dvb_frontend_detach(adap->fe[0]); dvbsky_s960_attach()
355 adap->fe[0]->ops.read_signal_strength = dvbsky_s960_attach()
356 adap->fe[0]->ops.tuner_ops.get_rf_strength; dvbsky_s960_attach()
359 state->fe_read_status = adap->fe[0]->ops.read_status; dvbsky_s960_attach()
360 adap->fe[0]->ops.read_status = dvbsky_usb_read_status; dvbsky_s960_attach()
363 state->fe_set_voltage = adap->fe[0]->ops.set_voltage; dvbsky_s960_attach()
364 adap->fe[0]->ops.set_voltage = dvbsky_usb_set_voltage; dvbsky_s960_attach()
432 static int dvbsky_s960c_attach(struct dvb_usb_adapter *adap) dvbsky_s960c_attach() argument
434 struct dvbsky_state *state = adap_to_priv(adap); dvbsky_s960c_attach()
435 struct dvb_usb_device *d = adap_to_d(adap); dvbsky_s960c_attach()
446 adap->fe[0] = dvb_attach(m88ds3103_attach, dvbsky_s960c_attach()
450 if (!adap->fe[0]) { dvbsky_s960c_attach()
457 ts2020_config.fe = adap->fe[0]; dvbsky_s960c_attach()
476 sp2_config.dvb_adap = &adap->dvb_adap; dvbsky_s960c_attach()
496 adap->fe[0]->ops.read_signal_strength = dvbsky_s960c_attach()
497 adap->fe[0]->ops.tuner_ops.get_rf_strength; dvbsky_s960c_attach()
500 state->fe_read_status = adap->fe[0]->ops.read_status; dvbsky_s960c_attach()
501 adap->fe[0]->ops.read_status = dvbsky_usb_read_status; dvbsky_s960c_attach()
504 state->fe_set_voltage = adap->fe[0]->ops.set_voltage; dvbsky_s960c_attach()
505 adap->fe[0]->ops.set_voltage = dvbsky_usb_ci_set_voltage; dvbsky_s960c_attach()
517 dvb_frontend_detach(adap->fe[0]); dvbsky_s960c_attach()
522 static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap) dvbsky_t680c_attach() argument
524 struct dvbsky_state *state = adap_to_priv(adap); dvbsky_t680c_attach()
525 struct dvb_usb_device *d = adap_to_d(adap); dvbsky_t680c_attach()
537 si2168_config.fe = &adap->fe[0]; dvbsky_t680c_attach()
554 si2157_config.fe = adap->fe[0]; dvbsky_t680c_attach()
571 sp2_config.dvb_adap = &adap->dvb_adap; dvbsky_t680c_attach()
607 static int dvbsky_t330_attach(struct dvb_usb_adapter *adap) dvbsky_t330_attach() argument
609 struct dvbsky_state *state = adap_to_priv(adap); dvbsky_t330_attach()
610 struct dvb_usb_device *d = adap_to_d(adap); dvbsky_t330_attach()
621 si2168_config.fe = &adap->fe[0]; dvbsky_t330_attach()
639 si2157_config.fe = adap->fe[0]; dvbsky_t330_attach()
H A Daz6007.c87 struct dvb_usb_adapter *adap = fe->sec_priv; drxk_gate_ctrl() local
92 if (!adap || !st) drxk_gate_ctrl()
578 static int az6007_ci_init(struct dvb_usb_adapter *adap) az6007_ci_init() argument
580 struct dvb_usb_device *d = adap_to_d(adap); az6007_ci_init()
581 struct az6007_device_state *state = adap_to_priv(adap); az6007_ci_init()
598 ret = dvb_ca_en50221_init(&adap->dvb_adap, az6007_ci_init()
613 static int az6007_read_mac_addr(struct dvb_usb_adapter *adap, u8 mac[6]) az6007_read_mac_addr() argument
615 struct dvb_usb_device *d = adap_to_d(adap); az6007_read_mac_addr()
616 struct az6007_device_state *st = adap_to_priv(adap); az6007_read_mac_addr()
628 static int az6007_frontend_attach(struct dvb_usb_adapter *adap) az6007_frontend_attach() argument
630 struct az6007_device_state *st = adap_to_priv(adap); az6007_frontend_attach()
631 struct dvb_usb_device *d = adap_to_d(adap); az6007_frontend_attach()
635 adap->fe[0] = dvb_attach(drxk_attach, &terratec_h7_drxk, az6007_frontend_attach()
637 if (!adap->fe[0]) az6007_frontend_attach()
640 adap->fe[0]->sec_priv = adap; az6007_frontend_attach()
641 st->gate_ctrl = adap->fe[0]->ops.i2c_gate_ctrl; az6007_frontend_attach()
642 adap->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; az6007_frontend_attach()
644 az6007_ci_init(adap); az6007_frontend_attach()
649 static int az6007_cablestar_hdci_frontend_attach(struct dvb_usb_adapter *adap) az6007_cablestar_hdci_frontend_attach() argument
651 struct az6007_device_state *st = adap_to_priv(adap); az6007_cablestar_hdci_frontend_attach()
652 struct dvb_usb_device *d = adap_to_d(adap); az6007_cablestar_hdci_frontend_attach()
656 adap->fe[0] = dvb_attach(drxk_attach, &cablestar_hdci_drxk, az6007_cablestar_hdci_frontend_attach()
658 if (!adap->fe[0]) az6007_cablestar_hdci_frontend_attach()
661 adap->fe[0]->sec_priv = adap; az6007_cablestar_hdci_frontend_attach()
662 st->gate_ctrl = adap->fe[0]->ops.i2c_gate_ctrl; az6007_cablestar_hdci_frontend_attach()
663 adap->fe[0]->ops.i2c_gate_ctrl = drxk_gate_ctrl; az6007_cablestar_hdci_frontend_attach()
665 az6007_ci_init(adap); az6007_cablestar_hdci_frontend_attach()
670 static int az6007_tuner_attach(struct dvb_usb_adapter *adap) az6007_tuner_attach() argument
672 struct dvb_usb_device *d = adap_to_d(adap); az6007_tuner_attach()
677 if (adap->fe[0]->ops.i2c_gate_ctrl) az6007_tuner_attach()
678 adap->fe[0]->ops.i2c_gate_ctrl(adap->fe[0], 1); az6007_tuner_attach()
679 if (!dvb_attach(mt2063_attach, adap->fe[0], az6007_tuner_attach()
684 if (adap->fe[0]->ops.i2c_gate_ctrl) az6007_tuner_attach()
685 adap->fe[0]->ops.i2c_gate_ctrl(adap->fe[0], 0); az6007_tuner_attach()
744 static int az6007_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], az6007_i2c_xfer() argument
747 struct dvb_usb_device *d = i2c_get_adapdata(adap); az6007_i2c_xfer()
956 struct dvb_usb_adapter *adap = &d->adapter[0]; az6007_resume() local
958 az6007_ci_init(adap); az6007_resume()
H A Dmxl111sf.c422 static int mxl111sf_lgdt3305_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) mxl111sf_lgdt3305_frontend_attach() argument
424 struct dvb_usb_device *d = adap_to_d(adap); mxl111sf_lgdt3305_frontend_attach()
469 adap->fe[fe_id] = dvb_attach(lgdt3305_attach, mxl111sf_lgdt3305_frontend_attach()
472 if (adap->fe[fe_id]) { mxl111sf_lgdt3305_frontend_attach()
474 adap_state->fe_init = adap->fe[fe_id]->ops.init; mxl111sf_lgdt3305_frontend_attach()
475 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; mxl111sf_lgdt3305_frontend_attach()
476 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; mxl111sf_lgdt3305_frontend_attach()
477 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; mxl111sf_lgdt3305_frontend_attach()
493 static int mxl111sf_lg2160_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) mxl111sf_lg2160_frontend_attach() argument
495 struct dvb_usb_device *d = adap_to_d(adap); mxl111sf_lg2160_frontend_attach()
544 adap->fe[fe_id] = dvb_attach(lg2160_attach, mxl111sf_lg2160_frontend_attach()
547 if (adap->fe[fe_id]) { mxl111sf_lg2160_frontend_attach()
549 adap_state->fe_init = adap->fe[fe_id]->ops.init; mxl111sf_lg2160_frontend_attach()
550 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; mxl111sf_lg2160_frontend_attach()
551 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; mxl111sf_lg2160_frontend_attach()
552 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; mxl111sf_lg2160_frontend_attach()
578 static int mxl111sf_lg2161_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) mxl111sf_lg2161_frontend_attach() argument
580 struct dvb_usb_device *d = adap_to_d(adap); mxl111sf_lg2161_frontend_attach()
629 adap->fe[fe_id] = dvb_attach(lg2160_attach, mxl111sf_lg2161_frontend_attach()
634 if (adap->fe[fe_id]) { mxl111sf_lg2161_frontend_attach()
636 adap_state->fe_init = adap->fe[fe_id]->ops.init; mxl111sf_lg2161_frontend_attach()
637 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; mxl111sf_lg2161_frontend_attach()
638 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; mxl111sf_lg2161_frontend_attach()
639 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; mxl111sf_lg2161_frontend_attach()
665 static int mxl111sf_lg2161_ep6_frontend_attach(struct dvb_usb_adapter *adap, u8 fe_id) mxl111sf_lg2161_ep6_frontend_attach() argument
667 struct dvb_usb_device *d = adap_to_d(adap); mxl111sf_lg2161_ep6_frontend_attach()
716 adap->fe[fe_id] = dvb_attach(lg2160_attach, mxl111sf_lg2161_ep6_frontend_attach()
721 if (adap->fe[fe_id]) { mxl111sf_lg2161_ep6_frontend_attach()
723 adap_state->fe_init = adap->fe[fe_id]->ops.init; mxl111sf_lg2161_ep6_frontend_attach()
724 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; mxl111sf_lg2161_ep6_frontend_attach()
725 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; mxl111sf_lg2161_ep6_frontend_attach()
726 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; mxl111sf_lg2161_ep6_frontend_attach()
740 static int mxl111sf_attach_demod(struct dvb_usb_adapter *adap, u8 fe_id) mxl111sf_attach_demod() argument
742 struct dvb_usb_device *d = adap_to_d(adap); mxl111sf_attach_demod()
783 adap->fe[fe_id] = dvb_attach(mxl111sf_demod_attach, state, mxl111sf_attach_demod()
785 if (adap->fe[fe_id]) { mxl111sf_attach_demod()
787 adap_state->fe_init = adap->fe[fe_id]->ops.init; mxl111sf_attach_demod()
788 adap->fe[fe_id]->ops.init = mxl111sf_adap_fe_init; mxl111sf_attach_demod()
789 adap_state->fe_sleep = adap->fe[fe_id]->ops.sleep; mxl111sf_attach_demod()
790 adap->fe[fe_id]->ops.sleep = mxl111sf_adap_fe_sleep; mxl111sf_attach_demod()
868 static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap) mxl111sf_attach_tuner() argument
870 struct mxl111sf_state *state = adap_to_priv(adap); mxl111sf_attach_tuner()
876 if (dvb_attach(mxl111sf_tuner_attach, adap->fe[i], state, mxl111sf_attach_tuner()
879 adap->fe[i]->ops.read_signal_strength = adap->fe[i]->ops.tuner_ops.get_rf_strength; mxl111sf_attach_tuner()
937 static int mxl111sf_frontend_attach_dvbt(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_dvbt() argument
939 return mxl111sf_attach_demod(adap, 0); mxl111sf_frontend_attach_dvbt()
942 static int mxl111sf_frontend_attach_atsc(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_atsc() argument
944 return mxl111sf_lgdt3305_frontend_attach(adap, 0); mxl111sf_frontend_attach_atsc()
947 static int mxl111sf_frontend_attach_mh(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_mh() argument
949 return mxl111sf_lg2160_frontend_attach(adap, 0); mxl111sf_frontend_attach_mh()
952 static int mxl111sf_frontend_attach_atsc_mh(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_atsc_mh() argument
957 ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); mxl111sf_frontend_attach_atsc_mh()
961 ret = mxl111sf_attach_demod(adap, 1); mxl111sf_frontend_attach_atsc_mh()
965 ret = mxl111sf_lg2160_frontend_attach(adap, 2); mxl111sf_frontend_attach_atsc_mh()
972 static int mxl111sf_frontend_attach_mercury(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_mercury() argument
977 ret = mxl111sf_lgdt3305_frontend_attach(adap, 0); mxl111sf_frontend_attach_mercury()
981 ret = mxl111sf_attach_demod(adap, 1); mxl111sf_frontend_attach_mercury()
985 ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 2); mxl111sf_frontend_attach_mercury()
992 static int mxl111sf_frontend_attach_mercury_mh(struct dvb_usb_adapter *adap) mxl111sf_frontend_attach_mercury_mh() argument
997 ret = mxl111sf_attach_demod(adap, 0); mxl111sf_frontend_attach_mercury_mh()
1002 ret = mxl111sf_lg2161_frontend_attach(adap, 1); mxl111sf_frontend_attach_mercury_mh()
1004 ret = mxl111sf_lg2161_ep6_frontend_attach(adap, 1); mxl111sf_frontend_attach_mercury_mh()
H A Daf9015.c207 static int af9015_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], af9015_i2c_xfer() argument
210 struct dvb_usb_device *d = i2c_get_adapdata(adap); af9015_i2c_xfer()
612 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id); af9015_get_stream_config()
810 static int af9015_af9013_frontend_attach(struct dvb_usb_adapter *adap) af9015_af9013_frontend_attach() argument
813 struct af9015_state *state = adap_to_priv(adap); af9015_af9013_frontend_attach()
815 if (adap->id == 0) { af9015_af9013_frontend_attach()
820 } else if (adap->id == 1) { af9015_af9013_frontend_attach()
828 ret = af9015_copy_firmware(adap_to_d(adap)); af9015_af9013_frontend_attach()
830 dev_err(&adap_to_d(adap)->udev->dev, af9015_af9013_frontend_attach()
843 adap->fe[0] = dvb_attach(af9013_attach, af9015_af9013_frontend_attach()
844 &state->af9013_config[adap->id], &adap_to_d(adap)->i2c_adap); af9015_af9013_frontend_attach()
853 if (adap->fe[0]) { af9015_af9013_frontend_attach()
854 state->set_frontend[adap->id] = af9015_af9013_frontend_attach()
855 adap->fe[0]->ops.set_frontend; af9015_af9013_frontend_attach()
856 adap->fe[0]->ops.set_frontend = af9015_af9013_frontend_attach()
859 state->read_status[adap->id] = af9015_af9013_frontend_attach()
860 adap->fe[0]->ops.read_status; af9015_af9013_frontend_attach()
861 adap->fe[0]->ops.read_status = af9015_af9013_frontend_attach()
864 state->init[adap->id] = adap->fe[0]->ops.init; af9015_af9013_frontend_attach()
865 adap->fe[0]->ops.init = af9015_af9013_init; af9015_af9013_frontend_attach()
867 state->sleep[adap->id] = adap->fe[0]->ops.sleep; af9015_af9013_frontend_attach()
868 adap->fe[0]->ops.sleep = af9015_af9013_sleep; af9015_af9013_frontend_attach()
871 return adap->fe[0] == NULL ? -ENODEV : 0; af9015_af9013_frontend_attach()
929 .i2c_wr_max = 21, /* max wr bytes AF9015 I2C adap can handle at once */
937 static int af9015_tuner_attach(struct dvb_usb_adapter *adap) af9015_tuner_attach() argument
939 struct dvb_usb_device *d = adap_to_d(adap); af9015_tuner_attach()
944 switch (state->af9013_config[adap->id].tuner) { af9015_tuner_attach()
947 ret = dvb_attach(mt2060_attach, adap->fe[0], af9015_tuner_attach()
948 &adap_to_d(adap)->i2c_adap, &af9015_mt2060_config, af9015_tuner_attach()
949 state->mt2060_if1[adap->id]) af9015_tuner_attach()
954 ret = dvb_attach(qt1010_attach, adap->fe[0], af9015_tuner_attach()
955 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
959 ret = dvb_attach(tda18271_attach, adap->fe[0], 0xc0, af9015_tuner_attach()
960 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
964 ret = dvb_attach(tda18218_attach, adap->fe[0], af9015_tuner_attach()
965 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
969 ret = dvb_attach(mxl5005s_attach, adap->fe[0], af9015_tuner_attach()
970 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
975 ret = dvb_attach(mxl5005s_attach, adap->fe[0], af9015_tuner_attach()
976 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
980 ret = dvb_attach(dvb_pll_attach, adap->fe[0], 0xc0, af9015_tuner_attach()
981 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
985 ret = dvb_attach(mc44s803_attach, adap->fe[0], af9015_tuner_attach()
986 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
990 ret = dvb_attach(mxl5007t_attach, adap->fe[0], af9015_tuner_attach()
991 &adap_to_d(adap)->i2c_adap, af9015_tuner_attach()
998 state->af9013_config[adap->id].tuner); af9015_tuner_attach()
1002 if (adap->fe[0]->ops.tuner_ops.init) { af9015_tuner_attach()
1003 state->tuner_init[adap->id] = af9015_tuner_attach()
1004 adap->fe[0]->ops.tuner_ops.init; af9015_tuner_attach()
1005 adap->fe[0]->ops.tuner_ops.init = af9015_tuner_init; af9015_tuner_attach()
1008 if (adap->fe[0]->ops.tuner_ops.sleep) { af9015_tuner_attach()
1009 state->tuner_sleep[adap->id] = af9015_tuner_attach()
1010 adap->fe[0]->ops.tuner_ops.sleep; af9015_tuner_attach()
1011 adap->fe[0]->ops.tuner_ops.sleep = af9015_tuner_sleep; af9015_tuner_attach()
1017 static int af9015_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) af9015_pid_filter_ctrl() argument
1019 struct dvb_usb_device *d = adap_to_d(adap); af9015_pid_filter_ctrl()
1031 static int af9015_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, af9015_pid_filter() argument
1034 struct dvb_usb_device *d = adap_to_d(adap); af9015_pid_filter()
H A Dau6610.c96 static int au6610_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], au6610_i2c_xfer() argument
99 struct dvb_usb_device *d = i2c_get_adapdata(adap); au6610_i2c_xfer()
143 static int au6610_zl10353_frontend_attach(struct dvb_usb_adapter *adap) au6610_zl10353_frontend_attach() argument
145 adap->fe[0] = dvb_attach(zl10353_attach, &au6610_zl10353_config, au6610_zl10353_frontend_attach()
146 &adap_to_d(adap)->i2c_adap); au6610_zl10353_frontend_attach()
147 if (adap->fe[0] == NULL) au6610_zl10353_frontend_attach()
157 static int au6610_qt1010_tuner_attach(struct dvb_usb_adapter *adap) au6610_qt1010_tuner_attach() argument
159 return dvb_attach(qt1010_attach, adap->fe[0], au6610_qt1010_tuner_attach()
160 &adap_to_d(adap)->i2c_adap, au6610_qt1010_tuner_attach()
H A Danysee.c206 static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, anysee_master_xfer() argument
209 struct dvb_usb_device *d = i2c_get_adapdata(adap); anysee_master_xfer()
719 static int anysee_frontend_attach(struct dvb_usb_adapter *adap) anysee_frontend_attach() argument
721 struct anysee_state *state = adap_to_priv(adap); anysee_frontend_attach()
722 struct dvb_usb_device *d = adap_to_d(adap); anysee_frontend_attach()
744 adap->fe[0] = dvb_attach(mt352_attach, &anysee_mt352_config, anysee_frontend_attach()
746 if (adap->fe[0]) anysee_frontend_attach()
750 adap->fe[0] = dvb_attach(zl10353_attach, &anysee_zl10353_config, anysee_frontend_attach()
768 adap->fe[0] = dvb_attach(zl10353_attach, &anysee_zl10353_config, anysee_frontend_attach()
781 adap->fe[0] = dvb_attach(tda10023_attach, anysee_frontend_attach()
794 adap->fe[0] = dvb_attach(cx24116_attach, &anysee_cx24116_config, anysee_frontend_attach()
836 adap->fe[0] = dvb_attach(tda10023_attach, anysee_frontend_attach()
841 if (adap->fe[0]) anysee_frontend_attach()
842 adap->fe[0]->ops.i2c_gate_ctrl = anysee_frontend_attach()
846 adap->fe[0] = dvb_attach(tda10023_attach, anysee_frontend_attach()
852 if (!adap->fe[0]) anysee_frontend_attach()
868 adap->fe[1] = dvb_attach(zl10353_attach, anysee_frontend_attach()
873 if (adap->fe[1]) anysee_frontend_attach()
874 adap->fe[1]->ops.i2c_gate_ctrl = anysee_frontend_attach()
878 adap->fe[1] = dvb_attach(zl10353_attach, anysee_frontend_attach()
900 adap->fe[0] = dvb_attach(tda10023_attach, anysee_frontend_attach()
905 if (adap->fe[0]) anysee_frontend_attach()
906 adap->fe[0]->ops.i2c_gate_ctrl = anysee_i2c_gate_ctrl; anysee_frontend_attach()
909 if (!adap->fe[0]) anysee_frontend_attach()
923 adap->fe[1] = dvb_attach(zl10353_attach, anysee_frontend_attach()
928 if (adap->fe[1]) anysee_frontend_attach()
929 adap->fe[1]->ops.i2c_gate_ctrl = anysee_i2c_gate_ctrl; anysee_frontend_attach()
945 adap->fe[0] = dvb_attach(stv0900_attach, anysee_frontend_attach()
960 adap->fe[0] = dvb_attach(cxd2820r_attach, anysee_frontend_attach()
968 if (!adap->fe[0]) { anysee_frontend_attach()
979 static int anysee_tuner_attach(struct dvb_usb_adapter *adap) anysee_tuner_attach() argument
981 struct anysee_state *state = adap_to_priv(adap); anysee_tuner_attach()
982 struct dvb_usb_device *d = adap_to_d(adap); anysee_tuner_attach()
992 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc2 >> 1), NULL, anysee_tuner_attach()
1000 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc2 >> 1), anysee_tuner_attach()
1008 fe = dvb_attach(dvb_pll_attach, adap->fe[0], (0xc0 >> 1), anysee_tuner_attach()
1016 fe = dvb_attach(isl6423_attach, adap->fe[0], &d->i2c_adap, anysee_tuner_attach()
1032 tda18212_config.fe = adap->fe[0]; anysee_tuner_attach()
1039 if (adap->fe[1]) { anysee_tuner_attach()
1040 adap->fe[1]->tuner_priv = anysee_tuner_attach()
1041 adap->fe[0]->tuner_priv; anysee_tuner_attach()
1042 memcpy(&adap->fe[1]->ops.tuner_ops, anysee_tuner_attach()
1043 &adap->fe[0]->ops.tuner_ops, anysee_tuner_attach()
1050 fe = dvb_attach(dvb_pll_attach, adap->fe[0], anysee_tuner_attach()
1054 if (fe && adap->fe[1]) { anysee_tuner_attach()
1056 fe = dvb_attach(dvb_pll_attach, adap->fe[1], anysee_tuner_attach()
1070 tda18212_config.fe = adap->fe[0]; anysee_tuner_attach()
1076 if (adap->fe[1]) { anysee_tuner_attach()
1077 adap->fe[1]->tuner_priv = adap->fe[0]->tuner_priv; anysee_tuner_attach()
1078 memcpy(&adap->fe[1]->ops.tuner_ops, anysee_tuner_attach()
1079 &adap->fe[0]->ops.tuner_ops, anysee_tuner_attach()
1091 fe = dvb_attach(stv6110_attach, adap->fe[0], anysee_tuner_attach()
1096 fe = dvb_attach(isl6423_attach, adap->fe[0], anysee_tuner_attach()
1108 tda18212_config.fe = adap->fe[0]; anysee_tuner_attach()
H A Daf9035.c282 static int af9035_i2c_master_xfer(struct i2c_adapter *adap, af9035_i2c_master_xfer() argument
285 struct dvb_usb_device *d = i2c_get_adapdata(adap); af9035_i2c_master_xfer()
1103 struct i2c_adapter *adap = adapter_priv; af9035_frontend_callback() local
1104 struct dvb_usb_device *d = i2c_get_adapdata(adap); af9035_frontend_callback()
1126 static int af9035_frontend_attach(struct dvb_usb_adapter *adap) af9035_frontend_attach() argument
1128 struct state *state = adap_to_priv(adap); af9035_frontend_attach()
1129 struct dvb_usb_device *d = adap_to_d(adap); af9035_frontend_attach()
1132 dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); af9035_frontend_attach()
1134 if (!state->af9033_config[adap->id].tuner) { af9035_frontend_attach()
1140 state->af9033_config[adap->id].fe = &adap->fe[0]; af9035_frontend_attach()
1141 state->af9033_config[adap->id].ops = &state->ops; af9035_frontend_attach()
1142 ret = af9035_add_i2c_dev(d, "af9033", state->af9033_i2c_addr[adap->id], af9035_frontend_attach()
1143 &state->af9033_config[adap->id], &d->i2c_adap); af9035_frontend_attach()
1147 if (adap->fe[0] == NULL) { af9035_frontend_attach()
1153 adap->fe[0]->ops.i2c_gate_ctrl = NULL; af9035_frontend_attach()
1154 adap->fe[0]->callback = af9035_frontend_callback; af9035_frontend_attach()
1164 static int it930x_frontend_attach(struct dvb_usb_adapter *adap) it930x_frontend_attach() argument
1166 struct state *state = adap_to_priv(adap); it930x_frontend_attach()
1167 struct dvb_usb_device *d = adap_to_d(adap); it930x_frontend_attach()
1172 dev_dbg(&d->udev->dev, "adap->id=%d\n", adap->id); it930x_frontend_attach()
1176 si2168_config.fe = &adap->fe[0]; it930x_frontend_attach()
1179 state->af9033_config[adap->id].fe = &adap->fe[0]; it930x_frontend_attach()
1180 state->af9033_config[adap->id].ops = &state->ops; it930x_frontend_attach()
1186 if (adap->fe[0] == NULL) { it930x_frontend_attach()
1200 static int af9035_frontend_detach(struct dvb_usb_adapter *adap) af9035_frontend_detach() argument
1202 struct state *state = adap_to_priv(adap); af9035_frontend_detach()
1203 struct dvb_usb_device *d = adap_to_d(adap); af9035_frontend_detach()
1206 dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); af9035_frontend_detach()
1213 switch (state->af9033_config[adap->id].tuner) { af9035_frontend_detach()
1226 if (adap->id == 1) { af9035_frontend_detach()
1229 } else if (adap->id == 0) { af9035_frontend_detach()
1278 static int af9035_tuner_attach(struct dvb_usb_adapter *adap) af9035_tuner_attach() argument
1280 struct state *state = adap_to_priv(adap); af9035_tuner_attach()
1281 struct dvb_usb_device *d = adap_to_d(adap); af9035_tuner_attach()
1287 dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); af9035_tuner_attach()
1294 switch (state->af9033_config[adap->id].tuner) { af9035_tuner_attach()
1297 .dvb_frontend = adap->fe[0], af9035_tuner_attach()
1328 fe = adap->fe[0]; af9035_tuner_attach()
1332 fe = dvb_attach(fc0011_attach, adap->fe[0], af9035_tuner_attach()
1336 if (adap->id == 0) { af9035_tuner_attach()
1387 fe = dvb_attach(mxl5007t_attach, adap->fe[0], &d->i2c_adap, af9035_tuner_attach()
1388 tuner_addr, &af9035_mxl5007t_config[adap->id]); af9035_tuner_attach()
1392 fe = dvb_attach(tda18218_attach, adap->fe[0], af9035_tuner_attach()
1397 .dvb_frontend = adap->fe[0], af9035_tuner_attach()
1420 fe = adap->fe[0]; af9035_tuner_attach()
1430 if (adap->id == 0) { af9035_tuner_attach()
1460 fe = dvb_attach(fc0012_attach, adap->fe[0], &d->i2c_adap, af9035_tuner_attach()
1461 &af9035_fc0012_config[adap->id]); af9035_tuner_attach()
1468 .fe = adap->fe[0], af9035_tuner_attach()
1473 if (adap->id == 0) af9035_tuner_attach()
1480 state->af9033_i2c_addr[adap->id] >> 1, af9035_tuner_attach()
1485 fe = adap->fe[0]; af9035_tuner_attach()
1493 .fe = adap->fe[0], af9035_tuner_attach()
1498 if (adap->id == 0) af9035_tuner_attach()
1505 state->af9033_i2c_addr[adap->id] >> 1, af9035_tuner_attach()
1510 fe = adap->fe[0]; af9035_tuner_attach()
1530 static int it930x_tuner_attach(struct dvb_usb_adapter *adap) it930x_tuner_attach() argument
1532 struct state *state = adap_to_priv(adap); it930x_tuner_attach()
1533 struct dvb_usb_device *d = adap_to_d(adap); it930x_tuner_attach()
1537 dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); it930x_tuner_attach()
1582 si2157_config.fe = adap->fe[0]; it930x_tuner_attach()
1599 static int it930x_tuner_detach(struct dvb_usb_adapter *adap) it930x_tuner_detach() argument
1601 struct state *state = adap_to_priv(adap); it930x_tuner_detach()
1602 struct dvb_usb_device *d = adap_to_d(adap); it930x_tuner_detach()
1604 dev_dbg(&d->udev->dev, "adap->id=%d\n", adap->id); it930x_tuner_detach()
1606 if (adap->id == 1) { it930x_tuner_detach()
1609 } else if (adap->id == 0) { it930x_tuner_detach()
1618 static int af9035_tuner_detach(struct dvb_usb_adapter *adap) af9035_tuner_detach() argument
1620 struct state *state = adap_to_priv(adap); af9035_tuner_detach()
1621 struct dvb_usb_device *d = adap_to_d(adap); af9035_tuner_detach()
1623 dev_dbg(&d->udev->dev, "%s: adap->id=%d\n", __func__, adap->id); af9035_tuner_detach()
1625 switch (state->af9033_config[adap->id].tuner) { af9035_tuner_detach()
1634 if (adap->id == 1) { af9035_tuner_detach()
1637 } else if (adap->id == 0) { af9035_tuner_detach()
1871 dev_dbg(&d->udev->dev, "%s: adap=%d\n", __func__, fe_to_adap(fe)->id); af9035_get_stream_config()
1879 static int af9035_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) af9035_pid_filter_ctrl() argument
1881 struct state *state = adap_to_priv(adap); af9035_pid_filter_ctrl()
1883 return state->ops.pid_filter_ctrl(adap->fe[0], onoff); af9035_pid_filter_ctrl()
1886 static int af9035_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, af9035_pid_filter() argument
1889 struct state *state = adap_to_priv(adap); af9035_pid_filter()
1891 return state->ops.pid_filter(adap->fe[0], index, pid, onoff); af9035_pid_filter()
H A Drtl28xxu.c143 static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], rtl28xxu_i2c_xfer() argument
147 struct dvb_usb_device *d = i2c_get_adapdata(adap); rtl28xxu_i2c_xfer()
647 static int rtl2831u_frontend_attach(struct dvb_usb_adapter *adap) rtl2831u_frontend_attach() argument
649 struct dvb_usb_device *d = adap_to_d(adap); rtl2831u_frontend_attach()
692 adap->fe[0] = pdata->get_dvb_frontend(client); rtl2831u_frontend_attach()
855 static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) rtl2832u_frontend_attach() argument
857 struct dvb_usb_device *d = adap_to_d(adap); rtl2832u_frontend_attach()
913 adap->fe[0] = pdata->get_dvb_frontend(client); rtl2832u_frontend_attach()
919 adap->fe[0]->callback = rtl2832u_frontend_callback; rtl2832u_frontend_attach()
934 mn88472_config.fe = &adap->fe[1]; rtl2832u_frontend_attach()
959 mn88473_config.fe = &adap->fe[1]; rtl2832u_frontend_attach()
983 si2168_config.fe = &adap->fe[1]; rtl2832u_frontend_attach()
1016 static int rtl28xxu_frontend_attach(struct dvb_usb_adapter *adap) rtl28xxu_frontend_attach() argument
1018 struct rtl28xxu_dev *dev = adap_to_priv(adap); rtl28xxu_frontend_attach()
1021 return rtl2831u_frontend_attach(adap); rtl28xxu_frontend_attach()
1023 return rtl2832u_frontend_attach(adap); rtl28xxu_frontend_attach()
1026 static int rtl28xxu_frontend_detach(struct dvb_usb_adapter *adap) rtl28xxu_frontend_detach() argument
1028 struct dvb_usb_device *d = adap_to_d(adap); rtl28xxu_frontend_detach()
1077 static int rtl2831u_tuner_attach(struct dvb_usb_adapter *adap) rtl2831u_tuner_attach() argument
1080 struct dvb_usb_device *d = adap_to_d(adap); rtl2831u_tuner_attach()
1088 fe = dvb_attach(qt1010_attach, adap->fe[0], rtl2831u_tuner_attach()
1093 fe = dvb_attach(mt2060_attach, adap->fe[0], rtl2831u_tuner_attach()
1098 fe = dvb_attach(mxl5005s_attach, adap->fe[0], rtl2831u_tuner_attach()
1137 static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap) rtl2832u_tuner_attach() argument
1140 struct dvb_usb_device *d = adap_to_d(adap); rtl2832u_tuner_attach()
1156 fe = dvb_attach(fc0012_attach, adap->fe[0], rtl2832u_tuner_attach()
1161 adap->fe[0]->ops.read_signal_strength = rtl2832u_tuner_attach()
1162 adap->fe[0]->ops.tuner_ops.get_rf_strength; rtl2832u_tuner_attach()
1165 fe = dvb_attach(fc0013_attach, adap->fe[0], rtl2832u_tuner_attach()
1169 adap->fe[0]->ops.read_signal_strength = rtl2832u_tuner_attach()
1170 adap->fe[0]->ops.tuner_ops.get_rf_strength; rtl2832u_tuner_attach()
1174 .fe = adap->fe[0], rtl2832u_tuner_attach()
1198 .dvb_frontend = adap->fe[0], rtl2832u_tuner_attach()
1220 .dvb_frontend = adap->fe[0], rtl2832u_tuner_attach()
1248 fe = dvb_attach(r820t_attach, adap->fe[0], rtl2832u_tuner_attach()
1253 adap->fe[0]->ops.read_signal_strength = rtl2832u_tuner_attach()
1254 adap->fe[0]->ops.tuner_ops.get_rf_strength; rtl2832u_tuner_attach()
1257 fe = dvb_attach(r820t_attach, adap->fe[0], rtl2832u_tuner_attach()
1260 adap->fe[0]->ops.read_signal_strength = rtl2832u_tuner_attach()
1261 adap->fe[0]->ops.tuner_ops.get_rf_strength; rtl2832u_tuner_attach()
1263 if (adap->fe[1]) { rtl2832u_tuner_attach()
1264 fe = dvb_attach(r820t_attach, adap->fe[1], rtl2832u_tuner_attach()
1267 adap->fe[1]->ops.read_signal_strength = rtl2832u_tuner_attach()
1268 adap->fe[1]->ops.tuner_ops.get_rf_strength; rtl2832u_tuner_attach()
1273 .fe = adap->fe[0], rtl2832u_tuner_attach()
1295 if (adap->fe[1]) { rtl2832u_tuner_attach()
1296 adap->fe[1]->tuner_priv = rtl2832u_tuner_attach()
1297 adap->fe[0]->tuner_priv; rtl2832u_tuner_attach()
1298 memcpy(&adap->fe[1]->ops.tuner_ops, rtl2832u_tuner_attach()
1299 &adap->fe[0]->ops.tuner_ops, rtl2832u_tuner_attach()
1326 pdata.dvb_frontend = adap->fe[0]; rtl2832u_tuner_attach()
1349 static int rtl28xxu_tuner_attach(struct dvb_usb_adapter *adap) rtl28xxu_tuner_attach() argument
1351 struct rtl28xxu_dev *dev = adap_to_priv(adap); rtl28xxu_tuner_attach()
1354 return rtl2831u_tuner_attach(adap); rtl28xxu_tuner_attach()
1356 return rtl2832u_tuner_attach(adap); rtl28xxu_tuner_attach()
1359 static int rtl28xxu_tuner_detach(struct dvb_usb_adapter *adap) rtl28xxu_tuner_detach() argument
1361 struct dvb_usb_device *d = adap_to_d(adap); rtl28xxu_tuner_detach()
1787 static int rtl28xxu_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff) rtl28xxu_pid_filter_ctrl() argument
1789 struct rtl28xxu_dev *dev = adap_to_priv(adap); rtl28xxu_pid_filter_ctrl()
1794 return pdata->pid_filter_ctrl(adap->fe[0], onoff); rtl28xxu_pid_filter_ctrl()
1798 return pdata->pid_filter_ctrl(adap->fe[0], onoff); rtl28xxu_pid_filter_ctrl()
1802 static int rtl28xxu_pid_filter(struct dvb_usb_adapter *adap, int index, rtl28xxu_pid_filter() argument
1805 struct rtl28xxu_dev *dev = adap_to_priv(adap); rtl28xxu_pid_filter()
1810 return pdata->pid_filter(adap->fe[0], index, pid, onoff); rtl28xxu_pid_filter()
1814 return pdata->pid_filter(adap->fe[0], index, pid, onoff); rtl28xxu_pid_filter()
H A Dce6230.c99 static int ce6230_i2c_master_xfer(struct i2c_adapter *adap, ce6230_i2c_master_xfer() argument
102 struct dvb_usb_device *d = i2c_get_adapdata(adap); ce6230_i2c_master_xfer()
179 static int ce6230_zl10353_frontend_attach(struct dvb_usb_adapter *adap) ce6230_zl10353_frontend_attach() argument
181 struct dvb_usb_device *d = adap_to_d(adap); ce6230_zl10353_frontend_attach()
185 adap->fe[0] = dvb_attach(zl10353_attach, &ce6230_zl10353_config, ce6230_zl10353_frontend_attach()
187 if (adap->fe[0] == NULL) ce6230_zl10353_frontend_attach()
210 static int ce6230_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) ce6230_mxl5003s_tuner_attach() argument
212 struct dvb_usb_device *d = adap_to_d(adap); ce6230_mxl5003s_tuner_attach()
217 ret = dvb_attach(mxl5005s_attach, adap->fe[0], &d->i2c_adap, ce6230_mxl5003s_tuner_attach()
H A Dec168.c115 static int ec168_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], ec168_i2c_xfer() argument
118 struct dvb_usb_device *d = i2c_get_adapdata(adap); ec168_i2c_xfer()
273 static int ec168_ec100_frontend_attach(struct dvb_usb_adapter *adap) ec168_ec100_frontend_attach() argument
275 struct dvb_usb_device *d = adap_to_d(adap); ec168_ec100_frontend_attach()
278 adap->fe[0] = dvb_attach(ec100_attach, &ec168_ec100_config, ec168_ec100_frontend_attach()
280 if (adap->fe[0] == NULL) ec168_ec100_frontend_attach()
303 static int ec168_mxl5003s_tuner_attach(struct dvb_usb_adapter *adap) ec168_mxl5003s_tuner_attach() argument
305 struct dvb_usb_device *d = adap_to_d(adap); ec168_mxl5003s_tuner_attach()
308 return dvb_attach(mxl5005s_attach, adap->fe[0], &d->i2c_adap, ec168_mxl5003s_tuner_attach()
H A Dmxl111sf-i2c.h26 int mxl111sf_i2c_xfer(struct i2c_adapter *adap,
H A Ddvb_usb.h52 * adap = pointer to adapter (struct dvb_usb_adapter *)
59 #define adap_to_d(adap) (container_of(adap, struct dvb_usb_device, \
60 adapter[adap->id]))
61 #define adap_to_priv(adap) (adap_to_d(adap)->priv)
/linux-4.4.14/drivers/media/usb/as102/
H A Das10x_cmd_stream.c22 * @adap: pointer to AS10x bus adapter
27 int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap, as10x_cmd_add_PID_filter() argument
33 pcmd = adap->cmd; as10x_cmd_add_PID_filter()
34 prsp = adap->rsp; as10x_cmd_add_PID_filter()
37 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_add_PID_filter()
52 if (adap->ops->xfer_cmd) { as10x_cmd_add_PID_filter()
53 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_add_PID_filter()
79 * @adap: pointer to AS10x bus adapte
84 int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap, as10x_cmd_del_PID_filter() argument
90 pcmd = adap->cmd; as10x_cmd_del_PID_filter()
91 prsp = adap->rsp; as10x_cmd_del_PID_filter()
94 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_del_PID_filter()
103 if (adap->ops->xfer_cmd) { as10x_cmd_del_PID_filter()
104 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_del_PID_filter()
125 * @adap: pointer to AS10x bus adapter
129 int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap) as10x_cmd_start_streaming() argument
134 pcmd = adap->cmd; as10x_cmd_start_streaming()
135 prsp = adap->rsp; as10x_cmd_start_streaming()
138 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_start_streaming()
146 if (adap->ops->xfer_cmd) { as10x_cmd_start_streaming()
147 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_start_streaming()
168 * @adap: pointer to AS10x bus adapter
172 int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap) as10x_cmd_stop_streaming() argument
177 pcmd = adap->cmd; as10x_cmd_stop_streaming()
178 prsp = adap->rsp; as10x_cmd_stop_streaming()
181 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_stop_streaming()
189 if (adap->ops->xfer_cmd) { as10x_cmd_stop_streaming()
190 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_stop_streaming()
H A Das10x_cmd.c23 * @adap: pointer to AS10x bus adapter
27 int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap) as10x_cmd_turn_on() argument
32 pcmd = adap->cmd; as10x_cmd_turn_on()
33 prsp = adap->rsp; as10x_cmd_turn_on()
36 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_turn_on()
43 if (adap->ops->xfer_cmd) { as10x_cmd_turn_on()
44 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_turn_on()
64 * @adap: pointer to AS10x bus adapter
68 int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap) as10x_cmd_turn_off() argument
73 pcmd = adap->cmd; as10x_cmd_turn_off()
74 prsp = adap->rsp; as10x_cmd_turn_off()
77 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_turn_off()
84 if (adap->ops->xfer_cmd) { as10x_cmd_turn_off()
85 error = adap->ops->xfer_cmd( as10x_cmd_turn_off()
86 adap, (uint8_t *) pcmd, as10x_cmd_turn_off()
104 * @adap: pointer to AS10x bus adapter
109 int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap, as10x_cmd_set_tune() argument
115 preq = adap->cmd; as10x_cmd_set_tune()
116 prsp = adap->rsp; as10x_cmd_set_tune()
119 as10x_cmd_build(preq, (++adap->cmd_xid), as10x_cmd_set_tune()
137 if (adap->ops->xfer_cmd) { as10x_cmd_set_tune()
138 error = adap->ops->xfer_cmd(adap, as10x_cmd_set_tune()
159 * @adap: pointer to AS10x bus adapter
164 int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap, as10x_cmd_get_tune_status() argument
170 preq = adap->cmd; as10x_cmd_get_tune_status()
171 prsp = adap->rsp; as10x_cmd_get_tune_status()
174 as10x_cmd_build(preq, (++adap->cmd_xid), as10x_cmd_get_tune_status()
182 if (adap->ops->xfer_cmd) { as10x_cmd_get_tune_status()
183 error = adap->ops->xfer_cmd( as10x_cmd_get_tune_status()
184 adap, as10x_cmd_get_tune_status()
212 * @adap: pointer to AS10x handle
217 int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap, struct as10x_tps *ptps) as10x_cmd_get_tps() argument
222 pcmd = adap->cmd; as10x_cmd_get_tps()
223 prsp = adap->rsp; as10x_cmd_get_tps()
226 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_get_tps()
234 if (adap->ops->xfer_cmd) { as10x_cmd_get_tps()
235 error = adap->ops->xfer_cmd(adap, as10x_cmd_get_tps()
270 * @adap: pointer to AS10x bus adapter
275 int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap, as10x_cmd_get_demod_stats() argument
281 pcmd = adap->cmd; as10x_cmd_get_demod_stats()
282 prsp = adap->rsp; as10x_cmd_get_demod_stats()
285 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_get_demod_stats()
293 if (adap->ops->xfer_cmd) { as10x_cmd_get_demod_stats()
294 error = adap->ops->xfer_cmd(adap, as10x_cmd_get_demod_stats()
329 * @adap: pointer to AS10x bus adapter
335 int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap, as10x_cmd_get_impulse_resp() argument
341 pcmd = adap->cmd; as10x_cmd_get_impulse_resp()
342 prsp = adap->rsp; as10x_cmd_get_impulse_resp()
345 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_get_impulse_resp()
353 if (adap->ops->xfer_cmd) { as10x_cmd_get_impulse_resp()
354 error = adap->ops->xfer_cmd(adap, as10x_cmd_get_impulse_resp()
H A Das10x_cmd_cfg.c26 * @adap: pointer to AS10x bus adapter
32 int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap, uint16_t tag, as10x_cmd_get_context() argument
38 pcmd = adap->cmd; as10x_cmd_get_context()
39 prsp = adap->rsp; as10x_cmd_get_context()
42 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_get_context()
51 if (adap->ops->xfer_cmd) { as10x_cmd_get_context()
52 error = adap->ops->xfer_cmd(adap, as10x_cmd_get_context()
82 * @adap: pointer to AS10x bus adapter
88 int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap, uint16_t tag, as10x_cmd_set_context() argument
94 pcmd = adap->cmd; as10x_cmd_set_context()
95 prsp = adap->rsp; as10x_cmd_set_context()
98 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_set_context()
109 if (adap->ops->xfer_cmd) { as10x_cmd_set_context()
110 error = adap->ops->xfer_cmd(adap, as10x_cmd_set_context()
134 * @adap: pointer to AS10x bus adapter
143 int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode) as10x_cmd_eLNA_change_mode() argument
148 pcmd = adap->cmd; as10x_cmd_eLNA_change_mode()
149 prsp = adap->rsp; as10x_cmd_eLNA_change_mode()
152 as10x_cmd_build(pcmd, (++adap->cmd_xid), as10x_cmd_eLNA_change_mode()
161 if (adap->ops->xfer_cmd) { as10x_cmd_eLNA_change_mode()
162 error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd, as10x_cmd_eLNA_change_mode()
H A Das10x_cmd.h486 int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
487 int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
489 int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
492 int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
495 int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
498 int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
501 int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
505 int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
507 int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
510 int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
511 int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
514 int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
517 int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
521 int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
/linux-4.4.14/drivers/i2c/busses/
H A Di2c-au1550.c50 struct i2c_adapter adap; member in struct:i2c_au1550_data
64 static int wait_xfer_done(struct i2c_au1550_data *adap) wait_xfer_done() argument
69 for (i = 0; i < adap->xfer_timeout; i++) { wait_xfer_done()
70 if (RD(adap, PSC_SMBSTAT) & PSC_SMBSTAT_TE) wait_xfer_done()
79 static int wait_ack(struct i2c_au1550_data *adap) wait_ack() argument
83 if (wait_xfer_done(adap)) wait_ack()
86 stat = RD(adap, PSC_SMBEVNT); wait_ack()
93 static int wait_master_done(struct i2c_au1550_data *adap) wait_master_done() argument
98 for (i = 0; i < 2 * adap->xfer_timeout; i++) { wait_master_done()
99 if ((RD(adap, PSC_SMBEVNT) & PSC_SMBEVNT_MD) != 0) wait_master_done()
108 do_address(struct i2c_au1550_data *adap, unsigned int addr, int rd, int q) do_address() argument
113 stat = RD(adap, PSC_SMBSTAT); do_address()
114 WR(adap, PSC_SMBEVNT, PSC_SMBEVNT_ALLCLR); do_address()
117 WR(adap, PSC_SMBPCR, PSC_SMBPCR_DC); do_address()
118 while ((RD(adap, PSC_SMBPCR) & PSC_SMBPCR_DC) != 0) do_address()
133 WR(adap, PSC_SMBTXRX, addr); do_address()
134 WR(adap, PSC_SMBPCR, PSC_SMBPCR_MS); do_address()
135 if (wait_ack(adap)) do_address()
137 return (q) ? wait_master_done(adap) : 0; do_address()
140 static int wait_for_rx_byte(struct i2c_au1550_data *adap, unsigned char *out) wait_for_rx_byte() argument
144 if (wait_xfer_done(adap)) wait_for_rx_byte()
147 j = adap->xfer_timeout * 100; wait_for_rx_byte()
153 if ((RD(adap, PSC_SMBSTAT) & PSC_SMBSTAT_RE) == 0) wait_for_rx_byte()
159 *out = RD(adap, PSC_SMBTXRX); wait_for_rx_byte()
164 static int i2c_read(struct i2c_au1550_data *adap, unsigned char *buf, i2c_read() argument
178 WR(adap, PSC_SMBTXRX, 0); i2c_read()
179 if (wait_for_rx_byte(adap, &buf[i])) i2c_read()
186 WR(adap, PSC_SMBTXRX, PSC_SMBTXRX_STP); i2c_read()
187 if (wait_master_done(adap)) i2c_read()
190 buf[i] = (unsigned char)(RD(adap, PSC_SMBTXRX) & 0xff); i2c_read()
194 static int i2c_write(struct i2c_au1550_data *adap, unsigned char *buf, i2c_write() argument
206 WR(adap, PSC_SMBTXRX, data); i2c_write()
207 if (wait_ack(adap)) i2c_write()
215 WR(adap, PSC_SMBTXRX, data); i2c_write()
216 if (wait_master_done(adap)) i2c_write()
224 struct i2c_au1550_data *adap = i2c_adap->algo_data; au1550_xfer() local
228 WR(adap, PSC_CTRL, PSC_CTRL_ENABLE); au1550_xfer()
232 err = do_address(adap, p->addr, p->flags & I2C_M_RD, au1550_xfer()
237 err = i2c_read(adap, p->buf, p->len); au1550_xfer()
239 err = i2c_write(adap, p->buf, p->len); au1550_xfer()
247 WR(adap, PSC_CTRL, PSC_CTRL_SUSPEND); au1550_xfer()
252 static u32 au1550_func(struct i2c_adapter *adap) au1550_func() argument
329 priv->adap.nr = pdev->id; i2c_au1550_probe()
330 priv->adap.algo = &au1550_algo; i2c_au1550_probe()
331 priv->adap.algo_data = priv; i2c_au1550_probe()
332 priv->adap.dev.parent = &pdev->dev; i2c_au1550_probe()
333 strlcpy(priv->adap.name, "Au1xxx PSC I2C", sizeof(priv->adap.name)); i2c_au1550_probe()
338 ret = i2c_add_numbered_adapter(&priv->adap); i2c_au1550_probe()
352 i2c_del_adapter(&priv->adap); i2c_au1550_remove()
H A Di2c-eg20t.c119 #define pch_dbg(adap, fmt, arg...) \
120 dev_dbg(adap->pch_adapter.dev.parent, "%s :" fmt, __func__, ##arg)
122 #define pch_err(adap, fmt, arg...) \
123 dev_err(adap->pch_adapter.dev.parent, "%s :" fmt, __func__, ##arg)
213 * @adap: Pointer to struct i2c_algo_pch_data.
215 static void pch_i2c_init(struct i2c_algo_pch_data *adap) pch_i2c_init() argument
217 void __iomem *p = adap->pch_base_address; pch_i2c_init()
230 pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_I2CCTL_I2CMEN); pch_i2c_init()
238 pch_dbg(adap, "Fast mode enabled\n"); pch_i2c_init()
254 pch_dbg(adap, pch_i2c_init()
263 * @adap: Pointer to struct i2c_algo_pch_data.
266 static s32 pch_i2c_wait_for_bus_idle(struct i2c_algo_pch_data *adap, pch_i2c_wait_for_bus_idle() argument
269 void __iomem *p = adap->pch_base_address; pch_i2c_wait_for_bus_idle()
275 pch_dbg(adap, "I2CSR = %x\n", ioread32(p + PCH_I2CSR)); pch_i2c_wait_for_bus_idle()
276 pch_err(adap, "%s: Timeout Error.return%d\n", pch_i2c_wait_for_bus_idle()
278 pch_i2c_init(adap); pch_i2c_wait_for_bus_idle()
298 * @adap: Pointer to struct i2c_algo_pch_data.
302 static void pch_i2c_start(struct i2c_algo_pch_data *adap) pch_i2c_start() argument
304 void __iomem *p = adap->pch_base_address; pch_i2c_start()
305 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_start()
306 pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_START); pch_i2c_start()
311 * @adap: Pointer to struct i2c_algo_pch_data.
313 static void pch_i2c_stop(struct i2c_algo_pch_data *adap) pch_i2c_stop() argument
315 void __iomem *p = adap->pch_base_address; pch_i2c_stop()
316 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_stop()
318 pch_clrbit(adap->pch_base_address, PCH_I2CCTL, PCH_START); pch_i2c_stop()
321 static int pch_i2c_wait_for_check_xfer(struct i2c_algo_pch_data *adap) pch_i2c_wait_for_check_xfer() argument
324 void __iomem *p = adap->pch_base_address; pch_i2c_wait_for_check_xfer()
327 (adap->pch_event_flag != 0), msecs_to_jiffies(1000)); pch_i2c_wait_for_check_xfer()
329 pch_err(adap, "%s:wait-event timeout\n", __func__); pch_i2c_wait_for_check_xfer()
330 adap->pch_event_flag = 0; pch_i2c_wait_for_check_xfer()
331 pch_i2c_stop(adap); pch_i2c_wait_for_check_xfer()
332 pch_i2c_init(adap); pch_i2c_wait_for_check_xfer()
336 if (adap->pch_event_flag & I2C_ERROR_MASK) { pch_i2c_wait_for_check_xfer()
337 pch_err(adap, "Lost Arbitration\n"); pch_i2c_wait_for_check_xfer()
338 adap->pch_event_flag = 0; pch_i2c_wait_for_check_xfer()
339 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMAL_BIT); pch_i2c_wait_for_check_xfer()
340 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT); pch_i2c_wait_for_check_xfer()
341 pch_i2c_init(adap); pch_i2c_wait_for_check_xfer()
345 adap->pch_event_flag = 0; pch_i2c_wait_for_check_xfer()
348 pch_dbg(adap, "Receive NACK for slave address setting\n"); pch_i2c_wait_for_check_xfer()
357 * @adap: Pointer to struct i2c_algo_pch_data.
359 static void pch_i2c_repstart(struct i2c_algo_pch_data *adap) pch_i2c_repstart() argument
361 void __iomem *p = adap->pch_base_address; pch_i2c_repstart()
362 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_repstart()
363 pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_REPSTART); pch_i2c_repstart()
378 struct i2c_algo_pch_data *adap = i2c_adap->algo_data; pch_i2c_writebytes() local
386 void __iomem *p = adap->pch_base_address; pch_i2c_writebytes()
393 pch_setbit(adap->pch_base_address, PCH_I2CCTL, I2C_TX_MODE); pch_i2c_writebytes()
395 pch_dbg(adap, "I2CCTL = %x msgs->len = %d\n", ioread32(p + PCH_I2CCTL), pch_i2c_writebytes()
399 if (pch_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) == -ETIME) pch_i2c_writebytes()
407 pch_i2c_start(adap); pch_i2c_writebytes()
409 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_writebytes()
419 pch_i2c_start(adap); pch_i2c_writebytes()
422 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_writebytes()
429 pch_dbg(adap, "writing %x to Data register\n", buf[wrcount]); pch_i2c_writebytes()
431 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_writebytes()
435 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMCF_BIT); pch_i2c_writebytes()
436 pch_clrbit(adap->pch_base_address, PCH_I2CSR, I2CMIF_BIT); pch_i2c_writebytes()
441 pch_i2c_stop(adap); pch_i2c_writebytes()
443 pch_i2c_repstart(adap); pch_i2c_writebytes()
445 pch_dbg(adap, "return=%d\n", wrcount); pch_i2c_writebytes()
452 * @adap: Pointer to struct i2c_algo_pch_data.
454 static void pch_i2c_sendack(struct i2c_algo_pch_data *adap) pch_i2c_sendack() argument
456 void __iomem *p = adap->pch_base_address; pch_i2c_sendack()
457 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_sendack()
458 pch_clrbit(adap->pch_base_address, PCH_I2CCTL, PCH_ACK); pch_i2c_sendack()
463 * @adap: Pointer to struct i2c_algo_pch_data.
465 static void pch_i2c_sendnack(struct i2c_algo_pch_data *adap) pch_i2c_sendnack() argument
467 void __iomem *p = adap->pch_base_address; pch_i2c_sendnack()
468 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_sendnack()
469 pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_ACK); pch_i2c_sendnack()
474 * @adap: Pointer to struct i2c_algo_pch_data.
478 static void pch_i2c_restart(struct i2c_algo_pch_data *adap) pch_i2c_restart() argument
480 void __iomem *p = adap->pch_base_address; pch_i2c_restart()
481 pch_dbg(adap, "I2CCTL = %x\n", ioread32(p + PCH_I2CCTL)); pch_i2c_restart()
482 pch_setbit(adap->pch_base_address, PCH_I2CCTL, PCH_RESTART); pch_i2c_restart()
495 struct i2c_algo_pch_data *adap = i2c_adap->algo_data; pch_i2c_readbytes() local
503 void __iomem *p = adap->pch_base_address; pch_i2c_readbytes()
511 pch_clrbit(adap->pch_base_address, PCH_I2CCTL, I2C_TX_MODE); pch_i2c_readbytes()
514 if (pch_i2c_wait_for_bus_idle(adap, BUS_IDLE_TIMEOUT) == -ETIME) pch_i2c_readbytes()
522 pch_i2c_start(adap); pch_i2c_readbytes()
524 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_readbytes()
531 pch_i2c_restart(adap); pch_i2c_readbytes()
533 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_readbytes()
547 pch_i2c_start(adap); pch_i2c_readbytes()
549 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_readbytes()
554 pch_i2c_stop(adap); pch_i2c_readbytes()
561 pch_i2c_sendack(adap); pch_i2c_readbytes()
570 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_readbytes()
575 pch_i2c_sendnack(adap); pch_i2c_readbytes()
582 rtn = pch_i2c_wait_for_check_xfer(adap); pch_i2c_readbytes()
587 pch_i2c_stop(adap); pch_i2c_readbytes()
589 pch_i2c_repstart(adap); pch_i2c_readbytes()
600 * @adap: Pointer to struct i2c_algo_pch_data.
602 static void pch_i2c_cb(struct i2c_algo_pch_data *adap) pch_i2c_cb() argument
605 void __iomem *p = adap->pch_base_address; pch_i2c_cb()
610 adap->pch_event_flag |= I2CMAL_EVENT; pch_i2c_cb()
613 adap->pch_event_flag |= I2CMCF_EVENT; pch_i2c_cb()
616 pch_clrbit(adap->pch_base_address, PCH_I2CSR, sts); pch_i2c_cb()
618 pch_dbg(adap, "PCH_I2CSR = %x\n", ioread32(p + PCH_I2CSR)); pch_i2c_cb()
670 struct i2c_algo_pch_data *adap = i2c_adap->algo_data; pch_i2c_xfer() local
676 if (adap->p_adapter_info->pch_i2c_suspended) { pch_i2c_xfer()
681 pch_dbg(adap, "adap->p_adapter_info->pch_i2c_suspended is %d\n", pch_i2c_xfer()
682 adap->p_adapter_info->pch_i2c_suspended); pch_i2c_xfer()
684 adap->pch_i2c_xfer_in_progress = true; pch_i2c_xfer()
688 pmsg->flags |= adap->pch_buff_mode_en; pch_i2c_xfer()
690 pch_dbg(adap, pch_i2c_xfer()
702 adap->pch_i2c_xfer_in_progress = false; /* transfer completed */ pch_i2c_xfer()
711 * @adap: Pointer to struct i2c_algo_pch_data.
713 static u32 pch_i2c_func(struct i2c_adapter *adap) pch_i2c_func() argument
725 * @adap: Pointer to struct i2c_algo_pch_data.
727 static void pch_i2c_disbl_int(struct i2c_algo_pch_data *adap) pch_i2c_disbl_int() argument
729 void __iomem *p = adap->pch_base_address; pch_i2c_disbl_int()
731 pch_clrbit(adap->pch_base_address, PCH_I2CCTL, NORMAL_INTR_ENBL); pch_i2c_disbl_int()
H A Di2c-uniphier.c52 struct i2c_adapter adap; member in struct:uniphier_i2c_priv
72 static int uniphier_i2c_xfer_byte(struct i2c_adapter *adap, u32 txdata, uniphier_i2c_xfer_byte() argument
75 struct uniphier_i2c_priv *priv = i2c_get_adapdata(adap); uniphier_i2c_xfer_byte()
82 dev_dbg(&adap->dev, "write data: 0x%04x\n", txdata); uniphier_i2c_xfer_byte()
85 time_left = wait_for_completion_timeout(&priv->comp, adap->timeout); uniphier_i2c_xfer_byte()
87 dev_err(&adap->dev, "transaction timeout\n"); uniphier_i2c_xfer_byte()
92 dev_dbg(&adap->dev, "read data: 0x%04x\n", rxdata); uniphier_i2c_xfer_byte()
100 static int uniphier_i2c_send_byte(struct i2c_adapter *adap, u32 txdata) uniphier_i2c_send_byte() argument
105 ret = uniphier_i2c_xfer_byte(adap, txdata, &rxdata); uniphier_i2c_send_byte()
110 dev_dbg(&adap->dev, "arbitration lost\n"); uniphier_i2c_send_byte()
114 dev_dbg(&adap->dev, "could not get ACK\n"); uniphier_i2c_send_byte()
121 static int uniphier_i2c_tx(struct i2c_adapter *adap, u16 addr, u16 len, uniphier_i2c_tx() argument
126 dev_dbg(&adap->dev, "start condition\n"); uniphier_i2c_tx()
127 ret = uniphier_i2c_send_byte(adap, addr << 1 | uniphier_i2c_tx()
134 ret = uniphier_i2c_send_byte(adap, uniphier_i2c_tx()
143 static int uniphier_i2c_rx(struct i2c_adapter *adap, u16 addr, u16 len, uniphier_i2c_rx() argument
148 dev_dbg(&adap->dev, "start condition\n"); uniphier_i2c_rx()
149 ret = uniphier_i2c_send_byte(adap, addr << 1 | uniphier_i2c_rx()
159 ret = uniphier_i2c_xfer_byte(adap, uniphier_i2c_rx()
170 static int uniphier_i2c_stop(struct i2c_adapter *adap) uniphier_i2c_stop() argument
172 dev_dbg(&adap->dev, "stop condition\n"); uniphier_i2c_stop()
173 return uniphier_i2c_send_byte(adap, UNIPHIER_I2C_DTRM_STO | uniphier_i2c_stop()
177 static int uniphier_i2c_master_xfer_one(struct i2c_adapter *adap, uniphier_i2c_master_xfer_one() argument
184 dev_dbg(&adap->dev, "%s: addr=0x%02x, len=%d, stop=%d\n", uniphier_i2c_master_xfer_one()
188 ret = uniphier_i2c_rx(adap, msg->addr, msg->len, msg->buf); uniphier_i2c_master_xfer_one()
190 ret = uniphier_i2c_tx(adap, msg->addr, msg->len, msg->buf); uniphier_i2c_master_xfer_one()
202 int ret2 = uniphier_i2c_stop(adap); uniphier_i2c_master_xfer_one()
212 i2c_recover_bus(adap); uniphier_i2c_master_xfer_one()
217 static int uniphier_i2c_check_bus_busy(struct i2c_adapter *adap) uniphier_i2c_check_bus_busy() argument
219 struct uniphier_i2c_priv *priv = i2c_get_adapdata(adap); uniphier_i2c_check_bus_busy()
228 i2c_recover_bus(adap); uniphier_i2c_check_bus_busy()
239 static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, uniphier_i2c_master_xfer() argument
245 ret = uniphier_i2c_check_bus_busy(adap); uniphier_i2c_master_xfer()
256 ret = uniphier_i2c_master_xfer_one(adap, msg, stop); uniphier_i2c_master_xfer()
264 static u32 uniphier_i2c_functionality(struct i2c_adapter *adap) uniphier_i2c_functionality() argument
282 static int uniphier_i2c_get_scl(struct i2c_adapter *adap) uniphier_i2c_get_scl() argument
284 struct uniphier_i2c_priv *priv = i2c_get_adapdata(adap); uniphier_i2c_get_scl()
290 static void uniphier_i2c_set_scl(struct i2c_adapter *adap, int val) uniphier_i2c_set_scl() argument
292 struct uniphier_i2c_priv *priv = i2c_get_adapdata(adap); uniphier_i2c_set_scl()
298 static int uniphier_i2c_get_sda(struct i2c_adapter *adap) uniphier_i2c_get_sda() argument
300 struct uniphier_i2c_priv *priv = i2c_get_adapdata(adap); uniphier_i2c_get_sda()
306 static void uniphier_i2c_unprepare_recovery(struct i2c_adapter *adap) uniphier_i2c_unprepare_recovery() argument
308 uniphier_i2c_reset(i2c_get_adapdata(adap), false); uniphier_i2c_unprepare_recovery()
380 priv->adap.owner = THIS_MODULE; uniphier_i2c_probe()
381 priv->adap.algo = &uniphier_i2c_algo; uniphier_i2c_probe()
382 priv->adap.dev.parent = dev; uniphier_i2c_probe()
383 priv->adap.dev.of_node = dev->of_node; uniphier_i2c_probe()
384 strlcpy(priv->adap.name, "UniPhier I2C", sizeof(priv->adap.name)); uniphier_i2c_probe()
385 priv->adap.bus_recovery_info = &uniphier_i2c_bus_recovery_info; uniphier_i2c_probe()
386 i2c_set_adapdata(&priv->adap, priv); uniphier_i2c_probe()
400 ret = i2c_add_adapter(&priv->adap); uniphier_i2c_probe()
417 i2c_del_adapter(&priv->adap); uniphier_i2c_remove()
H A Di2c-sibyte.c40 struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; smbus_xfer() local
44 while (csr_in32(SMB_CSR(adap, R_SMB_STATUS)) & M_SMB_BUSY) smbus_xfer()
51 V_SMB_TT_QUICKCMD), SMB_CSR(adap, R_SMB_START)); smbus_xfer()
56 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
59 csr_out32(V_SMB_CMD(command), SMB_CSR(adap, R_SMB_CMD)); smbus_xfer()
61 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
65 csr_out32(V_SMB_CMD(command), SMB_CSR(adap, R_SMB_CMD)); smbus_xfer()
68 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
72 SMB_CSR(adap, R_SMB_DATA)); smbus_xfer()
74 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
78 csr_out32(V_SMB_CMD(command), SMB_CSR(adap, R_SMB_CMD)); smbus_xfer()
81 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
85 SMB_CSR(adap, R_SMB_DATA)); smbus_xfer()
87 SMB_CSR(adap, R_SMB_DATA)); smbus_xfer()
89 SMB_CSR(adap, R_SMB_START)); smbus_xfer()
96 while (csr_in32(SMB_CSR(adap, R_SMB_STATUS)) & M_SMB_BUSY) smbus_xfer()
99 error = csr_in32(SMB_CSR(adap, R_SMB_STATUS)); smbus_xfer()
102 csr_out32(M_SMB_ERROR, SMB_CSR(adap, R_SMB_STATUS)); smbus_xfer()
107 data->byte = csr_in32(SMB_CSR(adap, R_SMB_DATA)) & 0xff; smbus_xfer()
109 data->word = csr_in32(SMB_CSR(adap, R_SMB_DATA)) & 0xffff; smbus_xfer()
114 static u32 bit_func(struct i2c_adapter *adap) bit_func() argument
133 struct i2c_algo_sibyte_data *adap = i2c_adap->algo_data; i2c_sibyte_add_bus() local
139 csr_out32(speed, SMB_CSR(adap,R_SMB_FREQ)); i2c_sibyte_add_bus()
140 csr_out32(0, SMB_CSR(adap,R_SMB_CONTROL)); i2c_sibyte_add_bus()
H A Di2c-emev2.c71 struct i2c_adapter adap; member in struct:em_i2c_device
88 time_left = wait_for_completion_timeout(&priv->msg_done, priv->adap.timeout); em_i2c_wait_for_event()
106 static void em_i2c_reset(struct i2c_adapter *adap) em_i2c_reset() argument
108 struct em_i2c_device *priv = i2c_get_adapdata(adap); em_i2c_reset()
140 static int __em_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, __em_i2c_xfer() argument
143 struct em_i2c_device *priv = i2c_get_adapdata(adap); __em_i2c_xfer()
205 em_i2c_reset(adap); __em_i2c_xfer()
210 static int em_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, em_i2c_xfer() argument
213 struct em_i2c_device *priv = i2c_get_adapdata(adap); em_i2c_xfer()
220 ret = __em_i2c_xfer(adap, &msgs[i], (i == (num - 1))); em_i2c_xfer()
237 static u32 em_i2c_func(struct i2c_adapter *adap) em_i2c_func() argument
262 strlcpy(priv->adap.name, "EMEV2 I2C", sizeof(priv->adap.name)); em_i2c_probe()
270 priv->adap.timeout = msecs_to_jiffies(100); em_i2c_probe()
271 priv->adap.retries = 5; em_i2c_probe()
272 priv->adap.dev.parent = &pdev->dev; em_i2c_probe()
273 priv->adap.algo = &em_i2c_algo; em_i2c_probe()
274 priv->adap.owner = THIS_MODULE; em_i2c_probe()
275 priv->adap.dev.of_node = pdev->dev.of_node; em_i2c_probe()
280 i2c_set_adapdata(&priv->adap, priv); em_i2c_probe()
282 em_i2c_reset(&priv->adap); em_i2c_probe()
290 ret = i2c_add_adapter(&priv->adap); em_i2c_probe()
295 dev_info(&pdev->dev, "Added i2c controller %d, irq %d\n", priv->adap.nr, irq); em_i2c_probe()
308 i2c_del_adapter(&priv->adap); em_i2c_remove()
H A Di2c-uniphier-f.c90 struct i2c_adapter adap; member in struct:uniphier_fi2c_priv
117 dev_dbg(&priv->adap.dev, "write data: %02x\n", *priv->buf); uniphier_fi2c_fill_txfifo()
133 dev_dbg(&priv->adap.dev, "read data: %02x\n", priv->buf[-1]); uniphier_fi2c_drain_rxfifo()
150 dev_dbg(&priv->adap.dev, "stop condition\n"); uniphier_fi2c_stop()
165 dev_dbg(&priv->adap.dev, uniphier_fi2c_interrupt()
173 dev_dbg(&priv->adap.dev, "arbitration lost\n"); uniphier_fi2c_interrupt()
179 dev_dbg(&priv->adap.dev, "could not get ACK\n"); uniphier_fi2c_interrupt()
214 dev_dbg(&priv->adap.dev, uniphier_fi2c_interrupt()
221 dev_dbg(&priv->adap.dev, "set NACK\n"); uniphier_fi2c_interrupt()
304 i2c_recover_bus(&priv->adap); uniphier_fi2c_recover()
307 static int uniphier_fi2c_master_xfer_one(struct i2c_adapter *adap, uniphier_fi2c_master_xfer_one() argument
310 struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); uniphier_fi2c_master_xfer_one()
314 dev_dbg(&adap->dev, "%s: addr=0x%02x, len=%d, stop=%d\n", uniphier_fi2c_master_xfer_one()
338 dev_dbg(&adap->dev, "start condition\n"); uniphier_fi2c_master_xfer_one()
342 time_left = wait_for_completion_timeout(&priv->comp, adap->timeout); uniphier_fi2c_master_xfer_one()
344 dev_err(&adap->dev, "transaction timeout.\n"); uniphier_fi2c_master_xfer_one()
348 dev_dbg(&adap->dev, "complete\n"); uniphier_fi2c_master_xfer_one()
355 dev_err(&adap->dev, uniphier_fi2c_master_xfer_one()
365 static int uniphier_fi2c_check_bus_busy(struct i2c_adapter *adap) uniphier_fi2c_check_bus_busy() argument
367 struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); uniphier_fi2c_check_bus_busy()
386 static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, uniphier_fi2c_master_xfer() argument
392 ret = uniphier_fi2c_check_bus_busy(adap); uniphier_fi2c_master_xfer()
403 ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); uniphier_fi2c_master_xfer()
411 static u32 uniphier_fi2c_functionality(struct i2c_adapter *adap) uniphier_fi2c_functionality() argument
421 static int uniphier_fi2c_get_scl(struct i2c_adapter *adap) uniphier_fi2c_get_scl() argument
423 struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); uniphier_fi2c_get_scl()
429 static void uniphier_fi2c_set_scl(struct i2c_adapter *adap, int val) uniphier_fi2c_set_scl() argument
431 struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); uniphier_fi2c_set_scl()
437 static int uniphier_fi2c_get_sda(struct i2c_adapter *adap) uniphier_fi2c_get_sda() argument
439 struct uniphier_fi2c_priv *priv = i2c_get_adapdata(adap); uniphier_fi2c_get_sda()
445 static void uniphier_fi2c_unprepare_recovery(struct i2c_adapter *adap) uniphier_fi2c_unprepare_recovery() argument
447 uniphier_fi2c_prepare_operation(i2c_get_adapdata(adap)); uniphier_fi2c_unprepare_recovery()
523 priv->adap.owner = THIS_MODULE; uniphier_fi2c_probe()
524 priv->adap.algo = &uniphier_fi2c_algo; uniphier_fi2c_probe()
525 priv->adap.dev.parent = dev; uniphier_fi2c_probe()
526 priv->adap.dev.of_node = dev->of_node; uniphier_fi2c_probe()
527 strlcpy(priv->adap.name, "UniPhier FI2C", sizeof(priv->adap.name)); uniphier_fi2c_probe()
528 priv->adap.bus_recovery_info = &uniphier_fi2c_bus_recovery_info; uniphier_fi2c_probe()
529 i2c_set_adapdata(&priv->adap, priv); uniphier_fi2c_probe()
543 ret = i2c_add_adapter(&priv->adap); uniphier_fi2c_probe()
560 i2c_del_adapter(&priv->adap); uniphier_fi2c_remove()
H A Di2c-xlr.c67 struct i2c_adapter adap; member in struct:xlr_i2c_private
74 struct i2c_adapter *adap = &priv->adap; xlr_i2c_tx() local
127 dev_err(&adap->dev, "I2C transmit timeout\n"); xlr_i2c_tx()
133 struct i2c_adapter *adap = &priv->adap; xlr_i2c_rx() local
181 dev_err(&adap->dev, "I2C receive timeout\n"); xlr_i2c_rx()
185 static int xlr_i2c_xfer(struct i2c_adapter *adap, xlr_i2c_xfer() argument
191 struct xlr_i2c_private *priv = i2c_get_adapdata(adap); xlr_i2c_xfer()
206 static u32 xlr_func(struct i2c_adapter *adap) xlr_func() argument
232 priv->adap.dev.parent = &pdev->dev; xlr_i2c_probe()
233 priv->adap.owner = THIS_MODULE; xlr_i2c_probe()
234 priv->adap.algo_data = priv; xlr_i2c_probe()
235 priv->adap.algo = &xlr_i2c_algo; xlr_i2c_probe()
236 priv->adap.nr = pdev->id; xlr_i2c_probe()
237 priv->adap.class = I2C_CLASS_HWMON; xlr_i2c_probe()
238 snprintf(priv->adap.name, sizeof(priv->adap.name), "xlr-i2c"); xlr_i2c_probe()
240 i2c_set_adapdata(&priv->adap, priv); xlr_i2c_probe()
241 ret = i2c_add_numbered_adapter(&priv->adap); xlr_i2c_probe()
243 dev_err(&priv->adap.dev, "Failed to add i2c bus.\n"); xlr_i2c_probe()
248 dev_info(&priv->adap.dev, "Added I2C Bus.\n"); xlr_i2c_probe()
257 i2c_del_adapter(&priv->adap); xlr_i2c_remove()
H A Di2c-versatile.c27 struct i2c_adapter adap; member in struct:i2c_versatile
98 i2c->adap.owner = THIS_MODULE; i2c_versatile_probe()
99 strlcpy(i2c->adap.name, "Versatile I2C adapter", sizeof(i2c->adap.name)); i2c_versatile_probe()
100 i2c->adap.algo_data = &i2c->algo; i2c_versatile_probe()
101 i2c->adap.dev.parent = &dev->dev; i2c_versatile_probe()
102 i2c->adap.dev.of_node = dev->dev.of_node; i2c_versatile_probe()
106 i2c->adap.nr = dev->id; i2c_versatile_probe()
107 ret = i2c_bit_add_numbered_bus(&i2c->adap); i2c_versatile_probe()
126 i2c_del_adapter(&i2c->adap); i2c_versatile_remove()
H A Di2c-sis630.c129 static int sis630_transaction_start(struct i2c_adapter *adap, int size, sis630_transaction_start() argument
137 dev_dbg(&adap->dev, "SMBus busy (%02x). Resetting...\n", temp); sis630_transaction_start()
143 dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); sis630_transaction_start()
146 dev_dbg(&adap->dev, "Successful!\n"); sis630_transaction_start()
153 dev_dbg(&adap->dev, "saved clock 0x%02x\n", *oldclock); sis630_transaction_start()
172 static int sis630_transaction_wait(struct i2c_adapter *adap, int size) sis630_transaction_wait() argument
187 dev_dbg(&adap->dev, "SMBus Timeout!\n"); sis630_transaction_wait()
192 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); sis630_transaction_wait()
197 dev_err(&adap->dev, "Bus collision!\n"); sis630_transaction_wait()
204 static void sis630_transaction_end(struct i2c_adapter *adap, u8 oldclock) sis630_transaction_end() argument
209 dev_dbg(&adap->dev, sis630_transaction_end()
219 dev_dbg(&adap->dev, sis630_transaction_end()
223 static int sis630_transaction(struct i2c_adapter *adap, int size) sis630_transaction() argument
228 result = sis630_transaction_start(adap, size, &oldclock); sis630_transaction()
230 result = sis630_transaction_wait(adap, size); sis630_transaction()
231 sis630_transaction_end(adap, oldclock); sis630_transaction()
237 static int sis630_block_data(struct i2c_adapter *adap, sis630_block_data() argument
251 dev_dbg(&adap->dev, sis630_block_data()
256 dev_dbg(&adap->dev, sis630_block_data()
259 rc = sis630_transaction_start(adap, sis630_block_data()
264 dev_dbg(&adap->dev, sis630_block_data()
267 dev_dbg(&adap->dev, sis630_block_data()
277 rc = sis630_transaction_wait(adap, sis630_block_data()
280 dev_dbg(&adap->dev, sis630_block_data()
289 rc = sis630_transaction_start(adap, sis630_block_data()
294 rc = sis630_transaction_wait(adap, SIS630_BLOCK_DATA); sis630_block_data()
296 dev_dbg(&adap->dev, "trans_wait failed\n"); sis630_block_data()
307 dev_dbg(&adap->dev, sis630_block_data()
311 dev_dbg(&adap->dev, sis630_block_data()
317 dev_dbg(&adap->dev, sis630_block_data()
325 sis630_transaction_end(adap, oldclock); sis630_block_data()
331 static s32 sis630_access(struct i2c_adapter *adap, u16 addr, sis630_access() argument
375 return sis630_block_data(adap, data, read_write); sis630_access()
377 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); sis630_access()
381 status = sis630_transaction(adap, size); sis630_access()
H A Di2c-powermac.c36 static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap, i2c_powermac_smbus_xfer() argument
44 struct pmac_i2c_bus *bus = i2c_get_adapdata(adap); i2c_powermac_smbus_xfer()
108 dev_err(&adap->dev, "Failed to open I2C, err %d\n", rc); i2c_powermac_smbus_xfer()
114 dev_err(&adap->dev, "Failed to set I2C mode %d, err %d\n", i2c_powermac_smbus_xfer()
122 dev_dbg(&adap->dev, i2c_powermac_smbus_xfer()
126 dev_err(&adap->dev, i2c_powermac_smbus_xfer()
147 static int i2c_powermac_master_xfer( struct i2c_adapter *adap, i2c_powermac_master_xfer() argument
151 struct pmac_i2c_bus *bus = i2c_get_adapdata(adap); i2c_powermac_master_xfer()
163 dev_err(&adap->dev, "Failed to open I2C, err %d\n", rc); i2c_powermac_master_xfer()
168 dev_err(&adap->dev, "Failed to set I2C mode %d, err %d\n", i2c_powermac_master_xfer()
175 dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n", i2c_powermac_master_xfer()
179 dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n", i2c_powermac_master_xfer()
216 static u32 i2c_powermac_get_addr(struct i2c_adapter *adap, i2c_powermac_get_addr() argument
239 dev_warn(&adap->dev, "No i2c address for %s\n", node->full_name); i2c_powermac_get_addr()
244 static void i2c_powermac_create_one(struct i2c_adapter *adap, i2c_powermac_create_one() argument
253 newdev = i2c_new_device(adap, &info); i2c_powermac_create_one()
255 dev_err(&adap->dev, i2c_powermac_create_one()
260 static void i2c_powermac_add_missing(struct i2c_adapter *adap, i2c_powermac_add_missing() argument
272 rc = i2c_smbus_xfer(adap, 0x46, 0, I2C_SMBUS_READ, i2c_powermac_add_missing()
276 i2c_powermac_create_one(adap, "MAC,pcm3052", 0x46); i2c_powermac_add_missing()
278 rc = i2c_smbus_xfer(adap, 0x47, 0, I2C_SMBUS_READ, i2c_powermac_add_missing()
282 i2c_powermac_create_one(adap, "MAC,pcm3052", 0x47); i2c_powermac_add_missing()
286 static bool i2c_powermac_get_type(struct i2c_adapter *adap, i2c_powermac_get_type() argument
320 dev_err(&adap->dev, "i2c-powermac: modalias failure" i2c_powermac_get_type()
325 static void i2c_powermac_register_devices(struct i2c_adapter *adap, i2c_powermac_register_devices() argument
337 if (!strcmp(adap->dev.of_node->name, "via-pmu")) i2c_powermac_register_devices()
340 for_each_child_of_node(adap->dev.of_node, node) { i2c_powermac_register_devices()
345 addr = i2c_powermac_get_addr(adap, bus, node); i2c_powermac_register_devices()
350 if (!pmac_i2c_match_adapter(node, adap)) i2c_powermac_register_devices()
353 dev_dbg(&adap->dev, "i2c-powermac: register %s\n", i2c_powermac_register_devices()
364 if (!i2c_powermac_get_type(adap, node, addr, i2c_powermac_register_devices()
374 newdev = i2c_new_device(adap, &info); i2c_powermac_register_devices()
376 dev_err(&adap->dev, "i2c-powermac: Failure to register" i2c_powermac_register_devices()
389 i2c_powermac_add_missing(adap, bus, found_onyx); i2c_powermac_register_devices()
H A Di2c-gpio.c22 struct i2c_adapter adap; member in struct:i2c_gpio_private_data
132 struct i2c_adapter *adap; i2c_gpio_probe() local
166 adap = &priv->adap; i2c_gpio_probe()
212 adap->owner = THIS_MODULE; i2c_gpio_probe()
214 strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); i2c_gpio_probe()
216 snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); i2c_gpio_probe()
218 adap->algo_data = bit_data; i2c_gpio_probe()
219 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; i2c_gpio_probe()
220 adap->dev.parent = &pdev->dev; i2c_gpio_probe()
221 adap->dev.of_node = pdev->dev.of_node; i2c_gpio_probe()
223 adap->nr = pdev->id; i2c_gpio_probe()
224 ret = i2c_bit_add_numbered_bus(adap); i2c_gpio_probe()
241 struct i2c_adapter *adap; i2c_gpio_remove() local
244 adap = &priv->adap; i2c_gpio_remove()
246 i2c_del_adapter(adap); i2c_gpio_remove()
H A Di2c-simtec.c30 struct i2c_adapter adap; member in struct:simtec_i2c_data
106 pd->adap.owner = THIS_MODULE; simtec_i2c_probe()
107 pd->adap.algo_data = &pd->bit; simtec_i2c_probe()
108 pd->adap.dev.parent = &dev->dev; simtec_i2c_probe()
110 strlcpy(pd->adap.name, "Simtec I2C", sizeof(pd->adap.name)); simtec_i2c_probe()
120 ret = i2c_bit_add_bus(&pd->adap); simtec_i2c_probe()
142 i2c_del_adapter(&pd->adap); simtec_i2c_remove()
H A Di2c-pca-platform.c34 struct i2c_adapter adap; member in struct:i2c_pca_pf_data
88 & I2C_PCA_CON_SI, i2c->adap.timeout); i2c_pca_pf_waitforcompletion()
91 timeout = jiffies + i2c->adap.timeout; i2c_pca_pf_waitforcompletion()
108 i2c->adap.name); i2c_pca_pf_dummyreset()
173 i2c->adap.nr = pdev->id; i2c_pca_pf_probe()
174 i2c->adap.owner = THIS_MODULE; i2c_pca_pf_probe()
175 snprintf(i2c->adap.name, sizeof(i2c->adap.name), i2c_pca_pf_probe()
178 i2c->adap.algo_data = &i2c->algo_data; i2c_pca_pf_probe()
179 i2c->adap.dev.parent = &pdev->dev; i2c_pca_pf_probe()
182 i2c->adap.timeout = platform_data->timeout; i2c_pca_pf_probe()
186 i2c->adap.timeout = HZ; i2c_pca_pf_probe()
213 ret = gpio_request(i2c->gpio, i2c->adap.name); i2c_pca_pf_probe()
219 i2c->adap.name); i2c_pca_pf_probe()
231 if (i2c_pca_add_numbered_bus(&i2c->adap) < 0) { i2c_pca_pf_probe()
238 printk(KERN_INFO "%s registered.\n", i2c->adap.name); i2c_pca_pf_probe()
263 i2c_del_adapter(&i2c->adap); i2c_pca_pf_remove()
H A Di2c-cpm.c105 struct i2c_adapter adap; member in struct:cpm_i2c
127 struct i2c_adapter *adap = dev_id; cpm_i2c_interrupt() local
137 dev_dbg(&adap->dev, "Interrupt: %x\n", i); cpm_i2c_interrupt()
174 static void cpm_i2c_force_close(struct i2c_adapter *adap) cpm_i2c_force_close() argument
176 struct cpm_i2c *cpm = i2c_get_adapdata(adap); cpm_i2c_force_close()
179 dev_dbg(&adap->dev, "cpm_i2c_force_close()\n"); cpm_i2c_force_close()
187 static void cpm_i2c_parse_message(struct i2c_adapter *adap, cpm_i2c_parse_message() argument
195 struct cpm_i2c *cpm = i2c_get_adapdata(adap); cpm_i2c_parse_message()
228 dev_dbg(&adap->dev, "cpm_i2c_read(abyte=0x%x)\n", addr); cpm_i2c_parse_message()
239 dev_dbg(&adap->dev, "cpm_i2c_write(abyte=0x%x)\n", addr); cpm_i2c_parse_message()
248 static int cpm_i2c_check_message(struct i2c_adapter *adap, cpm_i2c_check_message() argument
255 struct cpm_i2c *cpm = i2c_get_adapdata(adap); cpm_i2c_check_message()
268 dev_dbg(&adap->dev, "tx sc 0x%04x, rx sc 0x%04x\n", cpm_i2c_check_message()
272 dev_dbg(&adap->dev, "I2C read; No ack\n"); cpm_i2c_check_message()
276 dev_err(&adap->dev, cpm_i2c_check_message()
281 dev_err(&adap->dev, "I2C read; Overrun\n"); cpm_i2c_check_message()
286 dev_dbg(&adap->dev, "tx sc %d 0x%04x\n", tx, cpm_i2c_check_message()
290 dev_dbg(&adap->dev, "I2C write; No ack\n"); cpm_i2c_check_message()
294 dev_err(&adap->dev, "I2C write; Underrun\n"); cpm_i2c_check_message()
298 dev_err(&adap->dev, "I2C write; Collision\n"); cpm_i2c_check_message()
305 static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) cpm_i2c_xfer() argument
307 struct cpm_i2c *cpm = i2c_get_adapdata(adap); cpm_i2c_xfer()
337 dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr); cpm_i2c_xfer()
339 cpm_i2c_parse_message(adap, pmsg, num, tptr, rptr); cpm_i2c_xfer()
358 dev_dbg(&adap->dev, "test ready.\n"); cpm_i2c_xfer()
371 dev_err(&adap->dev, "I2C transfer: timeout\n"); cpm_i2c_xfer()
375 dev_dbg(&adap->dev, "ready.\n"); cpm_i2c_xfer()
376 ret = cpm_i2c_check_message(adap, pmsg, tptr, rptr); cpm_i2c_xfer()
395 cpm_i2c_force_close(adap); cpm_i2c_xfer()
405 static u32 cpm_i2c_func(struct i2c_adapter *adap) cpm_i2c_func() argument
451 &cpm->adap); cpm_i2c_setup()
509 cpm->adap.class = *data; cpm_i2c_setup()
605 free_irq(cpm->irq, &cpm->adap); cpm_i2c_setup()
620 free_irq(cpm->irq, &cpm->adap); cpm_i2c_shutdown()
653 cpm->adap = cpm_ops; cpm_i2c_probe()
654 i2c_set_adapdata(&cpm->adap, cpm); cpm_i2c_probe()
655 cpm->adap.dev.parent = &ofdev->dev; cpm_i2c_probe()
656 cpm->adap.dev.of_node = of_node_get(ofdev->dev.of_node); cpm_i2c_probe()
667 cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1; cpm_i2c_probe()
668 result = i2c_add_numbered_adapter(&cpm->adap); cpm_i2c_probe()
676 cpm->adap.name); cpm_i2c_probe()
691 i2c_del_adapter(&cpm->adap); cpm_i2c_remove()
H A Di2c-davinci.c296 static void davinci_i2c_prepare_recovery(struct i2c_adapter *adap) davinci_i2c_prepare_recovery() argument
298 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_prepare_recovery()
307 static void davinci_i2c_unprepare_recovery(struct i2c_adapter *adap) davinci_i2c_unprepare_recovery() argument
309 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_unprepare_recovery()
320 static void davinci_i2c_set_scl(struct i2c_adapter *adap, int val) davinci_i2c_set_scl() argument
322 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_set_scl()
332 static int davinci_i2c_get_scl(struct i2c_adapter *adap) davinci_i2c_get_scl() argument
334 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_get_scl()
342 static int davinci_i2c_get_sda(struct i2c_adapter *adap) davinci_i2c_get_sda() argument
344 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_get_sda()
352 static void davinci_i2c_scl_prepare_recovery(struct i2c_adapter *adap) davinci_i2c_scl_prepare_recovery() argument
354 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_scl_prepare_recovery()
356 davinci_i2c_prepare_recovery(adap); davinci_i2c_scl_prepare_recovery()
366 static void davinci_i2c_scl_unprepare_recovery(struct i2c_adapter *adap) davinci_i2c_scl_unprepare_recovery() argument
368 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); davinci_i2c_scl_unprepare_recovery()
373 davinci_i2c_unprepare_recovery(adap); davinci_i2c_scl_unprepare_recovery()
416 i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop) i2c_davinci_xfer_msg() argument
418 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); i2c_davinci_xfer_msg()
495 i2c_recover_bus(adap); i2c_davinci_xfer_msg()
536 i2c_davinci_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) i2c_davinci_xfer() argument
538 struct davinci_i2c_dev *dev = i2c_get_adapdata(adap); i2c_davinci_xfer()
551 ret = i2c_davinci_xfer_msg(adap, &msgs[i], (i == (num - 1))); i2c_davinci_xfer()
565 static u32 i2c_davinci_func(struct i2c_adapter *adap) i2c_davinci_func() argument
751 struct i2c_adapter *adap; davinci_i2c_probe() local
829 adap = &dev->adapter; davinci_i2c_probe()
830 i2c_set_adapdata(adap, dev); davinci_i2c_probe()
831 adap->owner = THIS_MODULE; davinci_i2c_probe()
832 adap->class = I2C_CLASS_DEPRECATED; davinci_i2c_probe()
833 strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name)); davinci_i2c_probe()
834 adap->algo = &i2c_davinci_algo; davinci_i2c_probe()
835 adap->dev.parent = &pdev->dev; davinci_i2c_probe()
836 adap->timeout = DAVINCI_I2C_TIMEOUT; davinci_i2c_probe()
837 adap->dev.of_node = pdev->dev.of_node; davinci_i2c_probe()
840 adap->bus_recovery_info = &davinci_i2c_scl_recovery_info; davinci_i2c_probe()
842 adap->bus_recovery_info = &davinci_i2c_gpio_recovery_info; davinci_i2c_probe()
843 adap->bus_recovery_info->scl_gpio = dev->pdata->scl_pin; davinci_i2c_probe()
844 adap->bus_recovery_info->sda_gpio = dev->pdata->sda_pin; davinci_i2c_probe()
847 adap->nr = pdev->id; davinci_i2c_probe()
848 r = i2c_add_numbered_adapter(adap); davinci_i2c_probe()
H A Di2c-cros-ec-tunnel.c25 * @adap: I2C adapter
34 struct i2c_adapter adap; member in struct:ec_i2c_device
177 static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[], ec_i2c_xfer() argument
180 struct ec_i2c_device *bus = adap->algo_data; ec_i2c_xfer()
237 static u32 ec_i2c_functionality(struct i2c_adapter *adap) ec_i2c_functionality() argument
275 bus->adap.owner = THIS_MODULE; ec_i2c_probe()
276 strlcpy(bus->adap.name, "cros-ec-i2c-tunnel", sizeof(bus->adap.name)); ec_i2c_probe()
277 bus->adap.algo = &ec_i2c_algorithm; ec_i2c_probe()
278 bus->adap.algo_data = bus; ec_i2c_probe()
279 bus->adap.dev.parent = &pdev->dev; ec_i2c_probe()
280 bus->adap.dev.of_node = np; ec_i2c_probe()
281 bus->adap.retries = I2C_MAX_RETRIES; ec_i2c_probe()
283 err = i2c_add_adapter(&bus->adap); ec_i2c_probe()
297 i2c_del_adapter(&bus->adap); ec_i2c_remove()
H A Di2c-bcm2835.c199 static int bcm2835_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], bcm2835_i2c_xfer() argument
202 struct bcm2835_i2c_dev *i2c_dev = i2c_get_adapdata(adap); bcm2835_i2c_xfer()
215 static u32 bcm2835_i2c_func(struct i2c_adapter *adap) bcm2835_i2c_func() argument
231 struct i2c_adapter *adap; bcm2835_i2c_probe() local
288 adap = &i2c_dev->adapter; bcm2835_i2c_probe()
289 i2c_set_adapdata(adap, i2c_dev); bcm2835_i2c_probe()
290 adap->owner = THIS_MODULE; bcm2835_i2c_probe()
291 adap->class = I2C_CLASS_DEPRECATED; bcm2835_i2c_probe()
292 strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name)); bcm2835_i2c_probe()
293 adap->algo = &bcm2835_i2c_algo; bcm2835_i2c_probe()
294 adap->dev.parent = &pdev->dev; bcm2835_i2c_probe()
295 adap->dev.of_node = pdev->dev.of_node; bcm2835_i2c_probe()
299 ret = i2c_add_adapter(adap); bcm2835_i2c_probe()
H A Di2c-nforce2.c134 static void nforce2_set_reference(struct i2c_adapter *adap) nforce2_set_reference() argument
136 nforce2_smbus = adap; nforce2_set_reference()
139 static inline void nforce2_set_reference(struct i2c_adapter *adap) { } nforce2_set_reference() argument
142 static void nforce2_abort(struct i2c_adapter *adap) nforce2_abort() argument
144 struct nforce2_smbus *smbus = adap->algo_data; nforce2_abort()
148 dev_dbg(&adap->dev, "Aborting current transaction\n"); nforce2_abort()
157 dev_err(&adap->dev, "Can't reset the smbus\n"); nforce2_abort()
161 static int nforce2_check_status(struct i2c_adapter *adap) nforce2_check_status() argument
163 struct nforce2_smbus *smbus = adap->algo_data; nforce2_check_status()
173 dev_dbg(&adap->dev, "SMBus Timeout!\n"); nforce2_check_status()
175 nforce2_abort(adap); nforce2_check_status()
179 dev_dbg(&adap->dev, "Transaction failed (0x%02x)!\n", temp); nforce2_check_status()
186 static s32 nforce2_access(struct i2c_adapter *adap, u16 addr, nforce2_access() argument
190 struct nforce2_smbus *smbus = adap->algo_data; nforce2_access()
232 dev_err(&adap->dev, nforce2_access()
246 dev_err(&adap->dev, "Unsupported transaction %d\n", size); nforce2_access()
253 status = nforce2_check_status(adap); nforce2_access()
274 dev_err(&adap->dev, nforce2_access()
H A Di2c-wmt.c126 static int wmt_i2c_write(struct i2c_adapter *adap, struct i2c_msg *pmsg, wmt_i2c_write() argument
129 struct wmt_i2c_dev *i2c_dev = i2c_get_adapdata(adap); wmt_i2c_write()
217 static int wmt_i2c_read(struct i2c_adapter *adap, struct i2c_msg *pmsg, wmt_i2c_read() argument
220 struct wmt_i2c_dev *i2c_dev = i2c_get_adapdata(adap); wmt_i2c_read()
297 static int wmt_i2c_xfer(struct i2c_adapter *adap, wmt_i2c_xfer() argument
310 ret = wmt_i2c_read(adap, pmsg, is_last); wmt_i2c_xfer()
312 ret = wmt_i2c_write(adap, pmsg, is_last); wmt_i2c_xfer()
318 static u32 wmt_i2c_func(struct i2c_adapter *adap) wmt_i2c_func() argument
378 struct i2c_adapter *adap; wmt_i2c_probe() local
418 adap = &i2c_dev->adapter; wmt_i2c_probe()
419 i2c_set_adapdata(adap, i2c_dev); wmt_i2c_probe()
420 strlcpy(adap->name, "WMT I2C adapter", sizeof(adap->name)); wmt_i2c_probe()
421 adap->owner = THIS_MODULE; wmt_i2c_probe()
422 adap->algo = &wmt_i2c_algo; wmt_i2c_probe()
423 adap->dev.parent = &pdev->dev; wmt_i2c_probe()
424 adap->dev.of_node = pdev->dev.of_node; wmt_i2c_probe()
434 err = i2c_add_adapter(adap); wmt_i2c_probe()
H A Di2c-pxa.c15 * Jun 2002: Properly separated algo/adap [FB]
167 struct i2c_adapter adap; member in struct:pxa_i2c
282 dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, i2c_pxa_show_state()
291 struct device *dev = &i2c->adap.dev; i2c_pxa_scream_blue_murder()
331 dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__); i2c_pxa_abort()
377 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", i2c_pxa_wait_master()
382 dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__); i2c_pxa_wait_master()
392 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); i2c_pxa_wait_master()
400 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__); i2c_pxa_wait_master()
408 dev_dbg(&i2c->adap.dev, "setting to bus master\n"); i2c_pxa_set_master()
411 dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__); i2c_pxa_set_master()
413 dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__); i2c_pxa_set_master()
433 dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", i2c_pxa_wait_slave()
440 dev_dbg(&i2c->adap.dev, "%s: done\n", __func__); i2c_pxa_wait_slave()
448 dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__); i2c_pxa_wait_slave()
472 dev_err(&i2c->adap.dev, "%s: wait timedout\n", i2c_pxa_set_slave()
482 dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", readl(_ICR(i2c)), readl(_ISR(i2c))); i2c_pxa_set_slave()
510 dev_info(&i2c->adap.dev, "Enabling slave mode\n"); i2c_pxa_reset()
557 dev_dbg(&i2c->adap.dev, "SAD, mode is slave-%cx\n", i2c_pxa_slave_start()
581 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n"); i2c_pxa_slave_start()
592 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop)\n"); i2c_pxa_slave_stop()
598 dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop) acked\n"); i2c_pxa_slave_stop()
644 dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n"); i2c_pxa_slave_start()
717 dev_err(&i2c->adap.dev, i2c_pxa_pio_set_master()
810 dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n"); i2c_pxa_do_xfer()
819 dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret); i2c_pxa_do_xfer()
826 dev_err(&i2c->adap.dev, "i2c_pxa_send_mastercode timeout\n"); i2c_pxa_do_xfer()
863 static int i2c_pxa_pio_xfer(struct i2c_adapter *adap, i2c_pxa_pio_xfer() argument
866 struct pxa_i2c *i2c = adap->algo_data; i2c_pxa_pio_xfer()
876 for (i = adap->retries; i >= 0; i--) { i2c_pxa_pio_xfer()
882 dev_dbg(&adap->dev, "Retrying transmission\n"); i2c_pxa_pio_xfer()
1058 dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n", i2c_pxa_handler()
1099 static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) i2c_pxa_xfer() argument
1101 struct pxa_i2c *i2c = adap->algo_data; i2c_pxa_xfer()
1104 for (i = adap->retries; i >= 0; i--) { i2c_pxa_xfer()
1110 dev_dbg(&adap->dev, "Retrying transmission\n"); i2c_pxa_xfer()
1120 static u32 i2c_pxa_functionality(struct i2c_adapter *adap) i2c_pxa_functionality() argument
1155 i2c->adap.nr = -1; i2c_pxa_probe_dt()
1211 i2c->adap.nr = dev->id; i2c_pxa_probe()
1219 i2c->adap.owner = THIS_MODULE; i2c_pxa_probe()
1220 i2c->adap.retries = 5; i2c_pxa_probe()
1225 strlcpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name)); i2c_pxa_probe()
1258 i2c->adap.class = plat->class; i2c_pxa_probe()
1265 i2c->adap.name, clk_get_rate(i2c->clk)); i2c_pxa_probe()
1268 i2c->adap.name); i2c_pxa_probe()
1274 i2c->adap.algo = &i2c_pxa_pio_algorithm; i2c_pxa_probe()
1276 i2c->adap.algo = &i2c_pxa_algorithm; i2c_pxa_probe()
1288 i2c->adap.algo_data = i2c; i2c_pxa_probe()
1289 i2c->adap.dev.parent = &dev->dev; i2c_pxa_probe()
1291 i2c->adap.dev.of_node = dev->dev.of_node; i2c_pxa_probe()
1294 ret = i2c_add_numbered_adapter(&i2c->adap); i2c_pxa_probe()
1303 dev_info(&i2c->adap.dev, " PXA I2C adapter, slave address %d\n", i2c_pxa_probe()
1306 dev_info(&i2c->adap.dev, " PXA I2C adapter\n"); i2c_pxa_probe()
1319 i2c_del_adapter(&i2c->adap); i2c_pxa_remove()
H A Di2c-amd756-s4882.c47 static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, amd756_access_virt0() argument
61 error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, amd756_access_virt0()
75 static inline s32 amd756_access_channel(struct i2c_adapter * adap, u16 addr, amd756_access_channel() argument
93 error = amd756_smbus.algo->smbus_xfer(adap, 0x18, 0, amd756_access_channel()
101 error = amd756_smbus.algo->smbus_xfer(adap, addr, flags, read_write, amd756_access_channel()
109 static s32 amd756_access_virt1(struct i2c_adapter * adap, u16 addr, amd756_access_virt1() argument
115 return amd756_access_channel(adap, addr, flags, read_write, command, amd756_access_virt1()
119 static s32 amd756_access_virt2(struct i2c_adapter * adap, u16 addr, amd756_access_virt2() argument
125 return amd756_access_channel(adap, addr, flags, read_write, command, amd756_access_virt2()
129 static s32 amd756_access_virt3(struct i2c_adapter * adap, u16 addr, amd756_access_virt3() argument
135 return amd756_access_channel(adap, addr, flags, read_write, command, amd756_access_virt3()
139 static s32 amd756_access_virt4(struct i2c_adapter * adap, u16 addr, amd756_access_virt4() argument
145 return amd756_access_channel(adap, addr, flags, read_write, command, amd756_access_virt4()
H A Di2c-digicolor.c51 struct i2c_adapter adap; member in struct:dc_i2c
248 static int dc_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) dc_i2c_xfer() argument
250 struct dc_i2c *i2c = adap->algo_data; dc_i2c_xfer()
283 static u32 dc_i2c_func(struct i2c_adapter *adap) dc_i2c_func() argument
332 strlcpy(i2c->adap.name, "Conexant Digicolor I2C adapter", dc_i2c_probe()
333 sizeof(i2c->adap.name)); dc_i2c_probe()
334 i2c->adap.owner = THIS_MODULE; dc_i2c_probe()
335 i2c->adap.algo = &dc_i2c_algorithm; dc_i2c_probe()
336 i2c->adap.dev.parent = &pdev->dev; dc_i2c_probe()
337 i2c->adap.dev.of_node = np; dc_i2c_probe()
338 i2c->adap.algo_data = i2c; dc_i2c_probe()
348 ret = i2c_add_adapter(&i2c->adap); dc_i2c_probe()
361 i2c_del_adapter(&i2c->adap); dc_i2c_remove()
H A Di2c-nforce2-s4985.c45 static s32 nforce2_access_virt0(struct i2c_adapter *adap, u16 addr, nforce2_access_virt0() argument
58 error = nforce2_smbus->algo->smbus_xfer(adap, addr, flags, read_write, nforce2_access_virt0()
71 static inline s32 nforce2_access_channel(struct i2c_adapter *adap, u16 addr, nforce2_access_channel() argument
88 error = nforce2_smbus->algo->smbus_xfer(adap, 0x18, 0, nforce2_access_channel()
96 error = nforce2_smbus->algo->smbus_xfer(adap, addr, flags, read_write, nforce2_access_channel()
104 static s32 nforce2_access_virt1(struct i2c_adapter *adap, u16 addr, nforce2_access_virt1() argument
110 return nforce2_access_channel(adap, addr, flags, read_write, command, nforce2_access_virt1()
114 static s32 nforce2_access_virt2(struct i2c_adapter *adap, u16 addr, nforce2_access_virt2() argument
120 return nforce2_access_channel(adap, addr, flags, read_write, command, nforce2_access_virt2()
124 static s32 nforce2_access_virt3(struct i2c_adapter *adap, u16 addr, nforce2_access_virt3() argument
130 return nforce2_access_channel(adap, addr, flags, read_write, command, nforce2_access_virt3()
134 static s32 nforce2_access_virt4(struct i2c_adapter *adap, u16 addr, nforce2_access_virt4() argument
140 return nforce2_access_channel(adap, addr, flags, read_write, command, nforce2_access_virt4()
H A Di2c-bfin-twi.c118 dev_dbg(&iface->adap.dev, "Lost Arbitration\n"); bfin_twi_handle_interrupt()
120 dev_dbg(&iface->adap.dev, "Address Not Acknowledged\n"); bfin_twi_handle_interrupt()
122 dev_dbg(&iface->adap.dev, "Data Not Acknowledged\n"); bfin_twi_handle_interrupt()
124 dev_dbg(&iface->adap.dev, "Buffer Read Error\n"); bfin_twi_handle_interrupt()
126 dev_dbg(&iface->adap.dev, "Buffer Write Error\n"); bfin_twi_handle_interrupt()
258 static int bfin_twi_do_master_xfer(struct i2c_adapter *adap, bfin_twi_do_master_xfer() argument
261 struct bfin_twi_iface *iface = adap->algo_data; bfin_twi_do_master_xfer()
277 dev_err(&adap->dev, "10 bits addr not supported!\n"); bfin_twi_do_master_xfer()
329 adap->timeout)) { bfin_twi_do_master_xfer()
331 dev_err(&adap->dev, "master transfer timeout\n"); bfin_twi_do_master_xfer()
346 static int bfin_twi_master_xfer(struct i2c_adapter *adap, bfin_twi_master_xfer() argument
349 return bfin_twi_do_master_xfer(adap, msgs, num); bfin_twi_master_xfer()
355 int bfin_twi_do_smbus_xfer(struct i2c_adapter *adap, u16 addr, bfin_twi_do_smbus_xfer() argument
359 struct bfin_twi_iface *iface = adap->algo_data; bfin_twi_do_smbus_xfer()
533 adap->timeout)) { bfin_twi_do_smbus_xfer()
535 dev_err(&adap->dev, "smbus transfer timeout\n"); bfin_twi_do_smbus_xfer()
547 int bfin_twi_smbus_xfer(struct i2c_adapter *adap, u16 addr, bfin_twi_smbus_xfer() argument
551 return bfin_twi_do_smbus_xfer(adap, addr, flags, bfin_twi_smbus_xfer()
558 static u32 bfin_twi_functionality(struct i2c_adapter *adap) bfin_twi_functionality() argument
646 p_adap = &iface->adap; i2c_bfin_twi_probe()
709 i2c_del_adapter(&(iface->adap)); i2c_bfin_twi_remove()
H A Di2c-jz4780.c153 struct i2c_adapter adap; member in struct:jz4780_i2c
206 dev_err(&i2c->adap.dev, "disable failed: ENSTA=0x%04x\n", regval); jz4780_i2c_disable()
225 dev_err(&i2c->adap.dev, "enable failed: ENSTA=0x%04x\n", regval); jz4780_i2c_enable()
248 dev_err(&i2c->adap.dev, jz4780_i2c_set_target()
267 dev_dbg(&i2c->adap.dev, "i2c not disabled\n"); jz4780_i2c_set_speed()
394 dev_err(&i2c->adap.dev, jz4780_i2c_cleanup()
399 dev_err(&i2c->adap.dev, jz4780_i2c_cleanup()
445 dev_dbg(&i2c->adap.dev, "received fifo overflow!\n"); jz4780_i2c_irq()
543 dev_err(&i2c->adap.dev, "txabrt: 0x%08x\n", src); jz4780_i2c_txabrt()
544 dev_err(&i2c->adap.dev, "device addr=%x\n", jz4780_i2c_txabrt()
546 dev_err(&i2c->adap.dev, "send cmd count:%d %d\n", jz4780_i2c_txabrt()
548 dev_err(&i2c->adap.dev, "receive data count:%d %d\n", jz4780_i2c_txabrt()
553 dev_dbg(&i2c->adap.dev, "I2C TXABRT[%d]=%s\n", jz4780_i2c_txabrt()
600 dev_err(&i2c->adap.dev, "irq read timeout\n"); jz4780_i2c_xfer_read()
601 dev_dbg(&i2c->adap.dev, "send cmd count:%d %d\n", jz4780_i2c_xfer_read()
603 dev_dbg(&i2c->adap.dev, "receive data count:%d %d\n", jz4780_i2c_xfer_read()
668 dev_err(&i2c->adap.dev, "write wait timeout\n"); jz4780_i2c_xfer_write()
681 static int jz4780_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, jz4780_i2c_xfer() argument
686 struct jz4780_i2c *i2c = adap->algo_data; jz4780_i2c_xfer()
690 dev_err(&i2c->adap.dev, "I2C prepare failed\n"); jz4780_i2c_xfer()
718 static u32 jz4780_i2c_functionality(struct i2c_adapter *adap) jz4780_i2c_functionality() argument
745 i2c->adap.owner = THIS_MODULE; jz4780_i2c_probe()
746 i2c->adap.algo = &jz4780_i2c_algorithm; jz4780_i2c_probe()
747 i2c->adap.algo_data = i2c; jz4780_i2c_probe()
748 i2c->adap.retries = 5; jz4780_i2c_probe()
749 i2c->adap.dev.parent = &pdev->dev; jz4780_i2c_probe()
750 i2c->adap.dev.of_node = pdev->dev.of_node; jz4780_i2c_probe()
751 sprintf(i2c->adap.name, "%s", pdev->name); jz4780_i2c_probe()
799 ret = i2c_add_adapter(&i2c->adap); jz4780_i2c_probe()
817 i2c_del_adapter(&i2c->adap); jz4780_i2c_remove()
H A Di2c-xiic.c58 * @adap: Kernel adapter representation
71 struct i2c_adapter adap; member in struct:xiic_i2c
307 dev_dbg(i2c->adap.dev.parent, xiic_read_rx()
338 dev_dbg(i2c->adap.dev.parent, "%s entry, len: %d, fifo space: %d\n", xiic_fill_tx_fifo()
346 dev_dbg(i2c->adap.dev.parent, "%s TX STOP\n", __func__); xiic_fill_tx_fifo()
377 dev_dbg(i2c->adap.dev.parent, "%s: IER: 0x%x, ISR: 0x%x, pend: 0x%x\n", xiic_process()
379 dev_dbg(i2c->adap.dev.parent, "%s: SR: 0x%x, msg: %p, nmsgs: %d\n", xiic_process()
394 dev_dbg(i2c->adap.dev.parent, "%s error\n", __func__); xiic_process()
412 dev_dbg(i2c->adap.dev.parent, xiic_process()
426 dev_dbg(i2c->adap.dev.parent, xiic_process()
437 dev_dbg(i2c->adap.dev.parent, xiic_process()
467 dev_dbg(i2c->adap.dev.parent, xiic_process()
476 dev_dbg(i2c->adap.dev.parent, xiic_process()
486 dev_dbg(i2c->adap.dev.parent, xiic_process()
497 dev_dbg(i2c->adap.dev.parent, "%s clr: 0x%x\n", __func__, clr); xiic_process()
575 dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, len: %d", xiic_start_send()
577 dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n", xiic_start_send()
608 dev_dbg(i2c->adap.dev.parent, "%s entry\n", __func__); xiic_isr()
623 dev_dbg(i2c->adap.dev.parent, "%s entry, msg: %p, fifos space: %d\n", __xiic_start_xfer()
671 static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) xiic_xfer() argument
673 struct xiic_i2c *i2c = i2c_get_adapdata(adap); xiic_xfer()
676 dev_dbg(adap->dev.parent, "%s entry SR: 0x%x\n", __func__, xiic_xfer()
699 static u32 xiic_func(struct i2c_adapter *adap) xiic_func() argument
743 i2c->adap = xiic_adapter; xiic_i2c_probe()
744 i2c_set_adapdata(&i2c->adap, i2c); xiic_i2c_probe()
745 i2c->adap.dev.parent = &pdev->dev; xiic_i2c_probe()
746 i2c->adap.dev.of_node = pdev->dev.of_node; xiic_i2c_probe()
775 ret = i2c_add_adapter(&i2c->adap); xiic_i2c_probe()
785 i2c_new_device(&i2c->adap, pdata->devices + i); xiic_i2c_probe()
796 i2c_del_adapter(&i2c->adap); xiic_i2c_remove()
H A Di2c-amd756.c104 static int amd756_transaction(struct i2c_adapter *adap) amd756_transaction() argument
110 dev_dbg(&adap->dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, " amd756_transaction()
117 dev_dbg(&adap->dev, "SMBus busy (%04x). Waiting...\n", temp); amd756_transaction()
125 dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp); amd756_transaction()
142 dev_dbg(&adap->dev, "Completion timeout!\n"); amd756_transaction()
148 dev_dbg(&adap->dev, "SMBus Protocol error (no response)!\n"); amd756_transaction()
153 dev_warn(&adap->dev, "SMBus collision!\n"); amd756_transaction()
158 dev_dbg(&adap->dev, "SMBus protocol timeout!\n"); amd756_transaction()
162 dev_dbg(&adap->dev, "SMBus protocol success!\n"); amd756_transaction()
168 dev_dbg(&adap->dev, amd756_transaction()
173 dev_dbg(&adap->dev, amd756_transaction()
181 dev_warn(&adap->dev, "Sending abort\n"); amd756_transaction()
189 static s32 amd756_access(struct i2c_adapter * adap, u16 addr, amd756_access() argument
244 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); amd756_access()
251 status = amd756_transaction(adap); amd756_access()
H A Di2c-meson.c63 * @adap: I2C adapter instance
81 struct i2c_adapter adap; member in struct:meson_i2c
358 static int meson_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, meson_i2c_xfer() argument
361 struct meson_i2c *i2c = adap->algo_data; meson_i2c_xfer()
379 static u32 meson_i2c_func(struct i2c_adapter *adap) meson_i2c_func() argument
440 strlcpy(i2c->adap.name, "Meson I2C adapter", meson_i2c_probe()
441 sizeof(i2c->adap.name)); meson_i2c_probe()
442 i2c->adap.owner = THIS_MODULE; meson_i2c_probe()
443 i2c->adap.algo = &meson_i2c_algorithm; meson_i2c_probe()
444 i2c->adap.dev.parent = &pdev->dev; meson_i2c_probe()
445 i2c->adap.dev.of_node = np; meson_i2c_probe()
446 i2c->adap.algo_data = i2c; meson_i2c_probe()
454 ret = i2c_add_adapter(&i2c->adap); meson_i2c_probe()
468 i2c_del_adapter(&i2c->adap); meson_i2c_remove()
H A Di2c-sh7760.c83 struct i2c_adapter adap; member in struct:cami2c
303 static int sh7760_i2c_master_xfer(struct i2c_adapter *adap, sh7760_i2c_master_xfer() argument
307 struct cami2c *id = adap->algo_data; sh7760_i2c_master_xfer()
311 dev_err(&adap->dev, "sh7760-i2c%d: bus busy!\n", adap->nr); sh7760_i2c_master_xfer()
317 retr = adap->retries; sh7760_i2c_master_xfer()
376 static u32 sh7760_i2c_func(struct i2c_adapter *adap) sh7760_i2c_func() argument
476 id->adap.nr = pdev->id; sh7760_i2c_probe()
477 id->adap.algo = &sh7760_i2c_algo; sh7760_i2c_probe()
478 id->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; sh7760_i2c_probe()
479 id->adap.retries = 3; sh7760_i2c_probe()
480 id->adap.algo_data = id; sh7760_i2c_probe()
481 id->adap.dev.parent = &pdev->dev; sh7760_i2c_probe()
482 snprintf(id->adap.name, sizeof(id->adap.name), sh7760_i2c_probe()
512 ret = i2c_add_numbered_adapter(&id->adap); sh7760_i2c_probe()
514 dev_err(&pdev->dev, "reg adap failed: %d\n", ret); sh7760_i2c_probe()
542 i2c_del_adapter(&id->adap); sh7760_i2c_remove()
H A Di2c-kempld.c66 struct i2c_adapter adap; member in struct:kempld_i2c_data
195 static int kempld_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, kempld_i2c_xfer() argument
198 struct kempld_i2c_data *i2c = i2c_get_adapdata(adap); kempld_i2c_xfer()
282 static u32 kempld_i2c_func(struct i2c_adapter *adap) kempld_i2c_func() argument
312 i2c->adap = kempld_i2c_adapter; kempld_i2c_probe()
313 i2c->adap.dev.parent = i2c->dev; kempld_i2c_probe()
314 i2c_set_adapdata(&i2c->adap, i2c); kempld_i2c_probe()
328 i2c->adap.nr = i2c_bus; kempld_i2c_probe()
329 ret = i2c_add_numbered_adapter(&i2c->adap); kempld_i2c_probe()
357 i2c_del_adapter(&i2c->adap); kempld_i2c_remove()
H A Di2c-puv3.c50 static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length) xfer_read() argument
57 dev_dbg(&adap->dev, "Tx FIFO Not Full timeout\n"); xfer_read()
72 dev_dbg(&adap->dev, "RXRDY timeout\n"); xfer_read()
84 static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length) xfer_write() argument
121 static int puv3_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, puv3_i2c_xfer() argument
138 dev_dbg(&adap->dev, "puv3_i2c_xfer: processing %d messages:\n", num); puv3_i2c_xfer()
141 dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i, puv3_i2c_xfer()
148 ret = xfer_read(adap, pmsg->buf, pmsg->len); puv3_i2c_xfer()
150 ret = xfer_write(adap, pmsg->buf, pmsg->len); puv3_i2c_xfer()
156 dev_dbg(&adap->dev, "transfer complete\n"); puv3_i2c_xfer()
H A Di2c-highlander.c278 static int highlander_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, highlander_i2c_smbus_xfer() argument
283 struct highlander_i2c_dev *dev = i2c_get_adapdata(adap); highlander_i2c_smbus_xfer()
361 struct i2c_adapter *adap; highlander_i2c_probe() local
404 adap = &dev->adapter; highlander_i2c_probe()
405 i2c_set_adapdata(adap, dev); highlander_i2c_probe()
406 adap->owner = THIS_MODULE; highlander_i2c_probe()
407 adap->class = I2C_CLASS_HWMON; highlander_i2c_probe()
408 strlcpy(adap->name, "HL FPGA I2C adapter", sizeof(adap->name)); highlander_i2c_probe()
409 adap->algo = &highlander_i2c_algo; highlander_i2c_probe()
410 adap->dev.parent = &pdev->dev; highlander_i2c_probe()
411 adap->nr = pdev->id; highlander_i2c_probe()
422 ret = i2c_add_numbered_adapter(adap); highlander_i2c_probe()
H A Di2c-riic.c118 static int riic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) riic_xfer() argument
120 struct riic_dev *riic = i2c_get_adapdata(adap); riic_xfer()
262 static u32 riic_func(struct i2c_adapter *adap) riic_func() argument
336 struct i2c_adapter *adap; riic_i2c_probe() local
369 adap = &riic->adapter; riic_i2c_probe()
370 i2c_set_adapdata(adap, riic); riic_i2c_probe()
371 strlcpy(adap->name, "Renesas RIIC adapter", sizeof(adap->name)); riic_i2c_probe()
372 adap->owner = THIS_MODULE; riic_i2c_probe()
373 adap->algo = &riic_algo; riic_i2c_probe()
374 adap->dev.parent = &pdev->dev; riic_i2c_probe()
375 adap->dev.of_node = pdev->dev.of_node; riic_i2c_probe()
385 ret = i2c_add_adapter(adap); riic_i2c_probe()
H A Di2c-hix5hd2.c87 struct i2c_adapter adap; member in struct:hix5hd2_i2c_priv
342 priv->adap.timeout); hix5hd2_i2c_xfer_msg()
348 priv->adap.timeout); hix5hd2_i2c_xfer_msg()
365 static int hix5hd2_i2c_xfer(struct i2c_adapter *adap, hix5hd2_i2c_xfer() argument
368 struct hix5hd2_i2c_priv *priv = i2c_get_adapdata(adap); hix5hd2_i2c_xfer()
398 static u32 hix5hd2_i2c_func(struct i2c_adapter *adap) hix5hd2_i2c_func() argument
451 strlcpy(priv->adap.name, "hix5hd2-i2c", sizeof(priv->adap.name)); hix5hd2_i2c_probe()
453 priv->adap.owner = THIS_MODULE; hix5hd2_i2c_probe()
454 priv->adap.algo = &hix5hd2_i2c_algorithm; hix5hd2_i2c_probe()
455 priv->adap.retries = 3; hix5hd2_i2c_probe()
456 priv->adap.dev.of_node = np; hix5hd2_i2c_probe()
457 priv->adap.algo_data = priv; hix5hd2_i2c_probe()
458 priv->adap.dev.parent = &pdev->dev; hix5hd2_i2c_probe()
459 i2c_set_adapdata(&priv->adap, priv); hix5hd2_i2c_probe()
480 ret = i2c_add_adapter(&priv->adap); hix5hd2_i2c_probe()
500 i2c_del_adapter(&priv->adap); hix5hd2_i2c_remove()
H A Di2c-sirf.c235 static u32 i2c_sirfsoc_func(struct i2c_adapter *adap) i2c_sirfsoc_func() argument
240 static int i2c_sirfsoc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, i2c_sirfsoc_xfer() argument
243 struct sirfsoc_i2c *siic = adap->algo_data; i2c_sirfsoc_xfer()
277 struct i2c_adapter *adap; i2c_sirfsoc_probe() local
313 adap = &siic->adapter; i2c_sirfsoc_probe()
314 adap->class = I2C_CLASS_DEPRECATED; i2c_sirfsoc_probe()
333 adap->algo = &i2c_sirfsoc_algo; i2c_sirfsoc_probe()
334 adap->algo_data = siic; i2c_sirfsoc_probe()
335 adap->retries = 3; i2c_sirfsoc_probe()
337 adap->dev.of_node = pdev->dev.of_node; i2c_sirfsoc_probe()
338 adap->dev.parent = &pdev->dev; i2c_sirfsoc_probe()
339 adap->nr = pdev->id; i2c_sirfsoc_probe()
341 strlcpy(adap->name, "sirfsoc-i2c", sizeof(adap->name)); i2c_sirfsoc_probe()
343 platform_set_drvdata(pdev, adap); i2c_sirfsoc_probe()
391 err = i2c_add_numbered_adapter(adap); i2c_sirfsoc_probe()
H A Di2c-piix4.c437 static s32 piix4_access(struct i2c_adapter * adap, u16 addr, piix4_access() argument
441 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); piix4_access()
493 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); piix4_access()
499 status = piix4_transaction(adap); piix4_access()
570 struct i2c_adapter *adap; piix4_add_adapter() local
574 adap = kzalloc(sizeof(*adap), GFP_KERNEL); piix4_add_adapter()
575 if (adap == NULL) { piix4_add_adapter()
580 adap->owner = THIS_MODULE; piix4_add_adapter()
581 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; piix4_add_adapter()
582 adap->algo = &smbus_algorithm; piix4_add_adapter()
586 kfree(adap); piix4_add_adapter()
594 adap->dev.parent = &dev->dev; piix4_add_adapter()
596 snprintf(adap->name, sizeof(adap->name), piix4_add_adapter()
599 i2c_set_adapdata(adap, adapdata); piix4_add_adapter()
601 retval = i2c_add_adapter(adap); piix4_add_adapter()
605 kfree(adap); piix4_add_adapter()
610 *padap = adap; piix4_add_adapter()
663 static void piix4_adap_remove(struct i2c_adapter *adap) piix4_adap_remove() argument
665 struct i2c_piix4_adapdata *adapdata = i2c_get_adapdata(adap); piix4_adap_remove()
668 i2c_del_adapter(adap); piix4_adap_remove()
671 kfree(adap); piix4_adap_remove()
H A Di2c-mxs.c177 static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap, mxs_i2c_dma_setup_xfer() argument
181 struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap); mxs_i2c_dma_setup_xfer()
370 static int mxs_i2c_pio_setup_xfer(struct i2c_adapter *adap, mxs_i2c_pio_setup_xfer() argument
373 struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap); mxs_i2c_pio_setup_xfer()
564 static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, mxs_i2c_xfer_msg() argument
567 struct mxs_i2c_dev *i2c = i2c_get_adapdata(adap); mxs_i2c_xfer_msg()
593 ret = mxs_i2c_pio_setup_xfer(adap, msg, flags); mxs_i2c_xfer_msg()
599 ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); mxs_i2c_xfer_msg()
648 static int mxs_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], mxs_i2c_xfer() argument
655 err = mxs_i2c_xfer_msg(adap, &msgs[i], i == (num - 1)); mxs_i2c_xfer()
663 static u32 mxs_i2c_func(struct i2c_adapter *adap) mxs_i2c_func() argument
811 struct i2c_adapter *adap; mxs_i2c_probe() local
861 adap = &i2c->adapter; mxs_i2c_probe()
862 strlcpy(adap->name, "MXS I2C adapter", sizeof(adap->name)); mxs_i2c_probe()
863 adap->owner = THIS_MODULE; mxs_i2c_probe()
864 adap->algo = &mxs_i2c_algo; mxs_i2c_probe()
865 adap->dev.parent = dev; mxs_i2c_probe()
866 adap->nr = pdev->id; mxs_i2c_probe()
867 adap->dev.of_node = pdev->dev.of_node; mxs_i2c_probe()
868 i2c_set_adapdata(adap, i2c); mxs_i2c_probe()
869 err = i2c_add_numbered_adapter(adap); mxs_i2c_probe()
H A Di2c-bcm-iproc.c273 static uint32_t bcm_iproc_i2c_functionality(struct i2c_adapter *adap) bcm_iproc_i2c_functionality() argument
371 struct i2c_adapter *adap; bcm_iproc_i2c_probe() local
412 adap = &iproc_i2c->adapter; bcm_iproc_i2c_probe()
413 i2c_set_adapdata(adap, iproc_i2c); bcm_iproc_i2c_probe()
414 strlcpy(adap->name, "Broadcom iProc I2C adapter", sizeof(adap->name)); bcm_iproc_i2c_probe()
415 adap->algo = &bcm_iproc_algo; bcm_iproc_i2c_probe()
416 adap->quirks = &bcm_iproc_i2c_quirks; bcm_iproc_i2c_probe()
417 adap->dev.parent = &pdev->dev; bcm_iproc_i2c_probe()
418 adap->dev.of_node = pdev->dev.of_node; bcm_iproc_i2c_probe()
420 ret = i2c_add_adapter(adap); bcm_iproc_i2c_probe()
H A Di2c-sis5595.c225 static int sis5595_transaction(struct i2c_adapter *adap) sis5595_transaction() argument
234 dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp); sis5595_transaction()
238 dev_dbg(&adap->dev, "Failed! (%02x)\n", temp); sis5595_transaction()
241 dev_dbg(&adap->dev, "Successful!\n"); sis5595_transaction()
256 dev_dbg(&adap->dev, "SMBus Timeout!\n"); sis5595_transaction()
261 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); sis5595_transaction()
266 dev_err(&adap->dev, "Bus collision! SMBus may be locked until " sis5595_transaction()
280 dev_dbg(&adap->dev, "Failed reset at end of transaction (%02x)\n", temp); sis5595_transaction()
286 static s32 sis5595_access(struct i2c_adapter *adap, u16 addr, sis5595_access() argument
322 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); sis5595_access()
328 status = sis5595_transaction(adap); sis5595_access()
H A Di2c-rcar.c110 struct i2c_adapter adap; member in struct:rcar_i2c_priv
124 #define rcar_i2c_priv_to_dev(p) ((p)->adap.dev.parent)
487 static int rcar_i2c_master_xfer(struct i2c_adapter *adap, rcar_i2c_master_xfer() argument
491 struct rcar_i2c_priv *priv = i2c_get_adapdata(adap); rcar_i2c_master_xfer()
537 adap->timeout); rcar_i2c_master_xfer()
606 static u32 rcar_i2c_func(struct i2c_adapter *adap) rcar_i2c_func() argument
637 struct i2c_adapter *adap; rcar_i2c_probe() local
671 adap = &priv->adap; rcar_i2c_probe()
672 adap->nr = pdev->id; rcar_i2c_probe()
673 adap->algo = &rcar_i2c_algo; rcar_i2c_probe()
674 adap->class = I2C_CLASS_DEPRECATED; rcar_i2c_probe()
675 adap->retries = 3; rcar_i2c_probe()
676 adap->dev.parent = dev; rcar_i2c_probe()
677 adap->dev.of_node = dev->of_node; rcar_i2c_probe()
678 i2c_set_adapdata(adap, priv); rcar_i2c_probe()
679 strlcpy(adap->name, pdev->name, sizeof(adap->name)); rcar_i2c_probe()
691 ret = i2c_add_numbered_adapter(adap); rcar_i2c_probe()
693 dev_err(dev, "reg adap failed: %d\n", ret); rcar_i2c_probe()
708 i2c_del_adapter(&priv->adap); rcar_i2c_remove()
H A Di2c-ali15x3.c227 static int ali15x3_transaction(struct i2c_adapter *adap) ali15x3_transaction() argument
233 dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, " ali15x3_transaction()
265 dev_info(&adap->dev, "Resetting entire SMB Bus to " ali15x3_transaction()
280 dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - " ali15x3_transaction()
306 dev_err(&adap->dev, "SMBus Timeout!\n"); ali15x3_transaction()
311 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); ali15x3_transaction()
322 dev_dbg(&adap->dev, ali15x3_transaction()
330 dev_err(&adap->dev, "Error: device error\n"); ali15x3_transaction()
332 dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, " ali15x3_transaction()
340 static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr, ali15x3_access() argument
359 dev_err(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp); ali15x3_access()
416 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); ali15x3_access()
422 temp = ali15x3_transaction(adap); ali15x3_access()
449 dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n", ali15x3_access()
H A Di2c-cadence.c125 * @adap: I2C adapter instance
145 struct i2c_adapter adap; member in struct:cdns_i2c
480 * @adap: pointer to the i2c adapter driver instance
485 static void cdns_i2c_master_reset(struct i2c_adapter *adap) cdns_i2c_master_reset() argument
487 struct cdns_i2c *id = adap->algo_data; cdns_i2c_master_reset()
508 struct i2c_adapter *adap) cdns_i2c_process_msg()
536 time_left = wait_for_completion_timeout(&id->xfer_done, adap->timeout); cdns_i2c_process_msg()
538 cdns_i2c_master_reset(adap); cdns_i2c_process_msg()
539 dev_err(id->adap.dev.parent, cdns_i2c_process_msg()
556 * @adap: pointer to the i2c adapter driver instance
564 static int cdns_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, cdns_i2c_master_xfer() argument
569 struct cdns_i2c *id = adap->algo_data; cdns_i2c_master_xfer()
591 dev_warn(adap->dev.parent, cdns_i2c_master_xfer()
609 ret = cdns_i2c_process_msg(id, msgs, adap); cdns_i2c_master_xfer()
615 cdns_i2c_master_reset(adap); cdns_i2c_master_xfer()
629 * @adap: pointer to the i2c adapter structure
633 static u32 cdns_i2c_func(struct i2c_adapter *adap) cdns_i2c_func() argument
776 dev_warn(id->adap.dev.parent, cdns_i2c_clk_notifier_cb()
899 id->adap.owner = THIS_MODULE; cdns_i2c_probe()
900 id->adap.dev.of_node = pdev->dev.of_node; cdns_i2c_probe()
901 id->adap.algo = &cdns_i2c_algo; cdns_i2c_probe()
902 id->adap.timeout = CDNS_I2C_TIMEOUT; cdns_i2c_probe()
903 id->adap.retries = 3; /* Default retry value. */ cdns_i2c_probe()
904 id->adap.algo_data = id; cdns_i2c_probe()
905 id->adap.dev.parent = &pdev->dev; cdns_i2c_probe()
907 snprintf(id->adap.name, sizeof(id->adap.name), cdns_i2c_probe()
947 ret = i2c_add_adapter(&id->adap); cdns_i2c_probe()
949 dev_err(&pdev->dev, "reg adap failed: %d\n", ret); cdns_i2c_probe()
984 i2c_del_adapter(&id->adap); cdns_i2c_remove()
507 cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, struct i2c_adapter *adap) cdns_i2c_process_msg() argument
H A Di2c-omap.c620 static int omap_i2c_xfer_msg(struct i2c_adapter *adap, omap_i2c_xfer_msg() argument
623 struct omap_i2c_dev *omap = i2c_get_adapdata(adap); omap_i2c_xfer_msg()
744 omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) omap_i2c_xfer() argument
746 struct omap_i2c_dev *omap = i2c_get_adapdata(adap); omap_i2c_xfer()
766 r = omap_i2c_xfer_msg(adap, &msgs[i], (i == (num - 1))); omap_i2c_xfer()
786 omap_i2c_func(struct i2c_adapter *adap) omap_i2c_func() argument
1211 static int omap_i2c_get_scl(struct i2c_adapter *adap) omap_i2c_get_scl() argument
1213 struct omap_i2c_dev *dev = i2c_get_adapdata(adap); omap_i2c_get_scl()
1221 static int omap_i2c_get_sda(struct i2c_adapter *adap) omap_i2c_get_sda() argument
1223 struct omap_i2c_dev *dev = i2c_get_adapdata(adap); omap_i2c_get_sda()
1231 static void omap_i2c_set_scl(struct i2c_adapter *adap, int val) omap_i2c_set_scl() argument
1233 struct omap_i2c_dev *dev = i2c_get_adapdata(adap); omap_i2c_set_scl()
1244 static void omap_i2c_prepare_recovery(struct i2c_adapter *adap) omap_i2c_prepare_recovery() argument
1246 struct omap_i2c_dev *dev = i2c_get_adapdata(adap); omap_i2c_prepare_recovery()
1261 static void omap_i2c_unprepare_recovery(struct i2c_adapter *adap) omap_i2c_unprepare_recovery() argument
1263 struct omap_i2c_dev *dev = i2c_get_adapdata(adap); omap_i2c_unprepare_recovery()
1288 struct i2c_adapter *adap; omap_i2c_probe() local
1425 adap = &omap->adapter; omap_i2c_probe()
1426 i2c_set_adapdata(adap, omap); omap_i2c_probe()
1427 adap->owner = THIS_MODULE; omap_i2c_probe()
1428 adap->class = I2C_CLASS_DEPRECATED; omap_i2c_probe()
1429 strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name)); omap_i2c_probe()
1430 adap->algo = &omap_i2c_algo; omap_i2c_probe()
1431 adap->dev.parent = &pdev->dev; omap_i2c_probe()
1432 adap->dev.of_node = pdev->dev.of_node; omap_i2c_probe()
1433 adap->bus_recovery_info = &omap_i2c_bus_recovery_info; omap_i2c_probe()
1436 adap->nr = pdev->id; omap_i2c_probe()
1437 r = i2c_add_numbered_adapter(adap); omap_i2c_probe()
1443 dev_info(omap->dev, "bus %d rev%d.%d at %d kHz\n", adap->nr, omap_i2c_probe()
H A Di2c-st.c174 * @adap: I2C adapter for this controller
187 struct i2c_adapter adap; member in struct:st_i2c_dev
654 i2c_dev->adap.timeout); st_i2c_xfer_msg()
738 static u32 st_i2c_func(struct i2c_adapter *adap) st_i2c_func() argument
776 struct i2c_adapter *adap; st_i2c_probe() local
823 adap = &i2c_dev->adap; st_i2c_probe()
824 i2c_set_adapdata(adap, i2c_dev); st_i2c_probe()
825 snprintf(adap->name, sizeof(adap->name), "ST I2C(%pa)", &res->start); st_i2c_probe()
826 adap->owner = THIS_MODULE; st_i2c_probe()
827 adap->timeout = 2 * HZ; st_i2c_probe()
828 adap->retries = 0; st_i2c_probe()
829 adap->algo = &st_i2c_algo; st_i2c_probe()
830 adap->dev.parent = &pdev->dev; st_i2c_probe()
831 adap->dev.of_node = pdev->dev.of_node; st_i2c_probe()
835 ret = i2c_add_adapter(adap); st_i2c_probe()
843 dev_info(i2c_dev->dev, "%s initialized\n", adap->name); st_i2c_probe()
852 i2c_del_adapter(&i2c_dev->adap); st_i2c_remove()
H A Di2c-brcmstb.c507 static u32 brcmstb_i2c_functionality(struct i2c_adapter *adap) brcmstb_i2c_functionality() argument
556 struct i2c_adapter *adap; brcmstb_i2c_probe() local
613 adap = &dev->adapter; brcmstb_i2c_probe()
614 i2c_set_adapdata(adap, dev); brcmstb_i2c_probe()
615 adap->owner = THIS_MODULE; brcmstb_i2c_probe()
616 strlcpy(adap->name, "Broadcom STB : ", sizeof(adap->name)); brcmstb_i2c_probe()
618 strlcat(adap->name, int_name, sizeof(adap->name)); brcmstb_i2c_probe()
619 adap->algo = &brcmstb_i2c_algo; brcmstb_i2c_probe()
620 adap->dev.parent = &pdev->dev; brcmstb_i2c_probe()
621 adap->dev.of_node = pdev->dev.of_node; brcmstb_i2c_probe()
622 rc = i2c_add_adapter(adap); brcmstb_i2c_probe()
H A Di2c-lpc2k.c82 struct i2c_adapter adap; member in struct:lpc2k_i2c
300 static int i2c_lpc2k_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, i2c_lpc2k_xfer() argument
303 struct lpc2k_i2c *i2c = i2c_get_adapdata(adap); i2c_lpc2k_xfer()
342 static u32 i2c_lpc2k_functionality(struct i2c_adapter *adap) i2c_lpc2k_functionality() argument
429 i2c_set_adapdata(&i2c->adap, i2c); i2c_lpc2k_probe()
430 i2c->adap.owner = THIS_MODULE; i2c_lpc2k_probe()
431 strlcpy(i2c->adap.name, "LPC2K I2C adapter", sizeof(i2c->adap.name)); i2c_lpc2k_probe()
432 i2c->adap.algo = &i2c_lpc2k_algorithm; i2c_lpc2k_probe()
433 i2c->adap.dev.parent = &pdev->dev; i2c_lpc2k_probe()
434 i2c->adap.dev.of_node = pdev->dev.of_node; i2c_lpc2k_probe()
436 ret = i2c_add_adapter(&i2c->adap); i2c_lpc2k_probe()
455 i2c_del_adapter(&i2c->adap); i2c_lpc2k_remove()
H A Di2c-ibm_iic.c418 !(in_8(&iic->sts) & STS_PT), dev->adap.timeout); iic_wait_for_tc()
429 unsigned long x = jiffies + dev->adap.timeout; iic_wait_for_tc()
554 static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) iic_xfer() argument
556 struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap)); iic_xfer()
626 static u32 iic_func(struct i2c_adapter *adap) iic_func() argument
698 struct i2c_adapter *adap; iic_probe() local
744 adap = &dev->adap; iic_probe()
745 adap->dev.parent = &ofdev->dev; iic_probe()
746 adap->dev.of_node = of_node_get(np); iic_probe()
747 strlcpy(adap->name, "IBM IIC", sizeof(adap->name)); iic_probe()
748 i2c_set_adapdata(adap, dev); iic_probe()
749 adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; iic_probe()
750 adap->algo = &iic_algo; iic_probe()
751 adap->timeout = HZ; iic_probe()
753 ret = i2c_add_adapter(adap); iic_probe()
784 i2c_del_adapter(&dev->adap); iic_remove()
H A Di2c-sun6i-p2wi.c112 static u32 p2wi_functionality(struct i2c_adapter *adap) p2wi_functionality() argument
117 static int p2wi_smbus_xfer(struct i2c_adapter *adap, u16 addr, p2wi_smbus_xfer() argument
121 struct p2wi *p2wi = i2c_get_adapdata(adap); p2wi_smbus_xfer()
125 dev_err(&adap->dev, "invalid P2WI address\n"); p2wi_smbus_xfer()
142 dev_err(&adap->dev, "P2WI bus busy\n"); p2wi_smbus_xfer()
157 dev_err(&adap->dev, "P2WI bus busy\n"); p2wi_smbus_xfer()
162 dev_err(&adap->dev, "P2WI bus xfer error\n"); p2wi_smbus_xfer()
H A Di2c-octeon.c65 struct i2c_adapter adap; member in struct:octeon_i2c
209 i2c->adap.timeout); octeon_i2c_wait()
390 * @adap: Pointer to the i2c_adapter structure.
397 static int octeon_i2c_xfer(struct i2c_adapter *adap, octeon_i2c_xfer() argument
404 struct octeon_i2c *i2c = i2c_get_adapdata(adap); octeon_i2c_xfer()
424 static u32 octeon_i2c_functionality(struct i2c_adapter *adap) octeon_i2c_functionality() argument
584 i2c->adap = octeon_i2c_ops; octeon_i2c_probe()
585 i2c->adap.dev.parent = &pdev->dev; octeon_i2c_probe()
586 i2c->adap.dev.of_node = pdev->dev.of_node; octeon_i2c_probe()
587 i2c_set_adapdata(&i2c->adap, i2c); octeon_i2c_probe()
590 result = i2c_add_adapter(&i2c->adap); octeon_i2c_probe()
607 i2c_del_adapter(&i2c->adap); octeon_i2c_remove()
H A Di2c-mt65xx.c138 struct i2c_adapter adap; /* i2c host adapter */ member in struct:mtk_i2c
474 i2c->adap.timeout); mtk_i2c_do_transfer()
510 static int mtk_i2c_transfer(struct i2c_adapter *adap, mtk_i2c_transfer() argument
515 struct mtk_i2c *i2c = i2c_get_adapdata(adap); mtk_i2c_transfer()
580 static u32 mtk_i2c_functionality(struct i2c_adapter *adap) mtk_i2c_functionality() argument
652 i2c->adap.dev.of_node = pdev->dev.of_node; mtk_i2c_probe()
654 i2c->adap.dev.parent = &pdev->dev; mtk_i2c_probe()
655 i2c->adap.owner = THIS_MODULE; mtk_i2c_probe()
656 i2c->adap.algo = &mtk_i2c_algorithm; mtk_i2c_probe()
657 i2c->adap.quirks = i2c->dev_comp->quirks; mtk_i2c_probe()
658 i2c->adap.timeout = 2 * HZ; mtk_i2c_probe()
659 i2c->adap.retries = 1; mtk_i2c_probe()
686 strlcpy(i2c->adap.name, I2C_DRV_NAME, sizeof(i2c->adap.name)); mtk_i2c_probe()
710 i2c_set_adapdata(&i2c->adap, i2c); mtk_i2c_probe()
711 ret = i2c_add_adapter(&i2c->adap); mtk_i2c_probe()
726 i2c_del_adapter(&i2c->adap); mtk_i2c_remove()
H A Di2c-s3c2410.c123 struct i2c_adapter adap; member in struct:s3c24xx_i2c
780 static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, s3c24xx_i2c_xfer() argument
783 struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data; s3c24xx_i2c_xfer()
787 pm_runtime_get_sync(&adap->dev); s3c24xx_i2c_xfer()
792 for (retry = 0; retry < adap->retries; retry++) { s3c24xx_i2c_xfer()
798 pm_runtime_put(&adap->dev); s3c24xx_i2c_xfer()
808 pm_runtime_put(&adap->dev); s3c24xx_i2c_xfer()
813 static u32 s3c24xx_i2c_func(struct i2c_adapter *adap) s3c24xx_i2c_func() argument
945 i2c_lock_adapter(&i2c->adap); s3c24xx_i2c_cpufreq_transition()
947 i2c_unlock_adapter(&i2c->adap); s3c24xx_i2c_cpufreq_transition()
1152 strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); s3c24xx_i2c_probe()
1153 i2c->adap.owner = THIS_MODULE; s3c24xx_i2c_probe()
1154 i2c->adap.algo = &s3c24xx_i2c_algorithm; s3c24xx_i2c_probe()
1155 i2c->adap.retries = 2; s3c24xx_i2c_probe()
1156 i2c->adap.class = I2C_CLASS_DEPRECATED; s3c24xx_i2c_probe()
1186 i2c->adap.algo_data = i2c; s3c24xx_i2c_probe()
1187 i2c->adap.dev.parent = &pdev->dev; s3c24xx_i2c_probe()
1243 i2c->adap.nr = i2c->pdata->bus_num; s3c24xx_i2c_probe()
1244 i2c->adap.dev.of_node = pdev->dev.of_node; s3c24xx_i2c_probe()
1250 ret = i2c_add_numbered_adapter(&i2c->adap); s3c24xx_i2c_probe()
1259 pm_runtime_enable(&i2c->adap.dev); s3c24xx_i2c_probe()
1261 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); s3c24xx_i2c_probe()
1276 pm_runtime_disable(&i2c->adap.dev); s3c24xx_i2c_remove()
1281 i2c_del_adapter(&i2c->adap); s3c24xx_i2c_remove()
H A Di2c-ocores.c34 struct i2c_adapter adap; member in struct:ocores_i2c
219 static int ocores_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ocores_xfer() argument
221 struct ocores_i2c *i2c = i2c_get_adapdata(adap); ocores_xfer()
272 static u32 ocores_func(struct i2c_adapter *adap) ocores_func() argument
491 i2c->adap = ocores_adapter; ocores_i2c_probe()
492 i2c_set_adapdata(&i2c->adap, i2c); ocores_i2c_probe()
493 i2c->adap.dev.parent = &pdev->dev; ocores_i2c_probe()
494 i2c->adap.dev.of_node = pdev->dev.of_node; ocores_i2c_probe()
497 ret = i2c_add_adapter(&i2c->adap); ocores_i2c_probe()
506 i2c_new_device(&i2c->adap, pdata->devices + i); ocores_i2c_probe()
521 i2c_del_adapter(&i2c->adap); ocores_i2c_remove()
H A Di2c-designware-pcidrv.c191 struct i2c_adapter *adap; i2c_dw_pci_probe() local
245 adap = &dev->adapter; i2c_dw_pci_probe()
246 adap->owner = THIS_MODULE; i2c_dw_pci_probe()
247 adap->class = 0; i2c_dw_pci_probe()
248 ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); i2c_dw_pci_probe()
249 adap->nr = controller->bus_num; i2c_dw_pci_probe()
H A Di2c-designware-platdrv.c138 struct i2c_adapter *adap; dw_i2c_plat_probe() local
232 adap = &dev->adapter; dw_i2c_plat_probe()
233 adap->owner = THIS_MODULE; dw_i2c_plat_probe()
234 adap->class = I2C_CLASS_DEPRECATED; dw_i2c_plat_probe()
235 ACPI_COMPANION_SET(&adap->dev, ACPI_COMPANION(&pdev->dev)); dw_i2c_plat_probe()
236 adap->dev.of_node = pdev->dev.of_node; dw_i2c_plat_probe()
H A Di2c-ali1535.c221 static int ali1535_transaction(struct i2c_adapter *adap) ali1535_transaction() argument
227 dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, " ali1535_transaction()
257 dev_info(&adap->dev, ali1535_transaction()
274 dev_err(&adap->dev, ali1535_transaction()
299 dev_err(&adap->dev, "SMBus Timeout!\n"); ali1535_transaction()
304 dev_dbg(&adap->dev, "Error: Failed bus transaction\n"); ali1535_transaction()
313 dev_dbg(&adap->dev, ali1535_transaction()
321 dev_err(&adap->dev, "Error: device error\n"); ali1535_transaction()
327 dev_err(&adap->dev, "Error: command never completed\n"); ali1535_transaction()
330 dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, " ali1535_transaction()
350 static s32 ali1535_access(struct i2c_adapter *adap, u16 addr, ali1535_access() argument
368 dev_warn(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp); ali1535_access()
432 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); ali1535_access()
437 result = ali1535_transaction(adap); ali1535_access()
465 dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n", ali1535_access()
H A Di2c-exynos5.c159 struct i2c_adapter adap; member in struct:exynos5_i2c
393 writel(HSI2C_MASTER_ID(MASTER_ID(i2c->adap.nr)), exynos5_i2c_init()
663 static int exynos5_i2c_xfer(struct i2c_adapter *adap, exynos5_i2c_xfer() argument
666 struct exynos5_i2c *i2c = adap->algo_data; exynos5_i2c_xfer()
704 static u32 exynos5_i2c_func(struct i2c_adapter *adap) exynos5_i2c_func() argument
740 strlcpy(i2c->adap.name, "exynos5-i2c", sizeof(i2c->adap.name)); exynos5_i2c_probe()
741 i2c->adap.owner = THIS_MODULE; exynos5_i2c_probe()
742 i2c->adap.algo = &exynos5_i2c_algorithm; exynos5_i2c_probe()
743 i2c->adap.retries = 3; exynos5_i2c_probe()
763 i2c->adap.dev.of_node = np; exynos5_i2c_probe()
764 i2c->adap.algo_data = i2c; exynos5_i2c_probe()
765 i2c->adap.dev.parent = &pdev->dev; exynos5_i2c_probe()
798 ret = i2c_add_adapter(&i2c->adap); exynos5_i2c_probe()
819 i2c_del_adapter(&i2c->adap); exynos5_i2c_remove()
H A Di2c-nomadik.c157 * @adap: corresponding I2C adapter.
174 struct i2c_adapter adap; member in struct:nmk_i2c_dev
233 timeout = jiffies + dev->adap.timeout; flush_i2c_fifo()
480 &dev->xfer_complete, dev->adap.timeout); read_i2c()
560 &dev->xfer_complete, dev->adap.timeout); write_i2c()
646 * i2c_transfer(adap, msg, 2);
658 * i2c_transfer(adap, msg, 1);
940 static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap) nmk_i2c_functionality() argument
972 struct i2c_adapter *adap; nmk_i2c_probe() local
1032 adap = &dev->adap; nmk_i2c_probe()
1033 adap->dev.of_node = np; nmk_i2c_probe()
1034 adap->dev.parent = &adev->dev; nmk_i2c_probe()
1035 adap->owner = THIS_MODULE; nmk_i2c_probe()
1036 adap->class = I2C_CLASS_DEPRECATED; nmk_i2c_probe()
1037 adap->algo = &nmk_i2c_algo; nmk_i2c_probe()
1038 adap->timeout = msecs_to_jiffies(dev->timeout); nmk_i2c_probe()
1039 snprintf(adap->name, sizeof(adap->name), nmk_i2c_probe()
1042 i2c_set_adapdata(adap, dev); nmk_i2c_probe()
1046 adap->name, dev->virtbase); nmk_i2c_probe()
1048 ret = i2c_add_adapter(adap); nmk_i2c_probe()
1070 i2c_del_adapter(&dev->adap); nmk_i2c_remove()
H A Di2c-mpc.c66 struct i2c_adapter adap; member in struct:mpc_i2c
465 unsigned timeout = i2c->adap.timeout; mpc_write()
492 unsigned timeout = i2c->adap.timeout; mpc_read()
560 static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) mpc_xfer() argument
566 struct mpc_i2c *i2c = i2c_get_adapdata(adap); mpc_xfer()
629 static u32 mpc_functionality(struct i2c_adapter *adap) mpc_functionality() argument
731 i2c->adap = mpc_ops; fsl_i2c_probe()
733 scnprintf(i2c->adap.name, sizeof(i2c->adap.name), fsl_i2c_probe()
735 i2c_set_adapdata(&i2c->adap, i2c); fsl_i2c_probe()
736 i2c->adap.dev.parent = &op->dev; fsl_i2c_probe()
737 i2c->adap.dev.of_node = of_node_get(op->dev.of_node); fsl_i2c_probe()
739 result = i2c_add_adapter(&i2c->adap); fsl_i2c_probe()
763 i2c_del_adapter(&i2c->adap); fsl_i2c_remove()
H A Di2c-qup.c108 struct i2c_adapter adap; member in struct:qup_i2c_dev
463 static int qup_i2c_xfer(struct i2c_adapter *adap, qup_i2c_xfer() argument
467 struct qup_i2c_dev *qup = i2c_get_adapdata(adap); qup_i2c_xfer()
516 static u32 qup_i2c_func(struct i2c_adapter *adap) qup_i2c_func() argument
669 i2c_set_adapdata(&qup->adap, qup); qup_i2c_probe()
670 qup->adap.algo = &qup_i2c_algo; qup_i2c_probe()
671 qup->adap.quirks = &qup_i2c_quirks; qup_i2c_probe()
672 qup->adap.dev.parent = qup->dev; qup_i2c_probe()
673 qup->adap.dev.of_node = pdev->dev.of_node; qup_i2c_probe()
674 strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name)); qup_i2c_probe()
681 ret = i2c_add_adapter(&qup->adap); qup_i2c_probe()
701 i2c_del_adapter(&qup->adap); qup_i2c_remove()
H A Di2c-axxia.c433 axxia_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) axxia_i2c_xfer() argument
435 struct axxia_i2c_dev *idev = i2c_get_adapdata(adap); axxia_i2c_xfer()
447 static int axxia_i2c_get_scl(struct i2c_adapter *adap) axxia_i2c_get_scl() argument
449 struct axxia_i2c_dev *idev = i2c_get_adapdata(adap); axxia_i2c_get_scl()
454 static void axxia_i2c_set_scl(struct i2c_adapter *adap, int val) axxia_i2c_set_scl() argument
456 struct axxia_i2c_dev *idev = i2c_get_adapdata(adap); axxia_i2c_set_scl()
466 static int axxia_i2c_get_sda(struct i2c_adapter *adap) axxia_i2c_get_sda() argument
468 struct axxia_i2c_dev *idev = i2c_get_adapdata(adap); axxia_i2c_get_sda()
480 static u32 axxia_i2c_func(struct i2c_adapter *adap) axxia_i2c_func() argument
H A Di2c-scmi.c80 acpi_smbus_cmi_access(struct i2c_adapter *adap, u16 addr, unsigned short flags, acpi_smbus_cmi_access() argument
85 struct acpi_smbus_cmi *smbus_cmi = adap->algo_data; acpi_smbus_cmi_access()
96 dev_dbg(&adap->dev, "access size: %d %s\n", size, acpi_smbus_cmi_access()
156 dev_warn(&adap->dev, "Unsupported transaction %d\n", size); acpi_smbus_cmi_access()
262 dev_dbg(&adap->dev, "Transaction status: %i\n", result); acpi_smbus_cmi_access()
H A Di2c-img-scb.c364 struct i2c_adapter adap; member in struct:img_i2c
484 dev_dbg(i2c->adap.dev.parent, img_i2c_atomic_op()
734 dev_dbg(i2c->adap.dev.parent, "abort condition detected\n"); img_i2c_atomic()
797 dev_err(i2c->adap.dev.parent, "bad atomic command %d\n", img_i2c_atomic()
830 dev_dbg(i2c->adap.dev.parent, img_i2c_check_timer()
848 dev_dbg(i2c->adap.dev.parent, "abort condition detected\n"); img_i2c_auto()
931 dev_crit(i2c->adap.dev.parent, img_i2c_isr()
1003 static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, img_i2c_xfer() argument
1006 struct img_i2c *i2c = i2c_get_adapdata(adap); img_i2c_xfer()
1085 dev_err(adap->dev.parent, "i2c transfer timed out\n"); img_i2c_xfer()
1099 static u32 img_i2c_func(struct i2c_adapter *adap) img_i2c_func() argument
1122 dev_info(i2c->adap.dev.parent, img_i2c_init()
1142 dev_warn(i2c->adap.dev.parent, img_i2c_init()
1333 i2c_set_adapdata(&i2c->adap, i2c); img_i2c_probe()
1334 i2c->adap.dev.parent = &pdev->dev; img_i2c_probe()
1335 i2c->adap.dev.of_node = node; img_i2c_probe()
1336 i2c->adap.owner = THIS_MODULE; img_i2c_probe()
1337 i2c->adap.algo = &img_i2c_algo; img_i2c_probe()
1338 i2c->adap.retries = 5; img_i2c_probe()
1339 i2c->adap.nr = pdev->id; img_i2c_probe()
1340 snprintf(i2c->adap.name, sizeof(i2c->adap.name), "IMG SCB I2C"); img_i2c_probe()
1356 ret = i2c_add_numbered_adapter(&i2c->adap); img_i2c_probe()
1373 i2c_del_adapter(&i2c->adap); img_i2c_remove()
H A Di2c-stu300.c653 static int stu300_xfer_msg(struct i2c_adapter *adap, stu300_xfer_msg() argument
661 struct stu300_dev *dev = i2c_get_adapdata(adap); stu300_xfer_msg()
821 static int stu300_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, stu300_xfer() argument
827 struct stu300_dev *dev = i2c_get_adapdata(adap); stu300_xfer()
840 ret = stu300_xfer_msg(adap, &msgs[i], (i == (num - 1))); stu300_xfer()
851 static u32 stu300_func(struct i2c_adapter *adap) stu300_func() argument
865 struct i2c_adapter *adap; stu300_probe() local
909 adap = &dev->adapter; stu300_probe()
910 adap->owner = THIS_MODULE; stu300_probe()
912 adap->class = I2C_CLASS_DEPRECATED; stu300_probe()
913 strlcpy(adap->name, "ST Microelectronics DDC I2C adapter", stu300_probe()
914 sizeof(adap->name)); stu300_probe()
915 adap->nr = bus_nr; stu300_probe()
916 adap->algo = &stu300_algo; stu300_probe()
917 adap->dev.parent = &pdev->dev; stu300_probe()
918 adap->dev.of_node = pdev->dev.of_node; stu300_probe()
919 i2c_set_adapdata(adap, dev); stu300_probe()
922 ret = i2c_add_numbered_adapter(adap); stu300_probe()
H A Di2c-bcm-kona.c706 static uint32_t bcm_kona_i2c_functionality(struct i2c_adapter *adap) bcm_kona_i2c_functionality() argument
755 struct i2c_adapter *adap; bcm_kona_i2c_probe() local
855 adap = &dev->adapter; bcm_kona_i2c_probe()
856 i2c_set_adapdata(adap, dev); bcm_kona_i2c_probe()
857 adap->owner = THIS_MODULE; bcm_kona_i2c_probe()
858 strlcpy(adap->name, "Broadcom I2C adapter", sizeof(adap->name)); bcm_kona_i2c_probe()
859 adap->algo = &bcm_algo; bcm_kona_i2c_probe()
860 adap->dev.parent = &pdev->dev; bcm_kona_i2c_probe()
861 adap->dev.of_node = pdev->dev.of_node; bcm_kona_i2c_probe()
863 rc = i2c_add_adapter(adap); bcm_kona_i2c_probe()
H A Di2c-designware-core.c622 i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) i2c_dw_xfer() argument
624 struct dw_i2c_dev *dev = i2c_get_adapdata(adap); i2c_dw_xfer()
706 static u32 i2c_dw_func(struct i2c_adapter *adap) i2c_dw_func() argument
708 struct dw_i2c_dev *dev = i2c_get_adapdata(adap); i2c_dw_func()
851 struct i2c_adapter *adap = &dev->adapter; i2c_dw_probe() local
861 snprintf(adap->name, sizeof(adap->name), i2c_dw_probe()
863 adap->algo = &i2c_dw_algo; i2c_dw_probe()
864 adap->dev.parent = dev->dev; i2c_dw_probe()
865 i2c_set_adapdata(adap, dev); i2c_dw_probe()
876 r = i2c_add_numbered_adapter(adap); i2c_dw_probe()
H A Di2c-opal.c85 static int i2c_opal_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, i2c_opal_master_xfer() argument
88 unsigned long opal_id = (unsigned long)adap->algo_data; i2c_opal_master_xfer()
128 static int i2c_opal_smbus_xfer(struct i2c_adapter *adap, u16 addr, i2c_opal_smbus_xfer() argument
132 unsigned long opal_id = (unsigned long)adap->algo_data; i2c_opal_smbus_xfer()
H A Di2c-sh_mobile.c127 struct i2c_adapter adap; member in struct:sh_mobile_i2c_data
883 struct i2c_adapter *adap; sh_mobile_i2c_probe() local
967 adap = &pd->adap; sh_mobile_i2c_probe()
968 i2c_set_adapdata(adap, pd); sh_mobile_i2c_probe()
970 adap->owner = THIS_MODULE; sh_mobile_i2c_probe()
971 adap->algo = &sh_mobile_i2c_algorithm; sh_mobile_i2c_probe()
972 adap->dev.parent = &dev->dev; sh_mobile_i2c_probe()
973 adap->retries = 5; sh_mobile_i2c_probe()
974 adap->nr = dev->id; sh_mobile_i2c_probe()
975 adap->dev.of_node = dev->dev.of_node; sh_mobile_i2c_probe()
977 strlcpy(adap->name, dev->name, sizeof(adap->name)); sh_mobile_i2c_probe()
982 ret = i2c_add_numbered_adapter(adap); sh_mobile_i2c_probe()
989 dev_info(&dev->dev, "I2C adapter %d, bus speed %lu Hz\n", adap->nr, pd->bus_speed); sh_mobile_i2c_probe()
998 i2c_del_adapter(&pd->adap); sh_mobile_i2c_remove()
H A Di2c-rk3x.c94 struct i2c_adapter adap; member in struct:rk3x_i2c
775 static int rk3x_i2c_xfer(struct i2c_adapter *adap, rk3x_i2c_xfer() argument
778 struct rk3x_i2c *i2c = (struct rk3x_i2c *)adap->algo_data; rk3x_i2c_xfer()
839 static u32 rk3x_i2c_func(struct i2c_adapter *adap) rk3x_i2c_func() argument
914 strlcpy(i2c->adap.name, "rk3x-i2c", sizeof(i2c->adap.name)); rk3x_i2c_probe()
915 i2c->adap.owner = THIS_MODULE; rk3x_i2c_probe()
916 i2c->adap.algo = &rk3x_i2c_algorithm; rk3x_i2c_probe()
917 i2c->adap.retries = 3; rk3x_i2c_probe()
918 i2c->adap.dev.of_node = np; rk3x_i2c_probe()
919 i2c->adap.algo_data = i2c; rk3x_i2c_probe()
920 i2c->adap.dev.parent = &pdev->dev; rk3x_i2c_probe()
1002 ret = i2c_add_adapter(&i2c->adap); rk3x_i2c_probe()
1023 i2c_del_adapter(&i2c->adap); rk3x_i2c_remove()
/linux-4.4.14/drivers/net/ethernet/chelsio/cxgb4/
H A Dcxgb4_main.c311 struct adapter *adap = pi->adapter; dcb_tx_queue_prio_enable() local
312 struct sge_eth_txq *txq = &adap->sge.ethtxq[pi->first_qset]; dcb_tx_queue_prio_enable()
332 err = t4_set_params_timeout(adap, adap->mbox, adap->pf, 0, 1, dcb_tx_queue_prio_enable()
337 dev_err(adap->pdev_dev, dcb_tx_queue_prio_enable()
366 void t4_os_portmod_changed(const struct adapter *adap, int port_id) t4_os_portmod_changed() argument
372 const struct net_device *dev = adap->port[port_id]; t4_os_portmod_changed()
519 static void dcb_rpl(struct adapter *adap, const struct fw_port_cmd *pcmd) dcb_rpl() argument
522 struct net_device *dev = adap->port[port]; dcb_rpl()
526 cxgb4_dcb_handle_fw_update(adap, pcmd); dcb_rpl()
541 static void clear_filter(struct adapter *adap, struct filter_entry *f) clear_filter() argument
561 static void filter_rpl(struct adapter *adap, const struct cpl_set_tcb_rpl *rpl) filter_rpl() argument
564 unsigned int nidx = idx - adap->tids.ftid_base; filter_rpl()
568 if (idx >= adap->tids.ftid_base && nidx < filter_rpl()
569 (adap->tids.nftids + adap->tids.nsftids)) { filter_rpl()
572 f = &adap->tids.ftid_tab[idx]; filter_rpl()
578 clear_filter(adap, f); filter_rpl()
580 dev_err(adap->pdev_dev, "filter %u setup failed due to full SMT\n", filter_rpl()
582 clear_filter(adap, f); filter_rpl()
591 dev_err(adap->pdev_dev, "filter %u setup failed with error %u\n", filter_rpl()
593 clear_filter(adap, f); filter_rpl()
615 dev_err(q->adap->pdev_dev, "unexpected FW4/CPL %#x on FW event queue\n" fwevtq_handler()
626 txq = q->adap->sge.egr_map[qid - q->adap->sge.egr_start]; fwevtq_handler()
628 if ((u8 *)txq < (u8 *)q->adap->sge.ofldtxq) { fwevtq_handler()
652 struct net_device *dev = q->adap->port[port]; fwevtq_handler()
663 dcb_rpl(q->adap, pcmd); fwevtq_handler()
667 t4_handle_fw_rpl(q->adap, p->data); fwevtq_handler()
671 do_l2t_write_rpl(q->adap, p); fwevtq_handler()
675 filter_rpl(q->adap, p); fwevtq_handler()
677 dev_err(q->adap->pdev_dev, fwevtq_handler()
703 if (ulds[q->uld].rx_handler(q->adap->uld_handle[q->uld], rsp, gl)) { uldrx_handler()
732 struct adapter *adap = cookie; t4_nondata_intr() local
733 u32 v = t4_read_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A)); t4_nondata_intr()
736 adap->swintr = 1; t4_nondata_intr()
737 t4_write_reg(adap, MYPF_REG(PL_PF_INT_CAUSE_A), v); t4_nondata_intr()
739 if (adap->flags & MASTER_PF) t4_nondata_intr()
740 t4_slow_intr_handler(adap); t4_nondata_intr()
747 static void name_msix_vecs(struct adapter *adap) name_msix_vecs() argument
749 int i, j, msi_idx = 2, n = sizeof(adap->msix_info[0].desc); name_msix_vecs()
752 snprintf(adap->msix_info[0].desc, n, "%s", adap->port[0]->name); name_msix_vecs()
755 snprintf(adap->msix_info[1].desc, n, "%s-FWeventq", name_msix_vecs()
756 adap->port[0]->name); name_msix_vecs()
759 for_each_port(adap, j) { for_each_port()
760 struct net_device *d = adap->port[j]; for_each_port()
764 snprintf(adap->msix_info[msi_idx].desc, n, "%s-Rx%d", for_each_port()
769 for_each_ofldrxq(&adap->sge, i)
770 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-ofld%d",
771 adap->port[0]->name, i);
773 for_each_rdmarxq(&adap->sge, i)
774 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma%d",
775 adap->port[0]->name, i);
777 for_each_rdmaciq(&adap->sge, i)
778 snprintf(adap->msix_info[msi_idx++].desc, n, "%s-rdma-ciq%d",
779 adap->port[0]->name, i);
782 static int request_msix_queue_irqs(struct adapter *adap) request_msix_queue_irqs() argument
784 struct sge *s = &adap->sge; request_msix_queue_irqs()
788 err = request_irq(adap->msix_info[1].vec, t4_sge_intr_msix, 0, request_msix_queue_irqs()
789 adap->msix_info[1].desc, &s->fw_evtq); request_msix_queue_irqs()
794 err = request_irq(adap->msix_info[msi_index].vec, for_each_ethrxq()
796 adap->msix_info[msi_index].desc, for_each_ethrxq()
803 err = request_irq(adap->msix_info[msi_index].vec, for_each_ofldrxq()
805 adap->msix_info[msi_index].desc, for_each_ofldrxq()
812 err = request_irq(adap->msix_info[msi_index].vec, for_each_rdmarxq()
814 adap->msix_info[msi_index].desc, for_each_rdmarxq()
821 err = request_irq(adap->msix_info[msi_index].vec, for_each_rdmaciq()
823 adap->msix_info[msi_index].desc, for_each_rdmaciq()
833 free_irq(adap->msix_info[--msi_index].vec,
836 free_irq(adap->msix_info[--msi_index].vec,
839 free_irq(adap->msix_info[--msi_index].vec,
842 free_irq(adap->msix_info[--msi_index].vec,
844 free_irq(adap->msix_info[1].vec, &s->fw_evtq);
848 static void free_msix_queue_irqs(struct adapter *adap) free_msix_queue_irqs() argument
851 struct sge *s = &adap->sge; free_msix_queue_irqs()
853 free_irq(adap->msix_info[1].vec, &s->fw_evtq); free_msix_queue_irqs()
855 free_irq(adap->msix_info[msi_index++].vec, &s->ethrxq[i].rspq); free_msix_queue_irqs()
857 free_irq(adap->msix_info[msi_index++].vec, &s->ofldrxq[i].rspq); free_msix_queue_irqs()
859 free_irq(adap->msix_info[msi_index++].vec, &s->rdmarxq[i].rspq); free_msix_queue_irqs()
861 free_irq(adap->msix_info[msi_index++].vec, &s->rdmaciq[i].rspq); free_msix_queue_irqs()
910 * @adap: the adapter
914 static int setup_rss(struct adapter *adap) setup_rss() argument
918 for_each_port(adap, i) { for_each_port()
919 const struct port_info *pi = adap2pinfo(adap, i); for_each_port()
944 static void quiesce_rx(struct adapter *adap) quiesce_rx() argument
948 for (i = 0; i < adap->sge.ingr_sz; i++) { quiesce_rx()
949 struct sge_rspq *q = adap->sge.ingr_map[i]; quiesce_rx()
963 static void disable_interrupts(struct adapter *adap) disable_interrupts() argument
965 if (adap->flags & FULL_INIT_DONE) { disable_interrupts()
966 t4_intr_disable(adap); disable_interrupts()
967 if (adap->flags & USING_MSIX) { disable_interrupts()
968 free_msix_queue_irqs(adap); disable_interrupts()
969 free_irq(adap->msix_info[0].vec, adap); disable_interrupts()
971 free_irq(adap->pdev->irq, adap); disable_interrupts()
973 quiesce_rx(adap); disable_interrupts()
980 static void enable_rx(struct adapter *adap) enable_rx() argument
984 for (i = 0; i < adap->sge.ingr_sz; i++) { enable_rx()
985 struct sge_rspq *q = adap->sge.ingr_map[i]; enable_rx()
994 t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A), enable_rx()
1000 static int alloc_ofld_rxqs(struct adapter *adap, struct sge_ofld_rxq *q, alloc_ofld_rxqs() argument
1009 err = t4_sge_alloc_rxq(adap, &q->rspq, false, alloc_ofld_rxqs()
1010 adap->port[i / per_chan], alloc_ofld_rxqs()
1024 * @adap: the adapter
1030 static int setup_sge_queues(struct adapter *adap) setup_sge_queues() argument
1033 struct sge *s = &adap->sge; setup_sge_queues()
1038 if (adap->flags & USING_MSIX) setup_sge_queues()
1041 err = t4_sge_alloc_rxq(adap, &s->intrq, false, adap->port[0], 0, setup_sge_queues()
1061 err = t4_sge_alloc_rxq(adap, &s->fw_evtq, true, adap->port[0], setup_sge_queues()
1064 freeout: t4_free_sge_resources(adap); setup_sge_queues()
1068 for_each_port(adap, i) { for_each_port()
1069 struct net_device *dev = adap->port[i]; for_each_port()
1077 err = t4_sge_alloc_rxq(adap, &q->rspq, false, dev, for_each_port()
1080 t4_get_mps_bg_map(adap, for_each_port()
1088 err = t4_sge_alloc_eth_txq(adap, t, dev, for_each_port()
1096 j = s->ofldqsets / adap->params.nports; /* ofld queues per channel */ for_each_ofldrxq()
1098 err = t4_sge_alloc_ofld_txq(adap, &s->ofldtxq[i], for_each_ofldrxq()
1099 adap->port[i / j], for_each_ofldrxq()
1106 err = alloc_ofld_rxqs(adap, firstq, nq, per_chan, msi_idx, ids); \
1115 j = s->rdmaciqs / adap->params.nports; /* rdmaq queues per channel */
1120 for_each_port(adap, i) { for_each_port()
1125 err = t4_sge_alloc_ctrl_txq(adap, &s->ctrlq[i], adap->port[i], for_each_port()
1132 t4_write_reg(adap, is_t4(adap->params.chip) ?
1135 RSSCONTROL_V(netdev2pinfo(adap->port[0])->tx_chan) |
1402 struct adapter *adap = q->adap; cxgb4_set_rspq_intr_params() local
1411 new_idx = closest_thres(&adap->sge, cnt); cxgb4_set_rspq_intr_params()
1418 err = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, cxgb4_set_rspq_intr_params()
1426 us = us == 0 ? 6 : closest_timer(&adap->sge, us); cxgb4_set_rspq_intr_params()
1448 static int setup_debugfs(struct adapter *adap) setup_debugfs() argument
1450 if (IS_ERR_OR_NULL(adap->debugfs_root)) setup_debugfs()
1454 t4_setup_debugfs(adap); setup_debugfs()
1615 struct adapter *adap = container_of(t, struct adapter, tids); cxgb4_queue_tid_release() local
1617 spin_lock_bh(&adap->tid_release_lock); cxgb4_queue_tid_release()
1618 *p = adap->tid_release_head; cxgb4_queue_tid_release()
1620 adap->tid_release_head = (void **)((uintptr_t)p | chan); cxgb4_queue_tid_release()
1621 if (!adap->tid_release_task_busy) { cxgb4_queue_tid_release()
1622 adap->tid_release_task_busy = true; cxgb4_queue_tid_release()
1623 queue_work(adap->workq, &adap->tid_release_task); cxgb4_queue_tid_release()
1625 spin_unlock_bh(&adap->tid_release_lock); cxgb4_queue_tid_release()
1634 struct adapter *adap; process_tid_release_list() local
1636 adap = container_of(work, struct adapter, tid_release_task); process_tid_release_list()
1638 spin_lock_bh(&adap->tid_release_lock); process_tid_release_list()
1639 while (adap->tid_release_head) { process_tid_release_list()
1640 void **p = adap->tid_release_head; process_tid_release_list()
1644 adap->tid_release_head = *p; process_tid_release_list()
1646 spin_unlock_bh(&adap->tid_release_lock); process_tid_release_list()
1652 mk_tid_release(skb, chan, p - adap->tids.tid_tab); process_tid_release_list()
1653 t4_ofld_send(adap, skb); process_tid_release_list()
1654 spin_lock_bh(&adap->tid_release_lock); process_tid_release_list()
1656 adap->tid_release_task_busy = false; process_tid_release_list()
1657 spin_unlock_bh(&adap->tid_release_lock); process_tid_release_list()
1667 struct adapter *adap = container_of(t, struct adapter, tids); cxgb4_remove_tid() local
1682 t4_ofld_send(adap, skb); cxgb4_remove_tid()
1696 struct adapter *adap = container_of(t, struct adapter, tids); tid_init() local
1734 (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5)) tid_init()
1757 struct adapter *adap; cxgb4_create_server() local
1765 adap = netdev2adap(dev); cxgb4_create_server()
1773 chan = rxq_to_chan(&adap->sge, queue); cxgb4_create_server()
1777 ret = t4_mgmt_tx(adap, skb); cxgb4_create_server()
1798 struct adapter *adap; cxgb4_create_server6() local
1806 adap = netdev2adap(dev); cxgb4_create_server6()
1816 chan = rxq_to_chan(&adap->sge, queue); cxgb4_create_server6()
1820 ret = t4_mgmt_tx(adap, skb); cxgb4_create_server6()
1829 struct adapter *adap; cxgb4_remove_server() local
1833 adap = netdev2adap(dev); cxgb4_remove_server()
1844 ret = t4_mgmt_tx(adap, skb); cxgb4_remove_server()
1979 struct adapter *adap = netdev2adap(dev); cxgb4_dbfifo_count() local
1982 v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); cxgb4_dbfifo_count()
1983 v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); cxgb4_dbfifo_count()
1984 if (is_t4(adap->params.chip)) { cxgb4_dbfifo_count()
2022 struct adapter *adap = pci_get_drvdata(pdev); cxgb4_get_tcp_stats() local
2024 spin_lock(&adap->stats_lock); cxgb4_get_tcp_stats()
2025 t4_tp_get_tcp_stats(adap, v4, v6); cxgb4_get_tcp_stats()
2026 spin_unlock(&adap->stats_lock); cxgb4_get_tcp_stats()
2033 struct adapter *adap = netdev2adap(dev); cxgb4_iscsi_init() local
2035 t4_write_reg(adap, ULP_RX_ISCSI_TAGMASK_A, tag_mask); cxgb4_iscsi_init()
2036 t4_write_reg(adap, ULP_RX_ISCSI_PSZ_A, HPZ0_V(pgsz_order[0]) | cxgb4_iscsi_init()
2044 struct adapter *adap = netdev2adap(dev); cxgb4_flush_eq_cache() local
2046 return t4_sge_ctxt_flush(adap, adap->mbox); cxgb4_flush_eq_cache()
2050 static int read_eq_indices(struct adapter *adap, u16 qid, u16 *pidx, u16 *cidx) read_eq_indices() argument
2052 u32 addr = t4_read_reg(adap, SGE_DBQ_CTXT_BADDR_A) + 24 * qid + 8; read_eq_indices()
2056 spin_lock(&adap->win0_lock); read_eq_indices()
2057 ret = t4_memory_rw(adap, 0, MEM_EDC0, addr, read_eq_indices()
2060 spin_unlock(&adap->win0_lock); read_eq_indices()
2071 struct adapter *adap = netdev2adap(dev); cxgb4_sync_txq_pidx() local
2075 ret = read_eq_indices(adap, qid, &hw_pidx, &hw_cidx); cxgb4_sync_txq_pidx()
2088 if (is_t4(adap->params.chip)) cxgb4_sync_txq_pidx()
2093 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), cxgb4_sync_txq_pidx()
2103 struct adapter *adap; cxgb4_read_tpte() local
2109 adap = netdev2adap(dev); cxgb4_read_tpte()
2111 offset = ((stag >> 8) * 32) + adap->vres.stag.start; cxgb4_read_tpte()
2119 size = t4_read_reg(adap, MA_EDRAM0_BAR_A); cxgb4_read_tpte()
2121 size = t4_read_reg(adap, MA_EDRAM1_BAR_A); cxgb4_read_tpte()
2123 size = t4_read_reg(adap, MA_EXT_MEMORY0_BAR_A); cxgb4_read_tpte()
2140 } else if (is_t5(adap->params.chip)) { cxgb4_read_tpte()
2141 size = t4_read_reg(adap, MA_EXT_MEMORY1_BAR_A); cxgb4_read_tpte()
2157 spin_lock(&adap->win0_lock); cxgb4_read_tpte()
2158 ret = t4_memory_rw(adap, 0, memtype, memaddr, 32, tpte, T4_MEMORY_READ); cxgb4_read_tpte()
2159 spin_unlock(&adap->win0_lock); cxgb4_read_tpte()
2163 dev_err(adap->pdev_dev, "stag %#x, offset %#x out of range\n", cxgb4_read_tpte()
2172 struct adapter *adap; cxgb4_read_sge_timestamp() local
2174 adap = netdev2adap(dev); cxgb4_read_sge_timestamp()
2175 lo = t4_read_reg(adap, SGE_TIMESTAMP_LO_A); cxgb4_read_sge_timestamp()
2176 hi = TSVAL_G(t4_read_reg(adap, SGE_TIMESTAMP_HI_A)); cxgb4_read_sge_timestamp()
2233 static void drain_db_fifo(struct adapter *adap, int usecs) drain_db_fifo() argument
2238 v1 = t4_read_reg(adap, SGE_DBFIFO_STATUS_A); drain_db_fifo()
2239 v2 = t4_read_reg(adap, SGE_DBFIFO_STATUS2_A); drain_db_fifo()
2240 if (is_t4(adap->params.chip)) { drain_db_fifo()
2264 static void enable_txq_db(struct adapter *adap, struct sge_txq *q) enable_txq_db() argument
2272 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), enable_txq_db()
2280 static void disable_dbs(struct adapter *adap) disable_dbs() argument
2284 for_each_ethrxq(&adap->sge, i) disable_dbs()
2285 disable_txq_db(&adap->sge.ethtxq[i].q); disable_dbs()
2286 for_each_ofldrxq(&adap->sge, i) disable_dbs()
2287 disable_txq_db(&adap->sge.ofldtxq[i].q); disable_dbs()
2288 for_each_port(adap, i) disable_dbs()
2289 disable_txq_db(&adap->sge.ctrlq[i].q); disable_dbs()
2292 static void enable_dbs(struct adapter *adap) enable_dbs() argument
2296 for_each_ethrxq(&adap->sge, i) enable_dbs()
2297 enable_txq_db(adap, &adap->sge.ethtxq[i].q); enable_dbs()
2298 for_each_ofldrxq(&adap->sge, i) enable_dbs()
2299 enable_txq_db(adap, &adap->sge.ofldtxq[i].q); enable_dbs()
2300 for_each_port(adap, i) enable_dbs()
2301 enable_txq_db(adap, &adap->sge.ctrlq[i].q); enable_dbs()
2304 static void notify_rdma_uld(struct adapter *adap, enum cxgb4_control cmd) notify_rdma_uld() argument
2306 if (adap->uld_handle[CXGB4_ULD_RDMA]) notify_rdma_uld()
2307 ulds[CXGB4_ULD_RDMA].control(adap->uld_handle[CXGB4_ULD_RDMA], notify_rdma_uld()
2313 struct adapter *adap; process_db_full() local
2315 adap = container_of(work, struct adapter, db_full_task); process_db_full()
2317 drain_db_fifo(adap, dbfifo_drain_delay); process_db_full()
2318 enable_dbs(adap); process_db_full()
2319 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY); process_db_full()
2320 if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) process_db_full()
2321 t4_set_reg_field(adap, SGE_INT_ENABLE3_A, process_db_full()
2325 t4_set_reg_field(adap, SGE_INT_ENABLE3_A, process_db_full()
2329 static void sync_txq_pidx(struct adapter *adap, struct sge_txq *q) sync_txq_pidx() argument
2335 ret = read_eq_indices(adap, (u16)q->cntxt_id, &hw_pidx, &hw_cidx); sync_txq_pidx()
2347 if (is_t4(adap->params.chip)) sync_txq_pidx()
2352 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), sync_txq_pidx()
2360 CH_WARN(adap, "DB drop recovery failed.\n"); sync_txq_pidx()
2362 static void recover_all_queues(struct adapter *adap) recover_all_queues() argument
2366 for_each_ethrxq(&adap->sge, i) recover_all_queues()
2367 sync_txq_pidx(adap, &adap->sge.ethtxq[i].q); recover_all_queues()
2368 for_each_ofldrxq(&adap->sge, i) recover_all_queues()
2369 sync_txq_pidx(adap, &adap->sge.ofldtxq[i].q); recover_all_queues()
2370 for_each_port(adap, i) recover_all_queues()
2371 sync_txq_pidx(adap, &adap->sge.ctrlq[i].q); recover_all_queues()
2376 struct adapter *adap; process_db_drop() local
2378 adap = container_of(work, struct adapter, db_drop_task); process_db_drop()
2380 if (is_t4(adap->params.chip)) { process_db_drop()
2381 drain_db_fifo(adap, dbfifo_drain_delay); process_db_drop()
2382 notify_rdma_uld(adap, CXGB4_CONTROL_DB_DROP); process_db_drop()
2383 drain_db_fifo(adap, dbfifo_drain_delay); process_db_drop()
2384 recover_all_queues(adap); process_db_drop()
2385 drain_db_fifo(adap, dbfifo_drain_delay); process_db_drop()
2386 enable_dbs(adap); process_db_drop()
2387 notify_rdma_uld(adap, CXGB4_CONTROL_DB_EMPTY); process_db_drop()
2388 } else if (is_t5(adap->params.chip)) { process_db_drop()
2389 u32 dropped_db = t4_read_reg(adap, 0x010ac); process_db_drop()
2396 ret = t4_bar2_sge_qregs(adap, qid, T4_BAR2_QTYPE_EGRESS, process_db_drop()
2399 dev_err(adap->pdev_dev, "doorbell drop recovery: " process_db_drop()
2403 adap->bar2 + bar2_qoffset + SGE_UDB_KDOORBELL); process_db_drop()
2406 t4_set_reg_field(adap, 0x10b0, 1<<15, 1<<15); process_db_drop()
2409 if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) process_db_drop()
2410 t4_set_reg_field(adap, SGE_DOORBELL_CONTROL_A, DROPPED_DB_F, 0); process_db_drop()
2413 void t4_db_full(struct adapter *adap) t4_db_full() argument
2415 if (is_t4(adap->params.chip)) { t4_db_full()
2416 disable_dbs(adap); t4_db_full()
2417 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); t4_db_full()
2418 t4_set_reg_field(adap, SGE_INT_ENABLE3_A, t4_db_full()
2420 queue_work(adap->workq, &adap->db_full_task); t4_db_full()
2424 void t4_db_dropped(struct adapter *adap) t4_db_dropped() argument
2426 if (is_t4(adap->params.chip)) { t4_db_dropped()
2427 disable_dbs(adap); t4_db_dropped()
2428 notify_rdma_uld(adap, CXGB4_CONTROL_DB_FULL); t4_db_dropped()
2430 queue_work(adap->workq, &adap->db_drop_task); t4_db_dropped()
2433 static void uld_attach(struct adapter *adap, unsigned int uld) uld_attach() argument
2439 lli.pdev = adap->pdev; uld_attach()
2440 lli.pf = adap->pf; uld_attach()
2441 lli.l2t = adap->l2t; uld_attach()
2442 lli.tids = &adap->tids; uld_attach()
2443 lli.ports = adap->port; uld_attach()
2444 lli.vr = &adap->vres; uld_attach()
2445 lli.mtus = adap->params.mtus; uld_attach()
2447 lli.rxq_ids = adap->sge.rdma_rxq; uld_attach()
2448 lli.ciq_ids = adap->sge.rdma_ciq; uld_attach()
2449 lli.nrxq = adap->sge.rdmaqs; uld_attach()
2450 lli.nciq = adap->sge.rdmaciqs; uld_attach()
2452 lli.rxq_ids = adap->sge.ofld_rxq; uld_attach()
2453 lli.nrxq = adap->sge.ofldqsets; uld_attach()
2455 lli.ntxq = adap->sge.ofldqsets; uld_attach()
2456 lli.nchan = adap->params.nports; uld_attach()
2457 lli.nports = adap->params.nports; uld_attach()
2458 lli.wr_cred = adap->params.ofldq_wr_cred; uld_attach()
2459 lli.adapter_type = adap->params.chip; uld_attach()
2460 lli.iscsi_iolen = MAXRXDATA_G(t4_read_reg(adap, TP_PARA_REG2_A)); uld_attach()
2461 lli.cclk_ps = 1000000000 / adap->params.vpd.cclk; uld_attach()
2462 lli.udb_density = 1 << adap->params.sge.eq_qpp; uld_attach()
2463 lli.ucq_density = 1 << adap->params.sge.iq_qpp; uld_attach()
2464 lli.filt_mode = adap->params.tp.vlan_pri_map; uld_attach()
2468 lli.gts_reg = adap->regs + MYPF_REG(SGE_PF_GTS_A); uld_attach()
2469 lli.db_reg = adap->regs + MYPF_REG(SGE_PF_KDOORBELL_A); uld_attach()
2470 lli.fw_vers = adap->params.fw_vers; uld_attach()
2472 lli.sge_ingpadboundary = adap->sge.fl_align; uld_attach()
2473 lli.sge_egrstatuspagesize = adap->sge.stat_len; uld_attach()
2474 lli.sge_pktshift = adap->sge.pktshift; uld_attach()
2475 lli.enable_fw_ofld_conn = adap->flags & FW_OFLD_CONN; uld_attach()
2476 lli.max_ordird_qp = adap->params.max_ordird_qp; uld_attach()
2477 lli.max_ird_adapter = adap->params.max_ird_adapter; uld_attach()
2478 lli.ulptx_memwrite_dsgl = adap->params.ulptx_memwrite_dsgl; uld_attach()
2479 lli.nodeid = dev_to_node(adap->pdev_dev); uld_attach()
2483 dev_warn(adap->pdev_dev, uld_attach()
2489 adap->uld_handle[uld] = handle; uld_attach()
2496 if (adap->flags & FULL_INIT_DONE) uld_attach()
2500 static void attach_ulds(struct adapter *adap) attach_ulds() argument
2505 list_add_tail_rcu(&adap->rcu_node, &adap_rcu_list); attach_ulds()
2509 list_add_tail(&adap->list_node, &adapter_list); attach_ulds()
2512 uld_attach(adap, i); attach_ulds()
2516 static void detach_ulds(struct adapter *adap) detach_ulds() argument
2521 list_del(&adap->list_node); detach_ulds()
2523 if (adap->uld_handle[i]) { detach_ulds()
2524 ulds[i].state_change(adap->uld_handle[i], detach_ulds()
2526 adap->uld_handle[i] = NULL; detach_ulds()
2535 list_del_rcu(&adap->rcu_node); detach_ulds()
2539 static void notify_ulds(struct adapter *adap, enum cxgb4_state new_state) notify_ulds() argument
2545 if (adap->uld_handle[i]) notify_ulds()
2546 ulds[i].state_change(adap->uld_handle[i], new_state); notify_ulds()
2562 struct adapter *adap; cxgb4_register_uld() local
2572 list_for_each_entry(adap, &adapter_list, list_node) cxgb4_register_uld()
2573 uld_attach(adap, type); cxgb4_register_uld()
2587 struct adapter *adap; cxgb4_unregister_uld() local
2592 list_for_each_entry(adap, &adapter_list, list_node) cxgb4_unregister_uld()
2593 adap->uld_handle[type] = NULL; cxgb4_unregister_uld()
2608 struct adapter *adap; cxgb4_inet6addr_handler() local
2614 list_for_each_entry(adap, &adapter_list, list_node) { cxgb4_inet6addr_handler()
2617 cxgb4_clip_get(adap->port[0], cxgb4_inet6addr_handler()
2621 cxgb4_clip_release(adap->port[0], cxgb4_inet6addr_handler()
2655 static void update_clip(const struct adapter *adap) update_clip() argument
2664 dev = adap->port[i]; update_clip()
2679 * @adap: adapter being enabled
2687 static int cxgb_up(struct adapter *adap) cxgb_up() argument
2691 err = setup_sge_queues(adap); cxgb_up()
2694 err = setup_rss(adap); cxgb_up()
2698 if (adap->flags & USING_MSIX) { cxgb_up()
2699 name_msix_vecs(adap); cxgb_up()
2700 err = request_irq(adap->msix_info[0].vec, t4_nondata_intr, 0, cxgb_up()
2701 adap->msix_info[0].desc, adap); cxgb_up()
2705 err = request_msix_queue_irqs(adap); cxgb_up()
2707 free_irq(adap->msix_info[0].vec, adap); cxgb_up()
2711 err = request_irq(adap->pdev->irq, t4_intr_handler(adap), cxgb_up()
2712 (adap->flags & USING_MSI) ? 0 : IRQF_SHARED, cxgb_up()
2713 adap->port[0]->name, adap); cxgb_up()
2717 enable_rx(adap); cxgb_up()
2718 t4_sge_start(adap); cxgb_up()
2719 t4_intr_enable(adap); cxgb_up()
2720 adap->flags |= FULL_INIT_DONE; cxgb_up()
2721 notify_ulds(adap, CXGB4_STATE_UP); cxgb_up()
2723 update_clip(adap); cxgb_up()
2728 dev_err(adap->pdev_dev, "request_irq failed, err %d\n", err); cxgb_up()
2730 t4_free_sge_resources(adap); cxgb_up()
2820 struct adapter *adap; cxgb4_create_server_filter() local
2824 adap = netdev2adap(dev); cxgb4_create_server_filter()
2827 stid -= adap->tids.sftid_base; cxgb4_create_server_filter()
2828 stid += adap->tids.nftids; cxgb4_create_server_filter()
2832 f = &adap->tids.ftid_tab[stid]; cxgb4_create_server_filter()
2841 clear_filter(adap, f); cxgb4_create_server_filter()
2853 if (adap->params.tp.vlan_pri_map & PORT_F) { cxgb4_create_server_filter()
2859 if (adap->params.tp.vlan_pri_map & PROTOCOL_F) { cxgb4_create_server_filter()
2870 ret = set_filter_wr(adap, stid); cxgb4_create_server_filter()
2872 clear_filter(adap, f); cxgb4_create_server_filter()
2885 struct adapter *adap; cxgb4_remove_server_filter() local
2887 adap = netdev2adap(dev); cxgb4_remove_server_filter()
2890 stid -= adap->tids.sftid_base; cxgb4_remove_server_filter()
2891 stid += adap->tids.nftids; cxgb4_remove_server_filter()
2893 f = &adap->tids.ftid_tab[stid]; cxgb4_remove_server_filter()
2897 ret = delete_filter(adap, stid); cxgb4_remove_server_filter()
3062 struct adapter *adap = pi->adapter; cxgb_netpoll() local
3064 if (adap->flags & USING_MSIX) { cxgb_netpoll()
3066 struct sge_eth_rxq *rx = &adap->sge.ethrxq[pi->first_qset]; cxgb_netpoll()
3071 t4_intr_handler(adap)(0, adap); cxgb_netpoll()
3100 void t4_fatal_err(struct adapter *adap) t4_fatal_err() argument
3102 t4_set_reg_field(adap, SGE_CONTROL_A, GLOBALENABLE_F, 0); t4_fatal_err()
3103 t4_intr_disable(adap); t4_fatal_err()
3104 dev_alert(adap->pdev_dev, "encountered fatal error, adapter stopped\n"); t4_fatal_err()
3107 static void setup_memwin(struct adapter *adap) setup_memwin() argument
3109 u32 nic_win_base = t4_get_util_window(adap); setup_memwin()
3111 t4_setup_memwin(adap, nic_win_base, MEMWIN_NIC); setup_memwin()
3114 static void setup_memwin_rdma(struct adapter *adap) setup_memwin_rdma() argument
3116 if (adap->vres.ocq.size) { setup_memwin_rdma()
3120 start = t4_read_pcie_cfg4(adap, PCI_BASE_ADDRESS_2); setup_memwin_rdma()
3122 start += OCQ_WIN_OFFSET(adap->pdev, &adap->vres); setup_memwin_rdma()
3123 sz_kb = roundup_pow_of_two(adap->vres.ocq.size) >> 10; setup_memwin_rdma()
3124 t4_write_reg(adap, setup_memwin_rdma()
3127 t4_write_reg(adap, setup_memwin_rdma()
3129 adap->vres.ocq.start); setup_memwin_rdma()
3130 t4_read_reg(adap, setup_memwin_rdma()
3135 static int adap_init1(struct adapter *adap, struct fw_caps_config_cmd *c) adap_init1() argument
3145 ret = t4_wr_mbox(adap, adap->mbox, c, sizeof(*c), c); adap_init1()
3156 dev_err(adap->pdev_dev, "virtualization ACLs not supported"); adap_init1()
3161 ret = t4_wr_mbox(adap, adap->mbox, c, sizeof(*c), NULL); adap_init1()
3165 ret = t4_config_glbl_rss(adap, adap->pf, adap_init1()
3172 ret = t4_cfg_pfvf(adap, adap->mbox, adap->pf, 0, adap->sge.egr_sz, 64, adap_init1()
3178 t4_sge_init(adap); adap_init1()
3181 t4_write_reg(adap, TP_SHIFT_CNT_A, 0x64f8849); adap_init1()
3182 t4_write_reg(adap, ULP_RX_TDDP_PSZ_A, HPZ0_V(PAGE_SHIFT - 12)); adap_init1()
3183 t4_write_reg(adap, TP_PIO_ADDR_A, TP_INGRESS_CONFIG_A); adap_init1()
3184 v = t4_read_reg(adap, TP_PIO_DATA_A); adap_init1()
3185 t4_write_reg(adap, TP_PIO_DATA_A, v & ~CSUM_HAS_PSEUDO_HDR_F); adap_init1()
3188 adap->params.tp.tx_modq_map = 0xE4; adap_init1()
3189 t4_write_reg(adap, TP_TX_MOD_QUEUE_REQ_MAP_A, adap_init1()
3190 TX_MOD_QUEUE_REQ_MAP_V(adap->params.tp.tx_modq_map)); adap_init1()
3194 t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, adap_init1()
3196 t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, adap_init1()
3198 t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, adap_init1()
3202 if (is_offload(adap)) { adap_init1()
3203 t4_write_reg(adap, TP_TX_MOD_QUEUE_WEIGHT0_A, adap_init1()
3208 t4_write_reg(adap, TP_TX_MOD_CHANNEL_WEIGHT_A, adap_init1()
3216 return t4_early_init(adap, adap->pf); adap_init1()
3340 static int adap_init0_phy(struct adapter *adap) adap_init0_phy() argument
3348 phy_info = find_phy_info(adap->pdev->device); adap_init0_phy()
3350 dev_warn(adap->pdev_dev, adap_init0_phy()
3361 adap->pdev_dev); adap_init0_phy()
3369 dev_err(adap->pdev_dev, "unable to find PHY Firmware image " adap_init0_phy()
3375 t4_phy_fw_ver(adap, &cur_phy_fw_ver); adap_init0_phy()
3376 dev_warn(adap->pdev_dev, "continuing with, on-adapter " adap_init0_phy()
3386 ret = t4_load_phy_fw(adap, MEMWIN_NIC, &adap->win0_lock, adap_init0_phy()
3390 dev_err(adap->pdev_dev, "PHY Firmware transfer error %d\n", adap_init0_phy()
3398 dev_info(adap->pdev_dev, "Successfully transferred PHY " adap_init0_phy()
3687 static int adap_init0(struct adapter *adap) adap_init0() argument
3699 ret = t4_init_devlog_params(adap); adap_init0()
3704 ret = t4_fw_hello(adap, adap->mbox, adap->mbox, MASTER_MAY, &state); adap_init0()
3706 dev_err(adap->pdev_dev, "could not connect to FW, error %d\n", adap_init0()
3710 if (ret == adap->mbox) adap_init0()
3711 adap->flags |= MASTER_PF; adap_init0()
3720 t4_get_fw_version(adap, &adap->params.fw_vers); adap_init0()
3721 t4_get_tp_version(adap, &adap->params.tp_vers); adap_init0()
3722 ret = t4_check_fw_version(adap); adap_init0()
3726 if ((adap->flags & MASTER_PF) && state != DEV_STATE_INIT) { adap_init0()
3736 fw_info = find_fw_info(CHELSIO_CHIP_VERSION(adap->params.chip)); adap_init0()
3738 dev_err(adap->pdev_dev, adap_init0()
3740 CHELSIO_CHIP_VERSION(adap->params.chip)); adap_init0()
3751 adap->pdev_dev); adap_init0()
3753 dev_err(adap->pdev_dev, adap_init0()
3762 ret = t4_prep_fw(adap, fw_info, fw_data, fw_size, card_fw, adap_init0()
3780 ret = t4_get_vpd_params(adap, &adap->params.vpd); adap_init0()
3792 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, &v, &port_vec); adap_init0()
3796 adap->params.nports = hweight32(port_vec); adap_init0()
3797 adap->params.portvec = port_vec; adap_init0()
3803 dev_info(adap->pdev_dev, "Coming up as %s: "\ adap_init0()
3805 adap->flags & MASTER_PF ? "MASTER" : "SLAVE"); adap_init0()
3807 dev_info(adap->pdev_dev, "Coming up as MASTER: "\ adap_init0()
3815 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, adap_init0()
3822 dev_err(adap->pdev_dev, "firmware doesn't support " adap_init0()
3831 ret = adap_init0_config(adap, reset); adap_init0()
3833 dev_err(adap->pdev_dev, "no Configuration File " adap_init0()
3838 dev_err(adap->pdev_dev, "could not initialize " adap_init0()
3848 ret = t4_sge_init(adap); adap_init0()
3852 if (is_bypass_device(adap->pdev->device)) adap_init0()
3853 adap->params.bypass = 1; adap_init0()
3874 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 6, params, val); adap_init0()
3877 adap->sge.egr_start = val[0]; adap_init0()
3878 adap->l2t_start = val[1]; adap_init0()
3879 adap->l2t_end = val[2]; adap_init0()
3880 adap->tids.ftid_base = val[3]; adap_init0()
3881 adap->tids.nftids = val[4] - val[3] + 1; adap_init0()
3882 adap->sge.ingr_start = val[5]; adap_init0()
3892 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, params, val); adap_init0()
3895 adap->sge.egr_sz = val[0] - adap->sge.egr_start + 1; adap_init0()
3896 adap->sge.ingr_sz = val[1] - adap->sge.ingr_start + 1; adap_init0()
3898 adap->sge.egr_map = kcalloc(adap->sge.egr_sz, adap_init0()
3899 sizeof(*adap->sge.egr_map), GFP_KERNEL); adap_init0()
3900 if (!adap->sge.egr_map) { adap_init0()
3905 adap->sge.ingr_map = kcalloc(adap->sge.ingr_sz, adap_init0()
3906 sizeof(*adap->sge.ingr_map), GFP_KERNEL); adap_init0()
3907 if (!adap->sge.ingr_map) { adap_init0()
3915 adap->sge.starving_fl = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), adap_init0()
3917 if (!adap->sge.starving_fl) { adap_init0()
3922 adap->sge.txq_maperr = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), adap_init0()
3924 if (!adap->sge.txq_maperr) { adap_init0()
3930 adap->sge.blocked_fl = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), adap_init0()
3932 if (!adap->sge.blocked_fl) { adap_init0()
3940 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, params, val); adap_init0()
3943 adap->clipt_start = val[0]; adap_init0()
3944 adap->clipt_end = val[1]; adap_init0()
3949 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, params, val); adap_init0()
3954 adap->flags |= FW_OFLD_CONN; adap_init0()
3955 adap->tids.aftid_base = val[0]; adap_init0()
3956 adap->tids.aftid_end = val[1]; adap_init0()
3966 (void)t4_set_params(adap, adap->mbox, adap->pf, 0, 1, params, val); adap_init0()
3974 if (is_t4(adap->params.chip)) { adap_init0()
3975 adap->params.ulptx_memwrite_dsgl = false; adap_init0()
3978 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, adap_init0()
3980 adap->params.ulptx_memwrite_dsgl = (ret == 0 && val[0] != 0); adap_init0()
3991 ret = t4_wr_mbox(adap, adap->mbox, &caps_cmd, sizeof(caps_cmd), adap_init0()
4004 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 6, adap_init0()
4008 adap->tids.ntids = val[0]; adap_init0()
4009 adap->tids.natids = min(adap->tids.ntids / 2, MAX_ATIDS); adap_init0()
4010 adap->tids.stid_base = val[1]; adap_init0()
4011 adap->tids.nstids = val[2] - val[1] + 1; adap_init0()
4021 if (adap->flags & FW_OFLD_CONN && !is_bypass(adap)) { adap_init0()
4022 adap->tids.sftid_base = adap->tids.ftid_base + adap_init0()
4023 DIV_ROUND_UP(adap->tids.nftids, 3); adap_init0()
4024 adap->tids.nsftids = adap->tids.nftids - adap_init0()
4025 DIV_ROUND_UP(adap->tids.nftids, 3); adap_init0()
4026 adap->tids.nftids = adap->tids.sftid_base - adap_init0()
4027 adap->tids.ftid_base; adap_init0()
4029 adap->vres.ddp.start = val[3]; adap_init0()
4030 adap->vres.ddp.size = val[4] - val[3] + 1; adap_init0()
4031 adap->params.ofldq_wr_cred = val[5]; adap_init0()
4033 adap->params.offload = 1; adap_init0()
4042 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 6, adap_init0()
4046 adap->vres.stag.start = val[0]; adap_init0()
4047 adap->vres.stag.size = val[1] - val[0] + 1; adap_init0()
4048 adap->vres.rq.start = val[2]; adap_init0()
4049 adap->vres.rq.size = val[3] - val[2] + 1; adap_init0()
4050 adap->vres.pbl.start = val[4]; adap_init0()
4051 adap->vres.pbl.size = val[5] - val[4] + 1; adap_init0()
4059 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 6, params, adap_init0()
4063 adap->vres.qp.start = val[0]; adap_init0()
4064 adap->vres.qp.size = val[1] - val[0] + 1; adap_init0()
4065 adap->vres.cq.start = val[2]; adap_init0()
4066 adap->vres.cq.size = val[3] - val[2] + 1; adap_init0()
4067 adap->vres.ocq.start = val[4]; adap_init0()
4068 adap->vres.ocq.size = val[5] - val[4] + 1; adap_init0()
4072 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, params, adap_init0()
4075 adap->params.max_ordird_qp = 8; adap_init0()
4076 adap->params.max_ird_adapter = 32 * adap->tids.ntids; adap_init0()
4079 adap->params.max_ordird_qp = val[0]; adap_init0()
4080 adap->params.max_ird_adapter = val[1]; adap_init0()
4082 dev_info(adap->pdev_dev, adap_init0()
4084 adap->params.max_ordird_qp, adap_init0()
4085 adap->params.max_ird_adapter); adap_init0()
4090 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, adap_init0()
4094 adap->vres.iscsi.start = val[0]; adap_init0()
4095 adap->vres.iscsi.size = val[1] - val[0] + 1; adap_init0()
4105 t4_read_mtu_tbl(adap, adap->params.mtus, NULL); adap_init0()
4127 if (adap->params.mtus[i] == 1492) { adap_init0()
4128 adap->params.mtus[i] = 1488; adap_init0()
4132 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd, adap_init0()
4133 adap->params.b_wnd); adap_init0()
4135 t4_init_sge_params(adap); adap_init0()
4136 adap->flags |= FW_OK; adap_init0()
4137 t4_init_tp_params(adap); adap_init0()
4146 kfree(adap->sge.egr_map); adap_init0()
4147 kfree(adap->sge.ingr_map); adap_init0()
4148 kfree(adap->sge.starving_fl); adap_init0()
4149 kfree(adap->sge.txq_maperr); adap_init0()
4151 kfree(adap->sge.blocked_fl); adap_init0()
4154 t4_fw_bye(adap, adap->mbox); adap_init0()
4164 struct adapter *adap = pci_get_drvdata(pdev); eeh_err_detected() local
4166 if (!adap) eeh_err_detected()
4170 adap->flags &= ~FW_OK; eeh_err_detected()
4171 notify_ulds(adap, CXGB4_STATE_START_RECOVERY); eeh_err_detected()
4172 spin_lock(&adap->stats_lock); for_each_port()
4173 for_each_port(adap, i) { for_each_port()
4174 struct net_device *dev = adap->port[i]; for_each_port()
4179 spin_unlock(&adap->stats_lock);
4180 disable_interrupts(adap);
4181 if (adap->flags & FULL_INIT_DONE)
4182 cxgb_down(adap);
4184 if ((adap->flags & DEV_ENABLED)) {
4186 adap->flags &= ~DEV_ENABLED;
4196 struct adapter *adap = pci_get_drvdata(pdev); eeh_slot_reset() local
4198 if (!adap) { eeh_slot_reset()
4204 if (!(adap->flags & DEV_ENABLED)) { eeh_slot_reset()
4210 adap->flags |= DEV_ENABLED; eeh_slot_reset()
4218 if (t4_wait_dev_ready(adap->regs) < 0) eeh_slot_reset()
4220 if (t4_fw_hello(adap, adap->mbox, adap->pf, MASTER_MUST, NULL) < 0) eeh_slot_reset()
4222 adap->flags |= FW_OK; eeh_slot_reset()
4223 if (adap_init1(adap, &c)) eeh_slot_reset()
4226 for_each_port(adap, i) { for_each_port()
4227 struct port_info *p = adap2pinfo(adap, i); for_each_port()
4229 ret = t4_alloc_vi(adap, adap->mbox, p->tx_chan, adap->pf, 0, 1, for_each_port()
4237 t4_load_mtus(adap, adap->params.mtus, adap->params.a_wnd,
4238 adap->params.b_wnd);
4239 setup_memwin(adap);
4240 if (cxgb_up(adap))
4248 struct adapter *adap = pci_get_drvdata(pdev); eeh_resume() local
4250 if (!adap) eeh_resume()
4254 for_each_port(adap, i) { for_each_port()
4255 struct net_device *dev = adap->port[i]; for_each_port()
4278 static inline void init_rspq(struct adapter *adap, struct sge_rspq *q, init_rspq() argument
4282 q->adap = adap; init_rspq()
4293 static void cfg_queues(struct adapter *adap) cfg_queues() argument
4295 struct sge *s = &adap->sge; cfg_queues()
4302 for_each_port(adap, i) cfg_queues()
4303 n10g += is_x_10g_port(&adap2pinfo(adap, i)->link_cfg); cfg_queues()
4309 if (adap->params.nports * 8 > MAX_ETH_QSETS) { cfg_queues()
4310 dev_err(adap->pdev_dev, "MAX_ETH_QSETS=%d < %d!\n", cfg_queues()
4311 MAX_ETH_QSETS, adap->params.nports * 8); cfg_queues()
4315 for_each_port(adap, i) { for_each_port()
4316 struct port_info *pi = adap2pinfo(adap, i); for_each_port()
4328 q10g = (MAX_ETH_QSETS - (adap->params.nports - n10g)) / n10g;
4332 for_each_port(adap, i) { for_each_port()
4333 struct port_info *pi = adap2pinfo(adap, i); for_each_port()
4344 if (is_offload(adap)) {
4353 s->ofldqsets = roundup(i, adap->params.nports);
4355 s->ofldqsets = adap->params.nports;
4357 s->rdmaqs = adap->params.nports;
4365 s->rdmaciqs = (s->rdmaciqs / adap->params.nports) *
4366 adap->params.nports;
4367 s->rdmaciqs = max_t(int, s->rdmaciqs, adap->params.nports);
4373 init_rspq(adap, &r->rspq, 5, 10, 1024, 64);
4389 init_rspq(adap, &r->rspq, 5, 1, 1024, 64);
4397 init_rspq(adap, &r->rspq, 5, 1, 511, 64);
4402 ciq_size = 64 + adap->vres.cq.size + adap->tids.nftids;
4404 CH_WARN(adap, "CIQ size too small for available IQs\n");
4411 init_rspq(adap, &r->rspq, 5, 1, ciq_size, 64);
4415 init_rspq(adap, &s->fw_evtq, 0, 1, 1024, 64);
4416 init_rspq(adap, &s->intrq, 0, 1, 2 * MAX_INGQ, 64);
4423 static void reduce_ethqs(struct adapter *adap, int n) reduce_ethqs() argument
4428 while (n < adap->sge.ethqsets) for_each_port()
4429 for_each_port(adap, i) { for_each_port()
4430 pi = adap2pinfo(adap, i); for_each_port()
4433 adap->sge.ethqsets--; for_each_port()
4434 if (adap->sge.ethqsets <= n) for_each_port()
4440 for_each_port(adap, i) { for_each_port()
4441 pi = adap2pinfo(adap, i); for_each_port()
4450 static int enable_msix(struct adapter *adap) enable_msix() argument
4454 struct sge *s = &adap->sge; enable_msix()
4455 unsigned int nchan = adap->params.nports; enable_msix()
4467 if (is_offload(adap)) { enable_msix()
4476 need = 8 * adap->params.nports + EXTRA_VECS + ofld_need; enable_msix()
4478 need = adap->params.nports + EXTRA_VECS + ofld_need; enable_msix()
4480 allocated = pci_enable_msix_range(adap->pdev, entries, need, want); enable_msix()
4482 dev_info(adap->pdev_dev, "not enough MSI-X vectors left," enable_msix()
4496 reduce_ethqs(adap, i); enable_msix()
4498 if (is_offload(adap)) { enable_msix()
4510 adap->msix_info[i].vec = entries[i].vector; enable_msix()
4511 dev_info(adap->pdev_dev, "%d MSI-X vectors allocated, " enable_msix()
4522 static int init_rss(struct adapter *adap) init_rss() argument
4527 err = t4_init_rss_mode(adap, adap->mbox); init_rss()
4531 for_each_port(adap, i) { for_each_port()
4532 struct port_info *pi = adap2pinfo(adap, i); for_each_port()
4547 const struct adapter *adap = pi->adapter; print_port_info() local
4549 if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_2_5GB) print_port_info()
4551 else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_5_0GB) print_port_info()
4553 else if (adap->params.pci.speed == PCI_EXP_LNKSTA_CLS_8_0GB) print_port_info()
4569 adap->params.vpd.id, print_port_info()
4570 CHELSIO_CHIP_RELEASE(adap->params.chip), buf, print_port_info()
4571 is_offload(adap) ? "R" : "", adap->params.pci.width, spd, print_port_info()
4572 (adap->flags & USING_MSIX) ? " MSI-X" : print_port_info()
4573 (adap->flags & USING_MSI) ? " MSI" : ""); print_port_info()
4575 adap->params.vpd.sn, adap->params.vpd.pn); print_port_info()
H A Dcxgb4_debugfs.c198 struct adapter *adap = inode->i_private; cim_la_open() local
200 ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &cfg); cim_la_open()
204 if (is_t6(adap->params.chip)) { cim_la_open()
206 p = seq_open_tab(file, (adap->params.cim_la_size / 10) + 1, cim_la_open()
211 p = seq_open_tab(file, adap->params.cim_la_size / 8, cim_la_open()
219 ret = t4_cim_read_la(adap, (u32 *)p->data, NULL); cim_la_open()
256 struct adapter *adap = inode->i_private; cim_pif_la_open() local
263 t4_cim_read_pif_la(adap, (u32 *)p->data, cim_pif_la_open()
302 struct adapter *adap = inode->i_private; cim_ma_la_open() local
309 t4_cim_read_ma_la(adap, (u32 *)p->data, cim_ma_la_open()
331 struct adapter *adap = seq->private; cim_qcfg_show() local
339 int cim_num_obq = is_t4(adap->params.chip) ? cim_qcfg_show()
342 i = t4_cim_read(adap, is_t4(adap->params.chip) ? UP_IBQ_0_RDADDR_A : cim_qcfg_show()
346 if (is_t4(adap->params.chip)) { cim_qcfg_show()
347 i = t4_cim_read(adap, UP_OBQ_0_REALADDR_A, cim_qcfg_show()
351 i = t4_cim_read(adap, UP_OBQ_0_SHADOW_REALADDR_A, cim_qcfg_show()
359 t4_read_cimq_cfg(adap, base, size, thres); cim_qcfg_show()
405 struct adapter *adap = inode->i_private - qid; cim_ibq_open() local
411 ret = t4_read_cim_ibq(adap, qid, (u32 *)p->data, CIM_IBQ_SIZE * 4); cim_ibq_open()
432 struct adapter *adap = inode->i_private - qid; cim_obq_open() local
438 ret = t4_read_cim_obq(adap, qid, (u32 *)p->data, 6 * CIM_OBQ_SIZE * 4); cim_obq_open()
650 struct adapter *adap = inode->i_private; tp_la_open() local
652 switch (DBGLAMODE_G(t4_read_reg(adap, TP_DBG_LA_CONFIG_A))) { tp_la_open()
667 t4_tp_read_la(adap, (u64 *)p->data, NULL); tp_la_open()
678 struct adapter *adap = file_inode(file)->i_private; tp_la_write() local
688 adap->params.tp.la_mask = val << 16; tp_la_write()
689 t4_set_reg_field(adap, TP_DBG_LA_CONFIG_A, 0xffff0000U, tp_la_write()
690 adap->params.tp.la_mask); tp_la_write()
719 struct adapter *adap = inode->i_private; ulprx_la_open() local
726 t4_ulprx_read_la(adap, (u32 *)p->data); ulprx_la_open()
762 struct adapter *adap = seq->private; pm_stats_show() local
764 t4_pmtx_get_stats(adap, tx_cnt, tx_cyc); pm_stats_show()
765 t4_pmrx_get_stats(adap, rx_cnt, rx_cyc); pm_stats_show()
787 struct adapter *adap = file_inode(file)->i_private; pm_stats_clear() local
789 t4_write_reg(adap, PM_RX_STAT_CONFIG_A, 0); pm_stats_clear()
790 t4_write_reg(adap, PM_TX_STAT_CONFIG_A, 0); pm_stats_clear()
806 struct adapter *adap = seq->private; tx_rate_show() local
808 t4_get_chan_txrate(adap, nrate, orate); tx_rate_show()
809 if (adap->params.arch.nchan == NCHAN) { tx_rate_show()
844 struct adapter *adap = seq->private; cctrl_tbl_show() local
850 t4_read_cong_tbl(adap, incr); cctrl_tbl_show()
859 adap->params.a_wnd[i], cctrl_tbl_show()
860 dec_fac[adap->params.b_wnd[i]]); cctrl_tbl_show()
890 struct adapter *adap = seq->private; clk_show() local
891 unsigned int cclk_ps = 1000000000 / adap->params.vpd.cclk; /* in ps */ clk_show()
892 u32 res = t4_read_reg(adap, TP_TIMER_RESOLUTION_A); clk_show()
908 t4_read_reg(adap, TP_DACK_TIMER_A)); clk_show()
910 tp_tick_us * t4_read_reg(adap, TP_RXT_MIN_A)); clk_show()
912 tp_tick_us * t4_read_reg(adap, TP_RXT_MAX_A)); clk_show()
914 tp_tick_us * t4_read_reg(adap, TP_PERS_MIN_A)); clk_show()
916 tp_tick_us * t4_read_reg(adap, TP_PERS_MAX_A)); clk_show()
918 tp_tick_us * t4_read_reg(adap, TP_KEEP_IDLE_A)); clk_show()
920 tp_tick_us * t4_read_reg(adap, TP_KEEP_INTVL_A)); clk_show()
922 tp_tick_us * INITSRTT_G(t4_read_reg(adap, TP_INIT_SRTT_A))); clk_show()
924 tp_tick_us * t4_read_reg(adap, TP_FINWAIT2_TIMER_A)); clk_show()
1068 struct adapter *adap = inode->i_private; devlog_open() local
1069 struct devlog_params *dparams = &adap->params.devlog; devlog_open()
1092 spin_lock(&adap->win0_lock); devlog_open()
1093 ret = t4_memory_rw(adap, adap->params.drv_memwin, dparams->memtype, devlog_open()
1096 spin_unlock(&adap->win0_lock); devlog_open()
1136 struct adapter *adap = seq->private - mbox; mbox_show() local
1137 void __iomem *addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); mbox_show()
1143 if (is_t4(adap->params.chip)) { mbox_show()
1147 void __iomem *ctrl = adap->regs + PF_REG(mbox, ctrl_reg); mbox_show()
1173 struct adapter *adap; mbox_write() local
1190 adap = ino->i_private - mbox; mbox_write()
1191 addr = adap->regs + PF_REG(mbox, CIM_PF_MAILBOX_DATA_A); mbox_write()
1218 struct adapter *adap = seq->private - trcidx; mps_trc_show() local
1220 t4_get_trace_filter(adap, &tp, trcidx, &enabled); mps_trc_show()
1227 dev_err(adap->pdev_dev, "illegal trace pattern skip offset\n"); mps_trc_show()
1231 i = adap->chan_map[tp.port & 3]; mps_trc_show()
1233 dev_err(adap->pdev_dev, "tracer %u is assigned " mps_trc_show()
1238 adap->port[i]->name, tp.port < 4 ? "Rx" : "Tx"); mps_trc_show()
1307 struct adapter *adap; mps_trc_write() local
1312 adap = ino->i_private - trcidx; mps_trc_write()
1335 if (adap->trace_rss) mps_trc_write()
1336 t4_write_reg(adap, MPS_TRC_CFG_A, TRC_RSS_ENABLE); mps_trc_write()
1338 t4_write_reg(adap, MPS_TRC_CFG_A, TRC_RSS_DISABLE); mps_trc_write()
1356 if (!adap->trace_rss) { mps_trc_write()
1357 t4_write_reg(adap, MPS_T5_TRC_RSS_CONTROL_A, j); mps_trc_write()
1363 t4_write_reg(adap, MPS_TRC_RSS_CONTROL_A, j); mps_trc_write()
1366 t4_write_reg(adap, mps_trc_write()
1370 t4_write_reg(adap, mps_trc_write()
1374 t4_write_reg(adap, mps_trc_write()
1412 if (adap->chan_map[tp.port & 3] >= MAX_NPORTS) mps_trc_write()
1420 if (adap->chan_map[tp.port] >= MAX_NPORTS) mps_trc_write()
1489 i = t4_set_trace_filter(adap, &tp, trcidx, enable); mps_trc_write()
1511 struct adapter *adap = file->private_data; flash_read() local
1527 ret = t4_read_flash(adap, pos - ofst, (len + 3) / 4, flash_read()
1560 struct adapter *adap = seq->private; mps_tcam_show() local
1561 unsigned int chip_ver = CHELSIO_CHIP_VERSION(adap->params.chip); mps_tcam_show()
1564 if (adap->params.arch.mps_rplc_size > 128) mps_tcam_show()
1595 t4_write_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A, ctl); mps_tcam_show()
1596 val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); mps_tcam_show()
1598 tcamy |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); mps_tcam_show()
1602 t4_write_reg(adap, MPS_CLS_TCAM_DATA2_CTL_A, ctl); mps_tcam_show()
1603 val = t4_read_reg(adap, MPS_CLS_TCAM_DATA1_A); mps_tcam_show()
1605 tcamx |= t4_read_reg(adap, MPS_CLS_TCAM_DATA0_A); mps_tcam_show()
1607 tcamy = t4_read_reg64(adap, MPS_CLS_TCAM_Y_L(idx)); mps_tcam_show()
1608 tcamx = t4_read_reg64(adap, MPS_CLS_TCAM_X_L(idx)); mps_tcam_show()
1611 cls_lo = t4_read_reg(adap, MPS_CLS_SRAM_L(idx)); mps_tcam_show()
1612 cls_hi = t4_read_reg(adap, MPS_CLS_SRAM_H(idx)); mps_tcam_show()
1643 ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, mps_tcam_show()
1646 dev_warn(adap->pdev_dev, "Can't read MPS " mps_tcam_show()
1655 if (adap->params.arch.mps_rplc_size > 128) { mps_tcam_show()
1686 if (adap->params.arch.mps_rplc_size > 128) mps_tcam_show()
1695 if (adap->params.arch.mps_rplc_size > 128) mps_tcam_show()
1719 struct adapter *adap = seq->private; mps_tcam_get_idx() local
1720 int max_mac_addr = is_t4(adap->params.chip) ? mps_tcam_get_idx()
1772 struct adapter *adap = seq->private; sensors_show() local
1785 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 2, sensors_show()
1835 struct adapter *adap = inode->i_private; rss_open() local
1841 ret = t4_read_rss(adap, (u16 *)p->data); rss_open()
2045 struct adapter *adap = file_inode(file)->i_private; rss_key_write() local
2064 t4_write_rss_key(adap, key, -1); rss_key_write()
2224 * @adap: the adapter
2227 static inline struct port_info *ethqset2pinfo(struct adapter *adap, int qset) ethqset2pinfo() argument
2231 for_each_port(adap, pidx) { for_each_port()
2232 struct port_info *pi = adap2pinfo(adap, pidx); for_each_port()
2246 struct adapter *adap = seq->private; sge_qinfo_show() local
2247 int eth_entries = DIV_ROUND_UP(adap->sge.ethqsets, 4); sge_qinfo_show()
2248 int iscsi_entries = DIV_ROUND_UP(adap->sge.ofldqsets, 4); sge_qinfo_show()
2249 int rdma_entries = DIV_ROUND_UP(adap->sge.rdmaqs, 4); sge_qinfo_show()
2250 int ciq_entries = DIV_ROUND_UP(adap->sge.rdmaciqs, 4); sge_qinfo_show()
2279 const struct sge_eth_rxq *rx = &adap->sge.ethrxq[base_qset]; sge_qinfo_show()
2280 const struct sge_eth_txq *tx = &adap->sge.ethtxq[base_qset]; sge_qinfo_show()
2281 int n = min(4, adap->sge.ethqsets - 4 * r); sge_qinfo_show()
2294 (ethqset2pinfo(adap, base_qset + i)->dcb.pgid >> sge_qinfo_show()
2297 (ethqset2pinfo(adap, base_qset + i)->dcb.pfcen >> sge_qinfo_show()
2305 S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); sge_qinfo_show()
2307 adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); sge_qinfo_show()
2332 &adap->sge.ofldrxq[iscsi_idx * 4]; sge_qinfo_show()
2334 &adap->sge.ofldtxq[iscsi_idx * 4]; sge_qinfo_show()
2335 int n = min(4, adap->sge.ofldqsets - 4 * iscsi_idx); sge_qinfo_show()
2348 S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); sge_qinfo_show()
2350 adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); sge_qinfo_show()
2366 &adap->sge.rdmarxq[rdma_idx * 4]; sge_qinfo_show()
2367 int n = min(4, adap->sge.rdmaqs - 4 * rdma_idx); sge_qinfo_show()
2377 S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); sge_qinfo_show()
2379 adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); sge_qinfo_show()
2394 const struct sge_ofld_rxq *rx = &adap->sge.rdmaciq[ciq_idx * 4]; sge_qinfo_show()
2395 int n = min(4, adap->sge.rdmaciqs - 4 * ciq_idx); sge_qinfo_show()
2405 S3("u", "Intr delay:", qtimer_val(adap, &rx[i].rspq)); sge_qinfo_show()
2407 adap->sge.counter_val[rx[i].rspq.pktcnt_idx]); sge_qinfo_show()
2412 const struct sge_ctrl_txq *tx = &adap->sge.ctrlq[ctrl_idx * 4]; sge_qinfo_show()
2413 int n = min(4, adap->params.nports - 4 * ctrl_idx); sge_qinfo_show()
2424 const struct sge_rspq *evtq = &adap->sge.fw_evtq; sge_qinfo_show()
2433 qtimer_val(adap, evtq)); sge_qinfo_show()
2435 adap->sge.counter_val[evtq->pktcnt_idx]); sge_qinfo_show()
2448 static int sge_queue_entries(const struct adapter *adap) sge_queue_entries() argument
2450 return DIV_ROUND_UP(adap->sge.ethqsets, 4) + sge_queue_entries()
2451 DIV_ROUND_UP(adap->sge.ofldqsets, 4) + sge_queue_entries()
2452 DIV_ROUND_UP(adap->sge.rdmaqs, 4) + sge_queue_entries()
2453 DIV_ROUND_UP(adap->sge.rdmaciqs, 4) + sge_queue_entries()
2506 struct adapter *adap; mem_open() local
2511 adap = file->private_data - mem; mem_open()
2513 (void)t4_fwcache(adap, FW_PARAM_DEV_FWCACHE_FLUSH); mem_open()
2524 struct adapter *adap = file->private_data - mem; mem_read() local
2539 spin_lock(&adap->win0_lock); mem_read()
2540 ret = t4_memory_rw(adap, 0, mem, pos, count, data, T4_MEMORY_READ); mem_read()
2541 spin_unlock(&adap->win0_lock); mem_read()
2564 struct adapter *adap = seq->private; tid_info_show() local
2565 const struct tid_info *t = &adap->tids; tid_info_show()
2566 enum chip_type chip = CHELSIO_CHIP_VERSION(adap->params.chip); tid_info_show()
2568 if (t4_read_reg(adap, LE_DB_CONFIG_A) & HASHEN_F) { tid_info_show()
2572 sb = t4_read_reg(adap, LE_DB_SERVER_INDEX_A) / 4; tid_info_show()
2574 sb = t4_read_reg(adap, LE_DB_SRVR_START_INDEX_A); tid_info_show()
2578 adap->tids.hash_base, tid_info_show()
2583 } else if (adap->flags & FW_OFLD_CONN) { tid_info_show()
2587 adap->tids.hash_base, tid_info_show()
2594 adap->tids.hash_base, tid_info_show()
2622 t4_read_reg(adap, LE_DB_ACT_CNT_IPV4_A), tid_info_show()
2623 t4_read_reg(adap, LE_DB_ACT_CNT_IPV6_A)); tid_info_show()
2629 static void add_debugfs_mem(struct adapter *adap, const char *name, add_debugfs_mem() argument
2632 debugfs_create_file_size(name, S_IRUSR, adap->debugfs_root, add_debugfs_mem()
2633 (void *)adap + idx, &mem_debugfs_fops, add_debugfs_mem()
2647 const struct adapter *adap = filp->private_data; blocked_fl_read() local
2649 ssize_t size = (adap->sge.egr_sz + 3) / 4 + blocked_fl_read()
2650 adap->sge.egr_sz / 32 + 2; /* includes ,/\n/\0 */ blocked_fl_read()
2657 adap->sge.egr_sz, adap->sge.blocked_fl); blocked_fl_read()
2669 struct adapter *adap = filp->private_data; blocked_fl_write() local
2671 t = kcalloc(BITS_TO_LONGS(adap->sge.egr_sz), sizeof(long), GFP_KERNEL); blocked_fl_write()
2675 err = bitmap_parse_user(ubuf, count, t, adap->sge.egr_sz); blocked_fl_write()
2679 bitmap_copy(adap->sge.blocked_fl, t, adap->sge.egr_sz); blocked_fl_write()
2733 struct adapter *adap = seq->private; meminfo_show() local
2742 lo = t4_read_reg(adap, MA_TARGET_MEM_ENABLE_A); meminfo_show()
2744 hi = t4_read_reg(adap, MA_EDRAM0_BAR_A); meminfo_show()
2751 hi = t4_read_reg(adap, MA_EDRAM1_BAR_A); meminfo_show()
2758 if (is_t5(adap->params.chip)) { meminfo_show()
2760 hi = t4_read_reg(adap, MA_EXT_MEMORY0_BAR_A); meminfo_show()
2768 hi = t4_read_reg(adap, MA_EXT_MEMORY1_BAR_A); meminfo_show()
2777 hi = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); meminfo_show()
2789 (md++)->base = t4_read_reg(adap, SGE_DBQ_CTXT_BADDR_A); meminfo_show()
2790 (md++)->base = t4_read_reg(adap, SGE_IMSG_CTXT_BADDR_A); meminfo_show()
2791 (md++)->base = t4_read_reg(adap, SGE_FLM_CACHE_BADDR_A); meminfo_show()
2792 (md++)->base = t4_read_reg(adap, TP_CMM_TCB_BASE_A); meminfo_show()
2793 (md++)->base = t4_read_reg(adap, TP_CMM_MM_BASE_A); meminfo_show()
2794 (md++)->base = t4_read_reg(adap, TP_CMM_TIMER_BASE_A); meminfo_show()
2795 (md++)->base = t4_read_reg(adap, TP_CMM_MM_RX_FLST_BASE_A); meminfo_show()
2796 (md++)->base = t4_read_reg(adap, TP_CMM_MM_TX_FLST_BASE_A); meminfo_show()
2797 (md++)->base = t4_read_reg(adap, TP_CMM_MM_PS_FLST_BASE_A); meminfo_show()
2800 md->base = t4_read_reg(adap, TP_PMM_TX_BASE_A); meminfo_show()
2802 t4_read_reg(adap, TP_PMM_TX_PAGE_SIZE_A) * meminfo_show()
2803 PMTXMAXPAGE_G(t4_read_reg(adap, TP_PMM_TX_MAX_PAGE_A)); meminfo_show()
2806 md->base = t4_read_reg(adap, TP_PMM_RX_BASE_A); meminfo_show()
2808 t4_read_reg(adap, TP_PMM_RX_PAGE_SIZE_A) * meminfo_show()
2809 PMRXMAXPAGE_G(t4_read_reg(adap, TP_PMM_RX_MAX_PAGE_A)); meminfo_show()
2812 if (t4_read_reg(adap, LE_DB_CONFIG_A) & HASHEN_F) { meminfo_show()
2813 if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) { meminfo_show()
2814 hi = t4_read_reg(adap, LE_DB_TID_HASHBASE_A) / 4; meminfo_show()
2815 md->base = t4_read_reg(adap, LE_DB_HASH_TID_BASE_A); meminfo_show()
2817 hi = t4_read_reg(adap, LE_DB_HASH_TID_BASE_A); meminfo_show()
2818 md->base = t4_read_reg(adap, meminfo_show()
2829 md->base = t4_read_reg(adap, ULP_ ## reg ## _LLIMIT_A);\ meminfo_show()
2830 (md++)->limit = t4_read_reg(adap, ULP_ ## reg ## _ULIMIT_A); \ meminfo_show()
2844 if (!is_t4(adap->params.chip)) { meminfo_show()
2846 u32 sge_ctrl = t4_read_reg(adap, SGE_CONTROL2_A); meminfo_show()
2847 u32 fifo_size = t4_read_reg(adap, SGE_DBVFIFO_SIZE_A); meminfo_show()
2849 if (is_t5(adap->params.chip)) { meminfo_show()
2857 md->base = BASEADDR_G(t4_read_reg(adap, meminfo_show()
2865 md->base = t4_read_reg(adap, ULP_RX_CTX_BASE_A); meminfo_show()
2868 md->base = t4_read_reg(adap, ULP_TX_ERR_TABLE_BASE_A); meminfo_show()
2872 md->base = adap->vres.ocq.start; meminfo_show()
2873 if (adap->vres.ocq.size) meminfo_show()
2874 md->limit = md->base + adap->vres.ocq.size - 1; meminfo_show()
2904 lo = t4_read_reg(adap, CIM_SDRAM_BASE_ADDR_A); meminfo_show()
2905 hi = t4_read_reg(adap, CIM_SDRAM_ADDR_SIZE_A) + lo - 1; meminfo_show()
2908 lo = t4_read_reg(adap, CIM_EXTMEM2_BASE_ADDR_A); meminfo_show()
2909 hi = t4_read_reg(adap, CIM_EXTMEM2_ADDR_SIZE_A) + lo - 1; meminfo_show()
2912 lo = t4_read_reg(adap, TP_PMM_RX_MAX_PAGE_A); meminfo_show()
2915 t4_read_reg(adap, TP_PMM_RX_PAGE_SIZE_A) >> 10, meminfo_show()
2918 lo = t4_read_reg(adap, TP_PMM_TX_MAX_PAGE_A); meminfo_show()
2919 hi = t4_read_reg(adap, TP_PMM_TX_PAGE_SIZE_A); meminfo_show()
2925 t4_read_reg(adap, TP_CMM_MM_MAX_PSTRUCT_A)); meminfo_show()
2928 if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) meminfo_show()
2929 lo = t4_read_reg(adap, MPS_RX_MAC_BG_PG_CNT0_A + i * 4); meminfo_show()
2931 lo = t4_read_reg(adap, MPS_RX_PG_RSV0_A + i * 4); meminfo_show()
2932 if (is_t5(adap->params.chip)) { meminfo_show()
2943 for (i = 0; i < adap->params.arch.nchan; i++) { meminfo_show()
2944 if (CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) meminfo_show()
2945 lo = t4_read_reg(adap, meminfo_show()
2948 lo = t4_read_reg(adap, MPS_RX_PG_RSV4_A + i * 4); meminfo_show()
2949 if (is_t5(adap->params.chip)) { meminfo_show()
2978 void add_debugfs_files(struct adapter *adap, add_debugfs_files() argument
2987 adap->debugfs_root, add_debugfs_files()
2988 (void *)adap + files[i].data, add_debugfs_files()
2992 int t4_setup_debugfs(struct adapter *adap) t4_setup_debugfs() argument
3058 add_debugfs_files(adap, t4_setup_debugfs()
3061 if (!is_t4(adap->params.chip)) t4_setup_debugfs()
3062 add_debugfs_files(adap, t4_setup_debugfs()
3066 i = t4_read_reg(adap, MA_TARGET_MEM_ENABLE_A); t4_setup_debugfs()
3068 size = t4_read_reg(adap, MA_EDRAM0_BAR_A); t4_setup_debugfs()
3069 add_debugfs_mem(adap, "edc0", MEM_EDC0, EDRAM0_SIZE_G(size)); t4_setup_debugfs()
3072 size = t4_read_reg(adap, MA_EDRAM1_BAR_A); t4_setup_debugfs()
3073 add_debugfs_mem(adap, "edc1", MEM_EDC1, EDRAM1_SIZE_G(size)); t4_setup_debugfs()
3075 if (is_t5(adap->params.chip)) { t4_setup_debugfs()
3077 size = t4_read_reg(adap, MA_EXT_MEMORY0_BAR_A); t4_setup_debugfs()
3078 add_debugfs_mem(adap, "mc0", MEM_MC0, t4_setup_debugfs()
3082 size = t4_read_reg(adap, MA_EXT_MEMORY1_BAR_A); t4_setup_debugfs()
3083 add_debugfs_mem(adap, "mc1", MEM_MC1, t4_setup_debugfs()
3088 size = t4_read_reg(adap, MA_EXT_MEMORY_BAR_A); t4_setup_debugfs()
3089 add_debugfs_mem(adap, "mc", MEM_MC, t4_setup_debugfs()
3094 de = debugfs_create_file_size("flash", S_IRUSR, adap->debugfs_root, adap, t4_setup_debugfs()
3095 &flash_debugfs_fops, adap->params.sf_size); t4_setup_debugfs()
3097 adap->debugfs_root, &adap->use_bd); t4_setup_debugfs()
3099 adap->debugfs_root, &adap->trace_rss); t4_setup_debugfs()
H A Dsge.c380 static void free_tx_desc(struct adapter *adap, struct sge_txq *q, free_tx_desc() argument
385 struct device *dev = adap->pdev_dev; free_tx_desc()
416 * @adap: the adapter
424 static inline void reclaim_completed_tx(struct adapter *adap, struct sge_txq *q, reclaim_completed_tx() argument
437 free_tx_desc(adap, q, avail, unmap); reclaim_completed_tx()
475 * @adap: the adapter
482 static void free_rx_bufs(struct adapter *adap, struct sge_fl *q, int n) free_rx_bufs() argument
488 dma_unmap_page(adap->pdev_dev, get_buf_addr(d), free_rx_bufs()
489 get_buf_size(adap, d), free_rx_bufs()
501 * @adap: the adapter
510 static void unmap_rx_buf(struct adapter *adap, struct sge_fl *q) unmap_rx_buf() argument
515 dma_unmap_page(adap->pdev_dev, get_buf_addr(d), unmap_rx_buf()
516 get_buf_size(adap, d), PCI_DMA_FROMDEVICE); unmap_rx_buf()
523 static inline void ring_fl_db(struct adapter *adap, struct sge_fl *q) ring_fl_db() argument
526 u32 val = adap->params.arch.sge_fl_db; ring_fl_db()
528 if (is_t4(adap->params.chip)) ring_fl_db()
543 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), ring_fl_db()
567 * @adap: the adapter
579 static unsigned int refill_fl(struct adapter *adap, struct sge_fl *q, int n, refill_fl() argument
582 struct sge *s = &adap->sge; refill_fl()
591 if (test_bit(q->cntxt_id - adap->sge.egr_start, adap->sge.blocked_fl)) refill_fl()
596 node = dev_to_node(adap->pdev_dev); refill_fl()
611 mapping = dma_map_page(adap->pdev_dev, pg, 0, refill_fl()
614 if (unlikely(dma_mapping_error(adap->pdev_dev, mapping))) { refill_fl()
641 mapping = dma_map_page(adap->pdev_dev, pg, 0, PAGE_SIZE, refill_fl()
643 if (unlikely(dma_mapping_error(adap->pdev_dev, mapping))) { refill_fl()
662 ring_fl_db(adap, q); refill_fl()
664 if (unlikely(fl_starving(adap, q))) { refill_fl()
666 set_bit(q->cntxt_id - adap->sge.egr_start, refill_fl()
667 adap->sge.starving_fl); refill_fl()
673 static inline void __refill_fl(struct adapter *adap, struct sge_fl *fl) __refill_fl() argument
675 refill_fl(adap, fl, min(MAX_RX_REFILL, fl_cap(fl) - fl->avail), __refill_fl()
923 * @adap: the adapter
929 static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q, int n) ring_tx_db() argument
948 t4_write_reg(adap, MYPF_REG(SGE_PF_KDOORBELL_A), ring_tx_db()
1101 cxgb_fcoe_offload(struct sk_buff *skb, struct adapter *adap, cxgb_fcoe_offload() argument
1118 if (!cxgb_fcoe_sof_eof_supported(adap, skb)) cxgb_fcoe_offload()
1144 struct adapter *adap; t4_eth_xmit() local
1174 adap = pi->adapter; t4_eth_xmit()
1176 q = &adap->sge.ethtxq[qidx + pi->first_qset]; t4_eth_xmit()
1178 reclaim_completed_tx(adap, &q->q, true); t4_eth_xmit()
1182 err = cxgb_fcoe_offload(skb, adap, pi, &cntrl); t4_eth_xmit()
1193 dev_err(adap->pdev_dev, t4_eth_xmit()
1203 unlikely(map_skb(adap->pdev_dev, skb, addr) < 0)) { t4_eth_xmit()
1239 if (is_t4(adap->params.chip)) t4_eth_xmit()
1245 if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) t4_eth_xmit()
1261 cntrl = hwcsum(adap->params.chip, skb) | t4_eth_xmit()
1278 TXPKT_PF_V(adap->pf); t4_eth_xmit()
1280 if (is_t4(adap->params.chip)) t4_eth_xmit()
1309 ring_tx_db(adap, &q->q, ndesc); t4_eth_xmit()
1400 ring_tx_db(q->adap, &q->q, ndesc); ctrl_xmit()
1448 ring_tx_db(q->adap, &q->q, written); restart_ctrlq()
1455 ring_tx_db(q->adap, &q->q, written); restart_ctrlq()
1461 * @adap: the adapter
1466 int t4_mgmt_tx(struct adapter *adap, struct sk_buff *skb) t4_mgmt_tx() argument
1471 ret = ctrl_xmit(&adap->sge.ctrlq[0], skb); t4_mgmt_tx()
1512 * @adap: the adapter
1523 set_bit(q->q.cntxt_id - q->adap->sge.egr_start, txq_stop_maperr()
1524 q->adap->sge.txq_maperr); txq_stop_maperr()
1566 reclaim_completed_tx(q->adap, &q->q, false); service_ofldq()
1578 else if (map_skb(q->adap->pdev_dev, skb, service_ofldq()
1591 skb->dev = q->adap->port[0]; service_ofldq()
1603 ring_tx_db(q->adap, &q->q, written); service_ofldq()
1613 ring_tx_db(q->adap, &q->q, written); service_ofldq()
1674 static inline int ofld_send(struct adapter *adap, struct sk_buff *skb) ofld_send() argument
1680 if (adap->tids.nsftids) ofld_send()
1682 return ctrl_xmit(&adap->sge.ctrlq[idx], skb); ofld_send()
1684 return ofld_xmit(&adap->sge.ofldtxq[idx], skb); ofld_send()
1689 * @adap: the adapter
1696 int t4_ofld_send(struct adapter *adap, struct sk_buff *skb) t4_ofld_send() argument
1701 ret = ofld_send(adap, skb); t4_ofld_send()
1800 static noinline int handle_trace_pkt(struct adapter *adap, handle_trace_pkt() argument
1811 if (is_t4(adap->params.chip)) handle_trace_pkt()
1818 skb->dev = adap->port[0]; handle_trace_pkt()
1825 * @adap: the adapter
1832 static void cxgb4_sgetim_to_hwtstamp(struct adapter *adap, cxgb4_sgetim_to_hwtstamp() argument
1837 u64 tmp = (sgetstamp * 1000 * 1000 + adap->params.vpd.cclk / 2); cxgb4_sgetim_to_hwtstamp()
1839 ns = div_u64(tmp, adap->params.vpd.cclk); cxgb4_sgetim_to_hwtstamp()
1848 struct adapter *adapter = rxq->rspq.adap; do_gro()
1904 struct sge *s = &q->adap->sge; t4_ethrx_handler()
1905 int cpl_trace_pkt = is_t4(q->adap->params.chip) ? t4_ethrx_handler()
1910 return handle_trace_pkt(q->adap, si); t4_ethrx_handler()
1940 cxgb4_sgetim_to_hwtstamp(q->adap, skb_hwtstamps(skb), t4_ethrx_handler()
2060 struct adapter *adapter = q->adap; process_responses()
2078 free_rx_bufs(q->adap, &rxq->fl, 1); process_responses()
2095 unmap_rx_buf(q->adap, &rxq->fl); process_responses()
2104 dma_sync_single_for_cpu(q->adap->pdev_dev, process_responses()
2135 __refill_fl(q->adap, &rxq->fl); process_responses()
2158 t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A), cxgb_busy_poll()
2224 t4_write_reg(q->adap, MYPF_REG(SGE_PF_GTS_A), napi_rx_handler()
2250 static unsigned int process_intrq(struct adapter *adap) process_intrq() argument
2254 struct sge_rspq *q = &adap->sge.intrq; process_intrq()
2257 spin_lock(&adap->sge.intrq_lock); process_intrq()
2267 qid -= adap->sge.ingr_start; process_intrq()
2268 napi_schedule(&adap->sge.ingr_map[qid]->napi); process_intrq()
2280 t4_write_reg(adap, MYPF_REG(SGE_PF_GTS_A), process_intrq()
2287 spin_unlock(&adap->sge.intrq_lock); process_intrq()
2297 struct adapter *adap = cookie; t4_intr_msi() local
2299 if (adap->flags & MASTER_PF) t4_intr_msi()
2300 t4_slow_intr_handler(adap); t4_intr_msi()
2301 process_intrq(adap); t4_intr_msi()
2312 struct adapter *adap = cookie; t4_intr_intx() local
2314 t4_write_reg(adap, MYPF_REG(PCIE_PF_CLI_A), 0); t4_intr_intx()
2315 if (((adap->flags & MASTER_PF) && t4_slow_intr_handler(adap)) | t4_intr_intx()
2316 process_intrq(adap)) t4_intr_intx()
2323 * @adap: the adapter
2328 irq_handler_t t4_intr_handler(struct adapter *adap) t4_intr_handler() argument
2330 if (adap->flags & USING_MSIX) t4_intr_handler()
2332 if (adap->flags & USING_MSI) t4_intr_handler()
2341 struct adapter *adap = (struct adapter *)data; sge_rx_timer_cb() local
2342 struct sge *s = &adap->sge; sge_rx_timer_cb()
2353 if (fl_starving(adap, fl)) { sge_rx_timer_cb()
2365 if (!(adap->flags & MASTER_PF)) sge_rx_timer_cb()
2368 t4_idma_monitor(adap, &s->idma_monitor, HZ, RX_QCHECK_PERIOD); sge_rx_timer_cb()
2378 struct adapter *adap = (struct adapter *)data; sge_tx_timer_cb() local
2379 struct sge *s = &adap->sge; sge_tx_timer_cb()
2404 free_tx_desc(adap, &q->q, avail, true); sge_tx_timer_cb()
2450 int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, t4_sge_alloc_rxq() argument
2456 struct sge *s = &adap->sge; t4_sge_alloc_rxq()
2462 iq->desc = alloc_ring(adap->pdev_dev, iq->size, iq->iqe_len, 0, t4_sge_alloc_rxq()
2470 FW_IQ_CMD_PFN_V(adap->pf) | FW_IQ_CMD_VFN_V(0)); t4_sge_alloc_rxq()
2489 enum chip_type chip = CHELSIO_CHIP_VERSION(adap->params.chip); t4_sge_alloc_rxq()
2501 fl->desc = alloc_ring(adap->pdev_dev, fl->size, sizeof(__be64), t4_sge_alloc_rxq()
2526 ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); t4_sge_alloc_rxq()
2538 iq->bar2_addr = bar2_address(adap, t4_sge_alloc_rxq()
2549 adap->sge.ingr_map[iq->cntxt_id - adap->sge.ingr_start] = iq; t4_sge_alloc_rxq()
2556 adap->sge.egr_map[fl->cntxt_id - adap->sge.egr_start] = fl; t4_sge_alloc_rxq()
2561 fl->bar2_addr = bar2_address(adap, t4_sge_alloc_rxq()
2565 refill_fl(adap, fl, fl_cap(fl), GFP_KERNEL); t4_sge_alloc_rxq()
2576 if (!is_t4(adap->params.chip) && cong >= 0) { t4_sge_alloc_rxq()
2594 ret = t4_set_params(adap, adap->mbox, adap->pf, 0, 1, t4_sge_alloc_rxq()
2597 dev_warn(adap->pdev_dev, "Failed to set Congestion" t4_sge_alloc_rxq()
2608 dma_free_coherent(adap->pdev_dev, iq->size * iq->iqe_len, t4_sge_alloc_rxq()
2615 dma_free_coherent(adap->pdev_dev, flsz * sizeof(struct tx_desc), t4_sge_alloc_rxq()
2622 static void init_txq(struct adapter *adap, struct sge_txq *q, unsigned int id) init_txq() argument
2625 q->bar2_addr = bar2_address(adap, init_txq()
2634 adap->sge.egr_map[id - adap->sge.egr_start] = q; init_txq()
2637 int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq, t4_sge_alloc_eth_txq() argument
2643 struct sge *s = &adap->sge; t4_sge_alloc_eth_txq()
2649 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, t4_sge_alloc_eth_txq()
2659 FW_EQ_ETH_CMD_PFN_V(adap->pf) | t4_sge_alloc_eth_txq()
2676 ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); t4_sge_alloc_eth_txq()
2680 dma_free_coherent(adap->pdev_dev, t4_sge_alloc_eth_txq()
2687 init_txq(adap, &txq->q, FW_EQ_ETH_CMD_EQID_G(ntohl(c.eqid_pkd))); t4_sge_alloc_eth_txq()
2694 int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq, t4_sge_alloc_ctrl_txq() argument
2700 struct sge *s = &adap->sge; t4_sge_alloc_ctrl_txq()
2706 txq->q.desc = alloc_ring(adap->pdev_dev, nentries, t4_sge_alloc_ctrl_txq()
2708 NULL, 0, dev_to_node(adap->pdev_dev)); t4_sge_alloc_ctrl_txq()
2714 FW_EQ_CTRL_CMD_PFN_V(adap->pf) | t4_sge_alloc_ctrl_txq()
2731 ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); t4_sge_alloc_ctrl_txq()
2733 dma_free_coherent(adap->pdev_dev, t4_sge_alloc_ctrl_txq()
2740 init_txq(adap, &txq->q, FW_EQ_CTRL_CMD_EQID_G(ntohl(c.cmpliqid_eqid))); t4_sge_alloc_ctrl_txq()
2741 txq->adap = adap; t4_sge_alloc_ctrl_txq()
2748 int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq, t4_sge_alloc_ofld_txq() argument
2753 struct sge *s = &adap->sge; t4_sge_alloc_ofld_txq()
2759 txq->q.desc = alloc_ring(adap->pdev_dev, txq->q.size, t4_sge_alloc_ofld_txq()
2769 FW_EQ_OFLD_CMD_PFN_V(adap->pf) | t4_sge_alloc_ofld_txq()
2784 ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); t4_sge_alloc_ofld_txq()
2788 dma_free_coherent(adap->pdev_dev, t4_sge_alloc_ofld_txq()
2795 init_txq(adap, &txq->q, FW_EQ_OFLD_CMD_EQID_G(ntohl(c.eqid_pkd))); t4_sge_alloc_ofld_txq()
2796 txq->adap = adap; t4_sge_alloc_ofld_txq()
2804 static void free_txq(struct adapter *adap, struct sge_txq *q) free_txq() argument
2806 struct sge *s = &adap->sge; free_txq()
2808 dma_free_coherent(adap->pdev_dev, free_txq()
2816 static void free_rspq_fl(struct adapter *adap, struct sge_rspq *rq, free_rspq_fl() argument
2819 struct sge *s = &adap->sge; free_rspq_fl()
2822 adap->sge.ingr_map[rq->cntxt_id - adap->sge.ingr_start] = NULL; free_rspq_fl()
2823 t4_iq_free(adap, adap->mbox, adap->pf, 0, FW_IQ_TYPE_FL_INT_CAP, free_rspq_fl()
2825 dma_free_coherent(adap->pdev_dev, (rq->size + 1) * rq->iqe_len, free_rspq_fl()
2834 free_rx_bufs(adap, fl, fl->avail); free_rspq_fl()
2835 dma_free_coherent(adap->pdev_dev, fl->size * 8 + s->stat_len, free_rspq_fl()
2846 * @adap: the adapter
2852 void t4_free_ofld_rxqs(struct adapter *adap, int n, struct sge_ofld_rxq *q) t4_free_ofld_rxqs() argument
2856 free_rspq_fl(adap, &q->rspq, t4_free_ofld_rxqs()
2862 * @adap: the adapter
2866 void t4_free_sge_resources(struct adapter *adap) t4_free_sge_resources() argument
2869 struct sge_eth_rxq *eq = adap->sge.ethrxq; t4_free_sge_resources()
2870 struct sge_eth_txq *etq = adap->sge.ethtxq; t4_free_sge_resources()
2873 for (i = 0; i < adap->sge.ethqsets; i++, eq++, etq++) { t4_free_sge_resources()
2875 free_rspq_fl(adap, &eq->rspq, t4_free_sge_resources()
2878 t4_eth_eq_free(adap, adap->mbox, adap->pf, 0, t4_free_sge_resources()
2880 free_tx_desc(adap, &etq->q, etq->q.in_use, true); t4_free_sge_resources()
2882 free_txq(adap, &etq->q); t4_free_sge_resources()
2887 t4_free_ofld_rxqs(adap, adap->sge.ofldqsets, adap->sge.ofldrxq); t4_free_sge_resources()
2888 t4_free_ofld_rxqs(adap, adap->sge.rdmaqs, adap->sge.rdmarxq); t4_free_sge_resources()
2889 t4_free_ofld_rxqs(adap, adap->sge.rdmaciqs, adap->sge.rdmaciq); t4_free_sge_resources()
2892 for (i = 0; i < ARRAY_SIZE(adap->sge.ofldtxq); i++) { t4_free_sge_resources()
2893 struct sge_ofld_txq *q = &adap->sge.ofldtxq[i]; t4_free_sge_resources()
2897 t4_ofld_eq_free(adap, adap->mbox, adap->pf, 0, t4_free_sge_resources()
2899 free_tx_desc(adap, &q->q, q->q.in_use, false); t4_free_sge_resources()
2902 free_txq(adap, &q->q); t4_free_sge_resources()
2907 for (i = 0; i < ARRAY_SIZE(adap->sge.ctrlq); i++) { t4_free_sge_resources()
2908 struct sge_ctrl_txq *cq = &adap->sge.ctrlq[i]; t4_free_sge_resources()
2912 t4_ctrl_eq_free(adap, adap->mbox, adap->pf, 0, t4_free_sge_resources()
2915 free_txq(adap, &cq->q); t4_free_sge_resources()
2919 if (adap->sge.fw_evtq.desc) t4_free_sge_resources()
2920 free_rspq_fl(adap, &adap->sge.fw_evtq, NULL); t4_free_sge_resources()
2922 if (adap->sge.intrq.desc) t4_free_sge_resources()
2923 free_rspq_fl(adap, &adap->sge.intrq, NULL); t4_free_sge_resources()
2926 memset(adap->sge.egr_map, 0, t4_free_sge_resources()
2927 adap->sge.egr_sz * sizeof(*adap->sge.egr_map)); t4_free_sge_resources()
2930 void t4_sge_start(struct adapter *adap) t4_sge_start() argument
2932 adap->sge.ethtxq_rover = 0; t4_sge_start()
2933 mod_timer(&adap->sge.rx_timer, jiffies + RX_QCHECK_PERIOD); t4_sge_start()
2934 mod_timer(&adap->sge.tx_timer, jiffies + TX_QCHECK_PERIOD); t4_sge_start()
2939 * @adap: the adapter
2945 void t4_sge_stop(struct adapter *adap) t4_sge_stop() argument
2948 struct sge *s = &adap->sge; t4_sge_stop()
2974 * @adap: the adapter
2980 static int t4_sge_init_soft(struct adapter *adap) t4_sge_init_soft() argument
2982 struct sge *s = &adap->sge; t4_sge_init_soft()
2992 if ((t4_read_reg(adap, SGE_CONTROL_A) & RXPKTCPLMODE_F) != t4_sge_init_soft()
2994 dev_err(adap->pdev_dev, "bad SGE CPL MODE\n"); t4_sge_init_soft()
3007 t4_read_reg(adap, SGE_FL_BUFFER_SIZE0_A+(x)*sizeof(u32)) t4_sge_init_soft()
3027 dev_err(adap->pdev_dev, "bad SGE FL page buffer sizes [%d, %d]\n", t4_sge_init_soft()
3034 if (fl_small_mtu < FL_MTU_SMALL_BUFSIZE(adap) || t4_sge_init_soft()
3035 fl_large_mtu < FL_MTU_LARGE_BUFSIZE(adap)) { t4_sge_init_soft()
3036 dev_err(adap->pdev_dev, "bad SGE FL MTU sizes [%d, %d]\n", t4_sge_init_soft()
3045 timer_value_0_and_1 = t4_read_reg(adap, SGE_TIMER_VALUE_0_AND_1_A); t4_sge_init_soft()
3046 timer_value_2_and_3 = t4_read_reg(adap, SGE_TIMER_VALUE_2_AND_3_A); t4_sge_init_soft()
3047 timer_value_4_and_5 = t4_read_reg(adap, SGE_TIMER_VALUE_4_AND_5_A); t4_sge_init_soft()
3048 s->timer_val[0] = core_ticks_to_us(adap, t4_sge_init_soft()
3050 s->timer_val[1] = core_ticks_to_us(adap, t4_sge_init_soft()
3052 s->timer_val[2] = core_ticks_to_us(adap, t4_sge_init_soft()
3054 s->timer_val[3] = core_ticks_to_us(adap, t4_sge_init_soft()
3056 s->timer_val[4] = core_ticks_to_us(adap, t4_sge_init_soft()
3058 s->timer_val[5] = core_ticks_to_us(adap, t4_sge_init_soft()
3061 ingress_rx_threshold = t4_read_reg(adap, SGE_INGRESS_RX_THRESHOLD_A); t4_sge_init_soft()
3072 * @adap: the adapter
3077 int t4_sge_init(struct adapter *adap) t4_sge_init() argument
3079 struct sge *s = &adap->sge; t4_sge_init()
3088 sge_control = t4_read_reg(adap, SGE_CONTROL_A); t4_sge_init()
3104 if (is_t4(adap->params.chip)) { t4_sge_init()
3110 sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A); t4_sge_init()
3121 ret = t4_sge_init_soft(adap); t4_sge_init()
3137 sge_conm_ctrl = t4_read_reg(adap, SGE_CONM_CTRL_A); t4_sge_init()
3138 if (is_t4(adap->params.chip)) t4_sge_init()
3144 t4_idma_monitor_init(adap, &s->idma_monitor); t4_sge_init()
3149 setup_timer(&s->rx_timer, sge_rx_timer_cb, (unsigned long)adap); t4_sge_init()
3150 setup_timer(&s->tx_timer, sge_tx_timer_cb, (unsigned long)adap); t4_sge_init()
H A Dt4_hw.c103 * @adap: the adapter
113 void t4_read_indirect(struct adapter *adap, unsigned int addr_reg, t4_read_indirect() argument
118 t4_write_reg(adap, addr_reg, start_idx); t4_read_indirect()
119 *vals++ = t4_read_reg(adap, data_reg); t4_read_indirect()
126 * @adap: the adapter
136 void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, t4_write_indirect() argument
141 t4_write_reg(adap, addr_reg, start_idx++); t4_write_indirect()
142 t4_write_reg(adap, data_reg, *vals++); t4_write_indirect()
152 void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) t4_hw_pci_read_cfg4() argument
154 u32 req = FUNCTION_V(adap->pf) | REGISTER_V(reg); t4_hw_pci_read_cfg4()
156 if (CHELSIO_CHIP_VERSION(adap->params.chip) <= CHELSIO_T5) t4_hw_pci_read_cfg4()
161 if (is_t4(adap->params.chip)) t4_hw_pci_read_cfg4()
164 t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, req); t4_hw_pci_read_cfg4()
165 *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA_A); t4_hw_pci_read_cfg4()
172 t4_write_reg(adap, PCIE_CFG_SPACE_REQ_A, 0); t4_hw_pci_read_cfg4()
177 * @adap: the adapter
183 static void t4_report_fw_error(struct adapter *adap) t4_report_fw_error() argument
197 pcie_fw = t4_read_reg(adap, PCIE_FW_A); t4_report_fw_error()
199 dev_err(adap->pdev_dev, "Firmware reports adapter error: %s\n", t4_report_fw_error()
206 static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, get_mbox_rpl() argument
210 *rpl++ = cpu_to_be64(t4_read_reg64(adap, mbox_addr)); get_mbox_rpl()
216 static void fw_asrt(struct adapter *adap, u32 mbox_addr) fw_asrt() argument
220 get_mbox_rpl(adap, (__be64 *)&asrt, sizeof(asrt) / 8, mbox_addr); fw_asrt()
221 dev_alert(adap->pdev_dev, fw_asrt()
227 static void dump_mbox(struct adapter *adap, int mbox, u32 data_reg) dump_mbox() argument
229 dev_err(adap->pdev_dev, dump_mbox()
231 (unsigned long long)t4_read_reg64(adap, data_reg), dump_mbox()
232 (unsigned long long)t4_read_reg64(adap, data_reg + 8), dump_mbox()
233 (unsigned long long)t4_read_reg64(adap, data_reg + 16), dump_mbox()
234 (unsigned long long)t4_read_reg64(adap, data_reg + 24), dump_mbox()
235 (unsigned long long)t4_read_reg64(adap, data_reg + 32), dump_mbox()
236 (unsigned long long)t4_read_reg64(adap, data_reg + 40), dump_mbox()
237 (unsigned long long)t4_read_reg64(adap, data_reg + 48), dump_mbox()
238 (unsigned long long)t4_read_reg64(adap, data_reg + 56)); dump_mbox()
243 * @adap: the adapter
264 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd, t4_wr_mbox_meat_timeout() argument
285 if (adap->pdev->error_state != pci_channel_io_normal) t4_wr_mbox_meat_timeout()
288 v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); t4_wr_mbox_meat_timeout()
290 v = MBOWNER_G(t4_read_reg(adap, ctl_reg)); t4_wr_mbox_meat_timeout()
296 t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p++)); t4_wr_mbox_meat_timeout()
298 t4_write_reg(adap, ctl_reg, MBMSGVALID_F | MBOWNER_V(MBOX_OWNER_FW)); t4_wr_mbox_meat_timeout()
299 t4_read_reg(adap, ctl_reg); /* flush write */ t4_wr_mbox_meat_timeout()
313 v = t4_read_reg(adap, ctl_reg); t4_wr_mbox_meat_timeout()
316 t4_write_reg(adap, ctl_reg, 0); t4_wr_mbox_meat_timeout()
320 res = t4_read_reg64(adap, data_reg); t4_wr_mbox_meat_timeout()
322 fw_asrt(adap, data_reg); t4_wr_mbox_meat_timeout()
325 get_mbox_rpl(adap, rpl, size / 8, data_reg); t4_wr_mbox_meat_timeout()
329 dump_mbox(adap, mbox, data_reg); t4_wr_mbox_meat_timeout()
330 t4_write_reg(adap, ctl_reg, 0); t4_wr_mbox_meat_timeout()
335 dump_mbox(adap, mbox, data_reg); t4_wr_mbox_meat_timeout()
336 dev_err(adap->pdev_dev, "command %#x in mailbox %d timed out\n", t4_wr_mbox_meat_timeout()
338 t4_report_fw_error(adap); t4_wr_mbox_meat_timeout()
342 int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size, t4_wr_mbox_meat() argument
345 return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, sleep_ok, t4_wr_mbox_meat()
349 static int t4_edc_err_read(struct adapter *adap, int idx) t4_edc_err_read() argument
354 if (is_t4(adap->params.chip)) { t4_edc_err_read()
355 CH_WARN(adap, "%s: T4 NOT supported.\n", __func__); t4_edc_err_read()
359 CH_WARN(adap, "%s: idx %d NOT supported.\n", __func__, idx); t4_edc_err_read()
366 CH_WARN(adap, t4_edc_err_read()
369 t4_read_reg(adap, edc_ecc_err_addr_reg)); t4_edc_err_read()
370 CH_WARN(adap, t4_edc_err_read()
373 (unsigned long long)t4_read_reg64(adap, rdata_reg), t4_edc_err_read()
374 (unsigned long long)t4_read_reg64(adap, rdata_reg + 8), t4_edc_err_read()
375 (unsigned long long)t4_read_reg64(adap, rdata_reg + 16), t4_edc_err_read()
376 (unsigned long long)t4_read_reg64(adap, rdata_reg + 24), t4_edc_err_read()
377 (unsigned long long)t4_read_reg64(adap, rdata_reg + 32), t4_edc_err_read()
378 (unsigned long long)t4_read_reg64(adap, rdata_reg + 40), t4_edc_err_read()
379 (unsigned long long)t4_read_reg64(adap, rdata_reg + 48), t4_edc_err_read()
380 (unsigned long long)t4_read_reg64(adap, rdata_reg + 56), t4_edc_err_read()
381 (unsigned long long)t4_read_reg64(adap, rdata_reg + 64)); t4_edc_err_read()
388 * @adap: the adapter
403 int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, t4_memory_rw() argument
430 edc_size = EDRAM0_SIZE_G(t4_read_reg(adap, MA_EDRAM0_BAR_A)); t4_memory_rw()
434 mc_size = EXT_MEM0_SIZE_G(t4_read_reg(adap, t4_memory_rw()
450 mem_reg = t4_read_reg(adap, t4_memory_rw()
455 if (is_t4(adap->params.chip)) t4_memory_rw()
456 mem_base -= adap->t4_bar0; t4_memory_rw()
457 win_pf = is_t4(adap->params.chip) ? 0 : PFNUM_V(adap->pf); t4_memory_rw()
469 t4_write_reg(adap, t4_memory_rw()
472 t4_read_reg(adap, t4_memory_rw()
511 *buf++ = le32_to_cpu((__force __le32)t4_read_reg(adap, t4_memory_rw()
514 t4_write_reg(adap, mem_base + offset, t4_memory_rw()
528 t4_write_reg(adap, t4_memory_rw()
531 t4_read_reg(adap, t4_memory_rw()
552 (__force __le32)t4_read_reg(adap, t4_memory_rw()
560 t4_write_reg(adap, mem_base + offset, t4_memory_rw()
573 u32 t4_read_pcie_cfg4(struct adapter *adap, int reg) t4_read_pcie_cfg4() argument
592 (FW_LDST_CMD_LC_F | FW_LDST_CMD_FN_V(adap->pf)); t4_read_pcie_cfg4()
598 ret = t4_wr_mbox(adap, adap->mbox, &ldst_cmd, sizeof(ldst_cmd), t4_read_pcie_cfg4()
606 t4_hw_pci_read_cfg4(adap, reg, &val); t4_read_pcie_cfg4()
614 static u32 t4_get_window(struct adapter *adap, u32 pci_base, u64 pci_mask, t4_get_window() argument
619 if (is_t4(adap->params.chip)) { t4_get_window()
631 bar0 = t4_read_pcie_cfg4(adap, pci_base); t4_get_window()
633 adap->t4_bar0 = bar0; t4_get_window()
644 u32 t4_get_util_window(struct adapter *adap) t4_get_util_window() argument
646 return t4_get_window(adap, PCI_BASE_ADDRESS_0, t4_get_util_window()
654 void t4_setup_memwin(struct adapter *adap, u32 memwin_base, u32 window) t4_setup_memwin() argument
656 t4_write_reg(adap, t4_setup_memwin()
660 t4_read_reg(adap, t4_setup_memwin()
690 * @adap: the adapter
698 void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size) t4_get_regs() argument
2507 unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip); t4_get_regs()
2529 dev_err(adap->pdev_dev, t4_get_regs()
2547 *bufp++ = t4_read_reg(adap, reg); t4_get_regs()
2947 int t4_get_exprom_version(struct adapter *adap, u32 *vers) t4_get_exprom_version() argument
2957 ret = t4_read_flash(adap, FLASH_EXP_ROM_START, t4_get_exprom_version()
2976 * @adap: the adapter
2982 int t4_check_fw_version(struct adapter *adap) t4_check_fw_version() argument
2986 unsigned int chip_version = CHELSIO_CHIP_VERSION(adap->params.chip); t4_check_fw_version()
2988 ret = t4_get_fw_version(adap, &adap->params.fw_vers); t4_check_fw_version()
2991 ret = t4_get_fw_version(adap, &adap->params.fw_vers); t4_check_fw_version()
2996 major = FW_HDR_FW_VER_MAJOR_G(adap->params.fw_vers); t4_check_fw_version()
2997 minor = FW_HDR_FW_VER_MINOR_G(adap->params.fw_vers); t4_check_fw_version()
2998 micro = FW_HDR_FW_VER_MICRO_G(adap->params.fw_vers); t4_check_fw_version()
3017 dev_err(adap->pdev_dev, "Unsupported chip type, %x\n", t4_check_fw_version()
3018 adap->chip); t4_check_fw_version()
3024 dev_err(adap->pdev_dev, t4_check_fw_version()
3056 static int should_install_fs_fw(struct adapter *adap, int card_fw_usable, should_install_fs_fw() argument
3074 dev_err(adap->pdev_dev, "firmware on card (%u.%u.%u.%u) is %s, " should_install_fs_fw()
3084 int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info, t4_prep_fw() argument
3096 ret = -t4_read_flash(adap, FLASH_FW_START, t4_prep_fw()
3102 dev_err(adap->pdev_dev, t4_prep_fw()
3122 should_install_fs_fw(adap, card_fw_usable, t4_prep_fw()
3125 ret = -t4_fw_upgrade(adap, adap->mbox, fw_data, t4_prep_fw()
3128 dev_err(adap->pdev_dev, t4_prep_fw()
3146 dev_err(adap->pdev_dev, "Cannot find a usable firmware: " t4_prep_fw()
3162 adap->params.fw_vers = be32_to_cpu(card_fw->fw_ver); t4_prep_fw()
3163 adap->params.tp_vers = be32_to_cpu(card_fw->tp_microcode_ver); t4_prep_fw()
3220 static bool t4_fw_matches_chip(const struct adapter *adap, t4_fw_matches_chip() argument
3226 if ((is_t4(adap->params.chip) && hdr->chip == FW_HDR_CHIP_T4) || t4_fw_matches_chip()
3227 (is_t5(adap->params.chip) && hdr->chip == FW_HDR_CHIP_T5) || t4_fw_matches_chip()
3228 (is_t6(adap->params.chip) && hdr->chip == FW_HDR_CHIP_T6)) t4_fw_matches_chip()
3231 dev_err(adap->pdev_dev, t4_fw_matches_chip()
3233 hdr->chip, CHELSIO_CHIP_VERSION(adap->params.chip)); t4_fw_matches_chip()
3239 * @adap: the adapter
3245 int t4_load_fw(struct adapter *adap, const u8 *fw_data, unsigned int size) t4_load_fw() argument
3253 unsigned int sf_sec_size = adap->params.sf_size / adap->params.sf_nsec; t4_load_fw()
3254 unsigned int fw_img_start = adap->params.sf_fw_start; t4_load_fw()
3258 dev_err(adap->pdev_dev, "FW image has no data\n"); t4_load_fw()
3262 dev_err(adap->pdev_dev, t4_load_fw()
3267 dev_err(adap->pdev_dev, t4_load_fw()
3272 dev_err(adap->pdev_dev, "FW image too large, max is %u bytes\n", t4_load_fw()
3276 if (!t4_fw_matches_chip(adap, hdr)) t4_load_fw()
3283 dev_err(adap->pdev_dev, t4_load_fw()
3289 ret = t4_flash_erase_sectors(adap, fw_start_sec, fw_start_sec + i - 1); t4_load_fw()
3300 ret = t4_write_flash(adap, fw_img_start, SF_PAGE_SIZE, first_page); t4_load_fw()
3308 ret = t4_write_flash(adap, addr, SF_PAGE_SIZE, fw_data); t4_load_fw()
3313 ret = t4_write_flash(adap, t4_load_fw()
3318 dev_err(adap->pdev_dev, "firmware download failed, error %d\n", t4_load_fw()
3321 ret = t4_get_fw_version(adap, &adap->params.fw_vers); t4_load_fw()
3327 * @adap: the adapter
3333 int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver) t4_phy_fw_ver() argument
3340 FW_PARAMS_PARAM_Y_V(adap->params.portvec) | t4_phy_fw_ver()
3342 ret = t4_query_params(adap, adap->mbox, adap->pf, 0, 1, t4_phy_fw_ver()
3352 * @adap: the adapter
3377 int t4_load_phy_fw(struct adapter *adap, t4_load_phy_fw() argument
3392 ret = t4_phy_fw_ver(adap, &cur_phy_fw_ver); t4_load_phy_fw()
3397 CH_WARN(adap, "PHY Firmware already up-to-date, " t4_load_phy_fw()
3411 FW_PARAMS_PARAM_Y_V(adap->params.portvec) | t4_load_phy_fw()
3414 ret = t4_query_params_rw(adap, adap->mbox, adap->pf, 0, 1, t4_load_phy_fw()
3426 ret = t4_memory_rw(adap, win, mtype, maddr, t4_load_phy_fw()
3441 FW_PARAMS_PARAM_Y_V(adap->params.portvec) | t4_load_phy_fw()
3443 ret = t4_set_params_timeout(adap, adap->mbox, adap->pf, 0, 1, t4_load_phy_fw()
3450 ret = t4_phy_fw_ver(adap, &cur_phy_fw_ver); t4_load_phy_fw()
3455 CH_WARN(adap, "PHY Firmware did not update: " t4_load_phy_fw()
3468 * @adap: the adapter
3471 int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op) t4_fwcache() argument
3479 FW_PARAMS_CMD_PFN_V(adap->pf) | t4_fwcache()
3487 return t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), NULL); t4_fwcache()
3490 void t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp, t4_cim_read_pif_la() argument
3497 cfg = t4_read_reg(adap, CIM_DEBUGCFG_A); t4_cim_read_pif_la()
3499 t4_write_reg(adap, CIM_DEBUGCFG_A, cfg ^ LADBGEN_F); t4_cim_read_pif_la()
3501 val = t4_read_reg(adap, CIM_DEBUGSTS_A); t4_cim_read_pif_la()
3511 t4_write_reg(adap, CIM_DEBUGCFG_A, POLADBGRDPTR_V(req) | t4_cim_read_pif_la()
3513 *pif_req++ = t4_read_reg(adap, CIM_PO_LA_DEBUGDATA_A); t4_cim_read_pif_la()
3514 *pif_rsp++ = t4_read_reg(adap, CIM_PI_LA_DEBUGDATA_A); t4_cim_read_pif_la()
3521 t4_write_reg(adap, CIM_DEBUGCFG_A, cfg); t4_cim_read_pif_la()
3524 void t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp) t4_cim_read_ma_la() argument
3529 cfg = t4_read_reg(adap, CIM_DEBUGCFG_A); t4_cim_read_ma_la()
3531 t4_write_reg(adap, CIM_DEBUGCFG_A, cfg ^ LADBGEN_F); t4_cim_read_ma_la()
3536 t4_write_reg(adap, CIM_DEBUGCFG_A, POLADBGRDPTR_V(idx) | t4_cim_read_ma_la()
3538 *ma_req++ = t4_read_reg(adap, CIM_PO_LA_MADEBUGDATA_A); t4_cim_read_ma_la()
3539 *ma_rsp++ = t4_read_reg(adap, CIM_PI_LA_MADEBUGDATA_A); t4_cim_read_ma_la()
3542 t4_write_reg(adap, CIM_DEBUGCFG_A, cfg); t4_cim_read_ma_la()
3545 void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf) t4_ulprx_read_la() argument
3552 t4_write_reg(adap, ULP_RX_LA_CTL_A, i); t4_ulprx_read_la()
3553 j = t4_read_reg(adap, ULP_RX_LA_WRPTR_A); t4_ulprx_read_la()
3554 t4_write_reg(adap, ULP_RX_LA_RDPTR_A, j); t4_ulprx_read_la()
3556 *p = t4_read_reg(adap, ULP_RX_LA_RDDATA_A); t4_ulprx_read_la()
3577 int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port, t4_link_l1cfg() argument
3607 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_link_l1cfg()
3612 * @adap: the adapter
3618 int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port) t4_restart_aneg() argument
3630 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_restart_aneg()
3633 typedef void (*int_handler_t)(struct adapter *adap);
4053 static void le_intr_handler(struct adapter *adap) le_intr_handler() argument
4055 enum chip_type chip = CHELSIO_CHIP_VERSION(adap->params.chip); le_intr_handler()
4074 if (t4_handle_intr_status(adap, LE_DB_INT_CAUSE_A, le_intr_handler()
4077 t4_fatal_err(adap); le_intr_handler()
4205 static void ma_intr_handler(struct adapter *adap) ma_intr_handler() argument
4207 u32 v, status = t4_read_reg(adap, MA_INT_CAUSE_A); ma_intr_handler()
4210 dev_alert(adap->pdev_dev, ma_intr_handler()
4212 t4_read_reg(adap, MA_PARITY_ERROR_STATUS1_A)); ma_intr_handler()
4213 if (is_t5(adap->params.chip)) ma_intr_handler()
4214 dev_alert(adap->pdev_dev, ma_intr_handler()
4216 t4_read_reg(adap, ma_intr_handler()
4220 v = t4_read_reg(adap, MA_INT_WRAP_STATUS_A); ma_intr_handler()
4221 dev_alert(adap->pdev_dev, "MA address wrap-around error by " ma_intr_handler()
4226 t4_write_reg(adap, MA_INT_CAUSE_A, status); ma_intr_handler()
4227 t4_fatal_err(adap); ma_intr_handler()
4233 static void smb_intr_handler(struct adapter *adap) smb_intr_handler() argument
4242 if (t4_handle_intr_status(adap, SMB_INT_CAUSE_A, smb_intr_info)) smb_intr_handler()
4243 t4_fatal_err(adap); smb_intr_handler()
4249 static void ncsi_intr_handler(struct adapter *adap) ncsi_intr_handler() argument
4259 if (t4_handle_intr_status(adap, NCSI_INT_CAUSE_A, ncsi_intr_info)) ncsi_intr_handler()
4260 t4_fatal_err(adap); ncsi_intr_handler()
4266 static void xgmac_intr_handler(struct adapter *adap, int port) xgmac_intr_handler() argument
4270 if (is_t4(adap->params.chip)) xgmac_intr_handler()
4275 v = t4_read_reg(adap, int_cause_reg); xgmac_intr_handler()
4282 dev_alert(adap->pdev_dev, "XGMAC %d Tx FIFO parity error\n", xgmac_intr_handler()
4285 dev_alert(adap->pdev_dev, "XGMAC %d Rx FIFO parity error\n", xgmac_intr_handler()
4287 t4_write_reg(adap, PORT_REG(port, XGMAC_PORT_INT_CAUSE_A), v); xgmac_intr_handler()
4288 t4_fatal_err(adap); xgmac_intr_handler()
4294 static void pl_intr_handler(struct adapter *adap) pl_intr_handler() argument
4302 if (t4_handle_intr_status(adap, PL_PL_INT_CAUSE_A, pl_intr_info)) pl_intr_handler()
4303 t4_fatal_err(adap); pl_intr_handler()
4568 static int rd_rss_row(struct adapter *adap, int row, u32 *val) rd_rss_row() argument
4570 t4_write_reg(adap, TP_RSS_LKP_TABLE_A, 0xfff00000 | row); rd_rss_row()
4571 return t4_wait_op_done_val(adap, TP_RSS_LKP_TABLE_A, LKPTBLROWVLD_F, 1, rd_rss_row()
4597 static unsigned int t4_use_ldst(struct adapter *adap) t4_use_ldst() argument
4599 return (adap->flags & FW_OK) || !adap->use_bd; t4_use_ldst()
4604 * @adap: the adapter
4612 static void t4_fw_tp_pio_rw(struct adapter *adap, u32 *vals, unsigned int nregs, t4_fw_tp_pio_rw() argument
4630 ret = t4_wr_mbox(adap, adap->mbox, &c, sizeof(c), &c); t4_fw_tp_pio_rw()
4638 * @adap: the adapter
4643 void t4_read_rss_key(struct adapter *adap, u32 *key) t4_read_rss_key() argument
4645 if (t4_use_ldst(adap)) t4_read_rss_key()
4646 t4_fw_tp_pio_rw(adap, key, 10, TP_RSS_SECRET_KEY0_A, 1); t4_read_rss_key()
4648 t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, key, 10, t4_read_rss_key()
4654 * @adap: the adapter
4662 void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx) t4_write_rss_key() argument
4665 u32 vrt = t4_read_reg(adap, TP_RSS_CONFIG_VRT_A); t4_write_rss_key()
4671 if ((CHELSIO_CHIP_VERSION(adap->params.chip) > CHELSIO_T5) && t4_write_rss_key()
4675 if (t4_use_ldst(adap)) t4_write_rss_key()
4676 t4_fw_tp_pio_rw(adap, (void *)key, 10, TP_RSS_SECRET_KEY0_A, 0); t4_write_rss_key()
4678 t4_write_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, key, 10, t4_write_rss_key()
4683 t4_write_reg(adap, TP_RSS_CONFIG_VRT_A, t4_write_rss_key()
4687 t4_write_reg(adap, TP_RSS_CONFIG_VRT_A, t4_write_rss_key()
4793 * @adap: the adapter
4800 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, t4_tp_get_tcp_stats() argument
4810 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val, t4_tp_get_tcp_stats()
4818 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val, t4_tp_get_tcp_stats()
4832 * @adap: the adapter
4837 void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st) t4_tp_get_err_stats() argument
4839 int nchan = adap->params.arch.nchan; t4_tp_get_err_stats()
4841 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4843 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4845 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4847 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4849 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4851 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4853 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4855 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4858 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, t4_tp_get_err_stats()
4864 * @adap: the adapter
4869 void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st) t4_tp_get_cpl_stats() argument
4871 int nchan = adap->params.arch.nchan; t4_tp_get_cpl_stats()
4873 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, st->req, t4_tp_get_cpl_stats()
4875 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, st->rsp, t4_tp_get_cpl_stats()
4882 * @adap: the adapter
4887 void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st) t4_tp_get_rdma_stats() argument
4889 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->rqe_dfr_pkt, t4_tp_get_rdma_stats()
4895 * @adap: the adapter
4901 void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx, t4_get_fcoe_stats() argument
4906 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->frames_ddp, t4_get_fcoe_stats()
4908 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, &st->frames_drop, t4_get_fcoe_stats()
4910 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val, t4_get_fcoe_stats()
4917 * @adap: the adapter
4922 void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st) t4_get_usm_stats() argument
4926 t4_read_indirect(adap, TP_MIB_INDEX_A, TP_MIB_DATA_A, val, 4, t4_get_usm_stats()
4935 * @adap: the adapter
4941 void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log) t4_read_mtu_tbl() argument
4947 t4_write_reg(adap, TP_MTU_TABLE_A, t4_read_mtu_tbl()
4949 v = t4_read_reg(adap, TP_MTU_TABLE_A); t4_read_mtu_tbl()
4958 * @adap: the adapter
4964 void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]) t4_read_cong_tbl() argument
4970 t4_write_reg(adap, TP_CCTRL_TABLE_A, t4_read_cong_tbl()
4972 incr[mtu][w] = (u16)t4_read_reg(adap, t4_read_cong_tbl()
4979 * @adap: the adapter
4986 void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr, t4_tp_wr_bits_indirect() argument
4989 t4_write_reg(adap, TP_PIO_ADDR_A, addr); t4_tp_wr_bits_indirect()
4990 val |= t4_read_reg(adap, TP_PIO_DATA_A) & ~mask; t4_tp_wr_bits_indirect()
4991 t4_write_reg(adap, TP_PIO_DATA_A, val); t4_tp_wr_bits_indirect()
5043 * @adap: the adapter
5053 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus, t4_load_mtus() argument
5070 t4_write_reg(adap, TP_MTU_TABLE_A, MTUINDEX_V(i) | t4_load_mtus()
5079 t4_write_reg(adap, TP_CCTRL_TABLE_A, (i << 21) | t4_load_mtus()
5094 static u64 chan_rate(struct adapter *adap, unsigned int bytes256) chan_rate() argument
5096 u64 v = bytes256 * adap->params.vpd.cclk; chan_rate()
5103 * @adap: the adapter
5110 void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate) t4_get_chan_txrate() argument
5114 v = t4_read_reg(adap, TP_TX_TRATE_A); t4_get_chan_txrate()
5115 nic_rate[0] = chan_rate(adap, TNLRATE0_G(v)); t4_get_chan_txrate()
5116 nic_rate[1] = chan_rate(adap, TNLRATE1_G(v)); t4_get_chan_txrate()
5117 if (adap->params.arch.nchan == NCHAN) { t4_get_chan_txrate()
5118 nic_rate[2] = chan_rate(adap, TNLRATE2_G(v)); t4_get_chan_txrate()
5119 nic_rate[3] = chan_rate(adap, TNLRATE3_G(v)); t4_get_chan_txrate()
5122 v = t4_read_reg(adap, TP_TX_ORATE_A); t4_get_chan_txrate()
5123 ofld_rate[0] = chan_rate(adap, OFDRATE0_G(v)); t4_get_chan_txrate()
5124 ofld_rate[1] = chan_rate(adap, OFDRATE1_G(v)); t4_get_chan_txrate()
5125 if (adap->params.arch.nchan == NCHAN) { t4_get_chan_txrate()
5126 ofld_rate[2] = chan_rate(adap, OFDRATE2_G(v)); t4_get_chan_txrate()
5127 ofld_rate[3] = chan_rate(adap, OFDRATE3_G(v)); t4_get_chan_txrate()
5133 * @adap: the adapter
5142 int t4_set_trace_filter(struct adapter *adap, const struct trace_params *tp, t4_set_trace_filter() argument
5150 t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A_A + ofst, 0); t4_set_trace_filter()
5154 cfg = t4_read_reg(adap, MPS_TRC_CFG_A); t4_set_trace_filter()
5172 if (tp->port > (is_t4(adap->params.chip) ? 11 : 19) || tp->invert > 1 || t4_set_trace_filter()
5178 t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A_A + ofst, 0); t4_set_trace_filter()
5185 t4_write_reg(adap, data_reg, tp->data[i]); t4_set_trace_filter()
5186 t4_write_reg(adap, mask_reg, ~tp->mask[i]); t4_set_trace_filter()
5188 t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B_A + ofst, t4_set_trace_filter()
5191 t4_write_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A_A + ofst, t4_set_trace_filter()
5193 (is_t4(adap->params.chip) ? t4_set_trace_filter()
5203 * @adap: the adapter
5210 void t4_get_trace_filter(struct adapter *adap, struct trace_params *tp, int idx, t4_get_trace_filter() argument
5217 ctla = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_A_A + ofst); t4_get_trace_filter()
5218 ctlb = t4_read_reg(adap, MPS_TRC_FILTER_MATCH_CTL_B_A + ofst); t4_get_trace_filter()
5220 if (is_t4(adap->params.chip)) { t4_get_trace_filter()
5239 tp->mask[i] = ~t4_read_reg(adap, mask_reg); t4_get_trace_filter()
5240 tp->data[i] = t4_read_reg(adap, data_reg) & tp->mask[i]; t4_get_trace_filter()
5246 * @adap: the adapter
5252 void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]) t4_pmtx_get_stats() argument
5258 t4_write_reg(adap, PM_TX_STAT_CONFIG_A, i + 1); t4_pmtx_get_stats()
5259 cnt[i] = t4_read_reg(adap, PM_TX_STAT_COUNT_A); t4_pmtx_get_stats()
5260 if (is_t4(adap->params.chip)) { t4_pmtx_get_stats()
5261 cycles[i] = t4_read_reg64(adap, PM_TX_STAT_LSB_A); t4_pmtx_get_stats()
5263 t4_read_indirect(adap, PM_TX_DBG_CTRL_A, t4_pmtx_get_stats()
5273 * @adap: the adapter
5279 void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]) t4_pmrx_get_stats() argument
5285 t4_write_reg(adap, PM_RX_STAT_CONFIG_A, i + 1); t4_pmrx_get_stats()
5286 cnt[i] = t4_read_reg(adap, PM_RX_STAT_COUNT_A); t4_pmrx_get_stats()
5287 if (is_t4(adap->params.chip)) { t4_pmrx_get_stats()
5288 cycles[i] = t4_read_reg64(adap, PM_RX_STAT_LSB_A); t4_pmrx_get_stats()
5290 t4_read_indirect(adap, PM_RX_DBG_CTRL_A, t4_pmrx_get_stats()
5300 * @adap: the adapter
5307 unsigned int t4_get_mps_bg_map(struct adapter *adap, int idx) t4_get_mps_bg_map() argument
5309 u32 n = NUMPORTS_G(t4_read_reg(adap, MPS_CMN_CTL_A)); t4_get_mps_bg_map()
5351 * @adap: The adapter
5356 void t4_get_port_stats_offset(struct adapter *adap, int idx, t4_get_port_stats_offset() argument
5363 t4_get_port_stats(adap, idx, stats); t4_get_port_stats_offset()
5372 * @adap: the adapter
5378 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p) t4_get_port_stats() argument
5380 u32 bgmap = t4_get_mps_bg_map(adap, idx); t4_get_port_stats()
5383 t4_read_reg64(adap, \ t4_get_port_stats()
5384 (is_t4(adap->params.chip) ? PORT_REG(idx, MPS_PORT_STAT_##name##_L) : \ t4_get_port_stats()
5386 #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) t4_get_port_stats()
5455 * @adap: the adapter
5461 void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p) t4_get_lb_stats() argument
5463 u32 bgmap = t4_get_mps_bg_map(adap, idx); t4_get_lb_stats()
5466 t4_read_reg64(adap, \ t4_get_lb_stats()
5467 (is_t4(adap->params.chip) ? \ t4_get_lb_stats()
5470 #define GET_STAT_COM(name) t4_read_reg64(adap, MPS_STAT_##name##_L) t4_get_lb_stats()
5529 int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox, t4_fwaddrspace_write() argument
5545 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_fwaddrspace_write()
5550 * @adap: the adapter
5559 int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, t4_mdio_rd() argument
5576 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_mdio_rd()
5584 * @adap: the adapter
5593 int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr, t4_mdio_wr() argument
5610 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_mdio_wr()
5615 * @adap: the adapter
5721 * @adap: the adapter
5727 int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox) t4_sge_ctxt_flush() argument
5741 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_sge_ctxt_flush()
5747 * @adap: the adapter
5756 int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox, t4_fw_hello() argument
5784 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_fw_hello()
5788 if (t4_read_reg(adap, PCIE_FW_A) & PCIE_FW_ERR_F) t4_fw_hello()
5789 t4_report_fw_error(adap); t4_fw_hello()
5838 pcie_fw = t4_read_reg(adap, PCIE_FW_A); t4_fw_hello()
5877 * @adap: the adapter
5882 int t4_fw_bye(struct adapter *adap, unsigned int mbox) t4_fw_bye() argument
5888 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_fw_bye()
5893 * @adap: the adapter
5899 int t4_early_init(struct adapter *adap, unsigned int mbox) t4_early_init() argument
5905 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_early_init()
5910 * @adap: the adapter
5916 int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) t4_fw_reset() argument
5923 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_fw_reset()
5928 * @adap: the adapter
5942 static int t4_fw_halt(struct adapter *adap, unsigned int mbox, int force) t4_fw_halt() argument
5957 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_fw_halt()
5974 t4_set_reg_field(adap, CIM_BOOT_CFG_A, UPCRST_F, UPCRST_F); t4_fw_halt()
5975 t4_set_reg_field(adap, PCIE_FW_A, PCIE_FW_HALT_F, t4_fw_halt()
5988 * @adap: the adapter
6007 static int t4_fw_restart(struct adapter *adap, unsigned int mbox, int reset) t4_fw_restart() argument
6015 t4_set_reg_field(adap, PCIE_FW_A, PCIE_FW_HALT_F, 0); t4_fw_restart()
6025 t4_set_reg_field(adap, CIM_BOOT_CFG_A, UPCRST_F, 0); t4_fw_restart()
6027 if (t4_fw_reset(adap, mbox, t4_fw_restart()
6032 t4_write_reg(adap, PL_RST_A, PIORST_F | PIORSTMODE_F); t4_fw_restart()
6037 t4_set_reg_field(adap, CIM_BOOT_CFG_A, UPCRST_F, 0); t4_fw_restart()
6039 if (!(t4_read_reg(adap, PCIE_FW_A) & PCIE_FW_HALT_F)) t4_fw_restart()
6051 * @adap: the adapter
6070 int t4_fw_upgrade(struct adapter *adap, unsigned int mbox, t4_fw_upgrade() argument
6076 if (!t4_fw_matches_chip(adap, fw_hdr)) t4_fw_upgrade()
6079 ret = t4_fw_halt(adap, mbox, force); t4_fw_upgrade()
6083 ret = t4_load_fw(adap, fw_data, size); t4_fw_upgrade()
6096 return t4_fw_restart(adap, mbox, reset); t4_fw_upgrade()
6101 * @adap: the adapter
6109 int t4_fixup_host_params(struct adapter *adap, unsigned int page_size, t4_fixup_host_params() argument
6118 t4_write_reg(adap, SGE_HOST_PAGE_SIZE_A, t4_fixup_host_params()
6128 if (is_t4(adap->params.chip)) { t4_fixup_host_params()
6129 t4_set_reg_field(adap, SGE_CONTROL_A, t4_fixup_host_params()
6164 t4_set_reg_field(adap, SGE_CONTROL_A, t4_fixup_host_params()
6169 t4_set_reg_field(adap, SGE_CONTROL2_A, t4_fixup_host_params()
6195 t4_write_reg(adap, SGE_FL_BUFFER_SIZE0_A, page_size); t4_fixup_host_params()
6196 t4_write_reg(adap, SGE_FL_BUFFER_SIZE2_A, t4_fixup_host_params()
6197 (t4_read_reg(adap, SGE_FL_BUFFER_SIZE2_A) + fl_align-1) t4_fixup_host_params()
6199 t4_write_reg(adap, SGE_FL_BUFFER_SIZE3_A, t4_fixup_host_params()
6200 (t4_read_reg(adap, SGE_FL_BUFFER_SIZE3_A) + fl_align-1) t4_fixup_host_params()
6203 t4_write_reg(adap, ULP_RX_TDDP_PSZ_A, HPZ0_V(page_shift - 12)); t4_fixup_host_params()
6210 * @adap: the adapter
6216 int t4_fw_initialize(struct adapter *adap, unsigned int mbox) t4_fw_initialize() argument
6222 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_fw_initialize()
6227 * @adap: the adapter
6239 int t4_query_params_rw(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_query_params_rw() argument
6264 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_query_params_rw()
6271 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_query_params() argument
6275 return t4_query_params_rw(adap, mbox, pf, vf, nparams, params, val, 0); t4_query_params()
6280 * @adap: the adapter
6292 int t4_set_params_timeout(struct adapter *adap, unsigned int mbox, t4_set_params_timeout() argument
6315 return t4_wr_mbox_timeout(adap, mbox, &c, sizeof(c), NULL, timeout); t4_set_params_timeout()
6320 * @adap: the adapter
6331 int t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_set_params() argument
6335 return t4_set_params_timeout(adap, mbox, pf, vf, nparams, params, val, t4_set_params()
6341 * @adap: the adapter
6360 int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_cfg_pfvf() argument
6384 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_cfg_pfvf()
6389 * @adap: the adapter
6404 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, t4_alloc_vi() argument
6419 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_alloc_vi()
6443 * @adap: the adapter
6451 int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_free_vi() argument
6465 return t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_free_vi()
6470 * @adap: the adapter
6482 int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid, t4_set_rxmode() argument
6511 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok); t4_set_rxmode()
6516 * @adap: the adapter
6536 int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox, t4_alloc_mac_filt() argument
6543 unsigned int max_naddr = adap->params.arch.mps_tcam_size; t4_alloc_mac_filt()
6580 ret = t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), &c, sleep_ok); t4_alloc_mac_filt()
6610 * @adap: the adapter
6627 int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, t4_change_mac() argument
6633 unsigned int max_mac_addr = adap->params.arch.mps_tcam_size; t4_change_mac()
6649 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); t4_change_mac()
6660 * @adap: the adapter
6669 int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, t4_set_addr_hash() argument
6682 return t4_wr_mbox_meat(adap, mbox, &c, sizeof(c), NULL, sleep_ok); t4_set_addr_hash()
6687 * @adap: the adapter
6697 int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, t4_enable_vi_params() argument
6710 return t4_wr_mbox_ns(adap, mbox, &c, sizeof(c), NULL); t4_enable_vi_params()
6715 * @adap: the adapter
6723 int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid, t4_enable_vi() argument
6726 return t4_enable_vi_params(adap, mbox, viid, rx_en, tx_en, 0); t4_enable_vi()
6731 * @adap: the adapter
6738 int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, t4_identify_port() argument
6749 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_identify_port()
6754 * @adap: the adapter
6765 int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_iq_free() argument
6780 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_iq_free()
6785 * @adap: the adapter
6793 int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_eth_eq_free() argument
6805 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_eth_eq_free()
6810 * @adap: the adapter
6818 int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_ctrl_eq_free() argument
6830 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_ctrl_eq_free()
6835 * @adap: the adapter
6843 int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, t4_ofld_eq_free() argument
6855 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); t4_ofld_eq_free()
6860 * @adap: the adapter
6865 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl) t4_handle_fw_rpl() argument
6873 int port = adap->chan_map[chan]; t4_handle_fw_rpl()
6874 struct port_info *pi = adap2pinfo(adap, port); t4_handle_fw_rpl()
6899 t4_os_link_changed(adap, port, link_ok); t4_handle_fw_rpl()
6903 t4_os_portmod_changed(adap, port); t4_handle_fw_rpl()
6964 static int get_flash_params(struct adapter *adap) get_flash_params() argument
6976 ret = sf1_write(adap, 1, 1, 0, SF_RD_ID); get_flash_params()
6978 ret = sf1_read(adap, 3, 0, 1, &info); get_flash_params()
6979 t4_write_reg(adap, SF_OP_A, 0); /* unlock SF */ get_flash_params()
6985 adap->params.sf_size = supported_flash[ret].size_mb; get_flash_params()
6986 adap->params.sf_nsec = get_flash_params()
6987 adap->params.sf_size / SF_SEC_SIZE; get_flash_params()
6995 adap->params.sf_nsec = 1 << (info - 16); get_flash_params()
6997 adap->params.sf_nsec = 64; get_flash_params()
7000 adap->params.sf_size = 1 << info; get_flash_params()
7001 adap->params.sf_fw_start = get_flash_params()
7002 t4_read_reg(adap, CIM_BOOT_CFG_A) & BOOTADDR_M; get_flash_params()
7004 if (adap->params.sf_size < FLASH_MIN_SIZE) get_flash_params()
7005 dev_warn(adap->pdev_dev, "WARNING!!! FLASH size %#x < %#x!!!\n", get_flash_params()
7006 adap->params.sf_size, FLASH_MIN_SIZE); get_flash_params()
7196 * @adap: the adapter
7201 int t4_init_devlog_params(struct adapter *adap) t4_init_devlog_params() argument
7203 struct devlog_params *dparams = &adap->params.devlog; t4_init_devlog_params()
7214 t4_read_reg(adap, PCIE_FW_REG(PCIE_FW_PF_A, PCIE_FW_PF_DEVLOG)); t4_init_devlog_params()
7234 ret = t4_wr_mbox(adap, adap->mbox, &devlog_cmd, sizeof(devlog_cmd), t4_init_devlog_params()
7249 * t4_init_sge_params - initialize adap->params.sge
7280 * t4_init_tp_params - initialize adap->params.tp
7281 * @adap: the adapter
7285 int t4_init_tp_params(struct adapter *adap) t4_init_tp_params() argument
7290 v = t4_read_reg(adap, TP_TIMER_RESOLUTION_A); t4_init_tp_params()
7291 adap->params.tp.tre = TIMERRESOLUTION_G(v); t4_init_tp_params()
7292 adap->params.tp.dack_re = DELAYEDACKRESOLUTION_G(v); t4_init_tp_params()
7296 adap->params.tp.tx_modq[chan] = chan; t4_init_tp_params()
7301 if (t4_use_ldst(adap)) { t4_init_tp_params()
7302 t4_fw_tp_pio_rw(adap, &adap->params.tp.vlan_pri_map, 1, t4_init_tp_params()
7304 t4_fw_tp_pio_rw(adap, &adap->params.tp.ingress_config, 1, t4_init_tp_params()
7307 t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, t4_init_tp_params()
7308 &adap->params.tp.vlan_pri_map, 1, t4_init_tp_params()
7310 t4_read_indirect(adap, TP_PIO_ADDR_A, TP_PIO_DATA_A, t4_init_tp_params()
7311 &adap->params.tp.ingress_config, 1, t4_init_tp_params()
7319 adap->params.tp.vlan_shift = t4_filter_field_shift(adap, VLAN_F); t4_init_tp_params()
7320 adap->params.tp.vnic_shift = t4_filter_field_shift(adap, VNIC_ID_F); t4_init_tp_params()
7321 adap->params.tp.port_shift = t4_filter_field_shift(adap, PORT_F); t4_init_tp_params()
7322 adap->params.tp.protocol_shift = t4_filter_field_shift(adap, t4_init_tp_params()
7328 if ((adap->params.tp.ingress_config & VNIC_F) == 0) t4_init_tp_params()
7329 adap->params.tp.vnic_shift = -1; t4_init_tp_params()
7336 * @adap: the adapter
7343 int t4_filter_field_shift(const struct adapter *adap, int filter_sel) t4_filter_field_shift() argument
7345 unsigned int filter_mode = adap->params.tp.vlan_pri_map; t4_filter_field_shift()
7389 int t4_init_rss_mode(struct adapter *adap, int mbox) t4_init_rss_mode() argument
7396 for_each_port(adap, i) { for_each_port()
7397 struct port_info *p = adap2pinfo(adap, i); for_each_port()
7404 ret = t4_wr_mbox(adap, mbox, &rvc, sizeof(rvc), &rvc); for_each_port()
7412 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf) t4_port_init() argument
7422 for_each_port(adap, i) { for_each_port()
7424 struct port_info *p = adap2pinfo(adap, i); for_each_port()
7426 while ((adap->params.portvec & (1 << j)) == 0) for_each_port()
7435 ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); for_each_port()
7439 ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &rss_size); for_each_port()
7447 memcpy(adap->port[i]->dev_addr, addr, ETH_ALEN); for_each_port()
7448 adap->port[i]->dev_port = j; for_each_port()
7461 ret = t4_wr_mbox(adap, mbox, &rvc, sizeof(rvc), &rvc); for_each_port()
7474 * @adap: the adapter
7482 void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres) t4_read_cimq_cfg() argument
7485 int cim_num_obq = is_t4(adap->params.chip) ? t4_read_cimq_cfg()
7489 t4_write_reg(adap, CIM_QUEUE_CONFIG_REF_A, IBQSELECT_F | t4_read_cimq_cfg()
7491 v = t4_read_reg(adap, CIM_QUEUE_CONFIG_CTRL_A); t4_read_cimq_cfg()
7498 t4_write_reg(adap, CIM_QUEUE_CONFIG_REF_A, OBQSELECT_F | t4_read_cimq_cfg()
7500 v = t4_read_reg(adap, CIM_QUEUE_CONFIG_CTRL_A); t4_read_cimq_cfg()
7509 * @adap: the adapter
7518 int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data, size_t n) t4_read_cim_ibq() argument
7537 t4_write_reg(adap, CIM_IBQ_DBG_CFG_A, IBQDBGADDR_V(addr) | t4_read_cim_ibq()
7539 err = t4_wait_op_done(adap, CIM_IBQ_DBG_CFG_A, IBQDBGBUSY_F, 0, t4_read_cim_ibq()
7543 *data++ = t4_read_reg(adap, CIM_IBQ_DBG_DATA_A); t4_read_cim_ibq()
7545 t4_write_reg(adap, CIM_IBQ_DBG_CFG_A, 0); t4_read_cim_ibq()
7551 * @adap: the adapter
7560 int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data, size_t n) t4_read_cim_obq() argument
7564 int cim_num_obq = is_t4(adap->params.chip) ? t4_read_cim_obq()
7570 t4_write_reg(adap, CIM_QUEUE_CONFIG_REF_A, OBQSELECT_F | t4_read_cim_obq()
7572 v = t4_read_reg(adap, CIM_QUEUE_CONFIG_CTRL_A); t4_read_cim_obq()
7580 t4_write_reg(adap, CIM_OBQ_DBG_CFG_A, OBQDBGADDR_V(addr) | t4_read_cim_obq()
7582 err = t4_wait_op_done(adap, CIM_OBQ_DBG_CFG_A, OBQDBGBUSY_F, 0, t4_read_cim_obq()
7586 *data++ = t4_read_reg(adap, CIM_OBQ_DBG_DATA_A); t4_read_cim_obq()
7588 t4_write_reg(adap, CIM_OBQ_DBG_CFG_A, 0); t4_read_cim_obq()
7594 * @adap: the adapter
7601 int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n, t4_cim_read() argument
7606 if (t4_read_reg(adap, CIM_HOST_ACC_CTRL_A) & HOSTBUSY_F) t4_cim_read()
7610 t4_write_reg(adap, CIM_HOST_ACC_CTRL_A, addr); t4_cim_read()
7611 ret = t4_wait_op_done(adap, CIM_HOST_ACC_CTRL_A, HOSTBUSY_F, t4_cim_read()
7614 *valp++ = t4_read_reg(adap, CIM_HOST_ACC_DATA_A); t4_cim_read()
7621 * @adap: the adapter
7628 int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n, t4_cim_write() argument
7633 if (t4_read_reg(adap, CIM_HOST_ACC_CTRL_A) & HOSTBUSY_F) t4_cim_write()
7637 t4_write_reg(adap, CIM_HOST_ACC_DATA_A, *valp++); t4_cim_write()
7638 t4_write_reg(adap, CIM_HOST_ACC_CTRL_A, addr | HOSTWRITE_F); t4_cim_write()
7639 ret = t4_wait_op_done(adap, CIM_HOST_ACC_CTRL_A, HOSTBUSY_F, t4_cim_write()
7645 static int t4_cim_write1(struct adapter *adap, unsigned int addr, t4_cim_write1() argument
7648 return t4_cim_write(adap, addr, 1, &val); t4_cim_write1()
7653 * @adap: the adapter
7661 int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr) t4_cim_read_la() argument
7666 ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &cfg); t4_cim_read_la()
7671 ret = t4_cim_write1(adap, UP_UP_DBG_LA_CFG_A, 0); t4_cim_read_la()
7676 ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &val); t4_cim_read_la()
7684 for (i = 0; i < adap->params.cim_la_size; i++) { t4_cim_read_la()
7685 ret = t4_cim_write1(adap, UP_UP_DBG_LA_CFG_A, t4_cim_read_la()
7689 ret = t4_cim_read(adap, UP_UP_DBG_LA_CFG_A, 1, &val); t4_cim_read_la()
7696 ret = t4_cim_read(adap, UP_UP_DBG_LA_DATA_A, 1, &la_buf[i]); t4_cim_read_la()
7703 int r = t4_cim_write1(adap, UP_UP_DBG_LA_CFG_A, t4_cim_read_la()
7713 * @adap: the adapter
7721 void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr) t4_tp_read_la() argument
7726 cfg = t4_read_reg(adap, TP_DBG_LA_CONFIG_A) & 0xffff; t4_tp_read_la()
7728 t4_write_reg(adap, TP_DBG_LA_CONFIG_A, t4_tp_read_la()
7729 adap->params.tp.la_mask | (cfg ^ DBGLAENABLE_F)); t4_tp_read_la()
7731 val = t4_read_reg(adap, TP_DBG_LA_CONFIG_A); t4_tp_read_la()
7741 val |= adap->params.tp.la_mask; t4_tp_read_la()
7744 t4_write_reg(adap, TP_DBG_LA_CONFIG_A, DBGLARPTR_V(idx) | val); t4_tp_read_la()
7745 la_buf[i] = t4_read_reg64(adap, TP_DBG_LA_DATAL_A); t4_tp_read_la()
7754 t4_write_reg(adap, TP_DBG_LA_CONFIG_A, t4_tp_read_la()
7755 cfg | adap->params.tp.la_mask); t4_tp_read_la()
H A Dcxgb4_dcb.c75 struct adapter *adap = pi->adapter; cxgb4_dcb_cleanup_apps() local
100 dev_err(adap->pdev_dev, cxgb4_dcb_cleanup_apps()
116 struct adapter *adap = pi->adapter; cxgb4_dcb_state_fsm() local
240 dev_err(adap->pdev_dev, "cxgb4_dcb_state_fsm: illegal input symbol %d\n", cxgb4_dcb_state_fsm()
245 dev_err(adap->pdev_dev, "cxgb4_dcb_state_fsm: bad state transition, state = %d, input = %d\n", cxgb4_dcb_state_fsm()
251 void cxgb4_dcb_handle_fw_update(struct adapter *adap, cxgb4_dcb_handle_fw_update() argument
256 struct net_device *dev = adap->port[port]; cxgb4_dcb_handle_fw_update()
279 dev_warn(adap->pdev_dev, "Interface %s is running %s\n", cxgb4_dcb_handle_fw_update()
283 dev_warn(adap->pdev_dev, cxgb4_dcb_handle_fw_update()
302 dev_err(adap->pdev_dev, "Receiving Firmware DCB messages in State %d\n", cxgb4_dcb_handle_fw_update()
365 dev_err(adap->pdev_dev, cxgb4_dcb_handle_fw_update()
377 dev_err(adap->pdev_dev, "Unknown DCB update type received %x\n", cxgb4_dcb_handle_fw_update()
422 struct adapter *adap = pi->adapter; cxgb4_getpgtccfg() local
433 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_getpgtccfg()
435 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); cxgb4_getpgtccfg()
445 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_getpgtccfg()
447 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_getpgtccfg()
485 struct adapter *adap = pi->adapter; cxgb4_setpgtccfg_tx() local
498 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgtccfg_tx()
500 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); cxgb4_setpgtccfg_tx()
511 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgtccfg_tx()
513 dev_err(adap->pdev_dev, "DCB write PGID failed with %d\n", cxgb4_setpgtccfg_tx()
523 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgtccfg_tx()
525 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_setpgtccfg_tx()
536 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgtccfg_tx()
538 dev_err(adap->pdev_dev, "DCB write PGRATE failed with %d\n", cxgb4_setpgtccfg_tx()
547 struct adapter *adap = pi->adapter; cxgb4_getpgbwgcfg() local
556 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_getpgbwgcfg()
558 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_getpgbwgcfg()
581 struct adapter *adap = pi->adapter; cxgb4_setpgbwgcfg_tx() local
587 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgbwgcfg_tx()
589 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_setpgbwgcfg_tx()
600 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpgbwgcfg_tx()
603 dev_err(adap->pdev_dev, "DCB write PGRATE failed with %d\n", cxgb4_setpgbwgcfg_tx()
629 struct adapter *adap = pi->adapter; cxgb4_setpfccfg() local
648 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_setpfccfg()
650 dev_err(adap->pdev_dev, "DCB PFC write failed with %d\n", -err); cxgb4_setpfccfg()
765 struct adapter *adap = pi->adapter; __cxgb4_getapp() local
783 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); __cxgb4_getapp()
785 dev_err(adap->pdev_dev, "DCB APP read failed with %d\n", __cxgb4_getapp()
818 struct adapter *adap = pi->adapter; __cxgb4_setapp() local
833 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); __cxgb4_setapp()
836 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", __cxgb4_setapp()
852 dev_err(adap->pdev_dev, "DCB app table full\n"); __cxgb4_setapp()
867 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); __cxgb4_setapp()
869 dev_err(adap->pdev_dev, "DCB app table write failed with %d\n", __cxgb4_setapp()
923 struct adapter *adap = pi->adapter; cxgb4_ieee_read_ets() local
941 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_ieee_read_ets()
943 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); cxgb4_ieee_read_ets()
955 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_ieee_read_ets()
957 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_ieee_read_ets()
1092 struct adapter *adap = pi->adapter; cxgb4_getpeer_app() local
1106 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_getpeer_app()
1109 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", cxgb4_getpeer_app()
1126 struct adapter *adap = pi->adapter; cxgb4_getpeerapp_tbl() local
1136 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_getpeerapp_tbl()
1139 dev_err(adap->pdev_dev, "DCB app table read failed with %d\n", cxgb4_getpeerapp_tbl()
1163 struct adapter *adap = pi->adapter; cxgb4_cee_peer_getpg() local
1174 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_cee_peer_getpg()
1176 dev_err(adap->pdev_dev, "DCB read PGID failed with %d\n", -err); cxgb4_cee_peer_getpg()
1186 err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); cxgb4_cee_peer_getpg()
1188 dev_err(adap->pdev_dev, "DCB read PGRATE failed with %d\n", cxgb4_cee_peer_getpg()
H A Dcxgb4_fcoe.c41 bool cxgb_fcoe_sof_eof_supported(struct adapter *adap, struct sk_buff *skb) cxgb_fcoe_sof_eof_supported() argument
48 dev_err(adap->pdev_dev, "Unsupported SOF 0x%x\n", sof); cxgb_fcoe_sof_eof_supported()
55 dev_err(adap->pdev_dev, "Unsupported EOF 0x%x\n", eof); cxgb_fcoe_sof_eof_supported()
71 struct adapter *adap = pi->adapter; cxgb_fcoe_enable() local
74 if (is_t4(adap->params.chip)) cxgb_fcoe_enable()
77 if (!(adap->flags & FULL_INIT_DONE)) cxgb_fcoe_enable()
80 dev_info(adap->pdev_dev, "Enabling FCoE offload features\n"); cxgb_fcoe_enable()
103 struct adapter *adap = pi->adapter; cxgb_fcoe_disable() local
109 dev_info(adap->pdev_dev, "Disabling FCoE offload features\n"); cxgb_fcoe_disable()
H A Dcxgb4.h55 #define CH_WARN(adap, fmt, ...) dev_warn(adap->pdev_dev, fmt, ## __VA_ARGS__)
529 struct adapter *adap; member in struct:sge_rspq
618 struct adapter *adap; member in struct:sge_ofld_txq
627 struct adapter *adap; member in struct:sge_ctrl_txq
883 static inline int is_offload(const struct adapter *adap) is_offload() argument
885 return adap->params.offload; is_offload()
888 static inline u32 t4_read_reg(struct adapter *adap, u32 reg_addr) t4_read_reg() argument
890 return readl(adap->regs + reg_addr); t4_read_reg()
893 static inline void t4_write_reg(struct adapter *adap, u32 reg_addr, u32 val) t4_write_reg() argument
895 writel(val, adap->regs + reg_addr); t4_write_reg()
911 static inline u64 t4_read_reg64(struct adapter *adap, u32 reg_addr) t4_read_reg64() argument
913 return readq(adap->regs + reg_addr); t4_read_reg64()
916 static inline void t4_write_reg64(struct adapter *adap, u32 reg_addr, u64 val) t4_write_reg64() argument
918 writeq(val, adap->regs + reg_addr); t4_write_reg64()
950 * @adap: the adapter
955 static inline struct port_info *adap2pinfo(struct adapter *adap, int idx) adap2pinfo() argument
957 return netdev_priv(adap->port[idx]); adap2pinfo()
1079 static inline unsigned int qtimer_val(const struct adapter *adap, qtimer_val() argument
1084 return idx < SGE_NTIMERS ? adap->sge.timer_val[idx] : 0; qtimer_val()
1091 void t4_os_portmod_changed(const struct adapter *adap, int port_id);
1092 void t4_os_link_changed(struct adapter *adap, int port_id, int link_stat);
1096 void t4_free_sge_resources(struct adapter *adap);
1097 void t4_free_ofld_rxqs(struct adapter *adap, int n, struct sge_ofld_rxq *q);
1098 irq_handler_t t4_intr_handler(struct adapter *adap);
1102 int t4_mgmt_tx(struct adapter *adap, struct sk_buff *skb);
1103 int t4_ofld_send(struct adapter *adap, struct sk_buff *skb);
1104 int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq,
1107 int t4_sge_alloc_eth_txq(struct adapter *adap, struct sge_eth_txq *txq,
1110 int t4_sge_alloc_ctrl_txq(struct adapter *adap, struct sge_ctrl_txq *txq,
1113 int t4_sge_alloc_ofld_txq(struct adapter *adap, struct sge_ofld_txq *txq,
1116 int t4_sge_init(struct adapter *adap);
1117 void t4_sge_start(struct adapter *adap);
1118 void t4_sge_stop(struct adapter *adap);
1129 static inline int is_bypass(struct adapter *adap) is_bypass() argument
1131 return adap->params.bypass; is_bypass()
1159 static inline unsigned int core_ticks_per_usec(const struct adapter *adap) core_ticks_per_usec() argument
1161 return adap->params.vpd.cclk / 1000; core_ticks_per_usec()
1164 static inline unsigned int us_to_core_ticks(const struct adapter *adap, us_to_core_ticks() argument
1167 return (us * adap->params.vpd.cclk) / 1000; us_to_core_ticks()
1178 void t4_set_reg_field(struct adapter *adap, unsigned int addr, u32 mask,
1181 int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox, const void *cmd,
1183 int t4_wr_mbox_meat(struct adapter *adap, int mbox, const void *cmd, int size,
1186 static inline int t4_wr_mbox_timeout(struct adapter *adap, int mbox, t4_wr_mbox_timeout() argument
1190 return t4_wr_mbox_meat_timeout(adap, mbox, cmd, size, rpl, true, t4_wr_mbox_timeout()
1194 static inline int t4_wr_mbox(struct adapter *adap, int mbox, const void *cmd, t4_wr_mbox() argument
1197 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, true); t4_wr_mbox()
1200 static inline int t4_wr_mbox_ns(struct adapter *adap, int mbox, const void *cmd, t4_wr_mbox_ns() argument
1203 return t4_wr_mbox_meat(adap, mbox, cmd, size, rpl, false); t4_wr_mbox_ns()
1206 void t4_write_indirect(struct adapter *adap, unsigned int addr_reg,
1209 void t4_read_indirect(struct adapter *adap, unsigned int addr_reg,
1221 int t4_link_l1cfg(struct adapter *adap, unsigned int mbox, unsigned int port,
1223 int t4_restart_aneg(struct adapter *adap, unsigned int mbox, unsigned int port);
1225 u32 t4_read_pcie_cfg4(struct adapter *adap, int reg);
1226 u32 t4_get_util_window(struct adapter *adap);
1227 void t4_setup_memwin(struct adapter *adap, u32 memwin_base, u32 window);
1231 int t4_memory_rw(struct adapter *adap, int win, int mtype, u32 addr, u32 len,
1233 static inline int t4_memory_write(struct adapter *adap, int mtype, u32 addr, t4_memory_write() argument
1236 return t4_memory_rw(adap, 0, mtype, addr, len, buf, 0); t4_memory_write()
1240 void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size);
1248 int t4_load_phy_fw(struct adapter *adap,
1252 int t4_phy_fw_ver(struct adapter *adap, int *phy_fw_ver);
1253 int t4_fwcache(struct adapter *adap, enum fw_params_param_dev_fwcache op);
1254 int t4_fw_upgrade(struct adapter *adap, unsigned int mbox,
1257 int t4_check_fw_version(struct adapter *adap);
1261 int t4_prep_fw(struct adapter *adap, struct fw_info *fw_info,
1274 unsigned int qtimer_val(const struct adapter *adap,
1279 int t4_init_tp_params(struct adapter *adap);
1280 int t4_filter_field_shift(const struct adapter *adap, int filter_sel);
1281 int t4_init_rss_mode(struct adapter *adap, int mbox);
1282 int t4_port_init(struct adapter *adap, int mbox, int pf, int vf);
1292 void t4_write_rss_key(struct adapter *adap, const u32 *key, int idx);
1301 void t4_pmtx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
1302 void t4_pmrx_get_stats(struct adapter *adap, u32 cnt[], u64 cycles[]);
1303 int t4_read_cim_ibq(struct adapter *adap, unsigned int qid, u32 *data,
1305 int t4_read_cim_obq(struct adapter *adap, unsigned int qid, u32 *data,
1307 int t4_cim_read(struct adapter *adap, unsigned int addr, unsigned int n,
1309 int t4_cim_write(struct adapter *adap, unsigned int addr, unsigned int n,
1311 int t4_cim_read_la(struct adapter *adap, u32 *la_buf, unsigned int *wrptr);
1312 void t4_cim_read_pif_la(struct adapter *adap, u32 *pif_req, u32 *pif_rsp,
1315 void t4_cim_read_ma_la(struct adapter *adap, u32 *ma_req, u32 *ma_rsp);
1316 void t4_read_cimq_cfg(struct adapter *adap, u16 *base, u16 *size, u16 *thres);
1318 void t4_get_port_stats(struct adapter *adap, int idx, struct port_stats *p);
1319 void t4_get_port_stats_offset(struct adapter *adap, int idx,
1322 void t4_get_lb_stats(struct adapter *adap, int idx, struct lb_port_stats *p);
1323 void t4_read_mtu_tbl(struct adapter *adap, u16 *mtus, u8 *mtu_log);
1324 void t4_read_cong_tbl(struct adapter *adap, u16 incr[NMTUS][NCCTRL_WIN]);
1325 void t4_tp_wr_bits_indirect(struct adapter *adap, unsigned int addr,
1327 void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr);
1328 void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st);
1329 void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st);
1330 void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st);
1331 void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st);
1332 void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4,
1334 void t4_get_fcoe_stats(struct adapter *adap, unsigned int idx,
1336 void t4_load_mtus(struct adapter *adap, const unsigned short *mtus,
1339 void t4_ulprx_read_la(struct adapter *adap, u32 *la_buf);
1341 void t4_get_chan_txrate(struct adapter *adap, u64 *nic_rate, u64 *ofld_rate);
1344 void t4_wol_magic_enable(struct adapter *adap, unsigned int port,
1346 int t4_wol_pat_enable(struct adapter *adap, unsigned int port, unsigned int map,
1349 int t4_fw_hello(struct adapter *adap, unsigned int mbox, unsigned int evt_mbox,
1351 int t4_fw_bye(struct adapter *adap, unsigned int mbox);
1352 int t4_early_init(struct adapter *adap, unsigned int mbox);
1353 int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset);
1354 int t4_fixup_host_params(struct adapter *adap, unsigned int page_size,
1356 int t4_fw_initialize(struct adapter *adap, unsigned int mbox);
1357 int t4_query_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
1360 int t4_query_params_rw(struct adapter *adap, unsigned int mbox, unsigned int pf,
1363 int t4_set_params_timeout(struct adapter *adap, unsigned int mbox,
1367 int t4_set_params(struct adapter *adap, unsigned int mbox, unsigned int pf,
1370 int t4_cfg_pfvf(struct adapter *adap, unsigned int mbox, unsigned int pf,
1375 int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port,
1378 int t4_free_vi(struct adapter *adap, unsigned int mbox,
1381 int t4_set_rxmode(struct adapter *adap, unsigned int mbox, unsigned int viid,
1384 int t4_alloc_mac_filt(struct adapter *adap, unsigned int mbox,
1387 int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid,
1389 int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid,
1391 int t4_enable_vi_params(struct adapter *adap, unsigned int mbox,
1393 int t4_enable_vi(struct adapter *adap, unsigned int mbox, unsigned int viid,
1395 int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid,
1397 int t4_mdio_rd(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
1399 int t4_mdio_wr(struct adapter *adap, unsigned int mbox, unsigned int phy_addr,
1401 int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
1404 int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
1406 int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
1408 int t4_ofld_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf,
1410 int t4_sge_ctxt_flush(struct adapter *adap, unsigned int mbox);
1411 int t4_handle_fw_rpl(struct adapter *adap, const __be64 *rpl);
1418 int t4_fwaddrspace_write(struct adapter *adap, unsigned int mbox,
H A Dcxgb4_ethtool.c194 struct adapter *adap = netdev2adap(dev); get_regs_len() local
196 return t4_get_regs_len(adap); get_regs_len()
307 static void collect_sge_port_stats(const struct adapter *adap, collect_sge_port_stats() argument
312 const struct sge_eth_txq *tx = &adap->sge.ethtxq[p->first_qset]; collect_sge_port_stats()
313 const struct sge_eth_rxq *rx = &adap->sge.ethrxq[p->first_qset]; collect_sge_port_stats()
327 static void collect_adapter_stats(struct adapter *adap, struct adapter_stats *s) collect_adapter_stats() argument
337 spin_lock(&adap->stats_lock); collect_adapter_stats()
338 t4_tp_get_tcp_stats(adap, &v4, &v6); collect_adapter_stats()
339 t4_tp_get_rdma_stats(adap, &rdma_stats); collect_adapter_stats()
340 t4_get_usm_stats(adap, &usm_stats); collect_adapter_stats()
341 t4_tp_get_err_stats(adap, &err_stats); collect_adapter_stats()
342 spin_unlock(&adap->stats_lock); collect_adapter_stats()
344 s->db_drop = adap->db_stats.db_drop; collect_adapter_stats()
345 s->db_full = adap->db_stats.db_full; collect_adapter_stats()
346 s->db_empty = adap->db_stats.db_empty; collect_adapter_stats()
357 if (is_offload(adap)) { collect_adapter_stats()
368 if (!is_t4(adap->params.chip)) { collect_adapter_stats()
371 v = t4_read_reg(adap, SGE_STAT_CFG_A); collect_adapter_stats()
373 val2 = t4_read_reg(adap, SGE_STAT_MATCH_A); collect_adapter_stats()
374 val1 = t4_read_reg(adap, SGE_STAT_TOTAL_A); collect_adapter_stats()
381 static void collect_channel_stats(struct adapter *adap, struct channel_stats *s, collect_channel_stats() argument
390 spin_lock(&adap->stats_lock); collect_channel_stats()
391 t4_tp_get_cpl_stats(adap, &cpl_stats); collect_channel_stats()
392 t4_tp_get_err_stats(adap, &err_stats); collect_channel_stats()
393 t4_get_fcoe_stats(adap, i, &fcoe_stats); collect_channel_stats()
394 spin_unlock(&adap->stats_lock); collect_channel_stats()
447 struct adapter *adap = netdev2adap(dev); get_regs() local
450 buf_size = t4_get_regs_len(adap); get_regs()
451 regs->version = mk_adap_vers(adap); get_regs()
452 t4_get_regs(adap, buf, buf_size); get_regs()
471 struct adapter *adap = netdev2adap(dev); identify_port() local
480 return t4_identify_port(adap, adap->pf, netdev2pinfo(dev)->viid, val); identify_port()
748 struct adapter *adap = pi->adapter; set_rx_intr_params() local
749 struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset]; set_rx_intr_params()
763 struct adapter *adap = pi->adapter; set_adaptive_rx_setting() local
764 struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset]; set_adaptive_rx_setting()
775 struct adapter *adap = pi->adapter; get_adaptive_rx_setting() local
776 struct sge_eth_rxq *q = &adap->sge.ethrxq[pi->first_qset]; get_adaptive_rx_setting()
791 const struct adapter *adap = pi->adapter; get_coalesce() local
792 const struct sge_rspq *rq = &adap->sge.ethrxq[pi->first_qset].rspq; get_coalesce()
794 c->rx_coalesce_usecs = qtimer_val(adap, rq); get_coalesce()
796 adap->sge.counter_val[rq->pktcnt_idx] : 0; get_coalesce()
832 static int eeprom_rd_phys(struct adapter *adap, unsigned int phys_addr, u32 *v) eeprom_rd_phys() argument
834 int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE); eeprom_rd_phys()
837 vaddr = pci_read_vpd(adap->pdev, vaddr, sizeof(u32), v); eeprom_rd_phys()
841 static int eeprom_wr_phys(struct adapter *adap, unsigned int phys_addr, u32 v) eeprom_wr_phys() argument
843 int vaddr = eeprom_ptov(phys_addr, adap->pf, EEPROMPFSIZE); eeprom_wr_phys()
846 vaddr = pci_write_vpd(adap->pdev, vaddr, sizeof(u32), &v); eeprom_wr_phys()
933 struct adapter *adap = netdev2adap(netdev); set_flash() local
939 pcie_fw = t4_read_reg(adap, PCIE_FW_A); set_flash()
944 if (master_vld && (master != adap->pf)) { set_flash()
945 dev_warn(adap->pdev_dev, set_flash()
951 ret = request_firmware(&fw, ef->data, adap->pdev_dev); set_flash()
960 if (adap->flags & FULL_INIT_DONE) set_flash()
961 mbox = adap->mbox; set_flash()
963 ret = t4_fw_upgrade(adap, mbox, fw->data, fw->size, 1); set_flash()
966 dev_info(adap->pdev_dev, set_flash()
H A Dclip_tbl.c47 struct adapter *adap = netdev2adap(dev); clip6_get_mbox() local
56 return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); clip6_get_mbox()
62 struct adapter *adap = netdev2adap(dev); clip6_release_mbox() local
71 return t4_wr_mbox_meat(adap, adap->mbox, &c, sizeof(c), &c, false); clip6_release_mbox()
76 struct adapter *adap = netdev2adap(dev); cxgb4_clip_get() local
77 struct clip_tbl *ctbl = adap->clipt; cxgb4_clip_get()
142 struct adapter *adap = netdev2adap(dev); cxgb4_clip_release() local
143 struct clip_tbl *ctbl = adap->clipt; cxgb4_clip_release()
312 void t4_cleanup_clip_tbl(struct adapter *adap) t4_cleanup_clip_tbl() argument
314 struct clip_tbl *ctbl = adap->clipt; t4_cleanup_clip_tbl()
H A Dl2t.c140 static int write_l2e(struct adapter *adap, struct l2t_entry *e, int sync) write_l2e() argument
142 struct l2t_data *d = adap->l2t; write_l2e()
156 TID_QID_V(adap->sge.fw_evtq.abs_id))); write_l2e()
165 t4_ofld_send(adap, skb); write_l2e()
176 static void send_pending(struct adapter *adap, struct l2t_entry *e) send_pending() argument
183 t4_ofld_send(adap, skb); send_pending()
193 void do_l2t_write_rpl(struct adapter *adap, const struct cpl_l2t_write_rpl *rpl) do_l2t_write_rpl() argument
195 struct l2t_data *d = adap->l2t; do_l2t_write_rpl()
200 dev_err(adap->pdev_dev, do_l2t_write_rpl()
211 send_pending(adap, e); do_l2t_write_rpl()
236 struct adapter *adap = netdev2adap(dev); cxgb4_l2t_send() local
247 return t4_ofld_send(adap, skb); cxgb4_l2t_send()
263 write_l2e(adap, e, 1); cxgb4_l2t_send()
424 struct adapter *adap = netdev2adap(dev); cxgb4_select_ntuple() local
425 struct tp_params *tp = &adap->params.tp; cxgb4_select_ntuple()
460 static void handle_failed_resolution(struct adapter *adap, struct sk_buff *arpq) handle_failed_resolution() argument
471 t4_ofld_send(adap, skb); handle_failed_resolution()
479 void t4_l2t_update(struct adapter *adap, struct neighbour *neigh) t4_l2t_update() argument
483 struct l2t_data *d = adap->l2t; t4_l2t_update()
513 write_l2e(adap, e, 1); t4_l2t_update()
519 write_l2e(adap, e, 0); t4_l2t_update()
525 handle_failed_resolution(adap, arpq); t4_l2t_update()
551 int t4_l2t_set_switching(struct adapter *adap, struct l2t_entry *e, u16 vlan, t4_l2t_set_switching() argument
557 return write_l2e(adap, e, 0); t4_l2t_set_switching()
666 struct adapter *adap = inode->i_private; l2t_seq_open() local
669 seq->private = adap->l2t; l2t_seq_open()
H A Dclip_tbl.h43 void t4_cleanup_clip_tbl(struct adapter *adap);
H A Dcxgb4_debugfs.h77 int t4_setup_debugfs(struct adapter *adap);
78 void add_debugfs_files(struct adapter *adap,
/linux-4.4.14/drivers/media/pci/pt1/
H A Dpt1.c98 struct dvb_adapter adap; member in struct:pt1_adapter
264 struct pt1_adapter *adap; pt1_filter() local
278 adap = pt1->adaps[index]; pt1_filter()
280 adap->upacket_count = 0; pt1_filter()
281 else if (!adap->upacket_count) pt1_filter()
289 if (adap->st_count != -1 && sc != ((adap->st_count + 1) & 0x7)) pt1_filter()
292 adap->st_count = sc; pt1_filter()
294 buf = adap->buf; pt1_filter()
295 offset = adap->packet_count * 188 + adap->upacket_count * 3; pt1_filter()
298 if (adap->upacket_count != 62) pt1_filter()
301 if (++adap->upacket_count >= 63) { pt1_filter()
302 adap->upacket_count = 0; pt1_filter()
303 if (++adap->packet_count >= 21) { pt1_filter()
304 dvb_dmx_swfilter_packets(&adap->demux, buf, 21); pt1_filter()
305 adap->packet_count = 0; pt1_filter()
504 struct pt1_adapter *adap; pt1_start_feed() local
505 adap = container_of(feed->demux, struct pt1_adapter, demux); pt1_start_feed()
506 if (!adap->users++) { pt1_start_feed()
509 ret = pt1_start_polling(adap->pt1); pt1_start_feed()
512 pt1_set_stream(adap->pt1, adap->index, 1); pt1_start_feed()
534 struct pt1_adapter *adap; pt1_stop_feed() local
535 adap = container_of(feed->demux, struct pt1_adapter, demux); pt1_stop_feed()
536 if (!--adap->users) { pt1_stop_feed()
537 pt1_set_stream(adap->pt1, adap->index, 0); pt1_stop_feed()
538 pt1_stop_polling(adap->pt1); pt1_stop_feed()
548 struct pt1_adapter *adap; pt1_update_power() local
559 adap = pt1->adaps[i]; pt1_update_power()
560 switch (adap->voltage) { pt1_update_power()
571 /* XXX: The bits should be changed depending on adap->sleep. */ pt1_update_power()
580 struct pt1_adapter *adap; pt1_set_voltage() local
582 adap = container_of(fe->dvb, struct pt1_adapter, adap); pt1_set_voltage()
583 adap->voltage = voltage; pt1_set_voltage()
584 pt1_update_power(adap->pt1); pt1_set_voltage()
586 if (adap->orig_set_voltage) pt1_set_voltage()
587 return adap->orig_set_voltage(fe, voltage); pt1_set_voltage()
594 struct pt1_adapter *adap; pt1_sleep() local
596 adap = container_of(fe->dvb, struct pt1_adapter, adap); pt1_sleep()
597 adap->sleep = 1; pt1_sleep()
598 pt1_update_power(adap->pt1); pt1_sleep()
600 if (adap->orig_sleep) pt1_sleep()
601 return adap->orig_sleep(fe); pt1_sleep()
608 struct pt1_adapter *adap; pt1_wakeup() local
610 adap = container_of(fe->dvb, struct pt1_adapter, adap); pt1_wakeup()
611 adap->sleep = 0; pt1_wakeup()
612 pt1_update_power(adap->pt1); pt1_wakeup()
615 if (adap->orig_init) pt1_wakeup()
616 return adap->orig_init(fe); pt1_wakeup()
621 static void pt1_free_adapter(struct pt1_adapter *adap) pt1_free_adapter() argument
623 adap->demux.dmx.close(&adap->demux.dmx); pt1_free_adapter()
624 dvb_dmxdev_release(&adap->dmxdev); pt1_free_adapter()
625 dvb_dmx_release(&adap->demux); pt1_free_adapter()
626 dvb_unregister_adapter(&adap->adap); pt1_free_adapter()
627 free_page((unsigned long)adap->buf); pt1_free_adapter()
628 kfree(adap); pt1_free_adapter()
636 struct pt1_adapter *adap; pt1_alloc_adapter() local
643 adap = kzalloc(sizeof(struct pt1_adapter), GFP_KERNEL); pt1_alloc_adapter()
644 if (!adap) { pt1_alloc_adapter()
649 adap->pt1 = pt1; pt1_alloc_adapter()
651 adap->voltage = SEC_VOLTAGE_OFF; pt1_alloc_adapter()
652 adap->sleep = 1; pt1_alloc_adapter()
660 adap->buf = buf; pt1_alloc_adapter()
661 adap->upacket_count = 0; pt1_alloc_adapter()
662 adap->packet_count = 0; pt1_alloc_adapter()
663 adap->st_count = -1; pt1_alloc_adapter()
665 dvb_adap = &adap->adap; pt1_alloc_adapter()
666 dvb_adap->priv = adap; pt1_alloc_adapter()
672 demux = &adap->demux; pt1_alloc_adapter()
674 demux->priv = adap; pt1_alloc_adapter()
684 dmxdev = &adap->dmxdev; pt1_alloc_adapter()
692 return adap; pt1_alloc_adapter()
701 kfree(adap); pt1_alloc_adapter()
716 struct pt1_adapter *adap; pt1_init_adapters() local
720 adap = pt1_alloc_adapter(pt1); pt1_init_adapters()
721 if (IS_ERR(adap)) { pt1_init_adapters()
722 ret = PTR_ERR(adap); pt1_init_adapters()
726 adap->index = i; pt1_init_adapters()
727 pt1->adaps[i] = adap; pt1_init_adapters()
738 static void pt1_cleanup_frontend(struct pt1_adapter *adap) pt1_cleanup_frontend() argument
740 dvb_unregister_frontend(adap->fe); pt1_cleanup_frontend()
743 static int pt1_init_frontend(struct pt1_adapter *adap, struct dvb_frontend *fe) pt1_init_frontend() argument
747 adap->orig_set_voltage = fe->ops.set_voltage; pt1_init_frontend()
748 adap->orig_sleep = fe->ops.sleep; pt1_init_frontend()
749 adap->orig_init = fe->ops.init; pt1_init_frontend()
754 ret = dvb_register_frontend(&adap->adap, fe); pt1_init_frontend()
758 adap->fe = fe; pt1_init_frontend()
982 static int pt1_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) pt1_i2c_xfer() argument
991 pt1 = i2c_get_adapdata(adap); pt1_i2c_xfer()
1034 static u32 pt1_i2c_func(struct i2c_adapter *adap) pt1_i2c_func() argument
H A Dva1j5jf8007s.c46 struct i2c_adapter *adap; member in struct:va1j5jf8007s_state
77 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007s_read_snr()
199 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_frequency_1()
219 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_frequency_2()
243 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_frequency_3()
271 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007s_check_frequency()
291 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_modulation()
318 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007s_check_modulation()
345 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_ts_id()
379 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007s_check_ts_id()
525 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_init_frequency()
544 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_set_sleep()
623 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007s_prepare_1()
676 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007s_prepare_2()
704 struct i2c_adapter *adap) va1j5jf8007s_attach()
716 state->adap = adap; va1j5jf8007s_attach()
730 if (i2c_transfer(state->adap, &msg, 1) != 1) { va1j5jf8007s_attach()
703 va1j5jf8007s_attach(const struct va1j5jf8007s_config *config, struct i2c_adapter *adap) va1j5jf8007s_attach() argument
H A Dva1j5jf8007t.c44 struct i2c_adapter *adap; member in struct:va1j5jf8007t_state
75 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007t_read_snr()
182 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007t_set_frequency()
210 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007t_check_frequency()
230 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007t_set_modulation()
257 if (i2c_transfer(state->adap, msgs, 2) != 2) va1j5jf8007t_check_modulation()
374 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007t_init_frequency()
393 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007t_set_sleep()
495 if (i2c_transfer(state->adap, &msg, 1) != 1) va1j5jf8007t_prepare()
504 struct i2c_adapter *adap) va1j5jf8007t_attach()
516 state->adap = adap; va1j5jf8007t_attach()
530 if (i2c_transfer(state->adap, &msg, 1) != 1) { va1j5jf8007t_attach()
503 va1j5jf8007t_attach(const struct va1j5jf8007t_config *config, struct i2c_adapter *adap) va1j5jf8007t_attach() argument
H A Dva1j5jf8007s.h41 struct i2c_adapter *adap);
H A Dva1j5jf8007t.h41 struct i2c_adapter *adap);
/linux-4.4.14/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/
H A Danx9805.c47 struct i2c_adapter *adap = &pad->bus->i2c; anx9805_bus_xfer() local
53 tmp = nvkm_rdi2cr(adap, pad->addr, 0x07) & ~0x10; anx9805_bus_xfer()
54 nvkm_wri2cr(adap, pad->addr, 0x07, tmp | 0x10); anx9805_bus_xfer()
55 nvkm_wri2cr(adap, pad->addr, 0x07, tmp); anx9805_bus_xfer()
56 nvkm_wri2cr(adap, bus->addr, 0x43, 0x05); anx9805_bus_xfer()
61 nvkm_wri2cr(adap, bus->addr, 0x40, msg->addr << 1); anx9805_bus_xfer()
62 nvkm_wri2cr(adap, bus->addr, 0x41, seg); anx9805_bus_xfer()
63 nvkm_wri2cr(adap, bus->addr, 0x42, off); anx9805_bus_xfer()
64 nvkm_wri2cr(adap, bus->addr, 0x44, msg->len); anx9805_bus_xfer()
65 nvkm_wri2cr(adap, bus->addr, 0x45, 0x00); anx9805_bus_xfer()
66 nvkm_wri2cr(adap, bus->addr, 0x43, 0x01); anx9805_bus_xfer()
69 while (nvkm_rdi2cr(adap, bus->addr, 0x46) & 0x10) { anx9805_bus_xfer()
74 msg->buf[i] = nvkm_rdi2cr(adap, bus->addr, 0x47); anx9805_bus_xfer()
93 nvkm_wri2cr(adap, bus->addr, 0x43, 0x00); anx9805_bus_xfer()
141 struct i2c_adapter *adap = &pad->bus->i2c; anx9805_aux_xfer() local
148 tmp = nvkm_rdi2cr(adap, pad->addr, 0x07) & ~0x04; anx9805_aux_xfer()
149 nvkm_wri2cr(adap, pad->addr, 0x07, tmp | 0x04); anx9805_aux_xfer()
150 nvkm_wri2cr(adap, pad->addr, 0x07, tmp); anx9805_aux_xfer()
151 nvkm_wri2cr(adap, pad->addr, 0xf7, 0x01); anx9805_aux_xfer()
153 nvkm_wri2cr(adap, aux->addr, 0xe4, 0x80); anx9805_aux_xfer()
158 nvkm_wri2cr(adap, aux->addr, 0xf0 + i, buf[i]); anx9805_aux_xfer()
160 nvkm_wri2cr(adap, aux->addr, 0xe5, ((size - 1) << 4) | type); anx9805_aux_xfer()
161 nvkm_wri2cr(adap, aux->addr, 0xe6, (addr & 0x000ff) >> 0); anx9805_aux_xfer()
162 nvkm_wri2cr(adap, aux->addr, 0xe7, (addr & 0x0ff00) >> 8); anx9805_aux_xfer()
163 nvkm_wri2cr(adap, aux->addr, 0xe8, (addr & 0xf0000) >> 16); anx9805_aux_xfer()
164 nvkm_wri2cr(adap, aux->addr, 0xe9, 0x01); anx9805_aux_xfer()
167 while ((tmp = nvkm_rdi2cr(adap, aux->addr, 0xe9)) & 0x01) { anx9805_aux_xfer()
173 if ((tmp = nvkm_rdi2cr(adap, pad->addr, 0xf7)) & 0x01) { anx9805_aux_xfer()
180 buf[i] = nvkm_rdi2cr(adap, aux->addr, 0xf0 + i); anx9805_aux_xfer()
187 nvkm_wri2cr(adap, pad->addr, 0xf7, 0x01); anx9805_aux_xfer()
197 struct i2c_adapter *adap = &pad->bus->i2c; anx9805_aux_lnk_ctl() local
203 nvkm_wri2cr(adap, aux->addr, 0xa0, link_bw); anx9805_aux_lnk_ctl()
204 nvkm_wri2cr(adap, aux->addr, 0xa1, link_nr | (enh ? 0x80 : 0x00)); anx9805_aux_lnk_ctl()
205 nvkm_wri2cr(adap, aux->addr, 0xa2, 0x01); anx9805_aux_lnk_ctl()
206 nvkm_wri2cr(adap, aux->addr, 0xa8, 0x01); anx9805_aux_lnk_ctl()
209 while ((tmp = nvkm_rdi2cr(adap, aux->addr, 0xa8)) & 0x01) { anx9805_aux_lnk_ctl()
H A Dbus.c33 nvkm_i2c_bus_pre_xfer(struct i2c_adapter *adap) nvkm_i2c_bus_pre_xfer() argument
35 struct nvkm_i2c_bus *bus = container_of(adap, typeof(*bus), i2c); nvkm_i2c_bus_pre_xfer()
40 nvkm_i2c_bus_post_xfer(struct i2c_adapter *adap) nvkm_i2c_bus_post_xfer() argument
42 struct nvkm_i2c_bus *bus = container_of(adap, typeof(*bus), i2c); nvkm_i2c_bus_post_xfer()
78 nvkm_i2c_bus_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) nvkm_i2c_bus_xfer() argument
80 struct nvkm_i2c_bus *bus = container_of(adap, typeof(*bus), i2c); nvkm_i2c_bus_xfer()
93 nvkm_i2c_bus_func(struct i2c_adapter *adap) nvkm_i2c_bus_func() argument
H A Daux.c28 nvkm_i2c_aux_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) nvkm_i2c_aux_i2c_xfer() argument
30 struct nvkm_i2c_aux *aux = container_of(adap, typeof(*aux), i2c); nvkm_i2c_aux_i2c_xfer()
72 nvkm_i2c_aux_i2c_func(struct i2c_adapter *adap) nvkm_i2c_aux_i2c_func() argument
/linux-4.4.14/drivers/i2c/
H A Di2c-mux.c32 struct i2c_adapter adap; member in struct:i2c_mux_priv
44 static int i2c_mux_master_xfer(struct i2c_adapter *adap, i2c_mux_master_xfer() argument
47 struct i2c_mux_priv *priv = adap->algo_data; i2c_mux_master_xfer()
62 static int i2c_mux_smbus_xfer(struct i2c_adapter *adap, i2c_mux_smbus_xfer() argument
67 struct i2c_mux_priv *priv = adap->algo_data; i2c_mux_smbus_xfer()
84 static u32 i2c_mux_functionality(struct i2c_adapter *adap) i2c_mux_functionality() argument
86 struct i2c_mux_priv *priv = adap->algo_data; i2c_mux_functionality()
140 snprintf(priv->adap.name, sizeof(priv->adap.name), i2c_add_mux_adapter()
142 priv->adap.owner = THIS_MODULE; i2c_add_mux_adapter()
143 priv->adap.algo = &priv->algo; i2c_add_mux_adapter()
144 priv->adap.algo_data = priv; i2c_add_mux_adapter()
145 priv->adap.dev.parent = &parent->dev; i2c_add_mux_adapter()
146 priv->adap.retries = parent->retries; i2c_add_mux_adapter()
147 priv->adap.timeout = parent->timeout; i2c_add_mux_adapter()
148 priv->adap.quirks = parent->quirks; i2c_add_mux_adapter()
156 priv->adap.class = class; i2c_add_mux_adapter()
171 priv->adap.dev.of_node = child; i2c_add_mux_adapter()
181 acpi_preset_companion(&priv->adap.dev, ACPI_COMPANION(mux_dev), i2c_add_mux_adapter()
185 priv->adap.nr = force_nr; i2c_add_mux_adapter()
186 ret = i2c_add_numbered_adapter(&priv->adap); i2c_add_mux_adapter()
188 ret = i2c_add_adapter(&priv->adap); i2c_add_mux_adapter()
198 WARN(sysfs_create_link(&priv->adap.dev.kobj, &mux_dev->kobj, "mux_device"), i2c_add_mux_adapter()
202 WARN(sysfs_create_link(&mux_dev->kobj, &priv->adap.dev.kobj, symlink_name), i2c_add_mux_adapter()
205 i2c_adapter_id(&priv->adap)); i2c_add_mux_adapter()
207 return &priv->adap; i2c_add_mux_adapter()
211 void i2c_del_mux_adapter(struct i2c_adapter *adap) i2c_del_mux_adapter() argument
213 struct i2c_mux_priv *priv = adap->algo_data; i2c_del_mux_adapter()
219 sysfs_remove_link(&priv->adap.dev.kobj, "mux_device"); i2c_del_mux_adapter()
220 i2c_del_adapter(adap); i2c_del_mux_adapter()
H A Di2c-core.c205 * @adap: pointer to adapter
211 static void acpi_i2c_register_devices(struct i2c_adapter *adap) acpi_i2c_register_devices() argument
215 if (!has_acpi_companion(&adap->dev)) acpi_i2c_register_devices()
221 adap, NULL); acpi_i2c_register_devices()
223 dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); acpi_i2c_register_devices()
227 static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { } acpi_i2c_register_devices() argument
545 static int get_scl_gpio_value(struct i2c_adapter *adap) get_scl_gpio_value() argument
547 return gpio_get_value(adap->bus_recovery_info->scl_gpio); get_scl_gpio_value()
550 static void set_scl_gpio_value(struct i2c_adapter *adap, int val) set_scl_gpio_value() argument
552 gpio_set_value(adap->bus_recovery_info->scl_gpio, val); set_scl_gpio_value()
555 static int get_sda_gpio_value(struct i2c_adapter *adap) get_sda_gpio_value() argument
557 return gpio_get_value(adap->bus_recovery_info->sda_gpio); get_sda_gpio_value()
560 static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap) i2c_get_gpios_for_recovery() argument
562 struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; i2c_get_gpios_for_recovery()
563 struct device *dev = &adap->dev; i2c_get_gpios_for_recovery()
585 static void i2c_put_gpios_for_recovery(struct i2c_adapter *adap) i2c_put_gpios_for_recovery() argument
587 struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; i2c_put_gpios_for_recovery()
603 static int i2c_generic_recovery(struct i2c_adapter *adap) i2c_generic_recovery() argument
605 struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; i2c_generic_recovery()
609 bri->prepare_recovery(adap); i2c_generic_recovery()
611 bri->set_scl(adap, val); i2c_generic_recovery()
620 if (bri->get_sda && bri->get_sda(adap)) i2c_generic_recovery()
623 if (!bri->get_scl(adap)) { i2c_generic_recovery()
624 dev_err(&adap->dev, i2c_generic_recovery()
632 bri->set_scl(adap, val); i2c_generic_recovery()
637 bri->unprepare_recovery(adap); i2c_generic_recovery()
642 int i2c_generic_scl_recovery(struct i2c_adapter *adap) i2c_generic_scl_recovery() argument
644 return i2c_generic_recovery(adap); i2c_generic_scl_recovery()
648 int i2c_generic_gpio_recovery(struct i2c_adapter *adap) i2c_generic_gpio_recovery() argument
652 ret = i2c_get_gpios_for_recovery(adap); i2c_generic_gpio_recovery()
656 ret = i2c_generic_recovery(adap); i2c_generic_gpio_recovery()
657 i2c_put_gpios_for_recovery(adap); i2c_generic_gpio_recovery()
663 int i2c_recover_bus(struct i2c_adapter *adap) i2c_recover_bus() argument
665 if (!adap->bus_recovery_info) i2c_recover_bus()
668 dev_dbg(&adap->dev, "Trying i2c bus recovery\n"); i2c_recover_bus()
669 return adap->bus_recovery_info->recover_bus(adap); i2c_recover_bus()
1004 static void i2c_dev_set_name(struct i2c_adapter *adap, i2c_dev_set_name() argument
1014 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), i2c_dev_set_name()
1020 * @adap: the adapter managing the device
1035 i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) i2c_new_device() argument
1044 client->adapter = adap; i2c_new_device()
1059 dev_err(&adap->dev, "Invalid %d-bit I2C address 0x%02hx\n", i2c_new_device()
1065 status = i2c_check_addr_busy(adap, i2c_encode_flags_to_addr(client)); i2c_new_device()
1075 i2c_dev_set_name(adap, client); i2c_new_device()
1080 dev_dbg(&adap->dev, "client [%s] registered with bus id %s\n", i2c_new_device()
1086 dev_err(&adap->dev, "Failed to register i2c client %s at 0x%02x " i2c_new_device()
1166 struct i2c_adapter *adap = to_i2c_adapter(dev); i2c_adapter_dev_release() local
1167 complete(&adap->dev_released); i2c_adapter_dev_release()
1200 struct i2c_adapter *adap = to_i2c_adapter(dev); i2c_sysfs_new_device() local
1240 client = i2c_new_device(adap, &info); i2c_sysfs_new_device()
1245 mutex_lock(&adap->userspace_clients_lock); i2c_sysfs_new_device()
1246 list_add_tail(&client->detected, &adap->userspace_clients); i2c_sysfs_new_device()
1247 mutex_unlock(&adap->userspace_clients_lock); i2c_sysfs_new_device()
1268 struct i2c_adapter *adap = to_i2c_adapter(dev); i2c_sysfs_delete_device() local
1287 mutex_lock_nested(&adap->userspace_clients_lock, i2c_sysfs_delete_device()
1288 i2c_adapter_depth(adap)); i2c_sysfs_delete_device()
1289 list_for_each_entry_safe(client, next, &adap->userspace_clients, i2c_sysfs_delete_device()
1301 mutex_unlock(&adap->userspace_clients_lock); i2c_sysfs_delete_device()
1365 static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, of_i2c_register_device() argument
1375 dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name); of_i2c_register_device()
1378 dev_err(&adap->dev, "of_i2c: modalias failure on %s\n", of_i2c_register_device()
1385 dev_err(&adap->dev, "of_i2c: invalid reg on %s\n", of_i2c_register_device()
1402 dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n", of_i2c_register_device()
1414 result = i2c_new_device(adap, &info); of_i2c_register_device()
1416 dev_err(&adap->dev, "of_i2c: Failure registering %s\n", of_i2c_register_device()
1424 static void of_i2c_register_devices(struct i2c_adapter *adap) of_i2c_register_devices() argument
1429 if (!adap->dev.of_node) of_i2c_register_devices()
1432 dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); of_i2c_register_devices()
1434 for_each_available_child_of_node(adap->dev.of_node, node) { of_i2c_register_devices()
1437 of_i2c_register_device(adap, node); of_i2c_register_devices()
1500 static void of_i2c_register_devices(struct i2c_adapter *adap) { } of_i2c_register_devices() argument
1504 struct i2c_adapter *adap) i2c_do_add_adapter()
1507 i2c_detect(adap, driver); i2c_do_add_adapter()
1511 dev_warn(&adap->dev, "%s: attach_adapter method is deprecated\n", i2c_do_add_adapter()
1513 dev_warn(&adap->dev, "Please use another way to instantiate " i2c_do_add_adapter()
1516 driver->attach_adapter(adap); i2c_do_add_adapter()
1526 static int i2c_register_adapter(struct i2c_adapter *adap) i2c_register_adapter() argument
1537 if (unlikely(adap->name[0] == '\0')) { i2c_register_adapter()
1542 if (unlikely(!adap->algo)) { i2c_register_adapter()
1544 "no algo!\n", adap->name); i2c_register_adapter()
1548 rt_mutex_init(&adap->bus_lock); i2c_register_adapter()
1549 mutex_init(&adap->userspace_clients_lock); i2c_register_adapter()
1550 INIT_LIST_HEAD(&adap->userspace_clients); i2c_register_adapter()
1553 if (adap->timeout == 0) i2c_register_adapter()
1554 adap->timeout = HZ; i2c_register_adapter()
1556 dev_set_name(&adap->dev, "i2c-%d", adap->nr); i2c_register_adapter()
1557 adap->dev.bus = &i2c_bus_type; i2c_register_adapter()
1558 adap->dev.type = &i2c_adapter_type; i2c_register_adapter()
1559 res = device_register(&adap->dev); i2c_register_adapter()
1563 dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); i2c_register_adapter()
1565 pm_runtime_no_callbacks(&adap->dev); i2c_register_adapter()
1568 res = class_compat_create_link(i2c_adapter_compat_class, &adap->dev, i2c_register_adapter()
1569 adap->dev.parent); i2c_register_adapter()
1571 dev_warn(&adap->dev, i2c_register_adapter()
1576 if (adap->bus_recovery_info) { i2c_register_adapter()
1577 struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; i2c_register_adapter()
1580 dev_err(&adap->dev, "No recover_bus() found, not using recovery\n"); i2c_register_adapter()
1581 adap->bus_recovery_info = NULL; i2c_register_adapter()
1588 dev_err(&adap->dev, "Invalid SCL gpio, not using recovery\n"); i2c_register_adapter()
1589 adap->bus_recovery_info = NULL; i2c_register_adapter()
1602 dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n"); i2c_register_adapter()
1603 adap->bus_recovery_info = NULL; i2c_register_adapter()
1609 of_i2c_register_devices(adap); i2c_register_adapter()
1610 acpi_i2c_register_devices(adap); i2c_register_adapter()
1611 acpi_i2c_install_space_handler(adap); i2c_register_adapter()
1613 if (adap->nr < __i2c_first_dynamic_bus_num) i2c_register_adapter()
1614 i2c_scan_static_board_info(adap); i2c_register_adapter()
1618 bus_for_each_drv(&i2c_bus_type, NULL, adap, __process_new_adapter); i2c_register_adapter()
1625 idr_remove(&i2c_adapter_idr, adap->nr); i2c_register_adapter()
1632 * @adap: the adapter to register (with adap->nr initialized)
1637 static int __i2c_add_numbered_adapter(struct i2c_adapter *adap) __i2c_add_numbered_adapter() argument
1642 id = idr_alloc(&i2c_adapter_idr, adap, adap->nr, adap->nr + 1, __i2c_add_numbered_adapter()
1648 return i2c_register_adapter(adap); __i2c_add_numbered_adapter()
1662 * in adap->nr, and the specified adapter became available for clients.
1693 * @adap: the adapter to register (with adap->nr initialized)
1709 * clients using the bus number provided in adap->nr. Also, the table
1714 int i2c_add_numbered_adapter(struct i2c_adapter *adap) i2c_add_numbered_adapter() argument
1716 if (adap->nr == -1) /* -1 means dynamically assign bus id */ i2c_add_numbered_adapter()
1717 return i2c_add_adapter(adap); i2c_add_numbered_adapter()
1719 return __i2c_add_numbered_adapter(adap); i2c_add_numbered_adapter()
1764 * @adap: the adapter being unregistered
1770 void i2c_del_adapter(struct i2c_adapter *adap) i2c_del_adapter() argument
1777 found = idr_find(&i2c_adapter_idr, adap->nr); i2c_del_adapter()
1779 if (found != adap) { i2c_del_adapter()
1781 "adapter [%s]\n", adap->name); i2c_del_adapter()
1785 acpi_i2c_remove_space_handler(adap); i2c_del_adapter()
1788 bus_for_each_drv(&i2c_bus_type, NULL, adap, i2c_del_adapter()
1793 mutex_lock_nested(&adap->userspace_clients_lock, i2c_del_adapter()
1794 i2c_adapter_depth(adap)); i2c_del_adapter()
1795 list_for_each_entry_safe(client, next, &adap->userspace_clients, i2c_del_adapter()
1797 dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name, i2c_del_adapter()
1802 mutex_unlock(&adap->userspace_clients_lock); i2c_del_adapter()
1809 device_for_each_child(&adap->dev, NULL, __unregister_client); i2c_del_adapter()
1810 device_for_each_child(&adap->dev, NULL, __unregister_dummy); i2c_del_adapter()
1813 class_compat_remove_link(i2c_adapter_compat_class, &adap->dev, i2c_del_adapter()
1814 adap->dev.parent); i2c_del_adapter()
1818 dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name); i2c_del_adapter()
1827 init_completion(&adap->dev_released); i2c_del_adapter()
1828 device_unregister(&adap->dev); i2c_del_adapter()
1829 wait_for_completion(&adap->dev_released); i2c_del_adapter()
1833 idr_remove(&i2c_adapter_idr, adap->nr); i2c_del_adapter()
1838 memset(&adap->dev, 0, sizeof(adap->dev)); i2c_del_adapter()
1972 void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) i2c_clients_command() argument
1978 device_for_each_child(&adap->dev, &cmd_arg, i2c_cmd); i2c_clients_command()
1987 struct i2c_adapter *adap; of_i2c_notify() local
1992 adap = of_find_i2c_adapter_by_node(rd->dn->parent); of_i2c_notify()
1993 if (adap == NULL) of_i2c_notify()
1997 put_device(&adap->dev); of_i2c_notify()
2001 client = of_i2c_register_device(adap, rd->dn); of_i2c_notify()
2002 put_device(&adap->dev); of_i2c_notify()
2102 static int i2c_quirk_error(struct i2c_adapter *adap, struct i2c_msg *msg, char *err_msg) i2c_quirk_error() argument
2104 dev_err_ratelimited(&adap->dev, "adapter quirk: %s (addr 0x%04x, size %u, %s)\n", i2c_quirk_error()
2110 static int i2c_check_for_quirks(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) i2c_check_for_quirks() argument
2112 const struct i2c_adapter_quirks *q = adap->quirks; i2c_check_for_quirks()
2122 return i2c_quirk_error(adap, &msgs[0], "1st comb msg must be write"); i2c_check_for_quirks()
2125 return i2c_quirk_error(adap, &msgs[1], "2nd comb msg must be read"); i2c_check_for_quirks()
2128 return i2c_quirk_error(adap, &msgs[0], "comb msg only to same addr"); i2c_check_for_quirks()
2131 return i2c_quirk_error(adap, &msgs[0], "msg too long"); i2c_check_for_quirks()
2134 return i2c_quirk_error(adap, &msgs[1], "msg too long"); i2c_check_for_quirks()
2141 return i2c_quirk_error(adap, &msgs[0], "too many messages"); i2c_check_for_quirks()
2148 return i2c_quirk_error(adap, &msgs[i], "msg too long"); i2c_check_for_quirks()
2151 return i2c_quirk_error(adap, &msgs[i], "msg too long"); i2c_check_for_quirks()
2160 * @adap: Handle to I2C bus
2168 * takes place. adap->algo->master_xfer existence isn't checked.
2170 int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) __i2c_transfer() argument
2175 if (adap->quirks && i2c_check_for_quirks(adap, msgs, num)) __i2c_transfer()
2186 trace_i2c_read(adap, &msgs[i], i); __i2c_transfer()
2188 trace_i2c_write(adap, &msgs[i], i); __i2c_transfer()
2193 for (ret = 0, try = 0; try <= adap->retries; try++) { __i2c_transfer()
2194 ret = adap->algo->master_xfer(adap, msgs, num); __i2c_transfer()
2197 if (time_after(jiffies, orig_jiffies + adap->timeout)) __i2c_transfer()
2205 trace_i2c_reply(adap, &msgs[i], i); __i2c_transfer()
2206 trace_i2c_result(adap, i, ret); __i2c_transfer()
2215 * @adap: Handle to I2C bus
2225 int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) i2c_transfer() argument
2246 if (adap->algo->master_xfer) { i2c_transfer()
2249 dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, " i2c_transfer()
2257 ret = i2c_trylock_adapter(adap); i2c_transfer()
2262 i2c_lock_adapter(adap); i2c_transfer()
2265 ret = __i2c_transfer(adap, msgs, num); i2c_transfer()
2266 i2c_unlock_adapter(adap); i2c_transfer()
2270 dev_dbg(&adap->dev, "I2C level transfers not supported\n"); i2c_transfer()
2287 struct i2c_adapter *adap = client->adapter; i2c_master_send() local
2295 ret = i2c_transfer(adap, &msg, 1); i2c_master_send()
2315 struct i2c_adapter *adap = client->adapter; i2c_master_recv() local
2325 ret = i2c_transfer(adap, &msg, 1); i2c_master_recv()
2353 static int i2c_default_probe(struct i2c_adapter *adap, unsigned short addr) i2c_default_probe() argument
2359 if (addr == 0x73 && (adap->class & I2C_CLASS_HWMON) i2c_default_probe()
2360 && i2c_check_functionality(adap, I2C_FUNC_SMBUS_READ_BYTE_DATA)) i2c_default_probe()
2361 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_READ, 0, i2c_default_probe()
2366 && i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) i2c_default_probe()
2367 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_WRITE, 0, i2c_default_probe()
2369 else if (i2c_check_functionality(adap, I2C_FUNC_SMBUS_READ_BYTE)) i2c_default_probe()
2370 err = i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_READ, 0, i2c_default_probe()
2373 dev_warn(&adap->dev, "No suitable probing method supported for address 0x%02X\n", i2c_default_probe()
2487 int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr) i2c_probe_func_quick_read() argument
2489 return i2c_smbus_xfer(adap, addr, 0, I2C_SMBUS_READ, 0, i2c_probe_func_quick_read()
2495 i2c_new_probed_device(struct i2c_adapter *adap, i2c_new_probed_device() argument
2508 dev_warn(&adap->dev, "Invalid 7-bit address " i2c_new_probed_device()
2514 if (i2c_check_addr_busy(adap, addr_list[i])) { i2c_new_probed_device()
2515 dev_dbg(&adap->dev, "Address 0x%02x already in " i2c_new_probed_device()
2521 if (probe(adap, addr_list[i])) i2c_new_probed_device()
2526 dev_dbg(&adap->dev, "Probing failed, no device found\n"); i2c_new_probed_device()
2531 return i2c_new_device(adap, info); i2c_new_probed_device()
2555 void i2c_put_adapter(struct i2c_adapter *adap) i2c_put_adapter() argument
2557 if (!adap) i2c_put_adapter()
2560 put_device(&adap->dev); i2c_put_adapter()
2561 module_put(adap->owner); i2c_put_adapter()
1503 i2c_do_add_adapter(struct i2c_driver *driver, struct i2c_adapter *adap) i2c_do_add_adapter() argument
H A Di2c-stub.c131 static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags, stub_xfer() argument
153 dev_dbg(&adap->dev, "smbus quick - addr 0x%02x\n", addr); stub_xfer()
160 dev_dbg(&adap->dev, stub_xfer()
166 dev_dbg(&adap->dev, stub_xfer()
179 dev_dbg(&adap->dev, stub_xfer()
188 dev_dbg(&adap->dev, stub_xfer()
194 dev_dbg(&adap->dev, stub_xfer()
207 dev_dbg(&adap->dev, stub_xfer()
212 dev_dbg(&adap->dev, stub_xfer()
233 dev_dbg(&adap->dev, stub_xfer()
241 dev_dbg(&adap->dev, stub_xfer()
254 b = stub_find_block(&adap->dev, chip, command, false); stub_xfer()
262 b = stub_find_block(&adap->dev, chip, command, stub_xfer()
276 dev_dbg(&adap->dev, stub_xfer()
281 dev_dbg(&adap->dev, stub_xfer()
290 dev_dbg(&adap->dev, stub_xfer()
299 dev_dbg(&adap->dev, "Unsupported I2C/SMBus command\n"); stub_xfer()
H A Di2c-dev.c48 struct i2c_adapter *adap; member in struct:i2c_dev
62 if (i2c_dev->adap->nr == index) i2c_dev_get_by_minor()
71 static struct i2c_dev *get_free_i2c_dev(struct i2c_adapter *adap) get_free_i2c_dev() argument
75 if (adap->nr >= I2C_MINORS) { get_free_i2c_dev()
77 adap->nr); get_free_i2c_dev()
84 i2c_dev->adap = adap; get_free_i2c_dev()
107 return sprintf(buf, "%s\n", i2c_dev->adap->name); name_show()
485 struct i2c_adapter *adap; i2cdev_open() local
492 adap = i2c_get_adapter(i2c_dev->adap->nr); i2cdev_open()
493 if (!adap) i2cdev_open()
505 i2c_put_adapter(adap); i2cdev_open()
508 snprintf(client->name, I2C_NAME_SIZE, "i2c-dev %d", adap->nr); i2cdev_open()
510 client->adapter = adap; i2cdev_open()
543 struct i2c_adapter *adap; i2cdev_attach_adapter() local
549 adap = to_i2c_adapter(dev); i2cdev_attach_adapter()
551 i2c_dev = get_free_i2c_dev(adap); i2cdev_attach_adapter()
556 i2c_dev->dev = device_create(i2c_dev_class, &adap->dev, i2cdev_attach_adapter()
557 MKDEV(I2C_MAJOR, adap->nr), NULL, i2cdev_attach_adapter()
558 "i2c-%d", adap->nr); i2cdev_attach_adapter()
565 adap->name, adap->nr); i2cdev_attach_adapter()
574 struct i2c_adapter *adap; i2cdev_detach_adapter() local
579 adap = to_i2c_adapter(dev); i2cdev_detach_adapter()
581 i2c_dev = i2c_dev_get_by_minor(adap->nr); i2cdev_detach_adapter()
586 device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr)); i2cdev_detach_adapter()
588 pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); i2cdev_detach_adapter()
/linux-4.4.14/drivers/media/pci/cobalt/
H A Dcobalt-i2c.c120 struct i2c_adapter *adap, bool start, bool stop, cobalt_tx_bytes()
153 if (time_after(jiffies, start_time + adap->timeout)) cobalt_tx_bytes()
178 struct i2c_adapter *adap, bool start, bool stop, cobalt_rx_bytes()
212 if (time_after(jiffies, start_time + adap->timeout)) cobalt_rx_bytes()
235 struct i2c_adapter *adap) cobalt_stop()
239 return cobalt_tx_bytes(regs, adap, true, true, &data, 1); cobalt_stop()
242 static int cobalt_xfer(struct i2c_adapter *adap, cobalt_xfer() argument
245 struct cobalt_i2c_data *data = adap->algo_data; cobalt_xfer()
265 for (j = 0; j < adap->retries; j++) { cobalt_xfer()
266 ret = cobalt_tx_bytes(regs, adap, true, false, cobalt_xfer()
270 cobalt_stop(regs, adap); cobalt_xfer()
278 ret = cobalt_rx_bytes(regs, adap, false, stop, cobalt_xfer()
284 ret = cobalt_tx_bytes(regs, adap, false, stop, cobalt_xfer()
294 cobalt_stop(regs, adap); cobalt_xfer()
298 static u32 cobalt_func(struct i2c_adapter *adap) cobalt_func() argument
332 struct i2c_adapter *adap = &cobalt->i2c_adap[i]; cobalt_i2c_init() local
343 adap->dev.parent = NULL; cobalt_i2c_init()
363 *adap = cobalt_i2c_adap_template; cobalt_i2c_init()
364 adap->algo = &cobalt_algo; cobalt_i2c_init()
365 adap->algo_data = &cobalt->i2c_data[i]; cobalt_i2c_init()
366 adap->retries = 3; cobalt_i2c_init()
367 sprintf(adap->name + strlen(adap->name), cobalt_i2c_init()
369 i2c_set_adapdata(adap, &cobalt->v4l2_dev); cobalt_i2c_init()
370 adap->dev.parent = &cobalt->pci_dev->dev; cobalt_i2c_init()
371 err = i2c_add_adapter(adap); cobalt_i2c_init()
374 adap->dev.parent = NULL; cobalt_i2c_init()
381 cobalt_info("registered bus %s\n", adap->name); cobalt_i2c_init()
119 cobalt_tx_bytes(struct cobalt_i2c_regs __iomem *regs, struct i2c_adapter *adap, bool start, bool stop, u8 *data, u16 len) cobalt_tx_bytes() argument
177 cobalt_rx_bytes(struct cobalt_i2c_regs __iomem *regs, struct i2c_adapter *adap, bool start, bool stop, u8 *data, u16 len) cobalt_rx_bytes() argument
234 cobalt_stop(struct cobalt_i2c_regs __iomem *regs, struct i2c_adapter *adap) cobalt_stop() argument
/linux-4.4.14/include/sound/
H A Dl3.h16 int l3_write(struct l3_pins *adap, u8 addr, u8 *data, int len);
/linux-4.4.14/include/trace/events/
H A Di2c.h30 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
32 TP_ARGS(adap, msg, num),
41 __entry->adapter_nr = adap->nr;
63 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
65 TP_ARGS(adap, msg, num),
74 __entry->adapter_nr = adap->nr;
94 TP_PROTO(const struct i2c_adapter *adap, const struct i2c_msg *msg,
96 TP_ARGS(adap, msg, num),
105 __entry->adapter_nr = adap->nr;
127 TP_PROTO(const struct i2c_adapter *adap, int num, int ret),
128 TP_ARGS(adap, num, ret),
135 __entry->adapter_nr = adap->nr;
151 TP_PROTO(const struct i2c_adapter *adap,
155 TP_ARGS(adap, addr, flags, read_write, command, protocol, data),
168 __entry->adapter_nr = adap->nr;
219 TP_PROTO(const struct i2c_adapter *adap,
222 TP_ARGS(adap, addr, flags, read_write, command, protocol),
234 __entry->adapter_nr = adap->nr;
261 TP_PROTO(const struct i2c_adapter *adap,
265 TP_ARGS(adap, addr, flags, read_write, command, protocol, data),
276 __entry->adapter_nr = adap->nr;
327 TP_PROTO(const struct i2c_adapter *adap,
331 TP_ARGS(adap, addr, flags, read_write, command, protocol, res),
342 __entry->adapter_nr = adap->nr;
/linux-4.4.14/drivers/media/pci/netup_unidvb/
H A Dnetup_unidvb_i2c.c83 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
86 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
92 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
98 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
107 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
115 dev_dbg(i2c->adap.dev.parent, netup_i2c_interrupt()
119 dev_warn(&i2c->adap.dev, "%s(): not mine interrupt\n", __func__); netup_i2c_interrupt()
130 dev_dbg(i2c->adap.dev.parent, "%s()\n", __func__); netup_i2c_reset()
151 dev_dbg(i2c->adap.dev.parent, netup_i2c_fifo_tx()
155 dev_dbg(i2c->adap.dev.parent, netup_i2c_fifo_tx()
167 dev_dbg(i2c->adap.dev.parent, netup_i2c_fifo_rx()
174 dev_dbg(i2c->adap.dev.parent, netup_i2c_fifo_rx()
179 dev_dbg(i2c->adap.dev.parent, netup_i2c_fifo_rx()
195 dev_dbg(i2c->adap.dev.parent, netup_i2c_start_xfer()
209 static int netup_i2c_xfer(struct i2c_adapter *adap, netup_i2c_xfer() argument
214 struct netup_i2c *i2c = i2c_get_adapdata(adap); netup_i2c_xfer()
218 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
224 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
229 dev_dbg(i2c->adap.dev.parent, "%s() num %d\n", __func__, num); netup_i2c_xfer()
251 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
258 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
263 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
279 dev_dbg(i2c->adap.dev.parent, netup_i2c_xfer()
289 dev_dbg(i2c->adap.dev.parent, "%s(): result %d\n", __func__, res); netup_i2c_xfer()
293 static u32 netup_i2c_func(struct i2c_adapter *adap) netup_i2c_func() argument
326 i2c->adap = netup_i2c_adapter; netup_i2c_init()
327 i2c->adap.dev.parent = &ndev->pci_dev->dev; netup_i2c_init()
328 i2c_set_adapdata(&i2c->adap, i2c); netup_i2c_init()
329 ret = i2c_add_adapter(&i2c->adap); netup_i2c_init()
356 i2c_del_adapter(&i2c->adap); netup_i2c_remove()
/linux-4.4.14/drivers/media/pci/cx88/
H A Dcx88-vp3054-i2c.c123 vp3054_i2c->adap.dev.parent = &dev->pci->dev; vp3054_i2c_probe()
124 strlcpy(vp3054_i2c->adap.name, core->name, vp3054_i2c_probe()
125 sizeof(vp3054_i2c->adap.name)); vp3054_i2c_probe()
126 vp3054_i2c->adap.owner = THIS_MODULE; vp3054_i2c_probe()
128 i2c_set_adapdata(&vp3054_i2c->adap, dev); vp3054_i2c_probe()
129 vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; vp3054_i2c_probe()
134 rc = i2c_bit_add_bus(&vp3054_i2c->adap); vp3054_i2c_probe()
153 i2c_del_adapter(&vp3054_i2c->adap); vp3054_i2c_remove()
H A Dcx88-vp3054-i2c.h27 struct i2c_adapter adap; member in struct:vp3054_i2c_state
/linux-4.4.14/drivers/media/dvb-core/
H A Ddvbdev.c167 static int dvbdev_get_free_id (struct dvb_adapter *adap, int type) dvbdev_get_free_id() argument
173 list_for_each_entry(dev, &adap->device_list, list_head) dvbdev_get_free_id()
271 int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, dvb_register_device() argument
282 if ((id = dvbdev_get_free_id (adap, type)) < 0){ dvb_register_device()
307 dvbdev->adapter = adap; dvb_register_device()
313 dvbdevfops->owner = adap->module; dvb_register_device()
315 list_add_tail (&dvbdev->list_head, &adap->device_list); dvb_register_device()
331 minor = nums2minor(adap->num, type, id); dvb_register_device()
340 clsdev = device_create(dvb_class, adap->device, dvb_register_device()
342 dvbdev, "dvb%d.%s%d", adap->num, dnames[type], id); dvb_register_device()
345 __func__, adap->num, dnames[type], id, PTR_ERR(clsdev)); dvb_register_device()
349 adap->num, dnames[type], id, minor, minor); dvb_register_device()
385 void dvb_create_media_graph(struct dvb_adapter *adap) dvb_create_media_graph() argument
387 struct media_device *mdev = adap->mdev; dvb_create_media_graph()
433 struct dvb_adapter *adap; dvbdev_check_free_adapter_num() local
434 adap = list_entry(entry, struct dvb_adapter, list_head); dvbdev_check_free_adapter_num()
435 if (adap->num == num) dvbdev_check_free_adapter_num()
455 int dvb_register_adapter(struct dvb_adapter *adap, const char *name, dvb_register_adapter() argument
481 memset (adap, 0, sizeof(struct dvb_adapter)); dvb_register_adapter()
482 INIT_LIST_HEAD (&adap->device_list); dvb_register_adapter()
486 adap->num = num; dvb_register_adapter()
487 adap->name = name; dvb_register_adapter()
488 adap->module = module; dvb_register_adapter()
489 adap->device = device; dvb_register_adapter()
490 adap->mfe_shared = 0; dvb_register_adapter()
491 adap->mfe_dvbdev = NULL; dvb_register_adapter()
492 mutex_init (&adap->mfe_lock); dvb_register_adapter()
494 list_add_tail (&adap->list_head, &dvb_adapter_list); dvb_register_adapter()
503 int dvb_unregister_adapter(struct dvb_adapter *adap) dvb_unregister_adapter() argument
506 list_del (&adap->list_head); dvb_unregister_adapter()
H A Ddvbdev.h161 * @adap: pointer to struct dvb_adapter
169 int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
176 * @adap: pointer to struct dvb_adapter
178 int dvb_unregister_adapter(struct dvb_adapter *adap);
183 * @adap: pointer to struct dvb_adapter
191 int dvb_register_device(struct dvb_adapter *adap,
205 void dvb_create_media_graph(struct dvb_adapter *adap); dvb_register_media_controller()
206 static inline void dvb_register_media_controller(struct dvb_adapter *adap, dvb_register_media_controller() argument
209 adap->mdev = mdev; dvb_register_media_controller()
213 static inline void dvb_create_media_graph(struct dvb_adapter *adap) {} dvb_create_media_graph() argument
H A Ddvb_net.h59 static inline int dvb_net_init(struct dvb_adapter *adap, dvb_net_init() argument
/linux-4.4.14/drivers/video/fbdev/via/
H A Dvia_aux.c28 struct via_aux_bus *via_aux_probe(struct i2c_adapter *adap) via_aux_probe() argument
32 if (!adap) via_aux_probe()
39 bus->adap = adap; via_aux_probe()
H A Dvia_i2c.c121 int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) viafb_i2c_readbyte() argument
127 if (!via_i2c_par[adap].is_active) viafb_i2c_readbyte()
136 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); viafb_i2c_readbyte()
145 int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) viafb_i2c_writebyte() argument
151 if (!via_i2c_par[adap].is_active) viafb_i2c_writebyte()
157 ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); viafb_i2c_writebyte()
166 int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) viafb_i2c_readbytes() argument
172 if (!via_i2c_par[adap].is_active) viafb_i2c_readbytes()
180 ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); viafb_i2c_readbytes()
H A Dvia_aux.h34 struct i2c_adapter *adap; /* the I2C device to access the bus */ member in struct:via_aux_bus
53 struct via_aux_bus *via_aux_probe(struct i2c_adapter *adap);
77 return i2c_transfer(drv->bus->adap, msg, 2) == 2; via_aux_read()
/linux-4.4.14/drivers/media/tuners/
H A Dtuner-i2c.h29 struct i2c_adapter *adap; member in struct:tuner_i2c_props
41 int ret = i2c_transfer(props->adap, &msg, 1); tuner_i2c_xfer_send()
51 int ret = i2c_transfer(props->adap, &msg, 1); tuner_i2c_xfer_recv()
64 int ret = i2c_transfer(props->adap, msg, 2); tuner_i2c_xfer_send_recv()
89 i2cprops.adap ? \
90 i2c_adapter_id(i2cprops.adap) : -1, \
135 if (((i2cadap) && (state->i2c_props.adap)) && \
136 ((i2c_adapter_id(state->i2c_props.adap) == \
151 state->i2c_props.adap = i2cadap; \
H A Dtda8290.c480 i2c_transfer(priv->i2c_props.adap, &msg, 1); tda8290_standby()
553 i2c_transfer(priv->i2c_props.adap, &msg, 1); tda8290_init_tuner()
594 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); tda829x_find_tuner()
611 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); tda829x_find_tuner()
631 ret = i2c_transfer(priv->i2c_props.adap, &msg, 1); tda829x_find_tuner()
645 priv->i2c_props.adap, &tda829x_tda18271_config); tda829x_find_tuner()
653 priv->i2c_props.adap, &priv->cfg); tda829x_find_tuner()
678 if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { tda8290_probe()
687 __func__, i2c_adapter_id(i2c_props->adap), tda8290_probe()
705 if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { tda8295_probe()
716 i2c_adapter_id(i2c_props->adap), tda8295_probe()
753 priv->i2c_props.adap = i2c_adap; tda829x_attach()
833 .adap = i2c_adap, tda829x_probe()
H A Dtda18271-common.c137 ret = i2c_transfer(priv->i2c_props.adap, msg, 2); tda18271_read_regs()
167 ret = i2c_transfer(priv->i2c_props.adap, msg, 2); tda18271_read_extended()
228 i2c_lock_adapter(priv->i2c_props.adap); __tda18271_write_regs()
241 ret = __i2c_transfer(priv->i2c_props.adap, &msg, 1); __tda18271_write_regs()
249 i2c_unlock_adapter(priv->i2c_props.adap); __tda18271_write_regs()
295 i2c_adapter_id(priv->i2c_props.adap), tda18271_init_regs()
303 i2c_lock_adapter(priv->i2c_props.adap); tda18271_init_regs()
519 i2c_unlock_adapter(priv->i2c_props.adap); tda18271_init_regs()
730 level, func, i2c_adapter_id(state->i2c_props.adap), _tda_printk()
/linux-4.4.14/drivers/gpu/drm/nouveau/include/nvkm/subdev/
H A Di2c.h95 nvkm_rdi2cr(struct i2c_adapter *adap, u8 addr, u8 reg) nvkm_rdi2cr() argument
103 int ret = i2c_transfer(adap, msgs, ARRAY_SIZE(msgs)); nvkm_rdi2cr()
111 nvkm_wri2cr(struct i2c_adapter *adap, u8 addr, u8 reg, u8 val) nvkm_wri2cr() argument
118 int ret = i2c_transfer(adap, msgs, ARRAY_SIZE(msgs)); nvkm_wri2cr()
126 nvkm_probe_i2c(struct i2c_adapter *adap, u8 addr) nvkm_probe_i2c() argument
128 return nvkm_rdi2cr(adap, addr, 0) >= 0; nvkm_probe_i2c()
/linux-4.4.14/drivers/i2c/muxes/
H A Di2c-mux-pca9541.c94 struct i2c_adapter *adap = client->adapter; pca9541_reg_write() local
97 if (adap->algo->master_xfer) { pca9541_reg_write()
107 ret = __i2c_transfer(adap, &msg, 1); pca9541_reg_write()
112 ret = adap->algo->smbus_xfer(adap, client->addr, pca9541_reg_write()
128 struct i2c_adapter *adap = client->adapter; pca9541_reg_read() local
132 if (adap->algo->master_xfer) { pca9541_reg_read()
147 ret = __i2c_transfer(adap, msg, 2); pca9541_reg_read()
155 ret = adap->algo->smbus_xfer(adap, client->addr, pca9541_reg_read()
288 static int pca9541_select_chan(struct i2c_adapter *adap, void *client, u32 chan) pca9541_select_chan() argument
312 static int pca9541_release_chan(struct i2c_adapter *adap, pca9541_release_chan() argument
325 struct i2c_adapter *adap = client->adapter; pca9541_probe() local
331 if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE_DATA)) pca9541_probe()
346 i2c_lock_adapter(adap); pca9541_probe()
348 i2c_unlock_adapter(adap); pca9541_probe()
355 data->mux_adap = i2c_add_mux_adapter(adap, &client->dev, client, pca9541_probe()
H A Di2c-mux-pca954x.c123 static int pca954x_reg_write(struct i2c_adapter *adap, pca954x_reg_write() argument
128 if (adap->algo->master_xfer) { pca954x_reg_write()
137 ret = __i2c_transfer(adap, &msg, 1); pca954x_reg_write()
140 ret = adap->algo->smbus_xfer(adap, client->addr, pca954x_reg_write()
149 static int pca954x_select_chan(struct i2c_adapter *adap, pca954x_select_chan() argument
165 ret = pca954x_reg_write(adap, client, regval); pca954x_select_chan()
172 static int pca954x_deselect_mux(struct i2c_adapter *adap, pca954x_deselect_mux() argument
179 return pca954x_reg_write(adap, client, data->last_chan); pca954x_deselect_mux()
188 struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); pca954x_probe() local
197 if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE)) pca954x_probe()
230 force = 0; /* dynamic adap number */ pca954x_probe()
244 i2c_add_mux_adapter(adap, &client->dev, client, pca954x_probe()
H A Di2c-mux-gpio.c22 struct i2c_adapter **adap; /* child busses */ member in struct:gpiomux
36 static int i2c_mux_gpio_select(struct i2c_adapter *adap, void *data, u32 chan) i2c_mux_gpio_select() argument
45 static int i2c_mux_gpio_deselect(struct i2c_adapter *adap, void *data, u32 chan) i2c_mux_gpio_deselect() argument
186 mux->adap = devm_kzalloc(&pdev->dev, i2c_mux_gpio_probe()
187 sizeof(*mux->adap) * mux->data.n_values, i2c_mux_gpio_probe()
189 if (!mux->adap) { i2c_mux_gpio_probe()
226 mux->adap[i] = i2c_add_mux_adapter(parent, &pdev->dev, mux, nr, i2c_mux_gpio_probe()
229 if (!mux->adap[i]) { i2c_mux_gpio_probe()
243 i2c_del_mux_adapter(mux->adap[i - 1]); i2c_mux_gpio_probe()
260 i2c_del_mux_adapter(mux->adap[i]); i2c_mux_gpio_remove()
H A Di2c-mux-reg.c25 struct i2c_adapter **adap; /* child busses */ member in struct:regmux
67 static int i2c_mux_reg_select(struct i2c_adapter *adap, void *data, i2c_mux_reg_select() argument
75 static int i2c_mux_reg_deselect(struct i2c_adapter *adap, void *data, i2c_mux_reg_deselect() argument
218 mux->adap = devm_kzalloc(&pdev->dev, i2c_mux_reg_probe()
219 sizeof(*mux->adap) * mux->data.n_values, i2c_mux_reg_probe()
221 if (!mux->adap) { i2c_mux_reg_probe()
235 mux->adap[i] = i2c_add_mux_adapter(mux->parent, &pdev->dev, mux, i2c_mux_reg_probe()
239 if (!mux->adap[i]) { i2c_mux_reg_probe()
253 i2c_del_mux_adapter(mux->adap[i - 1]); i2c_mux_reg_probe()
264 i2c_del_mux_adapter(mux->adap[i]); i2c_mux_reg_remove()
/linux-4.4.14/drivers/media/pci/ngene/
H A Dngene-i2c.c152 static u32 ngene_i2c_functionality(struct i2c_adapter *adap) ngene_i2c_functionality() argument
164 struct i2c_adapter *adap = &(dev->channel[dev_nr].i2c_adapter); ngene_i2c_init() local
166 i2c_set_adapdata(adap, &(dev->channel[dev_nr])); ngene_i2c_init()
168 strcpy(adap->name, "nGene"); ngene_i2c_init()
170 adap->algo = &ngene_i2c_algo; ngene_i2c_init()
171 adap->algo_data = (void *)&(dev->channel[dev_nr]); ngene_i2c_init()
172 adap->dev.parent = &dev->pci_dev->dev; ngene_i2c_init()
174 return i2c_add_adapter(adap); ngene_i2c_init()
/linux-4.4.14/sound/ppc/
H A Dkeywest.c142 struct i2c_adapter *adap; snd_pmac_keywest_init() local
148 adap = i2c_get_adapter(0); snd_pmac_keywest_init()
149 if (!adap) snd_pmac_keywest_init()
156 i2c_put_adapter(adap); snd_pmac_keywest_init()
165 while (adap) { snd_pmac_keywest_init()
167 err = keywest_attach_adapter(adap); snd_pmac_keywest_init()
170 i2c_put_adapter(adap); snd_pmac_keywest_init()
171 adap = i2c_get_adapter(++i); snd_pmac_keywest_init()
/linux-4.4.14/drivers/media/pci/solo6x10/
H A Dsolo6x10-i2c.c213 static int solo_i2c_master_xfer(struct i2c_adapter *adap, solo_i2c_master_xfer() argument
216 struct solo_dev *solo_dev = adap->algo_data; solo_i2c_master_xfer()
223 if (&solo_dev->i2c_adap[i] == adap) solo_i2c_master_xfer()
267 static u32 solo_i2c_functionality(struct i2c_adapter *adap) solo_i2c_functionality() argument
291 struct i2c_adapter *adap = &solo_dev->i2c_adap[i]; solo_i2c_init() local
293 snprintf(adap->name, I2C_NAME_SIZE, "%s I2C %d", solo_i2c_init()
295 adap->algo = &solo_i2c_algo; solo_i2c_init()
296 adap->algo_data = solo_dev; solo_i2c_init()
297 adap->retries = 1; solo_i2c_init()
298 adap->dev.parent = &solo_dev->pdev->dev; solo_i2c_init()
300 ret = i2c_add_adapter(adap); solo_i2c_init()
302 adap->algo_data = NULL; solo_i2c_init()
/linux-4.4.14/include/linux/
H A Dvia_i2c.h35 int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata);
36 int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data);
37 int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len);
H A Di2c.h69 extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
72 extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
329 i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info);
338 i2c_new_probed_device(struct i2c_adapter *adap,
350 i2c_new_dummy(struct i2c_adapter *adap, u16 address);
376 * the adapter specified by adap.
401 int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs,
403 int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
449 int i2c_recover_bus(struct i2c_adapter *adap);
452 int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
453 int i2c_generic_scl_recovery(struct i2c_adapter *adap);
599 extern void i2c_clients_command(struct i2c_adapter *adap,
603 extern void i2c_put_adapter(struct i2c_adapter *adap);
607 static inline u32 i2c_get_functionality(struct i2c_adapter *adap) i2c_get_functionality() argument
609 return adap->algo->functionality(adap); i2c_get_functionality()
613 static inline int i2c_check_functionality(struct i2c_adapter *adap, u32 func) i2c_check_functionality() argument
615 return (func & i2c_get_functionality(adap)) == func; i2c_check_functionality()
619 static inline int i2c_adapter_id(struct i2c_adapter *adap) i2c_adapter_id() argument
621 return adap->nr; i2c_adapter_id()
H A Di2c-algo-pcf.h2 /* adap-pcf.h i2c driver algorithms for PCF8584 adapters */
H A Di2c-mux.h45 void i2c_del_mux_adapter(struct i2c_adapter *adap);
/linux-4.4.14/arch/arm/mach-omap1/
H A Dboard-sx1.c51 struct i2c_adapter *adap; sx1_i2c_write_byte() local
56 adap = i2c_get_adapter(0); sx1_i2c_write_byte()
57 if (!adap) sx1_i2c_write_byte()
65 err = i2c_transfer(adap, msg, 1); sx1_i2c_write_byte()
66 i2c_put_adapter(adap); sx1_i2c_write_byte()
75 struct i2c_adapter *adap; sx1_i2c_read_byte() local
80 adap = i2c_get_adapter(0); sx1_i2c_read_byte()
81 if (!adap) sx1_i2c_read_byte()
89 err = i2c_transfer(adap, msg, 1); sx1_i2c_read_byte()
95 err = i2c_transfer(adap, msg, 1); sx1_i2c_read_byte()
97 i2c_put_adapter(adap); sx1_i2c_read_byte()
/linux-4.4.14/drivers/mfd/
H A D88pm860x-i2c.c91 struct i2c_adapter *adap = i2c->adapter; read_device() local
115 ret = adap->algo->master_xfer(adap, msg, num); read_device()
126 struct i2c_adapter *adap = i2c->adapter; write_device() local
137 ret = adap->algo->master_xfer(adap, &msg, 1); write_device()
/linux-4.4.14/drivers/gpu/drm/gma500/
H A Doaktrail_hdmi_i2c.c69 struct i2c_adapter *adap; member in struct:hdmi_i2c_dev
93 static int xfer_read(struct i2c_adapter *adap, struct i2c_msg *pmsg) xfer_read() argument
95 struct oaktrail_hdmi_dev *hdmi_dev = i2c_get_adapdata(adap); xfer_read()
116 static int xfer_write(struct i2c_adapter *adap, struct i2c_msg *pmsg) xfer_write() argument
124 static int oaktrail_hdmi_i2c_access(struct i2c_adapter *adap, oaktrail_hdmi_i2c_access() argument
128 struct oaktrail_hdmi_dev *hdmi_dev = i2c_get_adapdata(adap); oaktrail_hdmi_i2c_access()
142 xfer_read(adap, pmsg); oaktrail_hdmi_i2c_access()
144 xfer_write(adap, pmsg); oaktrail_hdmi_i2c_access()
288 i2c_dev->adap = &oaktrail_hdmi_i2c_adapter; oaktrail_hdmi_i2c_init()
/linux-4.4.14/drivers/media/pci/ddbridge/
H A Dddbridge-core.c147 static u32 ddb_i2c_functionality(struct i2c_adapter *adap) ddb_i2c_functionality() argument
161 struct i2c_adapter *adap; ddb_i2c_release() local
165 adap = &i2c->adap; ddb_i2c_release()
166 i2c_del_adapter(adap); ddb_i2c_release()
174 struct i2c_adapter *adap; ddb_i2c_init() local
188 adap = &i2c->adap; ddb_i2c_init()
189 i2c_set_adapdata(adap, i2c); ddb_i2c_init()
191 adap->class = I2C_ADAP_CLASS_TV_DIGITAL|I2C_CLASS_TV_ANALOG; ddb_i2c_init()
194 adap->class = I2C_CLASS_TV_ANALOG; ddb_i2c_init()
197 strcpy(adap->name, "ddbridge"); ddb_i2c_init()
198 adap->algo = &ddb_i2c_algo; ddb_i2c_init()
199 adap->algo_data = (void *)i2c; ddb_i2c_init()
200 adap->dev.parent = &dev->pdev->dev; ddb_i2c_init()
201 stat = i2c_add_adapter(adap); ddb_i2c_init()
208 adap = &i2c->adap; ddb_i2c_init()
209 i2c_del_adapter(adap); ddb_i2c_init()
575 struct i2c_adapter *i2c = &input->port->i2c->adap; demod_attach_drxk()
597 struct i2c_adapter *i2c = &input->port->i2c->adap; tuner_attach_tda18271()
668 struct i2c_adapter *i2c = &input->port->i2c->adap; demod_attach_stv0900()
689 struct i2c_adapter *i2c = &input->port->i2c->adap; tuner_attach_stv6110()
784 struct dvb_adapter *adap = &input->adap; dvb_input_detach() local
811 dvb_unregister_adapter(adap); dvb_input_detach()
820 struct dvb_adapter *adap = &input->adap; dvb_input_attach() local
823 ret = dvb_register_adapter(adap, "DDBridge", THIS_MODULE, dvb_input_attach()
842 &input->mem_frontend, adap); dvb_input_attach()
847 ret = dvb_net_init(adap, &input->dvbnet, input->dmxdev.demux); dvb_input_attach()
860 if (dvb_register_frontend(adap, input->fe) < 0) dvb_input_attach()
870 if (dvb_register_frontend(adap, input->fe) < 0) dvb_input_attach()
879 if (dvb_register_frontend(adap, input->fe) < 0) dvb_input_attach()
882 if (dvb_register_frontend(adap, input->fe2) < 0) dvb_input_attach()
1050 ret = dvb_register_adapter(&port->output->adap, ddb_ci_attach()
1057 port->en = cxd2099_attach(&cxd_cfg, port, &port->i2c->adap); ddb_ci_attach()
1059 dvb_unregister_adapter(&port->output->adap); ddb_ci_attach()
1064 dvb_ca_en50221_init(&port->output->adap, ddb_ci_attach()
1066 ret = dvb_register_device(&port->output->adap, &port->output->dev, ddb_ci_attach()
1128 dvb_unregister_adapter(&port->output->adap); ddb_ports_detach()
1141 return i2c_read_reg(&port->i2c->adap, 0x40, 0, &val) ? 0 : 1; port_has_ci()
1147 if (i2c_read_reg16(&port->i2c->adap, 0x69, 0xf100, &val) < 0) port_has_stv0900()
1155 if (i2c_read_reg16(&port->i2c->adap, 0x68, 0xf100, &val) < 0) port_has_stv0900_aa()
1163 if (i2c_read(&port->i2c->adap, 0x29, &val) < 0) port_has_drxks()
1165 if (i2c_read(&port->i2c->adap, 0x2a, &val) < 0) port_has_drxks()
H A Dddbridge.h91 struct dvb_adapter adap; member in struct:ddb_input
119 struct dvb_adapter adap; member in struct:ddb_output
126 struct i2c_adapter adap; member in struct:ddb_i2c
/linux-4.4.14/drivers/media/pci/cx18/
H A Dcx18-i2c.c86 static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw, cx18_i2c_new_ir() argument
107 return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? cx18_i2c_new_ir()
115 struct i2c_adapter *adap = &cx->i2c_adap[bus]; cx18_i2c_register() local
122 adap, type, 0, cx->card_i2c->radio); cx18_i2c_register()
126 adap, type, 0, cx->card_i2c->demod); cx18_i2c_register()
130 adap, type, 0, cx->card_i2c->tv); cx18_i2c_register()
137 return cx18_i2c_new_ir(cx, adap, hw, type, hw_addrs[idx]); cx18_i2c_register()
144 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, type, hw_addrs[idx], cx18_i2c_register()
/linux-4.4.14/include/media/
H A Dv4l2-clk.h68 #define v4l2_clk_name_i2c(name, size, adap, client) snprintf(name, size, \
69 "%d-%04x", adap, client)
/linux-4.4.14/drivers/media/dvb-frontends/
H A Dtc90522.c519 dev_warn(&state->tuner_i2c.dev, "(%s) failed. [adap%d-fe%d]\n", tc90522_set_frontend()
595 "(%s) failed. [adap%d-fe%d]\n", tc90522_sleep()
628 "(%s) failed. [adap%d-fe%d]\n", tc90522_init()
645 tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) tc90522_master_xfer() argument
665 state = i2c_get_adapdata(adap); tc90522_master_xfer()
709 static u32 tc90522_functionality(struct i2c_adapter *adap) tc90522_functionality() argument
776 struct i2c_adapter *adap; tc90522_probe() local
791 adap = &state->tuner_i2c; tc90522_probe()
792 adap->owner = THIS_MODULE; tc90522_probe()
793 adap->algo = &tc90522_tuner_i2c_algo; tc90522_probe()
794 adap->dev.parent = &client->dev; tc90522_probe()
795 strlcpy(adap->name, "tc90522_sub", sizeof(adap->name)); tc90522_probe()
796 i2c_set_adapdata(adap, state); tc90522_probe()
797 ret = i2c_add_adapter(adap); tc90522_probe()
800 cfg->tuner_i2c = state->cfg.tuner_i2c = adap; tc90522_probe()
/linux-4.4.14/drivers/net/ethernet/chelsio/cxgb/
H A Dcommon.h305 #define t1_is_T1B(adap) adapter_matches_type(adap, CHBT_TERM_T1, TERM_T1B)
306 #define is_T2(adap) adapter_matches_type(adap, CHBT_TERM_T2, TERM_T2)
320 static inline unsigned int core_ticks_per_usec(const adapter_t *adap) core_ticks_per_usec() argument
322 return board_info(adap)->clock_core / 1000000; core_ticks_per_usec()
H A Dtp.h67 void t1_tp_get_mib_statistics(adapter_t *adap, struct tp_mib_statistics *tps);
/linux-4.4.14/drivers/of/
H A Dunittest.c1544 struct i2c_adapter adap; member in struct:unittest_i2c_bus_data
1547 static int unittest_i2c_master_xfer(struct i2c_adapter *adap, unittest_i2c_master_xfer() argument
1550 struct unittest_i2c_bus_data *std = i2c_get_adapdata(adap); unittest_i2c_master_xfer()
1557 static u32 unittest_i2c_functionality(struct i2c_adapter *adap) unittest_i2c_functionality() argument
1572 struct i2c_adapter *adap; unittest_i2c_bus_probe() local
1593 adap = &std->adap; unittest_i2c_bus_probe()
1594 i2c_set_adapdata(adap, std); unittest_i2c_bus_probe()
1595 adap->nr = -1; unittest_i2c_bus_probe()
1596 strlcpy(adap->name, pdev->name, sizeof(adap->name)); unittest_i2c_bus_probe()
1597 adap->class = I2C_CLASS_DEPRECATED; unittest_i2c_bus_probe()
1598 adap->algo = &unittest_i2c_algo; unittest_i2c_bus_probe()
1599 adap->dev.parent = dev; unittest_i2c_bus_probe()
1600 adap->dev.of_node = dev->of_node; unittest_i2c_bus_probe()
1601 adap->timeout = 5 * HZ; unittest_i2c_bus_probe()
1602 adap->retries = 3; unittest_i2c_bus_probe()
1604 ret = i2c_add_numbered_adapter(adap); unittest_i2c_bus_probe()
1620 i2c_del_adapter(&std->adap); unittest_i2c_bus_remove()
1682 struct i2c_adapter *adap[]; member in struct:unittest_i2c_mux_data
1685 static int unittest_i2c_mux_select_chan(struct i2c_adapter *adap, unittest_i2c_mux_select_chan() argument
1696 struct i2c_adapter *adap = to_i2c_adapter(dev->parent); unittest_i2c_mux_probe() local
1722 size = offsetof(struct unittest_i2c_mux_data, adap[nchans]);
1730 stm->adap[i] = i2c_add_mux_adapter(adap, dev, client,
1732 if (!stm->adap[i]) {
1735 i2c_del_mux_adapter(stm->adap[i]);
1754 i2c_del_mux_adapter(stm->adap[i]); unittest_i2c_mux_remove()
/linux-4.4.14/drivers/media/platform/marvell-ccic/
H A Dcafe-driver.c336 struct i2c_adapter *adap; cafe_smbus_setup() local
339 adap = kzalloc(sizeof(*adap), GFP_KERNEL); cafe_smbus_setup()
340 if (adap == NULL) cafe_smbus_setup()
342 adap->owner = THIS_MODULE; cafe_smbus_setup()
343 adap->algo = &cafe_smbus_algo; cafe_smbus_setup()
344 strcpy(adap->name, "cafe_ccic"); cafe_smbus_setup()
345 adap->dev.parent = &cam->pdev->dev; cafe_smbus_setup()
346 i2c_set_adapdata(adap, cam); cafe_smbus_setup()
347 ret = i2c_add_adapter(adap); cafe_smbus_setup()
350 kfree(adap); cafe_smbus_setup()
354 cam->mcam.i2c_adapter = adap; cafe_smbus_setup()
/linux-4.4.14/drivers/gpu/drm/
H A Ddrm_encoder_slave.c36 * @adap: I2C adapter that will be used to communicate with
54 struct i2c_adapter *adap, drm_i2c_encoder_init()
64 client = i2c_new_device(adap, info); drm_i2c_encoder_init()
52 drm_i2c_encoder_init(struct drm_device *dev, struct drm_encoder_slave *encoder, struct i2c_adapter *adap, const struct i2c_board_info *info) drm_i2c_encoder_init() argument
/linux-4.4.14/drivers/media/pci/ivtv/
H A Divtv-i2c.c180 struct i2c_adapter *adap = &itv->i2c_adap; ivtv_i2c_new_ir() local
190 return i2c_new_probed_device(adap, &info, addr_list, NULL) ivtv_i2c_new_ir()
234 return i2c_new_probed_device(adap, &info, addr_list, NULL) == NULL ? ivtv_i2c_new_ir()
267 struct i2c_adapter *adap = &itv->i2c_adap; ivtv_i2c_register() local
273 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, ivtv_i2c_register()
277 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, ivtv_i2c_register()
281 sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, ivtv_i2c_register()
298 adap, type, 0, I2C_ADDRS(hw_addrs[idx])); ivtv_i2c_register()
308 sd = v4l2_i2c_new_subdev_board(&itv->v4l2_dev, adap, ivtv_i2c_register()
312 adap, type, hw_addrs[idx], NULL); ivtv_i2c_register()
623 static u32 ivtv_functionality(struct i2c_adapter *adap) ivtv_functionality() argument
/linux-4.4.14/drivers/hid/
H A Dhid-cp2112.c154 struct i2c_adapter adap; member in struct:cp2112_device
468 static int cp2112_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, cp2112_i2c_xfer() argument
471 struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data; cp2112_i2c_xfer()
585 static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, cp2112_xfer() argument
589 struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data; cp2112_xfer()
749 static u32 cp2112_functionality(struct i2c_adapter *adap) cp2112_functionality() argument
1078 dev->adap.owner = THIS_MODULE; cp2112_probe()
1079 dev->adap.class = I2C_CLASS_HWMON; cp2112_probe()
1080 dev->adap.algo = &smbus_algorithm; cp2112_probe()
1081 dev->adap.algo_data = dev; cp2112_probe()
1082 dev->adap.dev.parent = &hdev->dev; cp2112_probe()
1083 snprintf(dev->adap.name, sizeof(dev->adap.name), cp2112_probe()
1089 ret = i2c_add_adapter(&dev->adap); cp2112_probe()
1129 i2c_del_adapter(&dev->adap); cp2112_probe()
1147 i2c_del_adapter(&dev->adap); cp2112_remove()
1151 * waited for device_unregister(&adap->dev) to complete. Therefore we cp2112_remove()
/linux-4.4.14/drivers/gpu/drm/amd/amdgpu/
H A Datombios_i2c.h29 u32 amdgpu_atombios_i2c_func(struct i2c_adapter *adap);
/linux-4.4.14/sound/pci/asihpi/
H A Dhpicmn.c213 "adap %d control index %d out of range, cache not ready?\n", control_cache_alloc_check()
221 "adap %d cache not ready?\n", control_cache_alloc_check()
230 "adap %d zero size cache entry %d\n", control_cache_alloc_check()
263 "adap %d bytecount %d != cache size %d\n", control_cache_alloc_check()
268 "adap %d cache good, bytecount == cache size = %d\n", control_cache_alloc_check()
545 "HPICMN find_control() failed for adap %d\n", hpi_check_control_cache()
633 "HPICMN find_control() failed for adap %d\n", hpi_cmn_control_cache_sync_to_msg()
/linux-4.4.14/drivers/xen/xenbus/
H A Dxenbus_dev_frontend.c264 struct watch_adapter *adap; watch_fired() local
271 adap = container_of(watch, struct watch_adapter, watch); watch_fired()
274 token = adap->token; watch_fired()
285 mutex_lock(&adap->dev_data->reply_mutex); watch_fired()
297 list_splice_tail(&staging_q, &adap->dev_data->read_buffers); watch_fired()
298 wake_up(&adap->dev_data->read_waitq); watch_fired()
302 mutex_unlock(&adap->dev_data->reply_mutex); watch_fired()
/linux-4.4.14/drivers/staging/media/lirc/
H A Dlirc_zilog.c1452 struct i2c_adapter *adap = client->adapter; ir_probe() local
1457 __func__, id->name, adap->nr, adap->name, client->addr); ir_probe()
1470 tx_probe ? "Tx" : "Rx", adap->name, adap->nr); ir_probe()
1475 ir = get_ir_device_by_adapter(adap); ir_probe()
1488 ir->adapter = adap; ir_probe()
1505 ir->l.dev = &adap->dev; ir_probe()
1553 adap->name, adap->nr); ir_probe()
1588 "zilog-rx-i2c-%d", adap->nr); ir_probe()
1606 adap->name, adap->nr); ir_probe()
1623 adap->name, adap->nr, ir->l.minor); ir_probe()
1633 tx_probe ? "Tx" : "Rx", adap->name, adap->nr); ir_probe()
1647 __func__, tx_probe ? "Tx" : "Rx", adap->name, adap->nr, ret); ir_probe()
/linux-4.4.14/drivers/video/backlight/
H A Dtosa_lcd.c105 struct i2c_adapter *adap = i2c_get_adapter(0); tosa_lcd_tg_on() local
111 data->i2c = i2c_new_device(adap, &info); tosa_lcd_tg_on()

Completed in 3745 milliseconds

12