Lines Matching refs:cs
154 static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, in gigaset_set_modem_ctrl() argument
157 struct usb_device *udev = cs->hw.usb->udev; in gigaset_set_modem_ctrl()
178 static int set_value(struct cardstate *cs, u8 req, u16 val) in set_value() argument
180 struct usb_device *udev = cs->hw.usb->udev; in set_value()
200 0, 0, cs->hw.usb->bchars, 6, 2000 /*?*/); in set_value()
211 static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) in gigaset_baud_rate() argument
231 dev_err(cs->dev, "unsupported baudrate request 0x%x," in gigaset_baud_rate()
237 return set_value(cs, 1, val); in gigaset_baud_rate()
244 static int gigaset_set_line_ctrl(struct cardstate *cs, unsigned cflag) in gigaset_set_line_ctrl() argument
263 dev_err(cs->dev, "CSIZE was not CS5-CS8, using default of 8\n"); in gigaset_set_line_ctrl()
276 return set_value(cs, 3, val); in gigaset_set_line_ctrl()
295 static int write_modem(struct cardstate *cs);
296 static int send_cb(struct cardstate *cs);
304 struct cardstate *cs = (struct cardstate *) data; in gigaset_modem_fill() local
305 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ in gigaset_modem_fill()
309 if (cs->hw.usb->busy) { in gigaset_modem_fill()
316 if (cs->cmdbuf) { /* commands to send? */ in gigaset_modem_fill()
318 if (send_cb(cs) < 0) { in gigaset_modem_fill()
336 if (write_modem(cs) < 0) { in gigaset_modem_fill()
347 struct cardstate *cs = urb->context; in gigaset_read_int_callback() local
348 struct inbuf_t *inbuf = cs->inbuf; in gigaset_read_int_callback()
359 src = cs->hw.usb->rcvbuf; in gigaset_read_int_callback()
361 dev_warn(cs->dev, in gigaset_read_int_callback()
368 gigaset_schedule_event(inbuf->cs); in gigaset_read_int_callback()
382 spin_lock_irqsave(&cs->lock, flags); in gigaset_read_int_callback()
383 if (!cs->connected) { in gigaset_read_int_callback()
384 spin_unlock_irqrestore(&cs->lock, flags); in gigaset_read_int_callback()
389 spin_unlock_irqrestore(&cs->lock, flags); in gigaset_read_int_callback()
391 dev_err(cs->dev, "error %d resubmitting URB\n", -r); in gigaset_read_int_callback()
398 struct cardstate *cs = urb->context; in gigaset_write_bulk_callback() local
407 cs->hw.usb->busy = 0; in gigaset_write_bulk_callback()
410 dev_err(cs->dev, "bulk transfer failed (status %d)\n", in gigaset_write_bulk_callback()
416 spin_lock_irqsave(&cs->lock, flags); in gigaset_write_bulk_callback()
417 if (!cs->connected) { in gigaset_write_bulk_callback()
420 cs->hw.usb->busy = 0; in gigaset_write_bulk_callback()
421 tasklet_schedule(&cs->write_tasklet); in gigaset_write_bulk_callback()
423 spin_unlock_irqrestore(&cs->lock, flags); in gigaset_write_bulk_callback()
426 static int send_cb(struct cardstate *cs) in send_cb() argument
428 struct cmdbuf_t *cb = cs->cmdbuf; in send_cb()
432 struct usb_cardstate *ucs = cs->hw.usb; in send_cb()
436 spin_lock_irqsave(&cs->cmdlock, flags); in send_cb()
437 cs->cmdbytes -= cs->curlen; in send_cb()
439 cs->curlen, cs->cmdbytes); in send_cb()
440 cs->cmdbuf = cb->next; in send_cb()
441 if (cs->cmdbuf) { in send_cb()
442 cs->cmdbuf->prev = NULL; in send_cb()
443 cs->curlen = cs->cmdbuf->len; in send_cb()
445 cs->lastcmdbuf = NULL; in send_cb()
446 cs->curlen = 0; in send_cb()
448 spin_unlock_irqrestore(&cs->cmdlock, flags); in send_cb()
454 cb = cs->cmdbuf; in send_cb()
465 gigaset_write_bulk_callback, cs); in send_cb()
471 spin_lock_irqsave(&cs->lock, flags); in send_cb()
472 status = cs->connected ? in send_cb()
475 spin_unlock_irqrestore(&cs->lock, flags); in send_cb()
479 dev_err(cs->dev, in send_cb()
492 static int gigaset_write_cmd(struct cardstate *cs, struct cmdbuf_t *cb) in gigaset_write_cmd() argument
497 gigaset_dbg_buffer(cs->mstate != MS_LOCKED ? in gigaset_write_cmd()
501 spin_lock_irqsave(&cs->cmdlock, flags); in gigaset_write_cmd()
502 cb->prev = cs->lastcmdbuf; in gigaset_write_cmd()
503 if (cs->lastcmdbuf) in gigaset_write_cmd()
504 cs->lastcmdbuf->next = cb; in gigaset_write_cmd()
506 cs->cmdbuf = cb; in gigaset_write_cmd()
507 cs->curlen = cb->len; in gigaset_write_cmd()
509 cs->cmdbytes += cb->len; in gigaset_write_cmd()
510 cs->lastcmdbuf = cb; in gigaset_write_cmd()
511 spin_unlock_irqrestore(&cs->cmdlock, flags); in gigaset_write_cmd()
513 spin_lock_irqsave(&cs->lock, flags); in gigaset_write_cmd()
515 if (cs->connected) in gigaset_write_cmd()
516 tasklet_schedule(&cs->write_tasklet); in gigaset_write_cmd()
517 spin_unlock_irqrestore(&cs->lock, flags); in gigaset_write_cmd()
521 static int gigaset_write_room(struct cardstate *cs) in gigaset_write_room() argument
525 bytes = cs->cmdbytes; in gigaset_write_room()
529 static int gigaset_chars_in_buffer(struct cardstate *cs) in gigaset_chars_in_buffer() argument
531 return cs->cmdbytes; in gigaset_chars_in_buffer()
539 static int gigaset_brkchars(struct cardstate *cs, const unsigned char buf[6]) in gigaset_brkchars() argument
541 struct usb_device *udev = cs->hw.usb->udev; in gigaset_brkchars()
544 memcpy(cs->hw.usb->bchars, buf, 6); in gigaset_brkchars()
567 static void gigaset_freecshw(struct cardstate *cs) in gigaset_freecshw() argument
569 tasklet_kill(&cs->write_tasklet); in gigaset_freecshw()
570 kfree(cs->hw.usb); in gigaset_freecshw()
573 static int gigaset_initcshw(struct cardstate *cs) in gigaset_initcshw() argument
577 cs->hw.usb = ucs = in gigaset_initcshw()
593 tasklet_init(&cs->write_tasklet, in gigaset_initcshw()
594 gigaset_modem_fill, (unsigned long) cs); in gigaset_initcshw()
600 static int write_modem(struct cardstate *cs) in write_modem() argument
604 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ in write_modem()
605 struct usb_cardstate *ucs = cs->hw.usb; in write_modem()
623 spin_lock_irqsave(&cs->lock, flags); in write_modem()
624 if (cs->connected) { in write_modem()
629 gigaset_write_bulk_callback, cs); in write_modem()
634 spin_unlock_irqrestore(&cs->lock, flags); in write_modem()
637 dev_err(cs->dev, "could not submit urb (error %d)\n", -ret); in write_modem()
660 struct cardstate *cs = NULL; in gigaset_probe() local
694 cs = gigaset_initcs(driver, 1, 1, 0, cidmode, GIGASET_MODULENAME); in gigaset_probe()
695 if (!cs) in gigaset_probe()
697 ucs = cs->hw.usb; in gigaset_probe()
703 cs->dev = &interface->dev; in gigaset_probe()
706 usb_set_intfdata(interface, cs); in gigaset_probe()
715 dev_err(cs->dev, "Couldn't allocate bulk_out_buffer\n"); in gigaset_probe()
722 dev_err(cs->dev, "Couldn't allocate bulk_out_urb\n"); in gigaset_probe()
733 dev_err(cs->dev, "No free urbs available\n"); in gigaset_probe()
741 dev_err(cs->dev, "Couldn't allocate rcvbuf\n"); in gigaset_probe()
750 cs, endpoint->bInterval); in gigaset_probe()
754 dev_err(cs->dev, "Could not submit URB (error %d)\n", -retval); in gigaset_probe()
760 cs->mstate = MS_LOCKED; in gigaset_probe()
762 retval = gigaset_start(cs); in gigaset_probe()
764 tasklet_kill(&cs->write_tasklet); in gigaset_probe()
781 gigaset_freecs(cs); in gigaset_probe()
787 struct cardstate *cs; in gigaset_disconnect() local
790 cs = usb_get_intfdata(interface); in gigaset_disconnect()
791 ucs = cs->hw.usb; in gigaset_disconnect()
793 dev_info(cs->dev, "disconnecting Gigaset USB adapter\n"); in gigaset_disconnect()
797 gigaset_stop(cs); in gigaset_disconnect()
800 tasklet_kill(&cs->write_tasklet); in gigaset_disconnect()
814 cs->dev = NULL; in gigaset_disconnect()
815 gigaset_freecs(cs); in gigaset_disconnect()
823 struct cardstate *cs = usb_get_intfdata(intf); in gigaset_suspend() local
826 cs->connected = 0; /* prevent rescheduling */ in gigaset_suspend()
827 usb_kill_urb(cs->hw.usb->read_urb); in gigaset_suspend()
828 tasklet_kill(&cs->write_tasklet); in gigaset_suspend()
829 usb_kill_urb(cs->hw.usb->bulk_out_urb); in gigaset_suspend()
840 struct cardstate *cs = usb_get_intfdata(intf); in gigaset_resume() local
844 cs->connected = 1; in gigaset_resume()
845 rc = usb_submit_urb(cs->hw.usb->read_urb, GFP_KERNEL); in gigaset_resume()
847 dev_err(cs->dev, "Could not submit read URB (error %d)\n", -rc); in gigaset_resume()
929 gigaset_shutdown(driver->cs + i); in usb_gigaset_exit()