Esempio n. 1
0
static
void alsa_seqmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
{
	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
	struct process_info info;

	if (!self->keep_walking)
		return;

	set_process_info(&info, self, PORT_OUTPUT, nframes);
	jack_process(self, &info);
	snd_seq_drain_output(self->seq);
}
Esempio n. 2
0
static
void alsa_seqmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
{
	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;
	int res;
	snd_seq_event_t *event;
	struct process_info info;

	if (!self->keep_walking)
		return;

	set_process_info(&info, self, PORT_INPUT, nframes);
	jack_process(self, &info);

	while ((res = snd_seq_event_input(self->seq, &event))>0) {
		if (event->source.client == SND_SEQ_CLIENT_SYSTEM)
			port_event(self, event);
		else
			input_event(self, event, &info);
	}
}
Esempio n. 3
0
static
void alsa_rawmidi_read(alsa_midi_t *m, jack_nframes_t nframes)
{
    alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
    jack_process(&midi->in, nframes);
}
Esempio n. 4
0
static
void alsa_rawmidi_write(alsa_midi_t *m, jack_nframes_t nframes)
{
    alsa_rawmidi_t *midi = (alsa_rawmidi_t*)m;
    jack_process(&midi->out, nframes);
}
Esempio n. 5
0
static irqreturn_t mxskbd_irq_handler(int irq, void *dev_id)
{
	struct platform_device *pdev = dev_id;
	struct mxskbd_data *d = platform_get_drvdata(pdev);
	int i, key, f_key = -1;
	u32 vddio;

	jack_process(d);

	/* end key process */
	i = (__raw_readl(REGS_POWER_BASE + HW_POWER_STS) &
		   BF_POWER_STS_PSWITCH(0x1)) ? KEY_END : -1;

	if (i == KEY_END) {
		if (i == d->last_button)
			goto _end;

		f_key = i;
	}

	if (f_key < 0 && d->jack_cnt == 0 &&
	    d->jack_last == SW_MICROPHONE_INSERT) {
		i = __raw_readl(d->base + HW_LRADC_CHn(d->chan[MAX_CH-1])) &
			BM_LRADC_CHn_VALUE;

		if (i <= MIC_DET_THRESHOLD) {
			if (d->last_button == KEY_KPENTER) {
				d->jack_push_cnt = 0;
				goto _end;
			}

			if (++d->jack_push_cnt > 4)
				f_key = KEY_KPENTER;
		} else
			d->jack_push_cnt = 0;
	} else
		d->jack_push_cnt = 0;

	/* adc key process */
	vddio = __raw_readl(d->base + HW_LRADC_CHn(VDDIO_VOLTAGE_CH)) &
		BM_LRADC_CHn_VALUE;
	BUG_ON(vddio == 0);

#ifdef DUMP_KEY_ADC
	static int val[MAX_CH];
	printk("KEY=0x%03x(%4d), 0x%03x(%4d), 0x%03x(%4d), 0x%03x(%4d)\n",
	       val[0], val[0], val[1], val[1],
	       val[2], val[2], val[3], val[3]);
#endif

	for (i = 0; i < MAX_CH-1; i++) {
		int raw, norm;
		raw = __raw_readl(d->base + HW_LRADC_CHn(d->chan[i])) &
			BM_LRADC_CHn_VALUE;
		norm = (raw * TARGET_VDDIO_LRADC_VALUE) / vddio;

		key = mxskbd_decode_button(d->keycodes +
					   d->keycodes_offset*i, norm);
		key = unjitter_key(i, key);

#ifdef DUMP_KEY_ADC
		val[i] = raw;
#endif
		if (key >= 0) {
			if (key == d->last_button)
				goto _end;

			if (f_key < 0)
				f_key = key;
		}
	}

	key = volume_key_process(d);
	if (key > 0) {
		if (key == d->last_button)
			goto _end;

		if (f_key < 0)
			f_key = key;
	}

	if (d->last_button >= 0) {
		input_report_key(GET_INPUT_DEV(d), d->last_button, 0);
		d->last_button = -1;
	}

	if (f_key >= 0 && f_key != d->last_button) {
		input_report_key(GET_INPUT_DEV(d), f_key, !0);
#ifdef ENABLE_BACKLIGHT_GPIO_CONTROL
		_keypad_set_backlight(1);
#endif
#ifdef CONFIG_HAS_WAKELOCK
		wake_lock_timeout(&key_wake_lock, 5*HZ);
#endif
		d->last_button = f_key;
	}

_end:
	__raw_writel((BM_LRADC_CTRL1_LRADC0_IRQ << d->chan[0]) +
		     (BM_LRADC_CTRL1_LRADC0_IRQ << d->chan[1]) +
		     (BM_LRADC_CTRL1_LRADC0_IRQ << d->chan[2]) +
		     (BM_LRADC_CTRL1_LRADC0_IRQ << d->chan[3]) +
		     (BM_LRADC_CTRL1_LRADC0_IRQ << VDDIO_VOLTAGE_CH),
		     d->base + HW_LRADC_CTRL1_CLR);
	return IRQ_HANDLED;
}