• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/hid/

Lines Matching refs:pm

42 	struct pcmidi_snd	*pm; /* pcmidi device context */
49 struct pcmidi_snd *pm;
110 dbg_hid("pcmidi sysfs read channel=%u\n", pk->pm->midi_channel);
112 return sprintf(buf, "%u (min:%u, max:%u)\n", pk->pm->midi_channel,
127 pk->pm->midi_channel = channel;
147 dbg_hid("pcmidi sysfs read sustain=%u\n", pk->pm->midi_sustain);
149 return sprintf(buf, "%u (off:%u, max:%u (ms))\n", pk->pm->midi_sustain,
164 pk->pm->midi_sustain = sustain;
165 pk->pm->midi_sustain_mode =
166 (0 == sustain || !pk->pm->midi_mode) ? 0 : 1;
186 dbg_hid("pcmidi sysfs read octave=%d\n", pk->pm->midi_octave);
188 return sprintf(buf, "%d (min:%d, max:%d)\n", pk->pm->midi_octave,
204 pk->pm->midi_octave = octave;
218 static void pcmidi_send_note(struct pcmidi_snd *pm,
228 spin_lock_irqsave(&pm->rawmidi_in_lock, flags);
230 if (!pm->in_substream)
232 if (!test_bit(pm->in_substream->number, &pm->in_triggered))
235 snd_rawmidi_receive(pm->in_substream, buffer, 3);
238 spin_unlock_irqrestore(&pm->rawmidi_in_lock, flags);
247 pcmidi_send_note(pms->pm, pms->status, pms->note, pms->velocity);
251 void init_sustain_timers(struct pcmidi_snd *pm)
257 pms = &pm->sustained_notes[i];
259 pms->pm = pm;
265 void stop_sustain_timers(struct pcmidi_snd *pm)
271 pms = &pm->sustained_notes[i];
277 static int pcmidi_get_output_report(struct pcmidi_snd *pm)
279 struct hid_device *hdev = pm->pk->hdev;
295 pm->pcmidi_report6 = report;
302 static void pcmidi_submit_output_report(struct pcmidi_snd *pm, int state)
304 struct hid_device *hdev = pm->pk->hdev;
305 struct hid_report *report = pm->pcmidi_report6;
312 static int pcmidi_handle_report1(struct pcmidi_snd *pm, u8 *data)
320 dbg_hid("pcmidi mode: %d\n", pm->midi_mode);
323 if (pm->midi_mode && bit_mask == 0x004000) {
325 pm->midi_octave--;
326 if (pm->midi_octave < -2)
327 pm->midi_octave = -2;
329 pm->midi_mode, pm->midi_octave);
333 else if (pm->midi_mode && bit_mask == 0x000004) {
335 pm->midi_sustain_mode ^= 0x1;
342 static int pcmidi_handle_report3(struct pcmidi_snd *pm, u8 *data, int size)
354 status = 128 + 16 + pm->midi_channel; /* 1001nnnn */
356 (pm->midi_octave * 12);
360 status = 128 + pm->midi_channel; /* 1000nnnn */
362 (pm->midi_octave*12);
364 if (pm->midi_sustain_mode) {
366 pms = &pm->sustained_notes[i];
375 msecs_to_jiffies(pm->midi_sustain));
381 pcmidi_send_note(pm, status, note, velocity);
387 static int pcmidi_handle_report4(struct pcmidi_snd *pm, u8 *data)
399 key = pm->last_key[bit_index];
401 input_event(pm->input_ep82, EV_KEY,
402 pm->last_key[bit_index], 0);
403 pm->last_key[bit_index] = 0;
412 pm->fn_state ^= 0x000010;
413 if (pm->fn_state)
414 pcmidi_submit_output_report(pm, 0xc5);
416 pcmidi_submit_output_report(pm, 0xc6);
419 pcmidi_submit_output_report(pm, 0xc1);
420 pm->midi_mode ^= 0x01;
422 dbg_hid("pcmidi mode: %d\n", pm->midi_mode);
425 dbg_hid("pcmidi mode: %d\n", pm->midi_mode);
426 if (pm->midi_mode) {
427 pm->midi_octave++;
428 if (pm->midi_octave > 2)
429 pm->midi_octave = 2;
431 pm->midi_mode, pm->midi_octave);
492 input_event(pm->input_ep82, EV_KEY, key, 1);
493 pm->last_key[bit_index] = key;
501 struct pcmidi_snd *pm, unsigned report_id, u8 *data, int size)
507 ret = pcmidi_handle_report1(pm, data);
510 ret = pcmidi_handle_report3(pm, data, size);
513 ret = pcmidi_handle_report4(pm, data);
519 void pcmidi_setup_extra_keys(struct pcmidi_snd *pm, struct input_dev *input)
544 if (pm->ifnum != 1) /* only set up ONCE for interace 1 */
547 pm->input_ep82 = input;
550 pm->last_key[i] = 0;
553 set_bit(*pkeys, pm->input_ep82->keybit);
558 static int pcmidi_set_operational(struct pcmidi_snd *pm)
560 if (pm->ifnum != 1)
563 pcmidi_get_output_report(pm);
564 pcmidi_submit_output_report(pm, 0xc1);
575 struct pcmidi_snd *pm = substream->rmidi->private_data;
578 pm->in_substream = substream;
590 struct pcmidi_snd *pm = substream->rmidi->private_data;
594 pm->in_triggered = up;
603 int pcmidi_snd_initialise(struct pcmidi_snd *pm)
614 if (pm->ifnum != 1)
633 pm->card = card;
636 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pm, &ops);
655 pm->rwmidi = rwmidi;
658 rwmidi->private_data = pm;
663 snd_card_set_dev(card, &pm->pk->hdev->dev);
666 err = device_create_file(&pm->pk->hdev->dev,
674 err = device_create_file(&pm->pk->hdev->dev,
682 err = device_create_file(&pm->pk->hdev->dev,
690 spin_lock_init(&pm->rawmidi_in_lock);
692 init_sustain_timers(pm);
693 pcmidi_set_operational(pm);
707 stop_sustain_timers(pm);
708 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_octave);
710 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_sustain);
712 device_remove_file(&pm->pk->hdev->dev, sysfs_device_attr_channel);
714 if (pm->card) {
715 snd_card_free(pm->card);
716 pm->card = NULL;
721 int pcmidi_snd_terminate(struct pcmidi_snd *pm)
723 if (pm->card) {
724 stop_sustain_timers(pm);
726 device_remove_file(&pm->pk->hdev->dev,
728 device_remove_file(&pm->pk->hdev->dev,
730 device_remove_file(&pm->pk->hdev->dev,
733 snd_card_disconnect(pm->card);
734 snd_card_free_when_closed(pm->card);
761 struct pcmidi_snd *pm;
763 pm = pk->pm;
766 1 == pm->ifnum) {
767 pcmidi_setup_extra_keys(pm, hi->input);
781 if (1 == pk->pm->ifnum) {
787 ret = pcmidi_handle_report(pk->pm,
803 struct pcmidi_snd *pm = NULL;
813 pm = kzalloc(sizeof(*pm), GFP_KERNEL);
814 if (pm == NULL) {
821 pm->pk = pk;
822 pk->pm = pm;
823 pm->ifnum = ifnum;
843 ret = pcmidi_snd_initialise(pm);
851 if (pm != NULL)
852 kfree(pm);
861 struct pcmidi_snd *pm;
863 pm = pk->pm;
864 if (pm) {
865 pcmidi_snd_terminate(pm);
866 kfree(pm);