Beispiel #1
0
static void
rcu_stutter_wait(char *title)
{
	while (stutter_pause_test || !rcutorture_runnable) {
		if (rcutorture_runnable)
			schedule_timeout_interruptible(1);
		else
			schedule_timeout_interruptible(round_jiffies_relative(HZ));
		rcutorture_shutdown_absorb(title);
	}
}
Beispiel #2
0
static bool esas2r_flash_access(struct esas2r_adapter *a, u32 function)
{
	u32 starttime;
	u32 timeout;
	u32 intstat;
	u32 doorbell;

	/* Disable chip interrupts awhile */
	if (function == DRBL_FLASH_REQ)
		esas2r_disable_chip_interrupts(a);

	/* Issue the request to the firmware */
	esas2r_write_register_dword(a, MU_DOORBELL_IN, function);

	/* Now wait for the firmware to process it */
	starttime = jiffies_to_msecs(jiffies);
	timeout = a->flags &
		  (AF_CHPRST_PENDING | AF_DISC_PENDING) ? 40000 : 5000;

	while (true) {
		intstat = esas2r_read_register_dword(a, MU_INT_STATUS_OUT);

		if (intstat & MU_INTSTAT_DRBL) {
			/* Got a doorbell interrupt.  Check for the function */
			doorbell =
				esas2r_read_register_dword(a, MU_DOORBELL_OUT);
			esas2r_write_register_dword(a, MU_DOORBELL_OUT,
						    doorbell);
			if (doorbell & function)
				break;
		}

		schedule_timeout_interruptible(msecs_to_jiffies(100));

		if ((jiffies_to_msecs(jiffies) - starttime) > timeout) {
			/*
			 * Iimeout.  If we were requesting flash access,
			 * indicate we are done so the firmware knows we gave
			 * up.  If this was a REQ, we also need to re-enable
			 * chip interrupts.
			 */
			if (function == DRBL_FLASH_REQ) {
				esas2r_hdebug("flash access timeout");
				esas2r_write_register_dword(a, MU_DOORBELL_IN,
							    DRBL_FLASH_DONE);
				esas2r_enable_chip_interrupts(a);
			} else {
				esas2r_hdebug("flash release timeout");
			}

			return false;
		}
	}

	/* if we're done, re-enable chip interrupts */
	if (function == DRBL_FLASH_DONE)
		esas2r_enable_chip_interrupts(a);

	return true;
}
static int log_worker(void *p)
{
	/* The thread should have never started */
	if (log_buf == NULL)
		return -EFAULT;

	while (!kthread_should_stop()) {
		if (log_buf->write_pos == log_pos)
			schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);

		switch (log_buf->version) {
		case 1:
			log_pos = process_v1log();
			break;
		case 2:
			log_pos = process_v2log();
			break;
		default:
			MCDRV_DBG_ERROR("Unknown Mobicore log data "
				"version %d logging disabled.",
				log_buf->version);
			log_pos = log_buf->write_pos;
			/* Stop the thread as we have no idea what
			 * happens next */
			return -EFAULT;
		}
	}
	MCDRV_DBG("Logging thread stopped!");
	return 0;
}
Beispiel #4
0
static long compat_nanosleep_restart(struct restart_block *restart)
{
    unsigned long expire = restart->arg0, now = jiffies;
    struct compat_timespec __user *rmtp;

    /* Did it expire while we handled signals? */
    if (!time_after(expire, now))
        return 0;

    expire = schedule_timeout_interruptible(expire - now);
    if (expire == 0)
        return 0;

    rmtp = (struct compat_timespec __user *)restart->arg1;
    if (rmtp) {
        struct compat_timespec ct;
        struct timespec t;

        jiffies_to_timespec(expire, &t);
        ct.tv_sec = t.tv_sec;
        ct.tv_nsec = t.tv_nsec;
        if (copy_to_user(rmtp, &ct, sizeof(ct)))
            return -EFAULT;
    }
    /* The 'restart' block is already filled in */
    return -ERESTART_RESTARTBLOCK;
}
Beispiel #5
0
/**
 * exit_dsm() - Called when chip needs to be put out of DSM Mode.
 *
 * The enter_dsm() function is called to put chip out of DSM Mode.
 *
 */
