.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* Hewlett-Packard Harmony audio driver |
---|
2 | 3 | * |
---|
3 | 4 | * This is a driver for the Harmony audio chipset found |
---|
.. | .. |
---|
13 | 14 | * Copyright 2003 (c) Laurent Canet |
---|
14 | 15 | * Copyright 2004 (c) Stuart Brady |
---|
15 | 16 | * |
---|
16 | | - * This program is free software; you can redistribute it and/or modify |
---|
17 | | - * it under the terms of the GNU General Public License, version 2, as |
---|
18 | | - * published by the Free Software Foundation. |
---|
19 | | - * |
---|
20 | | - * This program is distributed in the hope that it will be useful, |
---|
21 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
22 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
23 | | - * GNU General Public License for more details. |
---|
24 | | - * |
---|
25 | | - * You should have received a copy of the GNU General Public License |
---|
26 | | - * along with this program; if not, write to the Free Software |
---|
27 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
28 | | - * |
---|
29 | 17 | * Notes: |
---|
30 | 18 | * - graveyard and silence buffers last for lifetime of |
---|
31 | 19 | * the driver. playback and capture buffers are allocated |
---|
32 | 20 | * per _open()/_close(). |
---|
33 | 21 | * |
---|
34 | 22 | * TODO: |
---|
35 | | - * |
---|
36 | 23 | */ |
---|
37 | 24 | |
---|
38 | 25 | #include <linux/init.h> |
---|
.. | .. |
---|
580 | 567 | snd_harmony_hw_params(struct snd_pcm_substream *ss, |
---|
581 | 568 | struct snd_pcm_hw_params *hw) |
---|
582 | 569 | { |
---|
583 | | - int err; |
---|
584 | 570 | struct snd_harmony *h = snd_pcm_substream_chip(ss); |
---|
585 | 571 | |
---|
586 | | - err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw)); |
---|
587 | | - if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) |
---|
| 572 | + if (h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS) |
---|
588 | 573 | ss->runtime->dma_addr = __pa(ss->runtime->dma_area); |
---|
589 | | - |
---|
590 | | - return err; |
---|
591 | | -} |
---|
592 | 574 | |
---|
593 | | -static int |
---|
594 | | -snd_harmony_hw_free(struct snd_pcm_substream *ss) |
---|
595 | | -{ |
---|
596 | | - return snd_pcm_lib_free_pages(ss); |
---|
| 575 | + return 0; |
---|
597 | 576 | } |
---|
598 | 577 | |
---|
599 | 578 | static const struct snd_pcm_ops snd_harmony_playback_ops = { |
---|
600 | 579 | .open = snd_harmony_playback_open, |
---|
601 | 580 | .close = snd_harmony_playback_close, |
---|
602 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
603 | 581 | .hw_params = snd_harmony_hw_params, |
---|
604 | | - .hw_free = snd_harmony_hw_free, |
---|
605 | 582 | .prepare = snd_harmony_playback_prepare, |
---|
606 | 583 | .trigger = snd_harmony_playback_trigger, |
---|
607 | 584 | .pointer = snd_harmony_playback_pointer, |
---|
.. | .. |
---|
610 | 587 | static const struct snd_pcm_ops snd_harmony_capture_ops = { |
---|
611 | 588 | .open = snd_harmony_capture_open, |
---|
612 | 589 | .close = snd_harmony_capture_close, |
---|
613 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
614 | 590 | .hw_params = snd_harmony_hw_params, |
---|
615 | | - .hw_free = snd_harmony_hw_free, |
---|
616 | 591 | .prepare = snd_harmony_capture_prepare, |
---|
617 | 592 | .trigger = snd_harmony_capture_trigger, |
---|
618 | 593 | .pointer = snd_harmony_capture_pointer, |
---|
.. | .. |
---|
669 | 644 | } |
---|
670 | 645 | |
---|
671 | 646 | /* pre-allocate space for DMA */ |
---|
672 | | - err = snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type, |
---|
673 | | - h->dma.dev, |
---|
674 | | - MAX_BUF_SIZE, |
---|
675 | | - MAX_BUF_SIZE); |
---|
676 | | - if (err < 0) { |
---|
677 | | - printk(KERN_ERR PFX "buffer allocation error: %d\n", err); |
---|
678 | | - return err; |
---|
679 | | - } |
---|
| 647 | + snd_pcm_set_managed_buffer_all(pcm, h->dma.type, h->dma.dev, |
---|
| 648 | + MAX_BUF_SIZE, MAX_BUF_SIZE); |
---|
680 | 649 | |
---|
681 | 650 | h->st.format = snd_harmony_set_data_format(h, |
---|
682 | 651 | SNDRV_PCM_FORMAT_S16_BE, 1); |
---|
.. | .. |
---|
828 | 797 | .private_value = ((left_shift) | ((right_shift) << 8) | \ |
---|
829 | 798 | ((mask) << 16) | ((invert) << 24)) } |
---|
830 | 799 | |
---|
831 | | -static struct snd_kcontrol_new snd_harmony_controls[] = { |
---|
| 800 | +static const struct snd_kcontrol_new snd_harmony_controls[] = { |
---|
832 | 801 | HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT, |
---|
833 | 802 | HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1), |
---|
834 | 803 | HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT, |
---|
.. | .. |
---|
912 | 881 | { |
---|
913 | 882 | int err; |
---|
914 | 883 | struct snd_harmony *h; |
---|
915 | | - static struct snd_device_ops ops = { |
---|
| 884 | + static const struct snd_device_ops ops = { |
---|
916 | 885 | .dev_free = snd_harmony_dev_free, |
---|
917 | 886 | }; |
---|
918 | 887 | |
---|
.. | .. |
---|
926 | 895 | h->card = card; |
---|
927 | 896 | h->dev = padev; |
---|
928 | 897 | h->irq = -1; |
---|
929 | | - h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE); |
---|
| 898 | + h->iobase = ioremap(padev->hpa.start, HARMONY_SIZE); |
---|
930 | 899 | if (h->iobase == NULL) { |
---|
931 | 900 | printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n", |
---|
932 | 901 | (unsigned long)padev->hpa.start); |
---|