Exemplo n.º 1
0
static int saudio_ctrl_thread(void *data)
{
        int result = 0;
	struct snd_saudio *saudio = (struct snd_saudio *)data;
	ADEBUG();
	daemonize("saudio");

        result = saudio_snd_init_ipc(saudio);
        if(result) {
            printk(KERN_ERR "saudio:saudio_snd_init_ipc error %d\n",result);
            return -1;
        }
       {
	    printk(KERN_INFO "saudio: waiting for modem boot handshake\n");
	    
	    printk(KERN_INFO "saudio: modem boot and handshake ok\n");
	    if(saudio->card) {
		printk(KERN_INFO "saudio: snd card free in\n");
		result = snd_card_free(saudio->card);
		saudio->card = NULL;
		printk(KERN_INFO "saudio: snd card free reulst %d\n",result);
	    }

	    flush_workqueue(saudio->queue);

	    result = saudio_snd_init_card(saudio);
	    printk(KERN_INFO "saudio: snd card init reulst %d\n",result);
        }
	ETRACE("saudio_ctrl_thread  create  ok\n");

	return 0;
}
Exemplo n.º 2
0
static int saudio_ctrl_thread(void *data)
{
	int result = 0;
	struct snd_saudio *saudio = (struct snd_saudio *)data;
	ADEBUG();

	result = saudio_snd_init_ipc(saudio);
	if (result) {
		printk(KERN_ERR "saudio:saudio_snd_init_ipc error %d\n",
		       result);
		return -1;
	}
	while (!kthread_should_stop()) {
		printk(KERN_INFO
		       "%s,saudio: waiting for modem boot handshake,dst %d,channel %d\n",
		       __func__, saudio->dst, saudio->channel);
		saudio_snd_wait_modem_restart(saudio);

		saudio->in_init = 1;

		printk(KERN_INFO
		       "%s,saudio: modem boot and handshake ok,dst %d, channel %d\n",
		       __func__, saudio->dst, saudio->channel);
		saudio_snd_card_free(saudio);
		printk(KERN_INFO
		       "saudio_ctrl_thread flush work queue in dst %d, channel %d\n",
		       saudio->dst, saudio->channel);

		flush_workqueue(saudio->queue);

		saudio->in_init = 0;

		printk(KERN_INFO
		       "saudio_ctrl_thread flush work queue out,dst %d, channel %d\n",
		       saudio->dst, saudio->channel);

		if(saudio_snd_notify_modem_clear(saudio)) {
			printk(KERN_ERR " saudio_ctrl_thread modem error again when notify modem clear \n");
		    continue;
		}

		saudio_clear_ctrl_cmd(saudio);

		if(!saudio->card) {
			result = saudio_snd_init_card(saudio);
			printk(KERN_INFO
			       "saudio: snd card init reulst %d, dst %d, channel %d\n",
			       result, saudio->dst, saudio->channel);
		}
		mutex_lock(&saudio->mutex);
		saudio->state = 1;
		mutex_unlock(&saudio->mutex);
	}
	ETRACE("saudio_ctrl_thread  create  ok\n");

	return 0;
}