void exit_dsm(void)
{
	CG2900_DBG("exit_dsm");

	mutex_lock(&uart_info->sleep_mutex);
	if (uart_info->sleep_state == CHIP_AWAKE) {
		CG2900_ERR("Chip already in normal mode");
		mutex_unlock(&uart_info->sleep_mutex);
		return;
	}

	/* Enable the RTS Flow and remove BREAK on UART */
	cg29xx_uart_enable();
	mutex_unlock(&uart_info->sleep_mutex);
	/* Wait some time to check the acknowledgement from chip for DSM */
	schedule_timeout_interruptible(
			msecs_to_jiffies(CG2900_DSM_ACK_TIMEOUT));
	
	/* Check the HOST CTS Level */
	if (!cg29xx_cts_gpio_level()) {
		/* HOST_CTS made LOW by chip */
		CG2900_DBG("exit_dsm: Chip out of DSM Mode");
	SET_SLEEP_STATE(CHIP_AWAKE);
	} else {
		/* No acknowledgement from Chip, major error */
		CG2900_ERR("exit_dsm: HOST_CTS still HIGH, "
			"chip still in DSM Mode");
		SET_SLEEP_STATE(CHIP_ASLEEP);
	}
}
Beispiel #6
0
static int bt866_write(struct bt866 *encoder,
			unsigned char subaddr, unsigned char data)
{
	unsigned char buffer[2];
	int err;

	buffer[0] = subaddr;
	buffer[1] = data;

	encoder->reg[subaddr] = data;

	DEBUG(printk
	      ("%s: write 0x%02X = 0x%02X\n",
	       encoder->i2c->name, subaddr, data));

	for (err = 0; err < 3;) {
		if (i2c_master_send(encoder->i2c, buffer, 2) == 2)
			break;
		err++;
		printk(KERN_WARNING "%s: I/O error #%d "
		       "(write 0x%02x/0x%02x)\n",
		       encoder->i2c->name, err, encoder->addr, subaddr);
		schedule_timeout_interruptible(msecs_to_jiffies(100));
	}
	if (err == 3) {
		printk(KERN_WARNING "%s: giving up\n",
		       encoder->i2c->name);
		return -1;
	}

	return 0;
}
Beispiel #7
0
asmlinkage long compat_sys_nanosleep(struct compat_timespec __user *rqtp,
                                     struct compat_timespec __user *rmtp)
{
    struct timespec t;
    struct restart_block *restart;
    unsigned long expire;

    if (get_compat_timespec(&t, rqtp))
        return -EFAULT;

    if ((t.tv_nsec >= 1000000000L) || (t.tv_nsec < 0) || (t.tv_sec < 0))
        return -EINVAL;

    expire = timespec_to_jiffies(&t) + (t.tv_sec || t.tv_nsec);
    expire = schedule_timeout_interruptible(expire);
    if (expire == 0)
        return 0;

