Lines Matching refs:i2sdev
18 static inline void get_pcm_info(struct i2sbus_dev *i2sdev, int in, in get_pcm_info() argument
23 *pi = &i2sdev->in; in get_pcm_info()
25 *other = &i2sdev->out; in get_pcm_info()
28 *pi = &i2sdev->out; in get_pcm_info()
30 *other = &i2sdev->in; in get_pcm_info()
72 static int i2sbus_pcm_open(struct i2sbus_dev *i2sdev, int in) in i2sbus_pcm_open() argument
86 mutex_lock(&i2sdev->lock); in i2sbus_pcm_open()
88 get_pcm_info(i2sdev, in, &pi, &other); in i2sbus_pcm_open()
91 sdev = &i2sdev->sound; in i2sbus_pcm_open()
181 hw->formats &= pcm_format_to_bits(i2sdev->format); in i2sbus_pcm_open()
183 hw->rate_min = i2sdev->rate; in i2sbus_pcm_open()
184 hw->rate_max = i2sdev->rate; in i2sbus_pcm_open()
223 mutex_unlock(&i2sdev->lock); in i2sbus_pcm_open()
229 static int i2sbus_pcm_close(struct i2sbus_dev *i2sdev, int in) in i2sbus_pcm_close() argument
235 mutex_lock(&i2sdev->lock); in i2sbus_pcm_close()
237 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_close()
239 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { in i2sbus_pcm_close()
249 mutex_unlock(&i2sdev->lock); in i2sbus_pcm_close()
253 static void i2sbus_wait_for_stop(struct i2sbus_dev *i2sdev, in i2sbus_wait_for_stop() argument
260 spin_lock_irqsave(&i2sdev->low_lock, flags); in i2sbus_wait_for_stop()
263 spin_unlock_irqrestore(&i2sdev->low_lock, flags); in i2sbus_wait_for_stop()
265 spin_lock_irqsave(&i2sdev->low_lock, flags); in i2sbus_wait_for_stop()
281 spin_unlock_irqrestore(&i2sdev->low_lock, flags); in i2sbus_wait_for_stop()
285 void i2sbus_wait_for_stop_both(struct i2sbus_dev *i2sdev) in i2sbus_wait_for_stop_both() argument
289 get_pcm_info(i2sdev, 0, &pi, NULL); in i2sbus_wait_for_stop_both()
290 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_wait_for_stop_both()
291 get_pcm_info(i2sdev, 1, &pi, NULL); in i2sbus_wait_for_stop_both()
292 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_wait_for_stop_both()
298 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_hw_free() local
301 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_hw_free()
303 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_hw_free()
317 static int i2sbus_pcm_prepare(struct i2sbus_dev *i2sdev, int in) in i2sbus_pcm_prepare() argument
336 mutex_lock(&i2sdev->lock); in i2sbus_pcm_prepare()
338 get_pcm_info(i2sdev, in, &pi, &other); in i2sbus_pcm_prepare()
345 i2sbus_wait_for_stop(i2sdev, pi); in i2sbus_pcm_prepare()
355 ((i2sdev->format != runtime->format) in i2sbus_pcm_prepare()
356 || (i2sdev->rate != runtime->rate))) { in i2sbus_pcm_prepare()
361 i2sdev->format = runtime->format; in i2sbus_pcm_prepare()
362 i2sdev->rate = runtime->rate; in i2sbus_pcm_prepare()
411 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { in i2sbus_pcm_prepare()
433 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { in i2sbus_pcm_prepare()
456 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) { in i2sbus_pcm_prepare()
477 if (in_le32(&i2sdev->intfregs->serial_format) == sfr in i2sbus_pcm_prepare()
478 && in_le32(&i2sdev->intfregs->data_word_sizes) == dws) in i2sbus_pcm_prepare()
483 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) in i2sbus_pcm_prepare()
487 i2sbus_control_enable(i2sdev->control, i2sdev); in i2sbus_pcm_prepare()
488 i2sbus_control_cell(i2sdev->control, i2sdev, 1); in i2sbus_pcm_prepare()
490 out_le32(&i2sdev->intfregs->intr_ctl, I2S_PENDING_CLOCKS_STOPPED); in i2sbus_pcm_prepare()
492 i2sbus_control_clock(i2sdev->control, i2sdev, 0); in i2sbus_pcm_prepare()
499 !(in_le32(&i2sdev->intfregs->intr_ctl) & I2S_PENDING_CLOCKS_STOPPED)) { in i2sbus_pcm_prepare()
502 out_le32(&i2sdev->intfregs->intr_ctl, I2S_PENDING_CLOCKS_STOPPED); in i2sbus_pcm_prepare()
505 out_le32(&i2sdev->intfregs->serial_format, sfr); in i2sbus_pcm_prepare()
506 out_le32(&i2sdev->intfregs->data_word_sizes, dws); in i2sbus_pcm_prepare()
508 i2sbus_control_enable(i2sdev->control, i2sdev); in i2sbus_pcm_prepare()
509 i2sbus_control_cell(i2sdev->control, i2sdev, 1); in i2sbus_pcm_prepare()
510 i2sbus_control_clock(i2sdev->control, i2sdev, 1); in i2sbus_pcm_prepare()
513 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) in i2sbus_pcm_prepare()
518 mutex_unlock(&i2sdev->lock); in i2sbus_pcm_prepare()
523 void i2sbus_pcm_prepare_both(struct i2sbus_dev *i2sdev) in i2sbus_pcm_prepare_both() argument
525 i2sbus_pcm_prepare(i2sdev, 0); in i2sbus_pcm_prepare_both()
526 i2sbus_pcm_prepare(i2sdev, 1); in i2sbus_pcm_prepare_both()
530 static int i2sbus_pcm_trigger(struct i2sbus_dev *i2sdev, int in, int cmd) in i2sbus_pcm_trigger() argument
537 spin_lock_irqsave(&i2sdev->low_lock, flags); in i2sbus_pcm_trigger()
539 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_trigger()
548 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) in i2sbus_pcm_trigger()
577 pi->frame_count = in_le32(&i2sdev->intfregs->frame_count); in i2sbus_pcm_trigger()
597 list_for_each_entry(cii, &i2sdev->sound.codec_list, list) in i2sbus_pcm_trigger()
607 spin_unlock_irqrestore(&i2sdev->low_lock, flags); in i2sbus_pcm_trigger()
611 static snd_pcm_uframes_t i2sbus_pcm_pointer(struct i2sbus_dev *i2sdev, int in) in i2sbus_pcm_pointer() argument
616 get_pcm_info(i2sdev, in, &pi, NULL); in i2sbus_pcm_pointer()
618 fc = in_le32(&i2sdev->intfregs->frame_count); in i2sbus_pcm_pointer()
626 static inline void handle_interrupt(struct i2sbus_dev *i2sdev, int in) in handle_interrupt() argument
635 spin_lock(&i2sdev->low_lock); in handle_interrupt()
636 get_pcm_info(i2sdev, in, &pi, NULL); in handle_interrupt()
662 fc = in_le32(&i2sdev->intfregs->frame_count); in handle_interrupt()
692 spin_unlock(&i2sdev->low_lock); in handle_interrupt()
698 spin_unlock(&i2sdev->low_lock); in handle_interrupt()
715 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_playback_open() local
717 if (!i2sdev) in i2sbus_playback_open()
719 i2sdev->out.substream = substream; in i2sbus_playback_open()
720 return i2sbus_pcm_open(i2sdev, 0); in i2sbus_playback_open()
725 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_playback_close() local
728 if (!i2sdev) in i2sbus_playback_close()
730 if (i2sdev->out.substream != substream) in i2sbus_playback_close()
732 err = i2sbus_pcm_close(i2sdev, 0); in i2sbus_playback_close()
734 i2sdev->out.substream = NULL; in i2sbus_playback_close()
740 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_playback_prepare() local
742 if (!i2sdev) in i2sbus_playback_prepare()
744 if (i2sdev->out.substream != substream) in i2sbus_playback_prepare()
746 return i2sbus_pcm_prepare(i2sdev, 0); in i2sbus_playback_prepare()
751 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_playback_trigger() local
753 if (!i2sdev) in i2sbus_playback_trigger()
755 if (i2sdev->out.substream != substream) in i2sbus_playback_trigger()
757 return i2sbus_pcm_trigger(i2sdev, 0, cmd); in i2sbus_playback_trigger()
763 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_playback_pointer() local
765 if (!i2sdev) in i2sbus_playback_pointer()
767 if (i2sdev->out.substream != substream) in i2sbus_playback_pointer()
769 return i2sbus_pcm_pointer(i2sdev, 0); in i2sbus_playback_pointer()
783 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_record_open() local
785 if (!i2sdev) in i2sbus_record_open()
787 i2sdev->in.substream = substream; in i2sbus_record_open()
788 return i2sbus_pcm_open(i2sdev, 1); in i2sbus_record_open()
793 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_record_close() local
796 if (!i2sdev) in i2sbus_record_close()
798 if (i2sdev->in.substream != substream) in i2sbus_record_close()
800 err = i2sbus_pcm_close(i2sdev, 1); in i2sbus_record_close()
802 i2sdev->in.substream = NULL; in i2sbus_record_close()
808 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_record_prepare() local
810 if (!i2sdev) in i2sbus_record_prepare()
812 if (i2sdev->in.substream != substream) in i2sbus_record_prepare()
814 return i2sbus_pcm_prepare(i2sdev, 1); in i2sbus_record_prepare()
819 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_record_trigger() local
821 if (!i2sdev) in i2sbus_record_trigger()
823 if (i2sdev->in.substream != substream) in i2sbus_record_trigger()
825 return i2sbus_pcm_trigger(i2sdev, 1, cmd); in i2sbus_record_trigger()
831 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream); in i2sbus_record_pointer() local
833 if (!i2sdev) in i2sbus_record_pointer()
835 if (i2sdev->in.substream != substream) in i2sbus_record_pointer()
837 return i2sbus_pcm_pointer(i2sdev, 1); in i2sbus_record_pointer()
851 struct i2sbus_dev *i2sdev = snd_pcm_chip(pcm); in i2sbus_private_free() local
854 i2sdev->sound.pcm = NULL; in i2sbus_private_free()
855 i2sdev->out.created = 0; in i2sbus_private_free()
856 i2sdev->in.created = 0; in i2sbus_private_free()
857 list_for_each_entry_safe(p, tmp, &i2sdev->sound.codec_list, list) { in i2sbus_private_free()
863 soundbus_dev_put(&i2sdev->sound); in i2sbus_private_free()
873 struct i2sbus_dev *i2sdev = soundbus_dev_to_i2sbus_dev(dev); in i2sbus_attach_codec() local
962 if (!i2sdev->out.created && out) { in i2sbus_attach_codec()
977 i2sdev->out.created = 1; in i2sbus_attach_codec()
980 if (!i2sdev->in.created && in) { in i2sbus_attach_codec()
994 i2sdev->in.created = 1; in i2sbus_attach_codec()
1011 dev->pcm->private_data = i2sdev; in i2sbus_attach_codec()
1017 &macio_get_pci_dev(i2sdev->macio)->dev, in i2sbus_attach_codec()