• Home
  • Raw
  • Download

Lines Matching refs:skt

101 static int socket_resume(struct pcmcia_socket *skt);
102 static int socket_suspend(struct pcmcia_socket *skt);
141 struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt) in pcmcia_get_socket() argument
143 struct device *dev = get_device(&skt->dev); in pcmcia_get_socket()
146 skt = dev_get_drvdata(dev); in pcmcia_get_socket()
147 if (!try_module_get(skt->owner)) { in pcmcia_get_socket()
148 put_device(&skt->dev); in pcmcia_get_socket()
151 return (skt); in pcmcia_get_socket()
156 void pcmcia_put_socket(struct pcmcia_socket *skt) in pcmcia_put_socket() argument
158 module_put(skt->owner); in pcmcia_put_socket()
159 put_device(&skt->dev); in pcmcia_put_socket()
345 static void socket_remove_drivers(struct pcmcia_socket *skt) in socket_remove_drivers() argument
347 cs_dbg(skt, 4, "remove_drivers\n"); in socket_remove_drivers()
349 send_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH); in socket_remove_drivers()
352 static int socket_reset(struct pcmcia_socket *skt) in socket_reset() argument
356 cs_dbg(skt, 4, "reset\n"); in socket_reset()
358 skt->socket.flags |= SS_OUTPUT_ENA | SS_RESET; in socket_reset()
359 skt->ops->set_socket(skt, &skt->socket); in socket_reset()
362 skt->socket.flags &= ~SS_RESET; in socket_reset()
363 skt->ops->set_socket(skt, &skt->socket); in socket_reset()
367 skt->ops->get_status(skt, &status); in socket_reset()
378 cs_err(skt, "time out after reset.\n"); in socket_reset()
423 static int socket_setup(struct pcmcia_socket *skt, int initial_delay) in socket_setup() argument
427 cs_dbg(skt, 4, "setup\n"); in socket_setup()
429 skt->ops->get_status(skt, &status); in socket_setup()
436 skt->ops->get_status(skt, &status); in socket_setup()
447 cs_err(skt, "voltage interrogation timed out.\n"); in socket_setup()
452 if (!(skt->features & SS_CAP_CARDBUS)) { in socket_setup()
453 cs_err(skt, "cardbus cards are not supported.\n"); in socket_setup()
456 skt->state |= SOCKET_CARDBUS; in socket_setup()
463 skt->socket.Vcc = skt->socket.Vpp = 33; in socket_setup()
465 skt->socket.Vcc = skt->socket.Vpp = 50; in socket_setup()
467 cs_err(skt, "unsupported voltage key.\n"); in socket_setup()
471 if (skt->power_hook) in socket_setup()
472 skt->power_hook(skt, HOOK_POWER_PRE); in socket_setup()
474 skt->socket.flags = 0; in socket_setup()
475 skt->ops->set_socket(skt, &skt->socket); in socket_setup()
482 skt->ops->get_status(skt, &status); in socket_setup()
484 cs_err(skt, "unable to apply power.\n"); in socket_setup()
488 status = socket_reset(skt); in socket_setup()
490 if (skt->power_hook) in socket_setup()
491 skt->power_hook(skt, HOOK_POWER_POST); in socket_setup()
500 static int socket_insert(struct pcmcia_socket *skt) in socket_insert() argument
504 cs_dbg(skt, 4, "insert\n"); in socket_insert()
506 if (!cs_socket_get(skt)) in socket_insert()
509 ret = socket_setup(skt, setup_delay); in socket_insert()
511 skt->state |= SOCKET_PRESENT; in socket_insert()
513 dev_printk(KERN_NOTICE, &skt->dev, in socket_insert()
515 (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA", in socket_insert()
516 skt->sock); in socket_insert()
519 if (skt->state & SOCKET_CARDBUS) { in socket_insert()
520 cb_alloc(skt); in socket_insert()
521 skt->state |= SOCKET_CARDBUS_CONFIG; in socket_insert()
524 cs_dbg(skt, 4, "insert done\n"); in socket_insert()
526 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); in socket_insert()
528 socket_shutdown(skt); in socket_insert()
534 static int socket_suspend(struct pcmcia_socket *skt) in socket_suspend() argument
536 if (skt->state & SOCKET_SUSPEND) in socket_suspend()
539 send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW); in socket_suspend()
540 skt->socket = dead_socket; in socket_suspend()
541 skt->ops->set_socket(skt, &skt->socket); in socket_suspend()
542 if (skt->ops->suspend) in socket_suspend()
543 skt->ops->suspend(skt); in socket_suspend()
544 skt->state |= SOCKET_SUSPEND; in socket_suspend()
554 static int socket_resume(struct pcmcia_socket *skt) in socket_resume() argument
558 if (!(skt->state & SOCKET_SUSPEND)) in socket_resume()
561 skt->socket = dead_socket; in socket_resume()
562 skt->ops->init(skt); in socket_resume()
563 skt->ops->set_socket(skt, &skt->socket); in socket_resume()
565 if (!(skt->state & SOCKET_PRESENT)) { in socket_resume()
566 skt->state &= ~SOCKET_SUSPEND; in socket_resume()
567 return socket_insert(skt); in socket_resume()
570 ret = socket_setup(skt, resume_delay); in socket_resume()
575 if (verify_cis_cache(skt) != 0) { in socket_resume()
576 cs_dbg(skt, 4, "cis mismatch - different card\n"); in socket_resume()
577 socket_remove_drivers(skt); in socket_resume()
578 destroy_cis_cache(skt); in socket_resume()
585 send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW); in socket_resume()
587 cs_dbg(skt, 4, "cis matches cache\n"); in socket_resume()
588 send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW); in socket_resume()
591 socket_shutdown(skt); in socket_resume()
594 skt->state &= ~SOCKET_SUSPEND; in socket_resume()
599 static void socket_remove(struct pcmcia_socket *skt) in socket_remove() argument
601 dev_printk(KERN_NOTICE, &skt->dev, in socket_remove()
602 "pccard: card ejected from slot %d\n", skt->sock); in socket_remove()
603 socket_shutdown(skt); in socket_remove()
617 static void socket_detect_change(struct pcmcia_socket *skt) in socket_detect_change() argument
619 if (!(skt->state & SOCKET_SUSPEND)) { in socket_detect_change()
622 if (!(skt->state & SOCKET_PRESENT)) in socket_detect_change()
625 skt->ops->get_status(skt, &status); in socket_detect_change()
626 if ((skt->state & SOCKET_PRESENT) && in socket_detect_change()
628 socket_remove(skt); in socket_detect_change()
629 if (!(skt->state & SOCKET_PRESENT) && in socket_detect_change()
631 socket_insert(skt); in socket_detect_change()
637 struct pcmcia_socket *skt = __skt; in pccardd() local
640 skt->thread = current; in pccardd()
641 skt->socket = dead_socket; in pccardd()
642 skt->ops->init(skt); in pccardd()
643 skt->ops->set_socket(skt, &skt->socket); in pccardd()
646 ret = device_register(&skt->dev); in pccardd()
648 dev_printk(KERN_WARNING, &skt->dev, in pccardd()
650 skt->thread = NULL; in pccardd()
651 complete(&skt->thread_done); in pccardd()
654 ret = pccard_sysfs_add_socket(&skt->dev); in pccardd()
656 dev_warn(&skt->dev, "err %d adding socket attributes\n", ret); in pccardd()
658 complete(&skt->thread_done); in pccardd()
667 spin_lock_irqsave(&skt->thread_lock, flags); in pccardd()
668 events = skt->thread_events; in pccardd()
669 skt->thread_events = 0; in pccardd()
670 spin_unlock_irqrestore(&skt->thread_lock, flags); in pccardd()
673 mutex_lock(&skt->skt_mutex); in pccardd()
675 socket_detect_change(skt); in pccardd()
677 send_event(skt, CS_EVENT_BATTERY_DEAD, CS_EVENT_PRI_LOW); in pccardd()
679 send_event(skt, CS_EVENT_BATTERY_LOW, CS_EVENT_PRI_LOW); in pccardd()
681 send_event(skt, CS_EVENT_READY_CHANGE, CS_EVENT_PRI_LOW); in pccardd()
682 mutex_unlock(&skt->skt_mutex); in pccardd()
696 pccard_sysfs_remove_socket(&skt->dev); in pccardd()
697 device_unregister(&skt->dev); in pccardd()
755 int pcmcia_reset_card(struct pcmcia_socket *skt) in pcmcia_reset_card() argument
759 cs_dbg(skt, 1, "resetting socket\n"); in pcmcia_reset_card()
761 mutex_lock(&skt->skt_mutex); in pcmcia_reset_card()
763 if (!(skt->state & SOCKET_PRESENT)) { in pcmcia_reset_card()
767 if (skt->state & SOCKET_SUSPEND) { in pcmcia_reset_card()
771 if (skt->state & SOCKET_CARDBUS) { in pcmcia_reset_card()
776 ret = send_event(skt, CS_EVENT_RESET_REQUEST, CS_EVENT_PRI_LOW); in pcmcia_reset_card()
778 send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW); in pcmcia_reset_card()
779 if (skt->callback) in pcmcia_reset_card()
780 skt->callback->suspend(skt); in pcmcia_reset_card()
781 if (socket_reset(skt) == 0) { in pcmcia_reset_card()
782 send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW); in pcmcia_reset_card()
783 if (skt->callback) in pcmcia_reset_card()
784 skt->callback->resume(skt); in pcmcia_reset_card()
790 mutex_unlock(&skt->skt_mutex); in pcmcia_reset_card()
800 int pcmcia_suspend_card(struct pcmcia_socket *skt) in pcmcia_suspend_card() argument
804 cs_dbg(skt, 1, "suspending socket\n"); in pcmcia_suspend_card()
806 mutex_lock(&skt->skt_mutex); in pcmcia_suspend_card()
808 if (!(skt->state & SOCKET_PRESENT)) { in pcmcia_suspend_card()
812 if (skt->state & SOCKET_CARDBUS) { in pcmcia_suspend_card()
816 if (skt->callback) { in pcmcia_suspend_card()
817 ret = skt->callback->suspend(skt); in pcmcia_suspend_card()
821 ret = socket_suspend(skt); in pcmcia_suspend_card()
823 mutex_unlock(&skt->skt_mutex); in pcmcia_suspend_card()
830 int pcmcia_resume_card(struct pcmcia_socket *skt) in pcmcia_resume_card() argument
834 cs_dbg(skt, 1, "waking up socket\n"); in pcmcia_resume_card()
836 mutex_lock(&skt->skt_mutex); in pcmcia_resume_card()
838 if (!(skt->state & SOCKET_PRESENT)) { in pcmcia_resume_card()
842 if (skt->state & SOCKET_CARDBUS) { in pcmcia_resume_card()
846 ret = socket_resume(skt); in pcmcia_resume_card()
847 if (!ret && skt->callback) in pcmcia_resume_card()
848 skt->callback->resume(skt); in pcmcia_resume_card()
850 mutex_unlock(&skt->skt_mutex); in pcmcia_resume_card()
858 int pcmcia_eject_card(struct pcmcia_socket *skt) in pcmcia_eject_card() argument
862 cs_dbg(skt, 1, "user eject request\n"); in pcmcia_eject_card()
864 mutex_lock(&skt->skt_mutex); in pcmcia_eject_card()
866 if (!(skt->state & SOCKET_PRESENT)) { in pcmcia_eject_card()
871 ret = send_event(skt, CS_EVENT_EJECTION_REQUEST, CS_EVENT_PRI_LOW); in pcmcia_eject_card()
877 socket_remove(skt); in pcmcia_eject_card()
880 mutex_unlock(&skt->skt_mutex); in pcmcia_eject_card()
887 int pcmcia_insert_card(struct pcmcia_socket *skt) in pcmcia_insert_card() argument
891 cs_dbg(skt, 1, "user insert request\n"); in pcmcia_insert_card()
893 mutex_lock(&skt->skt_mutex); in pcmcia_insert_card()
895 if (skt->state & SOCKET_PRESENT) { in pcmcia_insert_card()
899 if (socket_insert(skt) == -ENODEV) { in pcmcia_insert_card()
905 mutex_unlock(&skt->skt_mutex); in pcmcia_insert_card()