    if (rmtp) {
        jiffies_to_timespec(expire, &t);
        if (put_compat_timespec(&t, rmtp))
            return -EFAULT;
    }
    restart = &current_thread_info()->restart_block;
    restart->fn = compat_nanosleep_restart;
    restart->arg0 = jiffies + expire;
    restart->arg1 = (unsigned long) rmtp;
    return -ERESTART_RESTARTBLOCK;
}
Beispiel #8
0
static int __init kthread_init()
{
    int cpu;
    unsigned int cpu_count = num_online_cpus();
    unsigned int parameter[cpu_count];
    struct task_struct *t_thread[cpu_count];

    for_each_present_cpu(cpu) {
        parameter[cpu] = cpu;
        
        t_thread[cpu] = kthread_create(mythread, (void *)(parameter + cpu), "thread/%d", cpu);

        if (IS_ERR(t_thread[cpu])) {
            printk(KERN_ERR "[thread/%d]: creating kthread failed \n", cpu);
            goto out;
        }
        kthread_bind(t_thread[cpu], cpu);
        wake_up_process(t_thread[cpu]);
    }
    schedule_timeout_interruptible(msecs_to_jiffies(sleep_millisecs));
    
    for (cpu = 0; cpu < cpu_count; cpu++) {
        kthread_stop(t_thread[cpu]);
    }
out:
    return 0;
}
void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout)
{
	struct usb_serial_port *port = tty->driver_data;
	unsigned int bps;
	unsigned long period;
	unsigned long expire;

	bps = tty_get_baud_rate(tty);
	if (!bps)
		bps = 9600;	/* B0 */
	/*
	 * Use a poll-period of roughly the time it takes to send one
	 * character or at least one jiffy.
	 */
	period = max_t(unsigned long, (10 * HZ / bps), 1);
	period = min_t(unsigned long, period, timeout);

	dev_dbg(&port->dev, "%s - timeout = %u ms, period = %u ms\n",
					__func__, jiffies_to_msecs(timeout),
					jiffies_to_msecs(period));
	expire = jiffies + timeout;
	while (!port->serial->type->tx_empty(port)) {
		schedule_timeout_interruptible(period);
		if (signal_pending(current))
			break;
		if (time_after(jiffies, expire))
			break;
	}
}
Beispiel #10
0
static void usbrh_disconnect(struct usb_interface *interface)
{
    struct usbrh *dev;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
    while(!mutex_lock_interruptible(&usbrh_ioctl_mutex)) {
    	schedule_timeout_interruptible(msecs_to_jiffies(100));
    }
#else
    lock_kernel();
#endif

    dev = usb_get_intfdata(interface);
    usb_set_intfdata(interface, NULL);

    usb_deregister_dev(interface, &usbrh_class);

    mutex_lock(&dev->io_mutex);
    dev->interface = NULL;
    mutex_unlock(&dev->io_mutex);

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)
    mutex_unlock(&usbrh_ioctl_mutex);
#else
    unlock_kernel();
#endif

    kref_put(&dev->kref, usbrh_delete);

    info("USBRH disconnected");
}
/*
 * On a 5-minute timeout, wait for all devices currently configured.  We need
 * to do this to guarantee that the filesystems and / or network devices
 * needed for boot are available, before we can allow the boot to proceed.
 *
 * This needs to be on a late_initcall, to happen after the frontend device
 * drivers have been initialised, but before the root fs is mounted.
 *
 * A possible improvement here would be to have the tools add a per-device
 * flag to the store entry, indicating whether it is needed at boot time.
 * This would allow people who knew what they were doing to accelerate their
 * boot slightly, but of course needs tools or manual intervention to set up
 * those flags correctly.
 */
static void wait_for_devices(struct xenbus_driver *xendrv)
{
	unsigned long start = jiffies;
	struct device_driver *drv = xendrv ? &xendrv->driver : NULL;
	unsigned int seconds_waited = 0;

	if (!ready_to_wait_for_devices || !xen_domain())
		return;

	while (exists_connecting_device(drv)) {
		if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
			if (!seconds_waited)
				printk(KERN_WARNING "XENBUS: Waiting for "
				       "devices to initialise: ");
			seconds_waited += 5;
			printk("%us...", 300 - seconds_waited);
			if (seconds_waited == 300)
				break;
		}

		schedule_timeout_interruptible(HZ/10);
	}

	if (seconds_waited)
		printk("\n");

	bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
			 print_device_status);
}
Beispiel #12
0
/* sleeps that many milliseconds with a reschedule */
static void long_sleep(int ms)
{
	if (in_interrupt())
		mdelay(ms);
	else
		schedule_timeout_interruptible(msecs_to_jiffies(ms));
}
static void usleep(unsigned int usecs)
{
        unsigned long timeout = usecs_to_jiffies(usecs);

        while (timeout)
                timeout = schedule_timeout_interruptible(timeout);
}
Beispiel #14
0
static void
qm_sleep(PT3_QM *qm, PT3_BUS *bus, __u32 ms)
{
	if (bus)
		pt3_bus_sleep(bus, ms);
	else 
		schedule_timeout_interruptible(msecs_to_jiffies(ms));	
}
Beispiel #15
0
static int
wavefront_sleep (int limit)

