Ignore:
Timestamp:
Mar 18, 2021, 8:57:36 PM (4 years ago)
Author:
David Azarewicz
Message:

Merge changes from Paul's uniaud32next branch.

Location:
GPL/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/drivers/serial-u16550.c

    r598 r679  
     1// SPDX-License-Identifier: GPL-2.0-or-later
    12/*
    23 *   serial.c
     
    89 *   This code is based on the code from ALSA 0.5.9, but heavily rewritten.
    910 *
    10  *   This program is free software; you can redistribute it and/or modify
    11  *   it under the terms of the GNU General Public License as published by
    12  *   the Free Software Foundation; either version 2 of the License, or
    13  *   (at your option) any later version.
    14  *
    15  *   This program is distributed in the hope that it will be useful,
    16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
    17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    18  *   GNU General Public License for more details.
    19  *
    20  *   You should have received a copy of the GNU General Public License
    21  *   along with this program; if not, write to the Free Software
    22  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
    23  *
    2411 * Sat Mar 31 17:27:57 PST 2001 tim.mann@compaq.com
    2512 *      Added support for the Midiator MS-124T and for the MS-124W in
     
    3724#include <linux/slab.h>
    3825#include <linux/ioport.h>
    39 #include <linux/moduleparam.h>
     26#include <linux/module.h>
     27#include <linux/io.h>
    4028#include <sound/core.h>
    4129#include <sound/rawmidi.h>
     
    4432#include <linux/serial_reg.h>
    4533#include <linux/jiffies.h>
    46 
    47 #include <asm/io.h>
    4834
    4935MODULE_DESCRIPTION("MIDI serial u16550");
     
    5743#define SNDRV_SERIAL_GENERIC 4     /* Generic Interface */
    5844#define SNDRV_SERIAL_MAX_ADAPTOR SNDRV_SERIAL_GENERIC
    59 static char *adaptor_names[] = {
     45static const char * const adaptor_names[] = {
    6046        "Soundcanvas",
    6147        "MS-124T",
     
    7056static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;      /* Index 0-MAX */
    7157static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;       /* ID for this card */
    72 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
     58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
    7359static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */
    7460static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;        /* 3,4,5,7,9,10,11,14,15 */
     
    7864static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};  /* 1 to 16 */
    7965static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS};
    80 static int droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };
     66static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };
    8167
    8268module_param_array(index, int, NULL, 0444);
     
    8672module_param_array(enable, bool, NULL, 0444);
    8773MODULE_PARM_DESC(enable, "Enable UART16550A chip.");
    88 module_param_array(port, long, NULL, 0444);
     74module_param_hw_array(port, long, ioport, NULL, 0444);
    8975MODULE_PARM_DESC(port, "Port # for UART16550A chip.");
    90 module_param_array(irq, int, NULL, 0444);
     76module_param_hw_array(irq, int, irq, NULL, 0444);
    9177MODULE_PARM_DESC(irq, "IRQ # for UART16550A chip.");
    9278module_param_array(speed, int, NULL, 0444);
     
    175161        if (!uart->timer_running) {
    176162                /* timer 38600bps * 10bit * 16byte */
    177                 uart->buffer_timer.expires = jiffies + (HZ+255)/256;
     163                mod_timer(&uart->buffer_timer, jiffies + (HZ + 255) / 256);
    178164                uart->timer_running = 1;
    179                 add_timer(&uart->buffer_timer);
    180165        }
    181166}
     
    312297
    313298/* When the polling mode, this function calls snd_uart16550_io_loop. */
    314 static void snd_uart16550_buffer_timer(unsigned long data)
     299static void snd_uart16550_buffer_timer(struct timer_list *t)
    315300{
    316301        unsigned long flags;
    317302        struct snd_uart16550 *uart;
    318303
    319         uart = (struct snd_uart16550 *)data;
     304        uart = from_timer(uart, t, buffer_timer);
    320305        spin_lock_irqsave(&uart->open_lock, flags);
    321306        snd_uart16550_del_timer(uart);
     
    329314 *  return negative error if not found
    330315 */
    331 static int __devinit snd_uart16550_detect(struct snd_uart16550 *uart)
     316static int snd_uart16550_detect(struct snd_uart16550 *uart)
    332317{
    333318        unsigned long io_base = uart->base;
     
    755740}
    756741
    757 static struct snd_rawmidi_ops snd_uart16550_output =
     742static const struct snd_rawmidi_ops snd_uart16550_output =
    758743{
    759744        .open =         snd_uart16550_output_open,
     
    762747};
    763748
    764 static struct snd_rawmidi_ops snd_uart16550_input =
     749static const struct snd_rawmidi_ops snd_uart16550_input =
    765750{
    766751        .open =         snd_uart16550_input_open,
     
    784769}
    785770
    786 static int __devinit snd_uart16550_create(struct snd_card *card,
    787                                        unsigned long iobase,
    788                                        int irq,
    789                                        unsigned int speed,
    790                                        unsigned int base,
    791                                        int adaptor,
    792                                        int droponfull,
    793                                        struct snd_uart16550 **ruart)
    794 {
    795         static struct snd_device_ops ops = {
     771static int snd_uart16550_create(struct snd_card *card,
     772                                unsigned long iobase,
     773                                int irq,
     774                                unsigned int speed,
     775                                unsigned int base,
     776                                int adaptor,
     777                                int droponfull,
     778                                struct snd_uart16550 **ruart)
     779{
     780        static const struct snd_device_ops ops = {
    796781                .dev_free =     snd_uart16550_dev_free,
    797782        };
     
    817802        if (irq >= 0 && irq != SNDRV_AUTO_IRQ) {
    818803                if (request_irq(irq, snd_uart16550_interrupt,
    819                                 IRQF_DISABLED, "Serial MIDI", uart)) {
     804                                0, "Serial MIDI", uart)) {
    820805                        snd_printk(KERN_WARNING
    821806                                   "irq %d busy. Using Polling.\n", irq);
     
    831816        uart->rstatus = 0;
    832817        memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS);
    833         init_timer(&uart->buffer_timer);
    834         uart->buffer_timer.function = snd_uart16550_buffer_timer;
    835         uart->buffer_timer.data = (unsigned long)uart;
     818        timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0);
    836819        uart->timer_running = 0;
    837820
     
    864847}
    865848
    866 static void __devinit snd_uart16550_substreams(struct snd_rawmidi_str *stream)
     849static void snd_uart16550_substreams(struct snd_rawmidi_str *stream)
    867850{
    868851        struct snd_rawmidi_substream *substream;
     
    873856}
    874857
    875 static int __devinit snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
    876                                       int outs, int ins,
    877                                       struct snd_rawmidi **rmidi)
     858static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
     859                               int outs, int ins,
     860                               struct snd_rawmidi **rmidi)
    878861{
    879862        struct snd_rawmidi *rrawmidi;
     
    900883}
    901884
    902 static int __devinit snd_serial_probe(struct platform_device *devptr)
     885static int snd_serial_probe(struct platform_device *devptr)
    903886{
    904887        struct snd_card *card;
     
    943926        }
    944927
    945         err  = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
     928        err  = snd_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE,
     929                            0, &card);
    946930        if (err < 0)
    947931                return err;
     
    970954                uart->irq);
    971955
    972         snd_card_set_dev(card, &devptr->dev);
    973 
    974956        if ((err = snd_card_register(card)) < 0)
    975957                goto _err;
     
    983965}
    984966
    985 static int __devexit snd_serial_remove(struct platform_device *devptr)
     967static int snd_serial_remove(struct platform_device *devptr)
    986968{
    987969        snd_card_free(platform_get_drvdata(devptr));
    988         platform_set_drvdata(devptr, NULL);
    989970        return 0;
    990971}
     
    994975static struct platform_driver snd_serial_driver = {
    995976        .probe          = snd_serial_probe,
    996         .remove         = __devexit_p( snd_serial_remove),
     977        .remove         =  snd_serial_remove,
    997978        .driver         = {
    998                 .name   = SND_SERIAL_DRIVER
     979                .name   = SND_SERIAL_DRIVER,
    999980        },
    1000981};
Note: See TracChangeset for help on using the changeset viewer.