{
	schedule_timeout_interruptible(limit);

	return signal_pending(current);
}
Beispiel #16
0
STATUS
pt3_mx_set_frequency(PT3_MX *mx, __u32 channel, __s32 offset)
{
	STATUS status;
	int catv, locked1, locked2;
	__u32 number, freq;
	__u32 real_freq;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
	struct timeval begin, now;
#else
	struct timespec64 begin, now;
#endif

	status = pt3_tc_set_agc_t(mx->tc, NULL, PT3_TC_AGC_MANUAL);
	if (status)
		return status;
	
	pt3_mx_get_channel_frequency(mx, channel, &catv, &number, &freq);

	//real_freq = (7 * freq + 1 + offset) * 1000000.0 /7.0;
	real_freq = REAL_TABLE[channel];

	mx_set_frequency(mx, NULL, real_freq);

#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
	do_gettimeofday(&begin);
#else
	ktime_get_real_ts64(&begin);
#endif
	locked1 = locked2 = 0;
	while (1) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5,0,0)
		do_gettimeofday(&now);
#else
		ktime_get_real_ts64(&now);
#endif
		pt3_mx_get_locked1(mx, NULL, &locked1);
		pt3_mx_get_locked2(mx, NULL, &locked2);

		if (locked1 && locked2)
			break;
		if (time_diff(&begin, &now) > 1000)
			break;

		schedule_timeout_interruptible(msecs_to_jiffies(1));	
	}
#if 0
	PT3_PRINTK(7, KERN_DEBUG, "mx_get_locked1 %d locked2 %d\n", locked1, locked2);
#endif
	if (!(locked1 && locked2))
		return STATUS_PLL_LOCK_TIMEOUT_ERROR;
	
	status = pt3_tc_set_agc_t(mx->tc, NULL, PT3_TC_AGC_AUTO);
	if (status)
		return status;

	return status;
}
Beispiel #17
0
int parport_wait_peripheral(struct parport *port,
			    unsigned char mask, 
			    unsigned char result)
{
	int ret;
	int usec;
	unsigned long deadline;
	unsigned char status;

	usec = port->physport->spintime; /* usecs of fast polling */
	if (!port->physport->cad->timeout)
		/* A zero timeout is "special": busy wait for the
		   entire 35ms. */
		usec = 35000;

	/* Fast polling.
	 *
	 * This should be adjustable.
	 * How about making a note (in the device structure) of how long
	 * it takes, so we know for next time?
	 */
	ret = parport_poll_peripheral (port, mask, result, usec);
	if (ret != 1)
		return ret;

	if (!port->physport->cad->timeout)
		/* We may be in an interrupt handler, so we can't poll
		 * slowly anyway. */
		return 1;

	/* 40ms of slow polling. */
	deadline = jiffies + msecs_to_jiffies(40);
	while (time_before (jiffies, deadline)) {
		int ret;

		if (signal_pending (current))
			return -EINTR;

		/* Wait for 10ms (or until an interrupt occurs if
		 * the handler is set) */
		if ((ret = parport_wait_event (port, msecs_to_jiffies(10))) < 0)
			return ret;

		status = parport_read_status (port);
		if ((status & mask) == result)
			return 0;

		if (!ret) {
			/* parport_wait_event didn't time out, but the
			 * peripheral wasn't actually ready either.
			 * Wait for another 10ms. */
			schedule_timeout_interruptible(msecs_to_jiffies(10));
		}
	}

	return 1;
}
Beispiel #18
0
/* Identify device by flashing LEDs */
static int efx_ethtool_phys_id(struct net_device *net_dev, u32 seconds)
{
    struct efx_nic *efx = net_dev->priv;

    efx->board_info.blink(efx, 1);
    schedule_timeout_interruptible(seconds * HZ);
    efx->board_info.blink(efx, 0);
    return 0;
}
/* Xceive tuner reset function */
int ivtv_reset_tuner_gpio(void *dev, int component, int cmd, int value)
{
	struct i2c_algo_bit_data *algo = dev;
	struct ivtv *itv = algo->data;
	u32 curout;

	if (cmd != XC2028_TUNER_RESET)
		return 0;
	IVTV_DEBUG_INFO("Resetting tuner\n");
	curout = read_reg(IVTV_REG_GPIO_OUT);
	curout &= ~(1 << itv->card->xceive_pin);
	write_reg(curout, IVTV_REG_GPIO_OUT);
	schedule_timeout_interruptible(msecs_to_jiffies(1));

	curout |= 1 << itv->card->xceive_pin;
	write_reg(curout, IVTV_REG_GPIO_OUT);
	schedule_timeout_interruptible(msecs_to_jiffies(1));
	return 0;
}
Beispiel #20
0
static int watchdog_thread(void *data)
{
	pr_info("%s: Enter into watchdog_thread\n", __func__);
	while (1) {
		pr_debug("%s: feed the watchdog\n", __func__);
		s3c2410wdt_keepalive(&s3c2410_wdd);
		schedule_timeout_interruptible(HZ);
	}
	return 0;
}
Beispiel #21
0
static int wait_isoch_resource_delay_after_bus_reset(struct fw_card *card)
{
	for (;;) {
		s64 delay = (card->reset_jiffies + HZ) - get_jiffies_64();
		if (delay <= 0)
			return 0;
		if (schedule_timeout_interruptible(delay) > 0)
			return -ERESTARTSYS;
	}
}
Beispiel #22
0
/* 
 * This work ramps both output PGA's at stream start/stop time to
 * minimise pop associated with DAPM power switching.
 * It's best to enable Zero Cross when ramping occurs to minimise any 
 * zipper noises.
 */
static void wm8350_pga_work(struct work_struct *work)
{
	struct snd_soc_codec *codec =
		container_of(work, struct snd_soc_codec, delayed_work.work);
	struct wm8350_out_ramp *or = codec->private_data;
	struct wm8350_output *out1 = &or->out1, *out2 = &or->out2;
	int i, out1_complete, out2_complete;
	
	/* do we need to ramp at all ? */
	if (out1->ramp == WM8350_RAMP_NONE && out2->ramp == WM8350_RAMP_NONE)
		return;

	/* PGA volumes have 6 bits of resolution to ramp */
	for (i = 0; i <= 63; i++) {

		out1_complete = 1, out2_complete = 1;
		if (out1->ramp != WM8350_RAMP_NONE)
			out1_complete = wm8350_out1_ramp_step(codec);
		if (out2->ramp != WM8350_RAMP_NONE)
			out2_complete = wm8350_out2_ramp_step(codec);

		/* ramp finished ? */
		if (out1_complete && out2_complete)
			break;
		
		/* we need to delay longer on the up ramp */
		if (out1->ramp == WM8350_RAMP_UP || 
			out2->ramp == WM8350_RAMP_UP) {
			/* delay is longer over 0dB as increases are larger */
			if (i >= WM8350_OUTn_0dB) 
				schedule_timeout_interruptible(
					msecs_to_jiffies(2));
			else
				schedule_timeout_interruptible(
					msecs_to_jiffies(1));
		} else
			udelay(50); /* doesn't matter if we delay longer */
	}
	
	out1->ramp = WM8350_RAMP_NONE;
	out2->ramp = WM8350_RAMP_NONE;
}
Beispiel #23
0
static int tps65090_charger_poll_task(void *data)
{
	set_freezable();

	while (!kthread_should_stop()) {
		schedule_timeout_interruptible(POLL_INTERVAL);
		try_to_freeze();
		tps65090_charger_isr(-1, data);
	}
	return 0;
}
v_VOID_t vos_sleep_us( v_U32_t usInterval )
{
   unsigned long timeout = usecs_to_jiffies(usInterval) + 1;
   if (in_interrupt())
   {
      VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s cannot be called from interrupt context!!!", __func__);
      return;
   }
   while (timeout && !signal_pending(current))
       timeout = schedule_timeout_interruptible(timeout);
}
Beispiel #25
0
static int run_network(void *data)
{
  struct msghdr msg;
  struct iovec iov;
  mm_segment_t oldfs;
  char buffer[0x200];// = "Hello";
  int cc;
  struct socket *csock = data;
  struct nm_packet_rp *reply;

  printk(KERN_INFO "NetMalloc: creating client thread\n");
  while (network_is_running)
    {
      memset(&msg, 0, sizeof(msg));
      msg.msg_iov = &iov;
      msg.msg_iovlen = 1;
      msg.msg_flags = MSG_DONTWAIT;
      msg.msg_iov->iov_len = sizeof(buffer);
      msg.msg_iov->iov_base = buffer;
      oldfs = get_fs();
      set_fs(KERNEL_DS);
      cc = sock_recvmsg(csock, &msg, sizeof(buffer), MSG_DONTWAIT);
      set_fs(oldfs);

      if (!cc)
	break;
      else if (cc == -EWOULDBLOCK)
        schedule_timeout_interruptible(125);
      else if (cc > 0)
	{
	  printk(KERN_INFO "%d bytes received\n", cc);
	  reply = handle_packet((struct nm_packet_rq *) buffer, cc);
	  if (reply)
	    {
	      cc = sizeof(struct nm_packet_rp) + reply->data_len;
	      memset(&msg, 0, sizeof(msg));
	      msg.msg_iov = &iov;
	      msg.msg_iovlen = 1;
	      msg.msg_flags = MSG_DONTWAIT;
	      msg.msg_iov->iov_len = cc;
	      msg.msg_iov->iov_base = reply;
	      oldfs = get_fs();
	      set_fs(KERNEL_DS);
	      cc = sock_sendmsg(csock, &msg, cc);
	      set_fs(oldfs);
	      printk(KERN_INFO "%d bytes sent\n", cc);
	      kfree(reply);
	    }
	}
    }
  sock_release(csock);
  printk(KERN_INFO "NetMalloc: closing client thread\n");
  return 0;
}
void hw_camdrv_msleep(unsigned int ms)
{
	struct timeval now;
	unsigned long jiffies;

	if (ms > 0) {
		now.tv_sec  = ms / 1000;
		now.tv_usec = (ms % 1000) * 1000;
		jiffies = timeval_to_jiffies(&now);
		schedule_timeout_interruptible(jiffies);
	}
}
Beispiel #27
0
int gfs2_recoverd(void *data)
{
	struct gfs2_sbd *sdp = data;
	unsigned long t;

	while (!kthread_should_stop()) {
		gfs2_check_journals(sdp);
		t = gfs2_tune_get(sdp,  gt_recoverd_secs) * HZ;
		schedule_timeout_interruptible(t);
	}

	return 0;
}
int update_counter_thread(void *data)
{
    TZ_RESULT ret;
    KREE_SESSION_HANDLE icnt_session;
    uint32_t result;
    uint32_t a, b, rate;
    uint32_t nsec = THREAD_COUNT_FREQ;

    ret = KREE_CreateSession(TZ_TA_ICNT_UUID, &icnt_session);
    if (ret != TZ_RESULT_SUCCESS)
    {
        printk("CreateSession error %d\n", ret);
        return 1;
    }

    result = TEECK_Icnt_Rate(icnt_session, &rate);
    if (result == TZ_RESULT_SUCCESS)
    {
	//printk("(yjdbg) rate: %d\n", rate);
	nsec = (0xffffffff / rate);
	nsec -= 600;
	//printk("(yjdbg) rate: %d\n", nsec);
    }

    set_freezable();

    for (;;) {
	if (kthread_should_stop())
	    break;

	if (try_to_freeze())
	    continue;

	result = TEECK_Icnt_Counter(icnt_session, &a, &b);
	if (result == TZ_RESULT_SUCCESS)
	{
	    //printk("(yjdbg) tz_test TZCMD_ICNT_COUNT: 0x%x, 0x%x\n", a, b);
	}

	schedule_timeout_interruptible(HZ * nsec);
    }

    ret = KREE_CloseSession(icnt_session);
    if (ret != TZ_RESULT_SUCCESS)
    {
        printk("CloseSession error %d\n", ret);    
	return 1;
    }

    return 0;
}
/* pay attention: application should lock the route set period. */
static int bb_control_put(struct snd_kcontrol *kcontrol,
		struct snd_ctl_elem_value *ucontrol)
{
	unsigned short reg;
	struct snd_soc_codec *codec = wm9713_dai[WM9713_DAI_PCM_VOICE].codec;

	if (bb_enable == 1 && ucontrol->value.integer.value[0] == 0)
		printk(KERN_INFO "Disable BB!!\n");

	if (bb_enable == 0 && ucontrol->value.integer.value[0] == 1) {
		printk(KERN_INFO "Enable BB!!\n");

		snd_soc_dapm_stream_event(codec, "Voice Playback",
			SND_SOC_DAPM_STREAM_START);
		snd_soc_dapm_stream_event(codec, "Voice Capture",
			SND_SOC_DAPM_STREAM_START);
		/*enable VRA mode*/
		codec->write(codec, AC97_EXTENDED_STATUS, 0x1);
		codec->write(codec, AC97_PCM_LR_ADC_RATE, 0x1F40);
		codec->write(codec, AC97_EXTENDED_MID,
			codec->read(codec, AC97_EXTENDED_MID)&0xffc3);
		codec->write(codec, AC97_EXTENDED_MSTATUS,
			codec->read(codec, AC97_EXTENDED_MSTATUS)&0xf9f5);
		codec->write(codec, AC97_POWERDOWN, 0);
		codec->write(codec, AC97_HANDSET_RATE, 0x0f80);
		schedule_timeout_interruptible(msecs_to_jiffies(10));
		codec->write(codec, AC97_CENTER_LFE_MASTER, 0xa8b3);
		reg = codec->read(codec, AC97_GPIO_CFG);
		reg |= (0x1<<1);
		reg |= (0x1<<3);
		reg |= (0x1<<4);
		reg &= ~(0x1<<5);
		codec->write(codec, AC97_GPIO_CFG, reg);
		schedule_timeout_interruptible(msecs_to_jiffies(10));
	}
	bb_enable = ucontrol->value.integer.value[0];
	return 0;
}
Beispiel #30
0
static void snd_msnd_dsp_write_flush(struct snd_msnd *chip)
{
	if (!(chip->mode & FMODE_WRITE) || !test_bit(F_WRITING, &chip->flags))
		return;
	set_bit(F_WRITEFLUSH, &chip->flags);
/*	interruptible_sleep_on_timeout(
		&chip->writeflush,
		get_play_delay_jiffies(&chip, chip->DAPF.len));*/
	clear_bit(F_WRITEFLUSH, &chip->flags);
	if (!signal_pending(current))
		schedule_timeout_interruptible(
			get_play_delay_jiffies(chip, chip->play_period_bytes));
	clear_bit(F_WRITING, &chip->flags);
}