Merge remote-tracking branch 'sound/for-next'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 01:00:49 +0000 (11:00 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 13 Sep 2016 01:00:49 +0000 (11:00 +1000)
84 files changed:
include/sound/hda_register.h
include/sound/hdaudio.h
include/sound/hdaudio_ext.h
sound/aoa/fabrics/layout.c
sound/aoa/soundbus/i2sbus/core.c
sound/core/compress_offload.c
sound/core/pcm_native.c
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_compat.c
sound/firewire/bebob/Makefile
sound/firewire/bebob/bebob.c
sound/firewire/bebob/bebob.h
sound/firewire/bebob/bebob_terratec.c
sound/firewire/bebob/bebob_yamaha.c [deleted file]
sound/firewire/bebob/bebob_yamaha_terratec.c [new file with mode: 0644]
sound/firewire/dice/dice-pcm.c
sound/firewire/digi00x/digi00x-pcm.c
sound/firewire/oxfw/oxfw-pcm.c
sound/firewire/tascam/tascam-pcm.c
sound/hda/ext/hdac_ext_controller.c
sound/hda/ext/hdac_ext_stream.c
sound/hda/hdac_controller.c
sound/pci/ad1889.c
sound/pci/als300.c
sound/pci/als4000.c
sound/pci/asihpi/asihpi.c
sound/pci/asihpi/hpifunc.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/aw2/aw2-alsa.c
sound/pci/azt3328.c
sound/pci/bt87x.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/cs46xx/dsp_spos.c
sound/pci/cs5535audio/cs5535audio_pcm.c
sound/pci/ctxfi/ctatc.c
sound/pci/ctxfi/ctpcm.c
sound/pci/ctxfi/ctvmem.c
sound/pci/emu10k1/emu10k1x.c
sound/pci/emu10k1/emupcm.c
sound/pci/emu10k1/p16v.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_controller.h
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_ca0132.c
sound/pci/hda/patch_realtek.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1724.c
sound/pci/korg1212/korg1212.c
sound/pci/lola/lola_pcm.c
sound/pci/lx6464es/lx6464es.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/nm256/nm256.c
sound/pci/oxygen/oxygen_pcm.c
sound/pci/pcxhr/pcxhr.c
sound/pci/riptide/riptide.c
sound/pci/rme32.c
sound/pci/rme96.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/rme9652.c
sound/pci/sonicvibes.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/ymfpci/ymfpci_main.c
sound/ppc/snd_ps3.c
sound/soc/intel/baytrail/sst-baytrail-ipc.c
sound/soc/intel/skylake/skl-messages.c
sound/soc/intel/skylake/skl-pcm.c
sound/soc/intel/skylake/skl.c
sound/usb/caiaq/audio.c
sound/usb/card.h
sound/usb/endpoint.c
sound/usb/format.c
sound/usb/quirks.c

index ff1aecf325e87543d73bc4b4914790c181139110..0013063db7f2bfe22faaf7b7f0d66695581254f9 100644 (file)
@@ -89,6 +89,19 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define AZX_REG_SD_BDLPL               0x18
 #define AZX_REG_SD_BDLPU               0x1c
 
+/* GTS registers */
+#define AZX_REG_LLCH                   0x14
+
+#define AZX_REG_GTS_BASE               0x520
+
+#define AZX_REG_GTSCC  (AZX_REG_GTS_BASE + 0x00)
+#define AZX_REG_WALFCC (AZX_REG_GTS_BASE + 0x04)
+#define AZX_REG_TSCCL  (AZX_REG_GTS_BASE + 0x08)
+#define AZX_REG_TSCCU  (AZX_REG_GTS_BASE + 0x0C)
+#define AZX_REG_LLPFOC (AZX_REG_GTS_BASE + 0x14)
+#define AZX_REG_LLPCL  (AZX_REG_GTS_BASE + 0x18)
+#define AZX_REG_LLPCU  (AZX_REG_GTS_BASE + 0x1C)
+
 /* Haswell/Broadwell display HD-A controller Extended Mode registers */
 #define AZX_REG_HSW_EM4                        0x100c
 #define AZX_REG_HSW_EM5                        0x1010
@@ -242,6 +255,29 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 /* Interval used to calculate the iterating register offset */
 #define AZX_DRSM_INTERVAL              0x08
 
+/* Global time synchronization registers */
+#define GTSCC_TSCCD_MASK               0x80000000
+#define GTSCC_TSCCD_SHIFT              BIT(31)
+#define GTSCC_TSCCI_MASK               0x20
+#define GTSCC_CDMAS_DMA_DIR_SHIFT      4
+
+#define WALFCC_CIF_MASK                        0x1FF
+#define WALFCC_FN_SHIFT                        9
+#define HDA_CLK_CYCLES_PER_FRAME       512
+
+/*
+ * An error occurs near frame "rollover". The clocks in frame value indicates
+ * whether this error may have occurred. Here we use the value of 10. Please
+ * see the errata for the right number [<10]
+ */
+#define HDA_MAX_CYCLE_VALUE            499
+#define HDA_MAX_CYCLE_OFFSET           10
+#define HDA_MAX_CYCLE_READ_RETRY       10
+
+#define TSCCU_CCU_SHIFT                        32
+#define LLPC_CCU_SHIFT                 32
+
+
 /*
  * helpers to read the stream position
  */
index 93e63c56f48fbdbedeecd07a3dca10127debf1b9..56004ec8d4418b00e1d62b62e5b057bf964f81a5 100644 (file)
@@ -245,6 +245,12 @@ struct hdac_rb {
 
 /*
  * HD-audio bus base driver
+ *
+ * @ppcap: pp capabilities pointer
+ * @spbcap: SPIB capabilities pointer
+ * @mlcap: MultiLink capabilities pointer
+ * @gtscap: gts capabilities pointer
+ * @drsmcap: dma resume capabilities pointer
  */
 struct hdac_bus {
        struct device *dev;
@@ -256,6 +262,12 @@ struct hdac_bus {
        void __iomem *remap_addr;
        int irq;
 
+       void __iomem *ppcap;
+       void __iomem *spbcap;
+       void __iomem *mlcap;
+       void __iomem *gtscap;
+       void __iomem *drsmcap;
+
        /* codec linked list */
        struct list_head codec_list;
        unsigned int num_codecs;
@@ -335,6 +347,7 @@ static inline void snd_hdac_codec_link_down(struct hdac_device *codec)
 int snd_hdac_bus_send_cmd(struct hdac_bus *bus, unsigned int val);
 int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
                              unsigned int *res);
+int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus);
 int snd_hdac_link_power(struct hdac_device *codec, bool enable);
 
 bool snd_hdac_bus_init_chip(struct hdac_bus *bus, bool full_reset);
index b9593b201599f94f49b35a36c82a6f927d97677b..8660a7f10851bfe18815165ab10acad0197e6ed4 100644 (file)
@@ -8,11 +8,6 @@
  *
  * @bus: hdac bus
  * @num_streams: streams supported
- * @ppcap: pp capabilities pointer
- * @spbcap: SPIB capabilities pointer
- * @mlcap: MultiLink capabilities pointer
- * @gtscap: gts capabilities pointer
- * @drsmcap: dma resume capabilities pointer
  * @hlink_list: link list of HDA links
  * @lock: lock for link mgmt
  * @cmd_dma_state: state of cmd DMAs: CORB and RIRB
@@ -22,12 +17,6 @@ struct hdac_ext_bus {
        int num_streams;
        int idx;
 
-       void __iomem *ppcap;
-       void __iomem *spbcap;
-       void __iomem *mlcap;
-       void __iomem *gtscap;
-       void __iomem *drsmcap;
-
        struct list_head hlink_list;
 
        struct mutex lock;
@@ -54,7 +43,6 @@ void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus);
 #define HDA_CODEC_EXT_ENTRY(_vid, _revid, _name, _drv_data) \
        HDA_CODEC_REV_EXT_ENTRY(_vid, _revid, _name, _drv_data)
 
-int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *sbus);
 void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *chip, bool enable);
 void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *chip, bool enable);
 
index 8f71f7e4d96604915d837df191eebfa5bd6c2414..a0c4a5de809c0e43f8a213d401ab7679869502b8 100644 (file)
@@ -112,6 +112,7 @@ MODULE_ALIAS("sound-layout-100");
 
 MODULE_ALIAS("aoa-device-id-14");
 MODULE_ALIAS("aoa-device-id-22");
+MODULE_ALIAS("aoa-device-id-31");
 MODULE_ALIAS("aoa-device-id-35");
 MODULE_ALIAS("aoa-device-id-44");
 
@@ -362,6 +363,13 @@ static struct layout layouts[] = {
                .connections = tas_connections_nolineout,
          },
        },
+       /* PowerBook6,1 */
+       { .device_id = 31,
+         .codecs[0] = {
+               .name = "tas",
+               .connections = tas_connections_nolineout,
+         },
+       },
        /* PowerBook6,5 */
        { .device_id = 44,
          .codecs[0] = {
@@ -1161,12 +1169,7 @@ static struct soundbus_driver aoa_soundbus_driver = {
 
 static int __init aoa_fabric_layout_init(void)
 {
-       int err;
-
-       err = soundbus_register_driver(&aoa_soundbus_driver);
-       if (err)
-               return err;
-       return 0;
+       return soundbus_register_driver(&aoa_soundbus_driver);
 }
 
 static void __exit aoa_fabric_layout_exit(void)
index 1cbf210080a16c47237f97067c2185eb4f144a23..000b5852210634a666b60cdc6ed2d99e6942b90a 100644 (file)
@@ -197,7 +197,7 @@ static int i2sbus_add_dev(struct macio_dev *macio,
                         * so restrict to those we do handle for now.
                         */
                        if (id && (*id == 22 || *id == 14 || *id == 35 ||
-                                  *id == 44)) {
+                                  *id == 31 || *id == 44)) {
                                snprintf(dev->sound.modalias, 32,
                                         "aoa-device-id-%d", *id);
                                ok = 1;
index 2c498488af6c5aebe12ec4a2cd7b432076b788af..583d4076903a62ac3a920399dbd3b52ac57e0e3f 100644 (file)
@@ -553,13 +553,9 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
                 * we should allow parameter change only when stream has been
                 * opened not in other cases
                 */
-               params = kmalloc(sizeof(*params), GFP_KERNEL);
-               if (!params)
-                       return -ENOMEM;
-               if (copy_from_user(params, (void __user *)arg, sizeof(*params))) {
-                       retval = -EFAULT;
-                       goto out;
-               }
+               params = memdup_user((void __user *)arg, sizeof(*params));
+               if (IS_ERR(params))
+                       return PTR_ERR(params);
 
                retval = snd_compress_check_input(params);
                if (retval)
index c61fd50f771f9ecd55c8e472d152321b37255e71..9d33c1e85c79b1f6b66f74e6117a198e60244b28 100644 (file)
@@ -2637,9 +2637,11 @@ static int snd_pcm_hwsync(struct snd_pcm_substream *substream)
                        break;
                /* Fall through */
        case SNDRV_PCM_STATE_PREPARED:
-       case SNDRV_PCM_STATE_SUSPENDED:
                err = 0;
                break;
+       case SNDRV_PCM_STATE_SUSPENDED:
+               err = -ESTRPIPE;
+               break;
        case SNDRV_PCM_STATE_XRUN:
                err = -EPIPE;
                break;
index d6d9419d8bacd28959a3b154ff76cdee54abaac4..811b95b6f6fd37e06b90dac9857d2c8ee35eccd8 100644 (file)
@@ -85,21 +85,6 @@ static int snd_seq_deliver_single_event(struct snd_seq_client *client,
                                        struct snd_seq_event *event,
                                        int filter, int atomic, int hop);
 
-/*
- */
-static inline mm_segment_t snd_enter_user(void)
-{
-       mm_segment_t fs = get_fs();
-       set_fs(get_ds());
-       return fs;
-}
-
-static inline void snd_leave_user(mm_segment_t fs)
-{
-       set_fs(fs);
-}
-
 /*
  */
 static inline unsigned short snd_seq_file_flags(struct file *file)
@@ -1128,59 +1113,69 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait)
 
 /*-----------------------------------------------------*/
 
+static int snd_seq_ioctl_pversion(struct snd_seq_client *client, void *arg)
+{
+       int *pversion = arg;
+
+       *pversion = SNDRV_SEQ_VERSION;
+       return 0;
+}
+
+static int snd_seq_ioctl_client_id(struct snd_seq_client *client, void *arg)
+{
+       int *client_id = arg;
+
+       *client_id = client->number;
+       return 0;
+}
 
 /* SYSTEM_INFO ioctl() */
-static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg)
+static int snd_seq_ioctl_system_info(struct snd_seq_client *client, void *arg)
 {
-       struct snd_seq_system_info info;
+       struct snd_seq_system_info *info = arg;
 
-       memset(&info, 0, sizeof(info));
+       memset(info, 0, sizeof(*info));
        /* fill the info fields */
-       info.queues = SNDRV_SEQ_MAX_QUEUES;
-       info.clients = SNDRV_SEQ_MAX_CLIENTS;
-       info.ports = SNDRV_SEQ_MAX_PORTS;
-       info.channels = 256;    /* fixed limit */
-       info.cur_clients = client_usage.cur;
-       info.cur_queues = snd_seq_queue_get_cur_queues();
-
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
+       info->queues = SNDRV_SEQ_MAX_QUEUES;
+       info->clients = SNDRV_SEQ_MAX_CLIENTS;
+       info->ports = SNDRV_SEQ_MAX_PORTS;
+       info->channels = 256;   /* fixed limit */
+       info->cur_clients = client_usage.cur;
+       info->cur_queues = snd_seq_queue_get_cur_queues();
+
        return 0;
 }
 
 
 /* RUNNING_MODE ioctl() */
-static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void __user *arg)
+static int snd_seq_ioctl_running_mode(struct snd_seq_client *client, void  *arg)
 {
-       struct snd_seq_running_info info;
+       struct snd_seq_running_info *info = arg;
        struct snd_seq_client *cptr;
        int err = 0;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
        /* requested client number */
-       cptr = snd_seq_client_use_ptr(info.client);
+       cptr = snd_seq_client_use_ptr(info->client);
        if (cptr == NULL)
                return -ENOENT;         /* don't change !!! */
 
 #ifdef SNDRV_BIG_ENDIAN
-       if (! info.big_endian) {
+       if (!info->big_endian) {
                err = -EINVAL;
                goto __err;
        }
 #else
-       if (info.big_endian) {
+       if (info->big_endian) {
                err = -EINVAL;
                goto __err;
        }
 
 #endif
-       if (info.cpu_mode > sizeof(long)) {
+       if (info->cpu_mode > sizeof(long)) {
                err = -EINVAL;
                goto __err;
        }
-       cptr->convert32 = (info.cpu_mode < sizeof(long));
+       cptr->convert32 = (info->cpu_mode < sizeof(long));
  __err:
        snd_seq_client_unlock(cptr);
        return err;
@@ -1214,51 +1209,43 @@ static void get_client_info(struct snd_seq_client *cptr,
 }
 
 static int snd_seq_ioctl_get_client_info(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
+       struct snd_seq_client_info *client_info = arg;
        struct snd_seq_client *cptr;
-       struct snd_seq_client_info client_info;
-
-       if (copy_from_user(&client_info, arg, sizeof(client_info)))
-               return -EFAULT;
 
        /* requested client number */
-       cptr = snd_seq_client_use_ptr(client_info.client);
+       cptr = snd_seq_client_use_ptr(client_info->client);
        if (cptr == NULL)
                return -ENOENT;         /* don't change !!! */
 
-       get_client_info(cptr, &client_info);
+       get_client_info(cptr, client_info);
        snd_seq_client_unlock(cptr);
 
-       if (copy_to_user(arg, &client_info, sizeof(client_info)))
-               return -EFAULT;
        return 0;
 }
 
 
 /* CLIENT_INFO ioctl() */
 static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
-       struct snd_seq_client_info client_info;
-
-       if (copy_from_user(&client_info, arg, sizeof(client_info)))
-               return -EFAULT;
+       struct snd_seq_client_info *client_info = arg;
 
        /* it is not allowed to set the info fields for an another client */
-       if (client->number != client_info.client)
+       if (client->number != client_info->client)
                return -EPERM;
        /* also client type must be set now */
-       if (client->type != client_info.type)
+       if (client->type != client_info->type)
                return -EINVAL;
 
        /* fill the info fields */
-       if (client_info.name[0])
-               strlcpy(client->name, client_info.name, sizeof(client->name));
+       if (client_info->name[0])
+               strlcpy(client->name, client_info->name, sizeof(client->name));
 
-       client->filter = client_info.filter;
-       client->event_lost = client_info.event_lost;
-       memcpy(client->event_filter, client_info.event_filter, 32);
+       client->filter = client_info->filter;
+       client->event_lost = client_info->event_lost;
+       memcpy(client->event_filter, client_info->event_filter, 32);
 
        return 0;
 }
@@ -1267,30 +1254,26 @@ static int snd_seq_ioctl_set_client_info(struct snd_seq_client *client,
 /* 
  * CREATE PORT ioctl() 
  */
-static int snd_seq_ioctl_create_port(struct snd_seq_client *client,
-                                    void __user *arg)
+static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
 {
+       struct snd_seq_port_info *info = arg;
        struct snd_seq_client_port *port;
-       struct snd_seq_port_info info;
        struct snd_seq_port_callback *callback;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
        /* it is not allowed to create the port for an another client */
-       if (info.addr.client != client->number)
+       if (info->addr.client != client->number)
                return -EPERM;
 
-       port = snd_seq_create_port(client, (info.flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) ? info.addr.port : -1);
+       port = snd_seq_create_port(client, (info->flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) ? info->addr.port : -1);
        if (port == NULL)
                return -ENOMEM;
 
-       if (client->type == USER_CLIENT && info.kernel) {
+       if (client->type == USER_CLIENT && info->kernel) {
                snd_seq_delete_port(client, port->addr.port);
                return -EINVAL;
        }
        if (client->type == KERNEL_CLIENT) {
-               if ((callback = info.kernel) != NULL) {
+               if ((callback = info->kernel) != NULL) {
                        if (callback->owner)
                                port->owner = callback->owner;
                        port->private_data = callback->private_data;
@@ -1303,37 +1286,29 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client,
                }
        }
 
-       info.addr = port->addr;
+       info->addr = port->addr;
 
-       snd_seq_set_port_info(port, &info);
+       snd_seq_set_port_info(port, info);
        snd_seq_system_client_ev_port_start(port->addr.client, port->addr.port);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
-
        return 0;
 }
 
 /* 
  * DELETE PORT ioctl() 
  */
-static int snd_seq_ioctl_delete_port(struct snd_seq_client *client,
-                                    void __user *arg)
+static int snd_seq_ioctl_delete_port(struct snd_seq_client *client, void *arg)
 {
-       struct snd_seq_port_info info;
+       struct snd_seq_port_info *info = arg;
        int err;
 
-       /* set passed parameters */
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-       
        /* it is not allowed to remove the port for an another client */
-       if (info.addr.client != client->number)
+       if (info->addr.client != client->number)
                return -EPERM;
 
-       err = snd_seq_delete_port(client, info.addr.port);
+       err = snd_seq_delete_port(client, info->addr.port);
        if (err >= 0)
-               snd_seq_system_client_ev_port_exit(client->number, info.addr.port);
+               snd_seq_system_client_ev_port_exit(client->number, info->addr.port);
        return err;
 }
 
@@ -1341,32 +1316,27 @@ static int snd_seq_ioctl_delete_port(struct snd_seq_client *client,
 /* 
  * GET_PORT_INFO ioctl() (on any client) 
  */
-static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client,
-                                      void __user *arg)
+static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client, void *arg)
 {
+       struct snd_seq_port_info *info = arg;
        struct snd_seq_client *cptr;
        struct snd_seq_client_port *port;
-       struct snd_seq_port_info info;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-       cptr = snd_seq_client_use_ptr(info.addr.client);
+       cptr = snd_seq_client_use_ptr(info->addr.client);
        if (cptr == NULL)
                return -ENXIO;
 
-       port = snd_seq_port_use_ptr(cptr, info.addr.port);
+       port = snd_seq_port_use_ptr(cptr, info->addr.port);
        if (port == NULL) {
                snd_seq_client_unlock(cptr);
                return -ENOENT;                 /* don't change */
        }
 
        /* get port info */
-       snd_seq_get_port_info(port, &info);
+       snd_seq_get_port_info(port, info);
        snd_seq_port_unlock(port);
        snd_seq_client_unlock(cptr);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
        return 0;
 }
 
@@ -1374,20 +1344,16 @@ static int snd_seq_ioctl_get_port_info(struct snd_seq_client *client,
 /* 
  * SET_PORT_INFO ioctl() (only ports on this/own client) 
  */
-static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client,
-                                      void __user *arg)
+static int snd_seq_ioctl_set_port_info(struct snd_seq_client *client, void *arg)
 {
+       struct snd_seq_port_info *info = arg;
        struct snd_seq_client_port *port;
-       struct snd_seq_port_info info;
-
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
 
-       if (info.addr.client != client->number) /* only set our own ports ! */
+       if (info->addr.client != client->number) /* only set our own ports ! */
                return -EPERM;
-       port = snd_seq_port_use_ptr(client, info.addr.port);
+       port = snd_seq_port_use_ptr(client, info->addr.port);
        if (port) {
-               snd_seq_set_port_info(port, &info);
+               snd_seq_set_port_info(port, info);
                snd_seq_port_unlock(port);
        }
        return 0;
@@ -1453,34 +1419,31 @@ int snd_seq_client_notify_subscription(int client, int port,
  * add to port's subscription list IOCTL interface 
  */
 static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client,
-                                       void __user *arg)
+                                       void *arg)
 {
+       struct snd_seq_port_subscribe *subs = arg;
        int result = -EINVAL;
        struct snd_seq_client *receiver = NULL, *sender = NULL;
        struct snd_seq_client_port *sport = NULL, *dport = NULL;
-       struct snd_seq_port_subscribe subs;
-
-       if (copy_from_user(&subs, arg, sizeof(subs)))
-               return -EFAULT;
 
-       if ((receiver = snd_seq_client_use_ptr(subs.dest.client)) == NULL)
+       if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL)
                goto __end;
-       if ((sender = snd_seq_client_use_ptr(subs.sender.client)) == NULL)
+       if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL)
                goto __end;
-       if ((sport = snd_seq_port_use_ptr(sender, subs.sender.port)) == NULL)
+       if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL)
                goto __end;
-       if ((dport = snd_seq_port_use_ptr(receiver, subs.dest.port)) == NULL)
+       if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL)
                goto __end;
 
-       result = check_subscription_permission(client, sport, dport, &subs);
+       result = check_subscription_permission(client, sport, dport, subs);
        if (result < 0)
                goto __end;
 
        /* connect them */
-       result = snd_seq_port_connect(client, sender, sport, receiver, dport, &subs);
+       result = snd_seq_port_connect(client, sender, sport, receiver, dport, subs);
        if (! result) /* broadcast announce */
                snd_seq_client_notify_subscription(SNDRV_SEQ_ADDRESS_SUBSCRIBERS, 0,
-                                                  &subs, SNDRV_SEQ_EVENT_PORT_SUBSCRIBED);
+                                                  subs, SNDRV_SEQ_EVENT_PORT_SUBSCRIBED);
       __end:
        if (sport)
                snd_seq_port_unlock(sport);
@@ -1498,33 +1461,30 @@ static int snd_seq_ioctl_subscribe_port(struct snd_seq_client *client,
  * remove from port's subscription list 
  */
 static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
-                                         void __user *arg)
+                                         void *arg)
 {
+       struct snd_seq_port_subscribe *subs = arg;
        int result = -ENXIO;
        struct snd_seq_client *receiver = NULL, *sender = NULL;
        struct snd_seq_client_port *sport = NULL, *dport = NULL;
-       struct snd_seq_port_subscribe subs;
-
-       if (copy_from_user(&subs, arg, sizeof(subs)))
-               return -EFAULT;
 
-       if ((receiver = snd_seq_client_use_ptr(subs.dest.client)) == NULL)
+       if ((receiver = snd_seq_client_use_ptr(subs->dest.client)) == NULL)
                goto __end;
-       if ((sender = snd_seq_client_use_ptr(subs.sender.client)) == NULL)
+       if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL)
                goto __end;
-       if ((sport = snd_seq_port_use_ptr(sender, subs.sender.port)) == NULL)
+       if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL)
                goto __end;
-       if ((dport = snd_seq_port_use_ptr(receiver, subs.dest.port)) == NULL)
+       if ((dport = snd_seq_port_use_ptr(receiver, subs->dest.port)) == NULL)
                goto __end;
 
-       result = check_subscription_permission(client, sport, dport, &subs);
+       result = check_subscription_permission(client, sport, dport, subs);
        if (result < 0)
                goto __end;
 
-       result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, &subs);
+       result = snd_seq_port_disconnect(client, sender, sport, receiver, dport, subs);
        if (! result) /* broadcast announce */
                snd_seq_client_notify_subscription(SNDRV_SEQ_ADDRESS_SUBSCRIBERS, 0,
-                                                  &subs, SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED);
+                                                  subs, SNDRV_SEQ_EVENT_PORT_UNSUBSCRIBED);
       __end:
        if (sport)
                snd_seq_port_unlock(sport);
@@ -1539,17 +1499,13 @@ static int snd_seq_ioctl_unsubscribe_port(struct snd_seq_client *client,
 
 
 /* CREATE_QUEUE ioctl() */
-static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
-                                     void __user *arg)
+static int snd_seq_ioctl_create_queue(struct snd_seq_client *client, void *arg)
 {
-       struct snd_seq_queue_info info;
+       struct snd_seq_queue_info *info = arg;
        int result;
        struct snd_seq_queue *q;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       result = snd_seq_queue_alloc(client->number, info.locked, info.flags);
+       result = snd_seq_queue_alloc(client->number, info->locked, info->flags);
        if (result < 0)
                return result;
 
@@ -1557,181 +1513,150 @@ static int snd_seq_ioctl_create_queue(struct snd_seq_client *client,
        if (q == NULL)
                return -EINVAL;
 
-       info.queue = q->queue;
-       info.locked = q->locked;
-       info.owner = q->owner;
+       info->queue = q->queue;
+       info->locked = q->locked;
+       info->owner = q->owner;
 
        /* set queue name */
-       if (! info.name[0])
-               snprintf(info.name, sizeof(info.name), "Queue-%d", q->queue);
-       strlcpy(q->name, info.name, sizeof(q->name));
+       if (!info->name[0])
+               snprintf(info->name, sizeof(info->name), "Queue-%d", q->queue);
+       strlcpy(q->name, info->name, sizeof(q->name));
        queuefree(q);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
-
        return 0;
 }
 
 /* DELETE_QUEUE ioctl() */
-static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client,
-                                     void __user *arg)
+static int snd_seq_ioctl_delete_queue(struct snd_seq_client *client, void *arg)
 {
-       struct snd_seq_queue_info info;
-
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
+       struct snd_seq_queue_info *info = arg;
 
-       return snd_seq_queue_delete(client->number, info.queue);
+       return snd_seq_queue_delete(client->number, info->queue);
 }
 
 /* GET_QUEUE_INFO ioctl() */
 static int snd_seq_ioctl_get_queue_info(struct snd_seq_client *client,
-                                       void __user *arg)
+                                       void *arg)
 {
-       struct snd_seq_queue_info info;
+       struct snd_seq_queue_info *info = arg;
        struct snd_seq_queue *q;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       q = queueptr(info.queue);
+       q = queueptr(info->queue);
        if (q == NULL)
                return -EINVAL;
 
-       memset(&info, 0, sizeof(info));
-       info.queue = q->queue;
-       info.owner = q->owner;
-       info.locked = q->locked;
-       strlcpy(info.name, q->name, sizeof(info.name));
+       memset(info, 0, sizeof(*info));
+       info->queue = q->queue;
+       info->owner = q->owner;
+       info->locked = q->locked;
+       strlcpy(info->name, q->name, sizeof(info->name));
        queuefree(q);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
-
        return 0;
 }
 
 /* SET_QUEUE_INFO ioctl() */
 static int snd_seq_ioctl_set_queue_info(struct snd_seq_client *client,
-                                       void __user *arg)
+                                       void *arg)
 {
-       struct snd_seq_queue_info info;
+       struct snd_seq_queue_info *info = arg;
        struct snd_seq_queue *q;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       if (info.owner != client->number)
+       if (info->owner != client->number)
                return -EINVAL;
 
        /* change owner/locked permission */
-       if (snd_seq_queue_check_access(info.queue, client->number)) {
-               if (snd_seq_queue_set_owner(info.queue, client->number, info.locked) < 0)
+       if (snd_seq_queue_check_access(info->queue, client->number)) {
+               if (snd_seq_queue_set_owner(info->queue, client->number, info->locked) < 0)
                        return -EPERM;
-               if (info.locked)
-                       snd_seq_queue_use(info.queue, client->number, 1);
+               if (info->locked)
+                       snd_seq_queue_use(info->queue, client->number, 1);
        } else {
                return -EPERM;
        }       
 
-       q = queueptr(info.queue);
+       q = queueptr(info->queue);
        if (! q)
                return -EINVAL;
        if (q->owner != client->number) {
                queuefree(q);
                return -EPERM;
        }
-       strlcpy(q->name, info.name, sizeof(q->name));
+       strlcpy(q->name, info->name, sizeof(q->name));
        queuefree(q);
 
        return 0;
 }
 
 /* GET_NAMED_QUEUE ioctl() */
-static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client, void __user *arg)
+static int snd_seq_ioctl_get_named_queue(struct snd_seq_client *client,
+                                        void *arg)
 {
-       struct snd_seq_queue_info info;
+       struct snd_seq_queue_info *info = arg;
        struct snd_seq_queue *q;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       q = snd_seq_queue_find_name(info.name);
+       q = snd_seq_queue_find_name(info->name);
        if (q == NULL)
                return -EINVAL;
-       info.queue = q->queue;
-       info.owner = q->owner;
-       info.locked = q->locked;
+       info->queue = q->queue;
+       info->owner = q->owner;
+       info->locked = q->locked;
        queuefree(q);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
-
        return 0;
 }
 
 /* GET_QUEUE_STATUS ioctl() */
 static int snd_seq_ioctl_get_queue_status(struct snd_seq_client *client,
-                                         void __user *arg)
+                                         void *arg)
 {
-       struct snd_seq_queue_status status;
+       struct snd_seq_queue_status *status = arg;
        struct snd_seq_queue *queue;
        struct snd_seq_timer *tmr;
 
-       if (copy_from_user(&status, arg, sizeof(status)))
-               return -EFAULT;
-
-       queue = queueptr(status.queue);
+       queue = queueptr(status->queue);
        if (queue == NULL)
                return -EINVAL;
-       memset(&status, 0, sizeof(status));
-       status.queue = queue->queue;
+       memset(status, 0, sizeof(*status));
+       status->queue = queue->queue;
        
        tmr = queue->timer;
-       status.events = queue->tickq->cells + queue->timeq->cells;
+       status->events = queue->tickq->cells + queue->timeq->cells;
 
-       status.time = snd_seq_timer_get_cur_time(tmr);
-       status.tick = snd_seq_timer_get_cur_tick(tmr);
+       status->time = snd_seq_timer_get_cur_time(tmr);
+       status->tick = snd_seq_timer_get_cur_tick(tmr);
 
-       status.running = tmr->running;
+       status->running = tmr->running;
 
-       status.flags = queue->flags;
+       status->flags = queue->flags;
        queuefree(queue);
 
-       if (copy_to_user(arg, &status, sizeof(status)))
-               return -EFAULT;
        return 0;
 }
 
 
 /* GET_QUEUE_TEMPO ioctl() */
 static int snd_seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
-       struct snd_seq_queue_tempo tempo;
+       struct snd_seq_queue_tempo *tempo = arg;
        struct snd_seq_queue *queue;
        struct snd_seq_timer *tmr;
 
-       if (copy_from_user(&tempo, arg, sizeof(tempo)))
-               return -EFAULT;
-
-       queue = queueptr(tempo.queue);
+       queue = queueptr(tempo->queue);
        if (queue == NULL)
                return -EINVAL;
-       memset(&tempo, 0, sizeof(tempo));
-       tempo.queue = queue->queue;
+       memset(tempo, 0, sizeof(*tempo));
+       tempo->queue = queue->queue;
        
        tmr = queue->timer;
 
-       tempo.tempo = tmr->tempo;
-       tempo.ppq = tmr->ppq;
-       tempo.skew_value = tmr->skew;
-       tempo.skew_base = tmr->skew_base;
+       tempo->tempo = tmr->tempo;
+       tempo->ppq = tmr->ppq;
+       tempo->skew_value = tmr->skew;
+       tempo->skew_base = tmr->skew_base;
        queuefree(queue);
 
-       if (copy_to_user(arg, &tempo, sizeof(tempo)))
-               return -EFAULT;
        return 0;
 }
 
@@ -1747,31 +1672,25 @@ int snd_seq_set_queue_tempo(int client, struct snd_seq_queue_tempo *tempo)
 EXPORT_SYMBOL(snd_seq_set_queue_tempo);
 
 static int snd_seq_ioctl_set_queue_tempo(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
+       struct snd_seq_queue_tempo *tempo = arg;
        int result;
-       struct snd_seq_queue_tempo tempo;
-
-       if (copy_from_user(&tempo, arg, sizeof(tempo)))
-               return -EFAULT;
 
-       result = snd_seq_set_queue_tempo(client->number, &tempo);
+       result = snd_seq_set_queue_tempo(client->number, tempo);
        return result < 0 ? result : 0;
 }
 
 
 /* GET_QUEUE_TIMER ioctl() */
 static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
-       struct snd_seq_queue_timer timer;
+       struct snd_seq_queue_timer *timer = arg;
        struct snd_seq_queue *queue;
        struct snd_seq_timer *tmr;
 
-       if (copy_from_user(&timer, arg, sizeof(timer)))
-               return -EFAULT;
-
-       queue = queueptr(timer.queue);
+       queue = queueptr(timer->queue);
        if (queue == NULL)
                return -EINVAL;
 
@@ -1780,41 +1699,36 @@ static int snd_seq_ioctl_get_queue_timer(struct snd_seq_client *client,
                return -ERESTARTSYS;
        }
        tmr = queue->timer;
-       memset(&timer, 0, sizeof(timer));
-       timer.queue = queue->queue;
+       memset(timer, 0, sizeof(*timer));
+       timer->queue = queue->queue;
 
-       timer.type = tmr->type;
+       timer->type = tmr->type;
        if (tmr->type == SNDRV_SEQ_TIMER_ALSA) {
-               timer.u.alsa.id = tmr->alsa_id;
-               timer.u.alsa.resolution = tmr->preferred_resolution;
+               timer->u.alsa.id = tmr->alsa_id;
+               timer->u.alsa.resolution = tmr->preferred_resolution;
        }
        mutex_unlock(&queue->timer_mutex);
        queuefree(queue);
        
-       if (copy_to_user(arg, &timer, sizeof(timer)))
-               return -EFAULT;
        return 0;
 }
 
 
 /* SET_QUEUE_TIMER ioctl() */
 static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
+       struct snd_seq_queue_timer *timer = arg;
        int result = 0;
-       struct snd_seq_queue_timer timer;
-
-       if (copy_from_user(&timer, arg, sizeof(timer)))
-               return -EFAULT;
 
-       if (timer.type != SNDRV_SEQ_TIMER_ALSA)
+       if (timer->type != SNDRV_SEQ_TIMER_ALSA)
                return -EINVAL;
 
-       if (snd_seq_queue_check_access(timer.queue, client->number)) {
+       if (snd_seq_queue_check_access(timer->queue, client->number)) {
                struct snd_seq_queue *q;
                struct snd_seq_timer *tmr;
 
-               q = queueptr(timer.queue);
+               q = queueptr(timer->queue);
                if (q == NULL)
                        return -ENXIO;
                if (mutex_lock_interruptible(&q->timer_mutex)) {
@@ -1822,13 +1736,13 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
                        return -ERESTARTSYS;
                }
                tmr = q->timer;
-               snd_seq_queue_timer_close(timer.queue);
-               tmr->type = timer.type;
+               snd_seq_queue_timer_close(timer->queue);
+               tmr->type = timer->type;
                if (tmr->type == SNDRV_SEQ_TIMER_ALSA) {
-                       tmr->alsa_id = timer.u.alsa.id;
-                       tmr->preferred_resolution = timer.u.alsa.resolution;
+                       tmr->alsa_id = timer->u.alsa.id;
+                       tmr->preferred_resolution = timer->u.alsa.resolution;
                }
-               result = snd_seq_queue_timer_open(timer.queue);
+               result = snd_seq_queue_timer_open(timer->queue);
                mutex_unlock(&q->timer_mutex);
                queuefree(q);
        } else {
@@ -1841,38 +1755,30 @@ static int snd_seq_ioctl_set_queue_timer(struct snd_seq_client *client,
 
 /* GET_QUEUE_CLIENT ioctl() */
 static int snd_seq_ioctl_get_queue_client(struct snd_seq_client *client,
-                                         void __user *arg)
+                                         void *arg)
 {
-       struct snd_seq_queue_client info;
+       struct snd_seq_queue_client *info = arg;
        int used;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       used = snd_seq_queue_is_used(info.queue, client->number);
+       used = snd_seq_queue_is_used(info->queue, client->number);
        if (used < 0)
                return -EINVAL;
-       info.used = used;
-       info.client = client->number;
+       info->used = used;
+       info->client = client->number;
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
        return 0;
 }
 
 
 /* SET_QUEUE_CLIENT ioctl() */
 static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client,
-                                         void __user *arg)
+                                         void *arg)
 {
+       struct snd_seq_queue_client *info = arg;
        int err;
-       struct snd_seq_queue_client info;
-
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
 
-       if (info.used >= 0) {
-               err = snd_seq_queue_use(info.queue, client->number, info.used);
+       if (info->used >= 0) {
+               err = snd_seq_queue_use(info->queue, client->number, info->used);
                if (err < 0)
                        return err;
        }
@@ -1883,78 +1789,70 @@ static int snd_seq_ioctl_set_queue_client(struct snd_seq_client *client,
 
 /* GET_CLIENT_POOL ioctl() */
 static int snd_seq_ioctl_get_client_pool(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
-       struct snd_seq_client_pool info;
+       struct snd_seq_client_pool *info = arg;
        struct snd_seq_client *cptr;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       cptr = snd_seq_client_use_ptr(info.client);
+       cptr = snd_seq_client_use_ptr(info->client);
        if (cptr == NULL)
                return -ENOENT;
-       memset(&info, 0, sizeof(info));
-       info.client = cptr->number;
-       info.output_pool = cptr->pool->size;
-       info.output_room = cptr->pool->room;
-       info.output_free = info.output_pool;
-       info.output_free = snd_seq_unused_cells(cptr->pool);
+       memset(info, 0, sizeof(*info));
+       info->client = cptr->number;
+       info->output_pool = cptr->pool->size;
+       info->output_room = cptr->pool->room;
+       info->output_free = info->output_pool;
+       info->output_free = snd_seq_unused_cells(cptr->pool);
        if (cptr->type == USER_CLIENT) {
-               info.input_pool = cptr->data.user.fifo_pool_size;
-               info.input_free = info.input_pool;
+               info->input_pool = cptr->data.user.fifo_pool_size;
+               info->input_free = info->input_pool;
                if (cptr->data.user.fifo)
-                       info.input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool);
+                       info->input_free = snd_seq_unused_cells(cptr->data.user.fifo->pool);
        } else {
-               info.input_pool = 0;
-               info.input_free = 0;
+               info->input_pool = 0;
+               info->input_free = 0;
        }
        snd_seq_client_unlock(cptr);
        
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
        return 0;
 }
 
 /* SET_CLIENT_POOL ioctl() */
 static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
-       struct snd_seq_client_pool info;
+       struct snd_seq_client_pool *info = arg;
        int rc;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-
-       if (client->number != info.client)
+       if (client->number != info->client)
                return -EINVAL; /* can't change other clients */
 
-       if (info.output_pool >= 1 && info.output_pool <= SNDRV_SEQ_MAX_EVENTS &&
+       if (info->output_pool >= 1 && info->output_pool <= SNDRV_SEQ_MAX_EVENTS &&
            (! snd_seq_write_pool_allocated(client) ||
-            info.output_pool != client->pool->size)) {
+            info->output_pool != client->pool->size)) {
                if (snd_seq_write_pool_allocated(client)) {
                        /* remove all existing cells */
                        snd_seq_queue_client_leave_cells(client->number);
                        snd_seq_pool_done(client->pool);
                }
-               client->pool->size = info.output_pool;
+               client->pool->size = info->output_pool;
                rc = snd_seq_pool_init(client->pool);
                if (rc < 0)
                        return rc;
        }
        if (client->type == USER_CLIENT && client->data.user.fifo != NULL &&
-           info.input_pool >= 1 &&
-           info.input_pool <= SNDRV_SEQ_MAX_CLIENT_EVENTS &&
-           info.input_pool != client->data.user.fifo_pool_size) {
+           info->input_pool >= 1 &&
+           info->input_pool <= SNDRV_SEQ_MAX_CLIENT_EVENTS &&
+           info->input_pool != client->data.user.fifo_pool_size) {
                /* change pool size */
-               rc = snd_seq_fifo_resize(client->data.user.fifo, info.input_pool);
+               rc = snd_seq_fifo_resize(client->data.user.fifo, info->input_pool);
                if (rc < 0)
                        return rc;
-               client->data.user.fifo_pool_size = info.input_pool;
+               client->data.user.fifo_pool_size = info->input_pool;
        }
-       if (info.output_room >= 1 &&
-           info.output_room <= client->pool->size) {
-               client->pool->room  = info.output_room;
+       if (info->output_room >= 1 &&
+           info->output_room <= client->pool->size) {
+               client->pool->room  = info->output_room;
        }
 
        return snd_seq_ioctl_get_client_pool(client, arg);
@@ -1963,17 +1861,14 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
 
 /* REMOVE_EVENTS ioctl() */
 static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
-                                      void __user *arg)
+                                      void *arg)
 {
-       struct snd_seq_remove_events info;
-
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
+       struct snd_seq_remove_events *info = arg;
 
        /*
         * Input mostly not implemented XXX.
         */
-       if (info.remove_mode & SNDRV_SEQ_REMOVE_INPUT) {
+       if (info->remove_mode & SNDRV_SEQ_REMOVE_INPUT) {
                /*
                 * No restrictions so for a user client we can clear
                 * the whole fifo
@@ -1982,8 +1877,8 @@ static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
                        snd_seq_fifo_clear(client->data.user.fifo);
        }
 
-       if (info.remove_mode & SNDRV_SEQ_REMOVE_OUTPUT)
-               snd_seq_queue_remove_cells(client->number, &info);
+       if (info->remove_mode & SNDRV_SEQ_REMOVE_OUTPUT)
+               snd_seq_queue_remove_cells(client->number, info);
 
        return 0;
 }
@@ -1993,26 +1888,23 @@ static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
  * get subscription info
  */
 static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
-                                         void __user *arg)
+                                         void *arg)
 {
+       struct snd_seq_port_subscribe *subs = arg;
        int result;
        struct snd_seq_client *sender = NULL;
        struct snd_seq_client_port *sport = NULL;
-       struct snd_seq_port_subscribe subs;
        struct snd_seq_subscribers *p;
 
-       if (copy_from_user(&subs, arg, sizeof(subs)))
-               return -EFAULT;
-
        result = -EINVAL;
-       if ((sender = snd_seq_client_use_ptr(subs.sender.client)) == NULL)
+       if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL)
                goto __end;
-       if ((sport = snd_seq_port_use_ptr(sender, subs.sender.port)) == NULL)
+       if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL)
                goto __end;
-       p = snd_seq_port_get_subscription(&sport->c_src, &subs.dest);
+       p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest);
        if (p) {
                result = 0;
-               subs = p->info;
+               *subs = p->info;
        } else
                result = -ENOENT;
 
@@ -2021,10 +1913,7 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
                snd_seq_port_unlock(sport);
        if (sender)
                snd_seq_client_unlock(sender);
-       if (result >= 0) {
-               if (copy_to_user(arg, &subs, sizeof(subs)))
-                       return -EFAULT;
-       }
+
        return result;
 }
 
@@ -2032,26 +1921,22 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,
 /*
  * get subscription info - check only its presence
  */
-static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
-                                   void __user *arg)
+static int snd_seq_ioctl_query_subs(struct snd_seq_client *client, void *arg)
 {
+       struct snd_seq_query_subs *subs = arg;
        int result = -ENXIO;
        struct snd_seq_client *cptr = NULL;
        struct snd_seq_client_port *port = NULL;
-       struct snd_seq_query_subs subs;
        struct snd_seq_port_subs_info *group;
        struct list_head *p;
        int i;
 
-       if (copy_from_user(&subs, arg, sizeof(subs)))
-               return -EFAULT;
-
-       if ((cptr = snd_seq_client_use_ptr(subs.root.client)) == NULL)
+       if ((cptr = snd_seq_client_use_ptr(subs->root.client)) == NULL)
                goto __end;
-       if ((port = snd_seq_port_use_ptr(cptr, subs.root.port)) == NULL)
+       if ((port = snd_seq_port_use_ptr(cptr, subs->root.port)) == NULL)
                goto __end;
 
-       switch (subs.type) {
+       switch (subs->type) {
        case SNDRV_SEQ_QUERY_SUBS_READ:
                group = &port->c_src;
                break;
@@ -2064,22 +1949,22 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
 
        down_read(&group->list_mutex);
        /* search for the subscriber */
-       subs.num_subs = group->count;
+       subs->num_subs = group->count;
        i = 0;
        result = -ENOENT;
        list_for_each(p, &group->list_head) {
-               if (i++ == subs.index) {
+               if (i++ == subs->index) {
                        /* found! */
                        struct snd_seq_subscribers *s;
-                       if (subs.type == SNDRV_SEQ_QUERY_SUBS_READ) {
+                       if (subs->type == SNDRV_SEQ_QUERY_SUBS_READ) {
                                s = list_entry(p, struct snd_seq_subscribers, src_list);
-                               subs.addr = s->info.dest;
+                               subs->addr = s->info.dest;
                        } else {
                                s = list_entry(p, struct snd_seq_subscribers, dest_list);
-                               subs.addr = s->info.sender;
+                               subs->addr = s->info.sender;
                        }
-                       subs.flags = s->info.flags;
-                       subs.queue = s->info.queue;
+                       subs->flags = s->info.flags;
+                       subs->queue = s->info.queue;
                        result = 0;
                        break;
                }
@@ -2091,10 +1976,7 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
                snd_seq_port_unlock(port);
        if (cptr)
                snd_seq_client_unlock(cptr);
-       if (result >= 0) {
-               if (copy_to_user(arg, &subs, sizeof(subs)))
-                       return -EFAULT;
-       }
+
        return result;
 }
 
@@ -2103,31 +1985,26 @@ static int snd_seq_ioctl_query_subs(struct snd_seq_client *client,
  * query next client
  */
 static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
-                                          void __user *arg)
+                                          void *arg)
 {
+       struct snd_seq_client_info *info = arg;
        struct snd_seq_client *cptr = NULL;
-       struct snd_seq_client_info info;
-
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
 
        /* search for next client */
-       info.client++;
-       if (info.client < 0)
-               info.client = 0;
-       for (; info.client < SNDRV_SEQ_MAX_CLIENTS; info.client++) {
-               cptr = snd_seq_client_use_ptr(info.client);
+       info->client++;
+       if (info->client < 0)
+               info->client = 0;
+       for (; info->client < SNDRV_SEQ_MAX_CLIENTS; info->client++) {
+               cptr = snd_seq_client_use_ptr(info->client);
                if (cptr)
                        break; /* found */
        }
        if (cptr == NULL)
                return -ENOENT;
 
-       get_client_info(cptr, &info);
+       get_client_info(cptr, info);
        snd_seq_client_unlock(cptr);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
        return 0;
 }
 
@@ -2135,43 +2012,41 @@ static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
  * query next port
  */
 static int snd_seq_ioctl_query_next_port(struct snd_seq_client *client,
-                                        void __user *arg)
+                                        void *arg)
 {
+       struct snd_seq_port_info *info = arg;
        struct snd_seq_client *cptr;
        struct snd_seq_client_port *port = NULL;
-       struct snd_seq_port_info info;
 
-       if (copy_from_user(&info, arg, sizeof(info)))
-               return -EFAULT;
-       cptr = snd_seq_client_use_ptr(info.addr.client);
+       cptr = snd_seq_client_use_ptr(info->addr.client);
        if (cptr == NULL)
                return -ENXIO;
 
        /* search for next port */
-       info.addr.port++;
-       port = snd_seq_port_query_nearest(cptr, &info);
+       info->addr.port++;
+       port = snd_seq_port_query_nearest(cptr, info);
        if (port == NULL) {
                snd_seq_client_unlock(cptr);
                return -ENOENT;
        }
 
        /* get port info */
-       info.addr = port->addr;
-       snd_seq_get_port_info(port, &info);
+       info->addr = port->addr;
+       snd_seq_get_port_info(port, info);
        snd_seq_port_unlock(port);
        snd_seq_client_unlock(cptr);
 
-       if (copy_to_user(arg, &info, sizeof(info)))
-               return -EFAULT;
        return 0;
 }
 
 /* -------------------------------------------------------- */
 
-static struct seq_ioctl_table {
+static const struct ioctl_handler {
        unsigned int cmd;
-       int (*func)(struct snd_seq_client *client, void __user * arg);
-} ioctl_tables[] = {
+       int (*func)(struct snd_seq_client *client, void *arg);
+} ioctl_handlers[] = {
+       { SNDRV_SEQ_IOCTL_PVERSION, snd_seq_ioctl_pversion },
+       { SNDRV_SEQ_IOCTL_CLIENT_ID, snd_seq_ioctl_client_id },
        { SNDRV_SEQ_IOCTL_SYSTEM_INFO, snd_seq_ioctl_system_info },
        { SNDRV_SEQ_IOCTL_RUNNING_MODE, snd_seq_ioctl_running_mode },
        { SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, snd_seq_ioctl_get_client_info },
@@ -2204,40 +2079,65 @@ static struct seq_ioctl_table {
        { 0, NULL },
 };
 
-static int snd_seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd,
-                           void __user *arg)
+static long snd_seq_ioctl(struct file *file, unsigned int cmd,
+                         unsigned long arg)
 {
-       struct seq_ioctl_table *p;
+       struct snd_seq_client *client = file->private_data;
+       /* To use kernel stack for ioctl data. */
+       union {
+               int pversion;
+               int client_id;
+               struct snd_seq_system_info      system_info;
+               struct snd_seq_running_info     running_info;
+               struct snd_seq_client_info      client_info;
+               struct snd_seq_port_info        port_info;
+               struct snd_seq_port_subscribe   port_subscribe;
+               struct snd_seq_queue_info       queue_info;
+               struct snd_seq_queue_status     queue_status;
+               struct snd_seq_queue_tempo      tempo;
+               struct snd_seq_queue_timer      queue_timer;
+               struct snd_seq_queue_client     queue_client;
+               struct snd_seq_client_pool      client_pool;
+               struct snd_seq_remove_events    remove_events;
+               struct snd_seq_query_subs       query_subs;
+       } buf;
+       const struct ioctl_handler *handler;
+       unsigned long size;
+       int err;
 
-       switch (cmd) {
-       case SNDRV_SEQ_IOCTL_PVERSION:
-               /* return sequencer version number */
-               return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0;
-       case SNDRV_SEQ_IOCTL_CLIENT_ID:
-               /* return the id of this client */
-               return put_user(client->number, (int __user *)arg) ? -EFAULT : 0;
-       }
+       if (snd_BUG_ON(!client))
+               return -ENXIO;
 
-       if (! arg)
-               return -EFAULT;
-       for (p = ioctl_tables; p->cmd; p++) {
-               if (p->cmd == cmd)
-                       return p->func(client, arg);
+       for (handler = ioctl_handlers; handler->cmd > 0; ++handler) {
+               if (handler->cmd == cmd)
+                       break;
        }
-       pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n",
-                  cmd, _IOC_TYPE(cmd), _IOC_NR(cmd));
-       return -ENOTTY;
-}
+       if (handler->cmd == 0)
+               return -ENOTTY;
 
+       memset(&buf, 0, sizeof(buf));
 
-static long snd_seq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-       struct snd_seq_client *client = file->private_data;
+       /*
+        * All of ioctl commands for ALSA sequencer get an argument of size
+        * within 13 bits. We can safely pick up the size from the command.
+        */
+       size = _IOC_SIZE(handler->cmd);
+       if (_IOC_DIR(handler->cmd) & IOC_IN) {
+               if (copy_from_user(&buf, (const void __user *)arg, size))
+                       return -EFAULT;
+       }
 
-       if (snd_BUG_ON(!client))
-               return -ENXIO;
-               
-       return snd_seq_do_ioctl(client, cmd, (void __user *) arg);
+       err = handler->func(client, &buf);
+       if (err >= 0) {
+               /* Some commands includes a bug in 'dir' field. */
+               if (handler->cmd == SNDRV_SEQ_IOCTL_SET_QUEUE_CLIENT ||
+                   handler->cmd == SNDRV_SEQ_IOCTL_SET_CLIENT_POOL ||
+                   (_IOC_DIR(handler->cmd) & IOC_OUT))
+                       if (copy_to_user((void __user *)arg, &buf, size))
+                               return -EFAULT;
+       }
+
+       return err;
 }
 
 #ifdef CONFIG_COMPAT
@@ -2423,23 +2323,35 @@ int snd_seq_kernel_client_dispatch(int client, struct snd_seq_event * ev,
 
 EXPORT_SYMBOL(snd_seq_kernel_client_dispatch);
 
-/*
- * exported, called by kernel clients to perform same functions as with
- * userland ioctl() 
+/**
+ * snd_seq_kernel_client_ctl - operate a command for a client with data in
+ *                            kernel space.
+ * @clientid:  A numerical ID for a client.
+ * @cmd:       An ioctl(2) command for ALSA sequencer operation.
+ * @arg:       A pointer to data in kernel space.
+ *
+ * Against its name, both kernel/application client can be handled by this
+ * kernel API. A pointer of 'arg' argument should be in kernel space.
+ *
+ * Return: 0 at success. Negative error code at failure.
  */
 int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg)
 {
+       const struct ioctl_handler *handler;
        struct snd_seq_client *client;
-       mm_segment_t fs;
-       int result;
 
        client = clientptr(clientid);
        if (client == NULL)
                return -ENXIO;
-       fs = snd_enter_user();
-       result = snd_seq_do_ioctl(client, cmd, (void __force __user *)arg);
-       snd_leave_user(fs);
-       return result;
+
+       for (handler = ioctl_handlers; handler->cmd > 0; ++handler) {
+               if (handler->cmd == cmd)
+                       return handler->func(client, arg);
+       }
+
+       pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n",
+                cmd, _IOC_TYPE(cmd), _IOC_NR(cmd));
+       return -ENOTTY;
 }
 
 EXPORT_SYMBOL(snd_seq_kernel_client_ctl);
index 65175902a68a841650ac818f8fde713eca60c5b5..fce5697e42614a36056079b2a1aca289aec2d850 100644 (file)
@@ -47,7 +47,6 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned
 {
        int err = -EFAULT;
        struct snd_seq_port_info *data;
-       mm_segment_t fs;
 
        data = kmalloc(sizeof(*data), GFP_KERNEL);
        if (!data)
@@ -59,9 +58,7 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned
                goto error;
        data->kernel = NULL;
 
-       fs = snd_enter_user();
-       err = snd_seq_do_ioctl(client, cmd, data);
-       snd_leave_user(fs);
+       err = snd_seq_kernel_client_ctl(client->number, cmd, &data);
        if (err < 0)
                goto error;
 
@@ -123,7 +120,7 @@ static long snd_seq_ioctl_compat(struct file *file, unsigned int cmd, unsigned l
        case SNDRV_SEQ_IOCTL_GET_SUBSCRIPTION:
        case SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT:
        case SNDRV_SEQ_IOCTL_RUNNING_MODE:
-               return snd_seq_do_ioctl(client, cmd, argp);
+               return snd_seq_ioctl(file, cmd, arg);
        case SNDRV_SEQ_IOCTL_CREATE_PORT32:
                return snd_seq_call_port_info_ioctl(client, SNDRV_SEQ_IOCTL_CREATE_PORT, argp);
        case SNDRV_SEQ_IOCTL_DELETE_PORT32:
index af7ed66432661d307cded6269f9072d17ee99b35..dd454867240d27ce21a62a5553657b002793aae3 100644 (file)
@@ -1,4 +1,5 @@
 snd-bebob-objs := bebob_command.o bebob_stream.o bebob_proc.o bebob_midi.o \
-                 bebob_pcm.o bebob_hwdep.o bebob_terratec.o bebob_yamaha.o \
-                 bebob_focusrite.o bebob_maudio.o bebob.o
+                 bebob_pcm.o bebob_hwdep.o bebob_terratec.o \
+                 bebob_yamaha_terratec.o bebob_focusrite.o bebob_maudio.o \
+                 bebob.o
 obj-$(CONFIG_SND_BEBOB) += snd-bebob.o
index f7e2cbd2a3132b0cc52ff2ea3433477ce9a2cc04..3469ac14c89c83d635d2dadb2e52af3119b70d6a 100644 (file)
@@ -458,17 +458,17 @@ static const struct ieee1394_device_id bebob_id_table[] = {
        /* TerraTec Electronic GmbH, PHASE 88 Rack FW */
        SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000003, &phase88_rack_spec),
        /* TerraTec Electronic GmbH, PHASE 24 FW */
-       SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000004, &phase24_series_spec),
+       SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000004, &yamaha_terratec_spec),
        /* TerraTec Electronic GmbH, Phase X24 FW */
-       SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000007, &phase24_series_spec),
+       SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000007, &yamaha_terratec_spec),
        /* TerraTec Electronic GmbH, EWS MIC2/MIC8 */
        SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000005, &spec_normal),
        /* Terratec Electronic GmbH, Aureon 7.1 Firewire */
        SND_BEBOB_DEV_ENTRY(VEN_TERRATEC, 0x00000002, &spec_normal),
        /* Yamaha, GO44 */
-       SND_BEBOB_DEV_ENTRY(VEN_YAMAHA, 0x0010000b, &yamaha_go_spec),
+       SND_BEBOB_DEV_ENTRY(VEN_YAMAHA, 0x0010000b, &yamaha_terratec_spec),
        /* YAMAHA, GO46 */
-       SND_BEBOB_DEV_ENTRY(VEN_YAMAHA, 0x0010000c, &yamaha_go_spec),
+       SND_BEBOB_DEV_ENTRY(VEN_YAMAHA, 0x0010000c, &yamaha_terratec_spec),
        /* Focusrite, SaffirePro 26 I/O */
        SND_BEBOB_DEV_ENTRY(VEN_FOCUSRITE, 0x00000003, &saffirepro_26_spec),
        /* Focusrite, SaffirePro 10 I/O */
index e7f1bb925b12f9e19d76a1c4e563a522473a8436..175da875162d83a298ab4dfa16c64b7847ef4ed2 100644 (file)
@@ -235,8 +235,7 @@ int snd_bebob_create_hwdep_device(struct snd_bebob *bebob);
 
 /* model specific operations */
 extern const struct snd_bebob_spec phase88_rack_spec;
-extern const struct snd_bebob_spec phase24_series_spec;
-extern const struct snd_bebob_spec yamaha_go_spec;
+extern const struct snd_bebob_spec yamaha_terratec_spec;
 extern const struct snd_bebob_spec saffirepro_26_spec;
 extern const struct snd_bebob_spec saffirepro_10_spec;
 extern const struct snd_bebob_spec saffire_le_spec;
index c38358b82ada0ac909ff9e999ee3f57761b5a632..2fdaf93e7a8d3d69d8fa28e91a611c8776b52e76 100644 (file)
@@ -36,25 +36,6 @@ end:
        return err;
 }
 
-static enum snd_bebob_clock_type phase24_series_clk_src_types[] = {
-       SND_BEBOB_CLOCK_TYPE_INTERNAL,
-       SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* S/PDIF */
-};
-static int
-phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
-{
-       int err;
-
-       err = avc_audio_get_selector(bebob->unit, 0, 4, id);
-       if (err < 0)
-               return err;
-
-       if (*id >= ARRAY_SIZE(phase24_series_clk_src_types))
-               return -EIO;
-
-       return 0;
-}
-
 static const struct snd_bebob_rate_spec phase_series_rate_spec = {
        .get    = &snd_bebob_stream_get_rate,
        .set    = &snd_bebob_stream_set_rate,
@@ -71,15 +52,3 @@ const struct snd_bebob_spec phase88_rack_spec = {
        .rate   = &phase_series_rate_spec,
        .meter  = NULL
 };
-
-/* 'PHASE 24 FW' and 'PHASE X24 FW' */
-static const struct snd_bebob_clock_spec phase24_series_clk = {
-       .num    = ARRAY_SIZE(phase24_series_clk_src_types),
-       .types  = phase24_series_clk_src_types,
-       .get    = &phase24_series_clk_src_get,
-};
-const struct snd_bebob_spec phase24_series_spec = {
-       .clock  = &phase24_series_clk,
-       .rate   = &phase_series_rate_spec,
-       .meter  = NULL
-};
diff --git a/sound/firewire/bebob/bebob_yamaha.c b/sound/firewire/bebob/bebob_yamaha.c
deleted file mode 100644 (file)
index 90d4404..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * bebob_yamaha.c - a part of driver for BeBoB based devices
- *
- * Copyright (c) 2013-2014 Takashi Sakamoto
- *
- * Licensed under the terms of the GNU General Public License, version 2.
- */
-
-#include "./bebob.h"
-
-/*
- * NOTE:
- * Yamaha GO44 is not designed to be used as stand-alone mixer. So any streams
- * must be accompanied. If changing the state, a LED on the device starts to
- * blink and its sync status is false. In this state, the device sounds nothing
- * even if streaming. To start streaming at the current sampling rate is only
- * way to revocer this state. GO46 is better for stand-alone mixer.
- *
- * Both of them have a capability to change its sampling rate up to 192.0kHz.
- * At 192.0kHz, the device reports 4 PCM-in, 1 MIDI-in, 6 PCM-out, 1 MIDI-out.
- * But Yamaha's driver reduce 2 PCM-in, 1 MIDI-in, 2 PCM-out, 1 MIDI-out to use
- * 'Extended Stream Format Information Command - Single Request' in 'Additional
- * AVC commands' defined by BridgeCo.
- * This ALSA driver don't do this because a bit tiresome. Then isochronous
- * streaming with many asynchronous transactions brings sounds with noises.
- * Unfortunately current 'ffado-mixer' generated many asynchronous transaction
- * to observe device's state, mainly check cmp connection and signal format. I
- * reccomend users to close ffado-mixer at 192.0kHz if mixer is needless.
- */
-
-static enum snd_bebob_clock_type clk_src_types[] = {
-       SND_BEBOB_CLOCK_TYPE_INTERNAL,
-       SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* S/PDIF */
-};
-static int
-clk_src_get(struct snd_bebob *bebob, unsigned int *id)
-{
-       int err;
-
-       err = avc_audio_get_selector(bebob->unit, 0, 4, id);
-       if (err < 0)
-               return err;
-
-       if (*id >= ARRAY_SIZE(clk_src_types))
-               return -EIO;
-
-       return 0;
-}
-static const struct snd_bebob_clock_spec clock_spec = {
-       .num    = ARRAY_SIZE(clk_src_types),
-       .types  = clk_src_types,
-       .get    = &clk_src_get,
-};
-static const struct snd_bebob_rate_spec rate_spec = {
-       .get    = &snd_bebob_stream_get_rate,
-       .set    = &snd_bebob_stream_set_rate,
-};
-const struct snd_bebob_spec yamaha_go_spec = {
-       .clock  = &clock_spec,
-       .rate   = &rate_spec,
-       .meter  = NULL
-};
diff --git a/sound/firewire/bebob/bebob_yamaha_terratec.c b/sound/firewire/bebob/bebob_yamaha_terratec.c
new file mode 100644 (file)
index 0000000..a6be3e7
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * bebob_yamaha.c - a part of driver for BeBoB based devices
+ *
+ * Copyright (c) 2013-2014 Takashi Sakamoto
+ *
+ * Licensed under the terms of the GNU General Public License, version 2.
+ */
+
+#include "./bebob.h"
+
+/*
+ * NOTE:
+ * Yamaha GO44 is not designed to be used as stand-alone mixer. So any streams
+ * must be accompanied. If changing the state, a LED on the device starts to
+ * blink and its sync status is false. In this state, the device sounds nothing
+ * even if streaming. To start streaming at the current sampling rate is only
+ * way to recover this state. GO46 is better for stand-alone mixer.
+ *
+ * Both of them have a capability to change its sampling rate up to 192.0kHz.
+ * At 192.0kHz, the device reports 4 PCM-in, 1 MIDI-in, 6 PCM-out, 1 MIDI-out.
+ * But Yamaha's driver reduce 2 PCM-in, 1 MIDI-in, 2 PCM-out, 1 MIDI-out to use
+ * 'Extended Stream Format Information Command - Single Request' in 'Additional
+ * AVC commands' defined by BridgeCo.
+ * This ALSA driver don't do this because a bit tiresome. Then isochronous
+ * streaming with many asynchronous transactions brings sounds with noises.
+ * Unfortunately current 'ffado-mixer' generated many asynchronous transaction
+ * to observe device's state, mainly check cmp connection and signal format. I
+ * recommend users to close ffado-mixer at 192.0kHz if mixer is needless.
+ *
+ * Terratec PHASE 24 FW and PHASE X24 FW are internally the same as
+ * Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models.
+ */
+
+static enum snd_bebob_clock_type clk_src_types[] = {
+       SND_BEBOB_CLOCK_TYPE_INTERNAL,
+       SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* S/PDIF */
+};
+static int
+clk_src_get(struct snd_bebob *bebob, unsigned int *id)
+{
+       int err;
+
+       err = avc_audio_get_selector(bebob->unit, 0, 4, id);
+       if (err < 0)
+               return err;
+
+       if (*id >= ARRAY_SIZE(clk_src_types))
+               return -EIO;
+
+       return 0;
+}
+static const struct snd_bebob_clock_spec clock_spec = {
+       .num    = ARRAY_SIZE(clk_src_types),
+       .types  = clk_src_types,
+       .get    = &clk_src_get,
+};
+static const struct snd_bebob_rate_spec rate_spec = {
+       .get    = &snd_bebob_stream_get_rate,
+       .set    = &snd_bebob_stream_set_rate,
+};
+const struct snd_bebob_spec yamaha_terratec_spec = {
+       .clock  = &clock_spec,
+       .rate   = &rate_spec,
+       .meter  = NULL
+};
index 4aa0249826fd1378661d76a75cbb59a9b96ba8db..6074fe1f00f790f971d3a9b3722d330fe38c34b9 100644 (file)
@@ -302,7 +302,7 @@ static snd_pcm_uframes_t playback_pointer(struct snd_pcm_substream *substream)
 
 int snd_dice_create_pcm(struct snd_dice *dice)
 {
-       static struct snd_pcm_ops capture_ops = {
+       static const struct snd_pcm_ops capture_ops = {
                .open      = pcm_open,
                .close     = pcm_close,
                .ioctl     = snd_pcm_lib_ioctl,
@@ -314,7 +314,7 @@ int snd_dice_create_pcm(struct snd_dice *dice)
                .page      = snd_pcm_lib_get_vmalloc_page,
                .mmap      = snd_pcm_lib_mmap_vmalloc,
        };
-       static struct snd_pcm_ops playback_ops = {
+       static const struct snd_pcm_ops playback_ops = {
                .open      = pcm_open,
                .close     = pcm_close,
                .ioctl     = snd_pcm_lib_ioctl,
index cac28f70aef7a418ab1f5659e5c3e8a2f68cd257..613f05872770807698a58ad64fb8de8018c43f6f 100644 (file)
@@ -329,7 +329,7 @@ static snd_pcm_uframes_t pcm_playback_pointer(struct snd_pcm_substream *sbstrm)
        return amdtp_stream_pcm_pointer(&dg00x->rx_stream);
 }
 
-static struct snd_pcm_ops pcm_capture_ops = {
+static const struct snd_pcm_ops pcm_capture_ops = {
        .open           = pcm_open,
        .close          = pcm_close,
        .ioctl          = snd_pcm_lib_ioctl,
@@ -341,7 +341,7 @@ static struct snd_pcm_ops pcm_capture_ops = {
        .page           = snd_pcm_lib_get_vmalloc_page,
 };
 
-static struct snd_pcm_ops pcm_playback_ops = {
+static const struct snd_pcm_ops pcm_playback_ops = {
        .open           = pcm_open,
        .close          = pcm_close,
        .ioctl          = snd_pcm_lib_ioctl,
index 8d233417695d613141c2a49f44c279fc0b57b45e..f3530f89a025cd39a6c69f6e972bd4f68f39c07a 100644 (file)
@@ -388,7 +388,7 @@ static snd_pcm_uframes_t pcm_playback_pointer(struct snd_pcm_substream *sbstm)
 
 int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)
 {
-       static struct snd_pcm_ops capture_ops = {
+       static const struct snd_pcm_ops capture_ops = {
                .open      = pcm_open,
                .close     = pcm_close,
                .ioctl     = snd_pcm_lib_ioctl,
@@ -400,7 +400,7 @@ int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)
                .page      = snd_pcm_lib_get_vmalloc_page,
                .mmap      = snd_pcm_lib_mmap_vmalloc,
        };
-       static struct snd_pcm_ops playback_ops = {
+       static const struct snd_pcm_ops playback_ops = {
                .open      = pcm_open,
                .close     = pcm_close,
                .ioctl     = snd_pcm_lib_ioctl,
index 380d3db969a5896e41dc8f8cee973f60efe38c1a..79db1b651f5c59e2b2af1265eea68e13f14433fe 100644 (file)
@@ -268,7 +268,7 @@ static snd_pcm_uframes_t pcm_playback_pointer(struct snd_pcm_substream *sbstrm)
        return amdtp_stream_pcm_pointer(&tscm->rx_stream);
 }
 
-static struct snd_pcm_ops pcm_capture_ops = {
+static const struct snd_pcm_ops pcm_capture_ops = {
        .open           = pcm_open,
        .close          = pcm_close,
        .ioctl          = snd_pcm_lib_ioctl,
@@ -280,7 +280,7 @@ static struct snd_pcm_ops pcm_capture_ops = {
        .page           = snd_pcm_lib_get_vmalloc_page,
 };
 
-static struct snd_pcm_ops pcm_playback_ops = {
+static const struct snd_pcm_ops pcm_playback_ops = {
        .open           = pcm_open,
        .close          = pcm_close,
        .ioctl          = snd_pcm_lib_ioctl,
index 860f8cad6602d59332f1990b2e3ee216da0b72f6..261469188566c95eb1677266b8c92a7f34d53ad5 100644 (file)
  */
 #define HDAC_MAX_CAPS 10
 
-/**
- * snd_hdac_ext_bus_parse_capabilities - parse capablity structure
- * @ebus: the pointer to extended bus object
- *
- * Returns 0 if successful, or a negative error code.
- */
-int snd_hdac_ext_bus_parse_capabilities(struct hdac_ext_bus *ebus)
-{
-       unsigned int cur_cap;
-       unsigned int offset;
-       struct hdac_bus *bus = &ebus->bus;
-       unsigned int counter = 0;
-
-       offset = snd_hdac_chip_readl(bus, LLCH);
-
-       /* Lets walk the linked capabilities list */
-       do {
-               cur_cap = _snd_hdac_chip_read(l, bus, offset);
-
-               dev_dbg(bus->dev, "Capability version: 0x%x\n",
-                               ((cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF));
-
-               dev_dbg(bus->dev, "HDA capability ID: 0x%x\n",
-                               (cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
-
-               switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
-               case AZX_ML_CAP_ID:
-                       dev_dbg(bus->dev, "Found ML capability\n");
-                       ebus->mlcap = bus->remap_addr + offset;
-                       break;
-
-               case AZX_GTS_CAP_ID:
-                       dev_dbg(bus->dev, "Found GTS capability offset=%x\n", offset);
-                       ebus->gtscap = bus->remap_addr + offset;
-                       break;
-
-               case AZX_PP_CAP_ID:
-                       /* PP capability found, the Audio DSP is present */
-                       dev_dbg(bus->dev, "Found PP capability offset=%x\n", offset);
-                       ebus->ppcap = bus->remap_addr + offset;
-                       break;
-
-               case AZX_SPB_CAP_ID:
-                       /* SPIB capability found, handler function */
-                       dev_dbg(bus->dev, "Found SPB capability\n");
-                       ebus->spbcap = bus->remap_addr + offset;
-                       break;
-
-               case AZX_DRSM_CAP_ID:
-                       /* DMA resume  capability found, handler function */
-                       dev_dbg(bus->dev, "Found DRSM capability\n");
-                       ebus->drsmcap = bus->remap_addr + offset;
-                       break;
-
-               default:
-                       dev_dbg(bus->dev, "Unknown capability %d\n", cur_cap);
-                       break;
-               }
-
-               counter++;
-
-               if (counter > HDAC_MAX_CAPS) {
-                       dev_err(bus->dev, "We exceeded HDAC Ext capablities!!!\n");
-                       break;
-               }
-
-               /* read the offset of next capabiity */
-               offset = cur_cap & AZX_CAP_HDR_NXT_PTR_MASK;
-
-       } while (offset);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_parse_capabilities);
-
 /*
  * processing pipe helpers - these helpers are useful for dealing with HDA
  * new capability of processing pipelines
@@ -118,15 +43,15 @@ void snd_hdac_ext_bus_ppcap_enable(struct hdac_ext_bus *ebus, bool enable)
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->ppcap) {
+       if (!bus->ppcap) {
                dev_err(bus->dev, "Address of PP capability is NULL");
                return;
        }
 
        if (enable)
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL, 0, AZX_PPCTL_GPROCEN);
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, AZX_PPCTL_GPROCEN);
        else
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL, AZX_PPCTL_GPROCEN, 0);
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, AZX_PPCTL_GPROCEN, 0);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_enable);
 
@@ -139,15 +64,15 @@ void snd_hdac_ext_bus_ppcap_int_enable(struct hdac_ext_bus *ebus, bool enable)
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->ppcap) {
+       if (!bus->ppcap) {
                dev_err(bus->dev, "Address of PP capability is NULL\n");
                return;
        }
 
        if (enable)
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL, 0, AZX_PPCTL_PIE);
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0, AZX_PPCTL_PIE);
        else
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL, AZX_PPCTL_PIE, 0);
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, AZX_PPCTL_PIE, 0);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_ppcap_int_enable);
 
@@ -171,7 +96,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus)
        struct hdac_ext_link *hlink;
        struct hdac_bus *bus = &ebus->bus;
 
-       link_count = readl(ebus->mlcap + AZX_REG_ML_MLCD) + 1;
+       link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1;
 
        dev_dbg(bus->dev, "In %s Link count: %d\n", __func__, link_count);
 
@@ -181,7 +106,7 @@ int snd_hdac_ext_bus_get_ml_capabilities(struct hdac_ext_bus *ebus)
                        return -ENOMEM;
                hlink->index = idx;
                hlink->bus = bus;
-               hlink->ml_addr = ebus->mlcap + AZX_ML_BASE +
+               hlink->ml_addr = bus->mlcap + AZX_ML_BASE +
                                        (AZX_ML_INTERVAL * idx);
                hlink->lcaps  = readl(hlink->ml_addr + AZX_REG_ML_LCAP);
                hlink->lsdiid = readw(hlink->ml_addr + AZX_REG_ML_LSDIID);
index 626f3bb24c55da1411f3616566c94253c89ece79..2441273adcef80b3eb7f741241ae08fafb030655 100644 (file)
@@ -40,27 +40,27 @@ void snd_hdac_ext_stream_init(struct hdac_ext_bus *ebus,
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (ebus->ppcap) {
-               stream->pphc_addr = ebus->ppcap + AZX_PPHC_BASE +
+       if (bus->ppcap) {
+               stream->pphc_addr = bus->ppcap + AZX_PPHC_BASE +
                                AZX_PPHC_INTERVAL * idx;
 
-               stream->pplc_addr = ebus->ppcap + AZX_PPLC_BASE +
+               stream->pplc_addr = bus->ppcap + AZX_PPLC_BASE +
                                AZX_PPLC_MULTI * ebus->num_streams +
                                AZX_PPLC_INTERVAL * idx;
        }
 
-       if (ebus->spbcap) {
-               stream->spib_addr = ebus->spbcap + AZX_SPB_BASE +
+       if (bus->spbcap) {
+               stream->spib_addr = bus->spbcap + AZX_SPB_BASE +
                                        AZX_SPB_INTERVAL * idx +
                                        AZX_SPB_SPIB;
 
-               stream->fifo_addr = ebus->spbcap + AZX_SPB_BASE +
+               stream->fifo_addr = bus->spbcap + AZX_SPB_BASE +
                                        AZX_SPB_INTERVAL * idx +
                                        AZX_SPB_MAXFIFO;
        }
 
-       if (ebus->drsmcap)
-               stream->dpibr_addr = ebus->drsmcap + AZX_DRSM_BASE +
+       if (bus->drsmcap)
+               stream->dpibr_addr = bus->drsmcap + AZX_DRSM_BASE +
                                        AZX_DRSM_INTERVAL * idx;
 
        stream->decoupled = false;
@@ -131,10 +131,10 @@ void snd_hdac_ext_stream_decouple(struct hdac_ext_bus *ebus,
 
        spin_lock_irq(&bus->reg_lock);
        if (decouple)
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL, 0,
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL, 0,
                                AZX_PPCTL_PROCEN(hstream->index));
        else
-               snd_hdac_updatel(ebus->ppcap, AZX_REG_PP_PPCTL,
+               snd_hdac_updatel(bus->ppcap, AZX_REG_PP_PPCTL,
                                        AZX_PPCTL_PROCEN(hstream->index), 0);
        stream->decoupled = decouple;
        spin_unlock_irq(&bus->reg_lock);
@@ -255,7 +255,7 @@ hdac_ext_link_stream_assign(struct hdac_ext_bus *ebus,
        struct hdac_stream *stream = NULL;
        struct hdac_bus *hbus = &ebus->bus;
 
-       if (!ebus->ppcap) {
+       if (!hbus->ppcap) {
                dev_err(hbus->dev, "stream type not supported\n");
                return NULL;
        }
@@ -296,7 +296,7 @@ hdac_ext_host_stream_assign(struct hdac_ext_bus *ebus,
        struct hdac_stream *stream = NULL;
        struct hdac_bus *hbus = &ebus->bus;
 
-       if (!ebus->ppcap) {
+       if (!hbus->ppcap) {
                dev_err(hbus->dev, "stream type not supported\n");
                return NULL;
        }
@@ -423,21 +423,21 @@ void snd_hdac_ext_stream_spbcap_enable(struct hdac_ext_bus *ebus,
        u32 register_mask = 0;
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->spbcap) {
+       if (!bus->spbcap) {
                dev_err(bus->dev, "Address of SPB capability is NULL");
                return;
        }
 
        mask |= (1 << index);
 
-       register_mask = readl(ebus->spbcap + AZX_REG_SPB_SPBFCCTL);
+       register_mask = readl(bus->spbcap + AZX_REG_SPB_SPBFCCTL);
 
        mask |= register_mask;
 
        if (enable)
-               snd_hdac_updatel(ebus->spbcap, AZX_REG_SPB_SPBFCCTL, 0, mask);
+               snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, 0, mask);
        else
-               snd_hdac_updatel(ebus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0);
+               snd_hdac_updatel(bus->spbcap, AZX_REG_SPB_SPBFCCTL, mask, 0);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_spbcap_enable);
 
@@ -452,7 +452,7 @@ int snd_hdac_ext_stream_set_spib(struct hdac_ext_bus *ebus,
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->spbcap) {
+       if (!bus->spbcap) {
                dev_err(bus->dev, "Address of SPB capability is NULL");
                return -EINVAL;
        }
@@ -475,7 +475,7 @@ int snd_hdac_ext_stream_get_spbmaxfifo(struct hdac_ext_bus *ebus,
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->spbcap) {
+       if (!bus->spbcap) {
                dev_err(bus->dev, "Address of SPB capability is NULL");
                return -EINVAL;
        }
@@ -515,21 +515,21 @@ void snd_hdac_ext_stream_drsm_enable(struct hdac_ext_bus *ebus,
        u32 register_mask = 0;
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->drsmcap) {
+       if (!bus->drsmcap) {
                dev_err(bus->dev, "Address of DRSM capability is NULL");
                return;
        }
 
        mask |= (1 << index);
 
-       register_mask = readl(ebus->drsmcap + AZX_REG_SPB_SPBFCCTL);
+       register_mask = readl(bus->drsmcap + AZX_REG_SPB_SPBFCCTL);
 
        mask |= register_mask;
 
        if (enable)
-               snd_hdac_updatel(ebus->drsmcap, AZX_REG_DRSM_CTL, 0, mask);
+               snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, 0, mask);
        else
-               snd_hdac_updatel(ebus->drsmcap, AZX_REG_DRSM_CTL, mask, 0);
+               snd_hdac_updatel(bus->drsmcap, AZX_REG_DRSM_CTL, mask, 0);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_drsm_enable);
 
@@ -544,7 +544,7 @@ int snd_hdac_ext_stream_set_dpibr(struct hdac_ext_bus *ebus,
 {
        struct hdac_bus *bus = &ebus->bus;
 
-       if (!ebus->drsmcap) {
+       if (!bus->drsmcap) {
                dev_err(bus->dev, "Address of DRSM capability is NULL");
                return -EINVAL;
        }
index 9fee464e5d49772f53db5d4f5a6485ecaa028b10..043065867656d0bf2a5221fb9741bfc29c14c439 100644 (file)
@@ -255,6 +255,81 @@ int snd_hdac_bus_get_response(struct hdac_bus *bus, unsigned int addr,
 }
 EXPORT_SYMBOL_GPL(snd_hdac_bus_get_response);
 
+#define HDAC_MAX_CAPS 10
+/**
+ * snd_hdac_bus_parse_capabilities - parse capability structure
+ * @bus: the pointer to bus object
+ *
+ * Returns 0 if successful, or a negative error code.
+ */
+int snd_hdac_bus_parse_capabilities(struct hdac_bus *bus)
+{
+       unsigned int cur_cap;
+       unsigned int offset;
+       unsigned int counter = 0;
+
+       offset = snd_hdac_chip_readl(bus, LLCH);
+
+       /* Lets walk the linked capabilities list */
+       do {
+               cur_cap = _snd_hdac_chip_read(l, bus, offset);
+
+               dev_dbg(bus->dev, "Capability version: 0x%x\n",
+                       (cur_cap & AZX_CAP_HDR_VER_MASK) >> AZX_CAP_HDR_VER_OFF);
+
+               dev_dbg(bus->dev, "HDA capability ID: 0x%x\n",
+                       (cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF);
+
+               switch ((cur_cap & AZX_CAP_HDR_ID_MASK) >> AZX_CAP_HDR_ID_OFF) {
+               case AZX_ML_CAP_ID:
+                       dev_dbg(bus->dev, "Found ML capability\n");
+                       bus->mlcap = bus->remap_addr + offset;
+                       break;
+
+               case AZX_GTS_CAP_ID:
+                       dev_dbg(bus->dev, "Found GTS capability offset=%x\n", offset);
+                       bus->gtscap = bus->remap_addr + offset;
+                       break;
+
+               case AZX_PP_CAP_ID:
+                       /* PP capability found, the Audio DSP is present */
+                       dev_dbg(bus->dev, "Found PP capability offset=%x\n", offset);
+                       bus->ppcap = bus->remap_addr + offset;
+                       break;
+
+               case AZX_SPB_CAP_ID:
+                       /* SPIB capability found, handler function */
+                       dev_dbg(bus->dev, "Found SPB capability\n");
+                       bus->spbcap = bus->remap_addr + offset;
+                       break;
+
+               case AZX_DRSM_CAP_ID:
+                       /* DMA resume  capability found, handler function */
+                       dev_dbg(bus->dev, "Found DRSM capability\n");
+                       bus->drsmcap = bus->remap_addr + offset;
+                       break;
+
+               default:
+                       dev_dbg(bus->dev, "Unknown capability %d\n", cur_cap);
+                       break;
+               }
+
+               counter++;
+
+               if (counter > HDAC_MAX_CAPS) {
+                       dev_err(bus->dev, "We exceeded HDAC capabilities!!!\n");
+                       break;
+               }
+
+               /* read the offset of next capability */
+               offset = cur_cap & AZX_CAP_HDR_NXT_PTR_MASK;
+
+       } while (offset);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_hdac_bus_parse_capabilities);
+
 /*
  * Lowlevel interface
  */
index 1fc6d8bc09e54084a3cd38a4116342dd616f2698..8c36990e26f61ae926f48f67ea553bde5cdf8d00 100644 (file)
@@ -571,7 +571,7 @@ snd_ad1889_capture_pointer(struct snd_pcm_substream *ss)
        return bytes_to_frames(ss->runtime, ptr);
 }
 
-static struct snd_pcm_ops snd_ad1889_playback_ops = {
+static const struct snd_pcm_ops snd_ad1889_playback_ops = {
        .open = snd_ad1889_playback_open,
        .close = snd_ad1889_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
@@ -582,7 +582,7 @@ static struct snd_pcm_ops snd_ad1889_playback_ops = {
        .pointer = snd_ad1889_playback_pointer, 
 };
 
-static struct snd_pcm_ops snd_ad1889_capture_ops = {
+static const struct snd_pcm_ops snd_ad1889_capture_ops = {
        .open = snd_ad1889_capture_open,
        .close = snd_ad1889_capture_close,
        .ioctl = snd_pcm_lib_ioctl,
index add3176398d3269781172d9a600193554f851258..ab75601d7c2c4504d7a3737801d357ad758d15fc 100644 (file)
@@ -563,7 +563,7 @@ static snd_pcm_uframes_t snd_als300_pointer(struct snd_pcm_substream *substream)
        return bytes_to_frames(substream->runtime, current_ptr);
 }
 
-static struct snd_pcm_ops snd_als300_playback_ops = {
+static const struct snd_pcm_ops snd_als300_playback_ops = {
        .open =         snd_als300_playback_open,
        .close =        snd_als300_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -574,7 +574,7 @@ static struct snd_pcm_ops snd_als300_playback_ops = {
        .pointer =      snd_als300_pointer,
 };
 
-static struct snd_pcm_ops snd_als300_capture_ops = {
+static const struct snd_pcm_ops snd_als300_capture_ops = {
        .open =         snd_als300_capture_open,
        .close =        snd_als300_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index ff39a0c7277b6d42f646ca0790fffa4ca8fd9c5c..edabe137166013e5e5918017cea434a6958dfabd 100644 (file)
@@ -672,7 +672,7 @@ static int snd_als4000_capture_close(struct snd_pcm_substream *substream)
 
 /******************************************************************/
 
-static struct snd_pcm_ops snd_als4000_playback_ops = {
+static const struct snd_pcm_ops snd_als4000_playback_ops = {
        .open =         snd_als4000_playback_open,
        .close =        snd_als4000_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -683,7 +683,7 @@ static struct snd_pcm_ops snd_als4000_playback_ops = {
        .pointer =      snd_als4000_playback_pointer
 };
 
-static struct snd_pcm_ops snd_als4000_capture_ops = {
+static const struct snd_pcm_ops snd_als4000_capture_ops = {
        .open =         snd_als4000_capture_open,
        .close =        snd_als4000_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 1039eccbb895f29f7f110f2dac0a1d2d45e29fa6..976a3d23557e4792ea5c6bfad4b63cc5a7e113f0 100644 (file)
@@ -1138,7 +1138,7 @@ static int snd_card_asihpi_playback_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_card_asihpi_playback_mmap_ops = {
+static const struct snd_pcm_ops snd_card_asihpi_playback_mmap_ops = {
        .open = snd_card_asihpi_playback_open,
        .close = snd_card_asihpi_playback_close,
        .ioctl = snd_card_asihpi_playback_ioctl,
@@ -1305,7 +1305,7 @@ static int snd_card_asihpi_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = {
+static const struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = {
        .open = snd_card_asihpi_capture_open,
        .close = snd_card_asihpi_capture_close,
        .ioctl = snd_card_asihpi_capture_ioctl,
index 510e56cffd31b6b71664c2b381b424e15b93888b..f9b57647b3197de7eaa8b8268bf8aa960bcf64db 100644 (file)
@@ -2323,11 +2323,8 @@ u16 hpi_sample_clock_get_source_index(u32 h_control, u16 *pw_source_index)
 u16 hpi_sample_clock_query_local_rate(const u32 h_clock, const u32 index,
        u32 *prate)
 {
-       u16 err;
-       err = hpi_control_query(h_clock, HPI_SAMPLECLOCK_LOCAL_SAMPLERATE,
-               index, 0, prate);
-
-       return err;
+       return hpi_control_query(h_clock, HPI_SAMPLECLOCK_LOCAL_SAMPLERATE,
+                                index, 0, prate);
 }
 
 u16 hpi_sample_clock_set_local_rate(u32 h_control, u32 sample_rate)
index 2ce0022dbc4688ecd41cb11e2686cb6266814186..a40c918c8dff2c9e42fae0d872cfcf71ee20569f 100644 (file)
@@ -1148,7 +1148,7 @@ static int snd_atiixp_spdif_close(struct snd_pcm_substream *substream)
 }
 
 /* AC97 playback */
-static struct snd_pcm_ops snd_atiixp_playback_ops = {
+static const struct snd_pcm_ops snd_atiixp_playback_ops = {
        .open =         snd_atiixp_playback_open,
        .close =        snd_atiixp_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1160,7 +1160,7 @@ static struct snd_pcm_ops snd_atiixp_playback_ops = {
 };
 
 /* AC97 capture */
-static struct snd_pcm_ops snd_atiixp_capture_ops = {
+static const struct snd_pcm_ops snd_atiixp_capture_ops = {
        .open =         snd_atiixp_capture_open,
        .close =        snd_atiixp_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1172,7 +1172,7 @@ static struct snd_pcm_ops snd_atiixp_capture_ops = {
 };
 
 /* SPDIF playback */
-static struct snd_pcm_ops snd_atiixp_spdif_ops = {
+static const struct snd_pcm_ops snd_atiixp_spdif_ops = {
        .open =         snd_atiixp_spdif_open,
        .close =        snd_atiixp_spdif_close,
        .ioctl =        snd_pcm_lib_ioctl,
index c534552963e7ecd7825faf64afd9c56e98dc3939..40152feef1e7e82c98f34985888f6ddf2533e961 100644 (file)
@@ -947,7 +947,7 @@ static int snd_atiixp_capture_close(struct snd_pcm_substream *substream)
 
 
 /* AC97 playback */
-static struct snd_pcm_ops snd_atiixp_playback_ops = {
+static const struct snd_pcm_ops snd_atiixp_playback_ops = {
        .open =         snd_atiixp_playback_open,
        .close =        snd_atiixp_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -959,7 +959,7 @@ static struct snd_pcm_ops snd_atiixp_playback_ops = {
 };
 
 /* AC97 capture */
-static struct snd_pcm_ops snd_atiixp_capture_ops = {
+static const struct snd_pcm_ops snd_atiixp_capture_ops = {
        .open =         snd_atiixp_capture_open,
        .close =        snd_atiixp_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 1677143030700380f661d8183a22c77f60ad0ce6..57bbb87d0c628f09f7a4c32e59725f076c303354 100644 (file)
@@ -179,7 +179,7 @@ static struct pci_driver aw2_driver = {
 module_pci_driver(aw2_driver);
 
 /* operators for playback PCM alsa interface */
-static struct snd_pcm_ops snd_aw2_playback_ops = {
+static const struct snd_pcm_ops snd_aw2_playback_ops = {
        .open = snd_aw2_pcm_playback_open,
        .close = snd_aw2_pcm_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
@@ -191,7 +191,7 @@ static struct snd_pcm_ops snd_aw2_playback_ops = {
 };
 
 /* operators for capture PCM alsa interface */
-static struct snd_pcm_ops snd_aw2_capture_ops = {
+static const struct snd_pcm_ops snd_aw2_capture_ops = {
        .open = snd_aw2_pcm_capture_open,
        .close = snd_aw2_pcm_capture_close,
        .ioctl = snd_pcm_lib_ioctl,
index 5e2ef0bb7057cd9c6c78d60213b6f207ee1888ac..80c4a4456197954e801590ed52989a9901f8f6ba 100644 (file)
@@ -2090,7 +2090,7 @@ snd_azf3328_pcm_close(struct snd_pcm_substream *substream
 
 /******************************************************************/
 
-static struct snd_pcm_ops snd_azf3328_playback_ops = {
+static const struct snd_pcm_ops snd_azf3328_playback_ops = {
        .open =         snd_azf3328_pcm_playback_open,
        .close =        snd_azf3328_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -2101,7 +2101,7 @@ static struct snd_pcm_ops snd_azf3328_playback_ops = {
        .pointer =      snd_azf3328_pcm_pointer
 };
 
-static struct snd_pcm_ops snd_azf3328_capture_ops = {
+static const struct snd_pcm_ops snd_azf3328_capture_ops = {
        .open =         snd_azf3328_pcm_capture_open,
        .close =        snd_azf3328_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -2112,7 +2112,7 @@ static struct snd_pcm_ops snd_azf3328_capture_ops = {
        .pointer =      snd_azf3328_pcm_pointer
 };
 
-static struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
+static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
        .open =         snd_azf3328_pcm_i2s_out_open,
        .close =        snd_azf3328_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 5925b7170e25f131e2cdce1fbf9b48f51f557b5b..f2c0709d74411f3042d5eda7b9de1063bbf3fab2 100644 (file)
@@ -550,7 +550,7 @@ static snd_pcm_uframes_t snd_bt87x_pointer(struct snd_pcm_substream *substream)
        return (snd_pcm_uframes_t)bytes_to_frames(runtime, chip->current_line * chip->line_bytes);
 }
 
-static struct snd_pcm_ops snd_bt87x_pcm_ops = {
+static const struct snd_pcm_ops snd_bt87x_pcm_ops = {
        .open = snd_bt87x_pcm_open,
        .close = snd_bt87x_close,
        .ioctl = snd_pcm_lib_ioctl,
index d3cd95633ee2ca6d7bb0475ef01f9c2c6e27fba8..6165a57a94aeac79552aa2fd61f63f4cbd431a79 100644 (file)
@@ -1109,7 +1109,7 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream)
 }
 
 /* operators */
-static struct snd_pcm_ops snd_ca0106_playback_front_ops = {
+static const struct snd_pcm_ops snd_ca0106_playback_front_ops = {
        .open =        snd_ca0106_pcm_open_playback_front,
        .close =       snd_ca0106_pcm_close_playback,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -1120,7 +1120,7 @@ static struct snd_pcm_ops snd_ca0106_playback_front_ops = {
        .pointer =     snd_ca0106_pcm_pointer_playback,
 };
 
-static struct snd_pcm_ops snd_ca0106_capture_0_ops = {
+static const struct snd_pcm_ops snd_ca0106_capture_0_ops = {
        .open =        snd_ca0106_pcm_open_0_capture,
        .close =       snd_ca0106_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -1131,7 +1131,7 @@ static struct snd_pcm_ops snd_ca0106_capture_0_ops = {
        .pointer =     snd_ca0106_pcm_pointer_capture,
 };
 
-static struct snd_pcm_ops snd_ca0106_capture_1_ops = {
+static const struct snd_pcm_ops snd_ca0106_capture_1_ops = {
        .open =        snd_ca0106_pcm_open_1_capture,
        .close =       snd_ca0106_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -1142,7 +1142,7 @@ static struct snd_pcm_ops snd_ca0106_capture_1_ops = {
        .pointer =     snd_ca0106_pcm_pointer_capture,
 };
 
-static struct snd_pcm_ops snd_ca0106_capture_2_ops = {
+static const struct snd_pcm_ops snd_ca0106_capture_2_ops = {
        .open =        snd_ca0106_pcm_open_2_capture,
        .close =       snd_ca0106_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -1153,7 +1153,7 @@ static struct snd_pcm_ops snd_ca0106_capture_2_ops = {
        .pointer =     snd_ca0106_pcm_pointer_capture,
 };
 
-static struct snd_pcm_ops snd_ca0106_capture_3_ops = {
+static const struct snd_pcm_ops snd_ca0106_capture_3_ops = {
        .open =        snd_ca0106_pcm_open_3_capture,
        .close =       snd_ca0106_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -1164,7 +1164,7 @@ static struct snd_pcm_ops snd_ca0106_capture_3_ops = {
        .pointer =     snd_ca0106_pcm_pointer_capture,
 };
 
-static struct snd_pcm_ops snd_ca0106_playback_center_lfe_ops = {
+static const struct snd_pcm_ops snd_ca0106_playback_center_lfe_ops = {
         .open =         snd_ca0106_pcm_open_playback_center_lfe,
         .close =        snd_ca0106_pcm_close_playback,
         .ioctl =        snd_pcm_lib_ioctl,
@@ -1175,7 +1175,7 @@ static struct snd_pcm_ops snd_ca0106_playback_center_lfe_ops = {
         .pointer =      snd_ca0106_pcm_pointer_playback, 
 };
 
-static struct snd_pcm_ops snd_ca0106_playback_unknown_ops = {
+static const struct snd_pcm_ops snd_ca0106_playback_unknown_ops = {
         .open =         snd_ca0106_pcm_open_playback_unknown,
         .close =        snd_ca0106_pcm_close_playback,
         .ioctl =        snd_pcm_lib_ioctl,
@@ -1186,7 +1186,7 @@ static struct snd_pcm_ops snd_ca0106_playback_unknown_ops = {
         .pointer =      snd_ca0106_pcm_pointer_playback, 
 };
 
-static struct snd_pcm_ops snd_ca0106_playback_rear_ops = {
+static const struct snd_pcm_ops snd_ca0106_playback_rear_ops = {
         .open =         snd_ca0106_pcm_open_playback_rear,
         .close =        snd_ca0106_pcm_close_playback,
         .ioctl =        snd_pcm_lib_ioctl,
index 24cdcba06d2797e2531d1859f0cc5207c55f1ae6..73f593526b2d78cecaf8daebd740214e0cabf09f 100644 (file)
@@ -1838,7 +1838,7 @@ static int snd_cmipci_capture_spdif_close(struct snd_pcm_substream *substream)
 /*
  */
 
-static struct snd_pcm_ops snd_cmipci_playback_ops = {
+static const struct snd_pcm_ops snd_cmipci_playback_ops = {
        .open =         snd_cmipci_playback_open,
        .close =        snd_cmipci_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1849,7 +1849,7 @@ static struct snd_pcm_ops snd_cmipci_playback_ops = {
        .pointer =      snd_cmipci_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_cmipci_capture_ops = {
+static const struct snd_pcm_ops snd_cmipci_capture_ops = {
        .open =         snd_cmipci_capture_open,
        .close =        snd_cmipci_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1860,7 +1860,7 @@ static struct snd_pcm_ops snd_cmipci_capture_ops = {
        .pointer =      snd_cmipci_capture_pointer,
 };
 
-static struct snd_pcm_ops snd_cmipci_playback2_ops = {
+static const struct snd_pcm_ops snd_cmipci_playback2_ops = {
        .open =         snd_cmipci_playback2_open,
        .close =        snd_cmipci_playback2_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1871,7 +1871,7 @@ static struct snd_pcm_ops snd_cmipci_playback2_ops = {
        .pointer =      snd_cmipci_capture_pointer,     /* channel B */
 };
 
-static struct snd_pcm_ops snd_cmipci_playback_spdif_ops = {
+static const struct snd_pcm_ops snd_cmipci_playback_spdif_ops = {
        .open =         snd_cmipci_playback_spdif_open,
        .close =        snd_cmipci_playback_spdif_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1882,7 +1882,7 @@ static struct snd_pcm_ops snd_cmipci_playback_spdif_ops = {
        .pointer =      snd_cmipci_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_cmipci_capture_spdif_ops = {
+static const struct snd_pcm_ops snd_cmipci_capture_spdif_ops = {
        .open =         snd_cmipci_capture_spdif_open,
        .close =        snd_cmipci_capture_spdif_close,
        .ioctl =        snd_pcm_lib_ioctl,
index c296fd0dbc9c4d939e422a32ad42033db571ecee..615d8a99d8c87a08fa03df8976709d07e4034b24 100644 (file)
@@ -951,7 +951,7 @@ static int snd_cs4281_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_cs4281_playback_ops = {
+static const struct snd_pcm_ops snd_cs4281_playback_ops = {
        .open =         snd_cs4281_playback_open,
        .close =        snd_cs4281_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -962,7 +962,7 @@ static struct snd_pcm_ops snd_cs4281_playback_ops = {
        .pointer =      snd_cs4281_pointer,
 };
 
-static struct snd_pcm_ops snd_cs4281_capture_ops = {
+static const struct snd_pcm_ops snd_cs4281_capture_ops = {
        .open =         snd_cs4281_capture_open,
        .close =        snd_cs4281_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 2706f271a83b0f19cf7a83b833b9f4e3a35e4242..528102cc2d5d03ce8b516e584133d06a42dc3c39 100644 (file)
@@ -2460,7 +2460,7 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
                udelay(10);
                if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) {
                        dev_dbg(chip->card->dev,
-                               "seconadry codec not present\n");
+                               "secondary codec not present\n");
                        return -ENXIO;
                }
        }
@@ -2503,7 +2503,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
        chip->nr_ac97_codecs = 1;
 
 #ifdef CONFIG_SND_CS46XX_NEW_DSP
-       dev_dbg(chip->card->dev, "detecting seconadry codec\n");
+       dev_dbg(chip->card->dev, "detecting secondary codec\n");
        /* try detect a secondary codec */
        if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX))
                chip->nr_ac97_codecs = 2;
index d2951ed4bf719414934e0b5b7fda1d0cfd97e33c..4a0cbd2241d87448f6c7035a7b91d2073579f41a 100644 (file)
@@ -1441,7 +1441,7 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
        
        if (chip->nr_ac97_codecs == 2) {
                /* create CODEC tasklet for rear Center/LFE output 
-                  slot 6 and 9 on seconadry CODEC */
+                  slot 6 and 9 on secondary CODEC */
                clfe_codec_out_scb = cs46xx_dsp_create_codec_out_scb(chip,"CodecOutSCB_CLFE",0x0030,0x0030,
                                                                     CLFE_MIXER_SCB_ADDR,
                                                                     CLFE_CODEC_SCB_ADDR,
index 27fa57da8dc43bd3c060b629aa204dc6294270e8..c208c1d8dbb2b18877f0da72867c783e6bd8c4db 100644 (file)
@@ -380,7 +380,7 @@ static int snd_cs5535audio_capture_prepare(struct snd_pcm_substream *substream)
                                 substream->runtime->rate);
 }
 
-static struct snd_pcm_ops snd_cs5535audio_playback_ops = {
+static const struct snd_pcm_ops snd_cs5535audio_playback_ops = {
        .open =         snd_cs5535audio_playback_open,
        .close =        snd_cs5535audio_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -391,7 +391,7 @@ static struct snd_pcm_ops snd_cs5535audio_playback_ops = {
        .pointer =      snd_cs5535audio_pcm_pointer,
 };
 
-static struct snd_pcm_ops snd_cs5535audio_capture_ops = {
+static const struct snd_pcm_ops snd_cs5535audio_capture_ops = {
        .open =         snd_cs5535audio_capture_open,
        .close =        snd_cs5535audio_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 977a59855fa6d88d870234fbdf9b6c6c27309efd..908658a00377e3b2fb56579e97d93a3b94851af9 100644 (file)
@@ -1623,7 +1623,7 @@ static int atc_resume(struct ct_atc *atc)
 }
 #endif
 
-static struct ct_atc atc_preset = {
+static const struct ct_atc atc_preset = {
        .map_audio_buffer = ct_map_audio_buffer,
        .unmap_audio_buffer = ct_unmap_audio_buffer,
        .pcm_playback_prepare = atc_pcm_playback_prepare,
index d86c474ca5b62da74aee826b4021bdccb4f09088..974978041558b2a08d1837432240e2abe011cf58 100644 (file)
@@ -372,7 +372,7 @@ ct_pcm_capture_pointer(struct snd_pcm_substream *substream)
 }
 
 /* PCM operators for playback */
-static struct snd_pcm_ops ct_pcm_playback_ops = {
+static const struct snd_pcm_ops ct_pcm_playback_ops = {
        .open           = ct_pcm_playback_open,
        .close          = ct_pcm_playback_close,
        .ioctl          = snd_pcm_lib_ioctl,
@@ -385,7 +385,7 @@ static struct snd_pcm_ops ct_pcm_playback_ops = {
 };
 
 /* PCM operators for capture */
-static struct snd_pcm_ops ct_pcm_capture_ops = {
+static const struct snd_pcm_ops ct_pcm_capture_ops = {
        .open           = ct_pcm_capture_open,
        .close          = ct_pcm_capture_close,
        .ioctl          = snd_pcm_lib_ioctl,
index 419306ef825f61c51c50a507c3c249784f613337..520e19bc649ffcfacea2b10703d9a08e9ae9e7e4 100644 (file)
@@ -166,11 +166,7 @@ static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block)
 static dma_addr_t
 ct_get_ptp_phys(struct ct_vm *vm, int index)
 {
-       dma_addr_t addr;
-
-       addr = (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
-
-       return addr;
+       return (index >= CT_PTP_NUM) ? ~0UL : vm->ptp[index].addr;
 }
 
 int ct_vm_create(struct ct_vm **rvm, struct pci_dev *pci)
index 6d1b98d14327c2ec3ffc5cb2ff91e5cadc413e32..921037ed8468f03a95f80372571f07e3e260893d 100644 (file)
@@ -548,7 +548,7 @@ snd_emu10k1x_pcm_pointer(struct snd_pcm_substream *substream)
 }
 
 /* operators */
-static struct snd_pcm_ops snd_emu10k1x_playback_ops = {
+static const struct snd_pcm_ops snd_emu10k1x_playback_ops = {
        .open =        snd_emu10k1x_playback_open,
        .close =       snd_emu10k1x_playback_close,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -694,7 +694,7 @@ snd_emu10k1x_pcm_pointer_capture(struct snd_pcm_substream *substream)
        return ptr;
 }
 
-static struct snd_pcm_ops snd_emu10k1x_capture_ops = {
+static const struct snd_pcm_ops snd_emu10k1x_capture_ops = {
        .open =        snd_emu10k1x_pcm_open_capture,
        .close =       snd_emu10k1x_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
index 14a305bd8a98577cf50ecad28090996714b2034b..37be1e14d756626a4c9d887c26249807f48dbc81 100644 (file)
@@ -1364,7 +1364,7 @@ static int snd_emu10k1_capture_efx_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_emu10k1_playback_ops = {
+static const struct snd_pcm_ops snd_emu10k1_playback_ops = {
        .open =                 snd_emu10k1_playback_open,
        .close =                snd_emu10k1_playback_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1376,7 +1376,7 @@ static struct snd_pcm_ops snd_emu10k1_playback_ops = {
        .page =                 snd_pcm_sgbuf_ops_page,
 };
 
-static struct snd_pcm_ops snd_emu10k1_capture_ops = {
+static const struct snd_pcm_ops snd_emu10k1_capture_ops = {
        .open =                 snd_emu10k1_capture_open,
        .close =                snd_emu10k1_capture_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1388,7 +1388,7 @@ static struct snd_pcm_ops snd_emu10k1_capture_ops = {
 };
 
 /* EFX playback */
-static struct snd_pcm_ops snd_emu10k1_efx_playback_ops = {
+static const struct snd_pcm_ops snd_emu10k1_efx_playback_ops = {
        .open =                 snd_emu10k1_efx_playback_open,
        .close =                snd_emu10k1_efx_playback_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1455,7 +1455,7 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
 }
 
 
-static struct snd_pcm_ops snd_emu10k1_capture_mic_ops = {
+static const struct snd_pcm_ops snd_emu10k1_capture_mic_ops = {
        .open =                 snd_emu10k1_capture_mic_open,
        .close =                snd_emu10k1_capture_mic_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1550,7 +1550,7 @@ static struct snd_kcontrol_new snd_emu10k1_pcm_efx_voices_mask = {
        .put = snd_emu10k1_pcm_efx_voices_mask_put
 };
 
-static struct snd_pcm_ops snd_emu10k1_capture_efx_ops = {
+static const struct snd_pcm_ops snd_emu10k1_capture_efx_ops = {
        .open =                 snd_emu10k1_capture_efx_open,
        .close =                snd_emu10k1_capture_efx_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1791,7 +1791,7 @@ static int snd_emu10k1_fx8010_playback_close(struct snd_pcm_substream *substream
        return 0;
 }
 
-static struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = {
+static const struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = {
        .open =                 snd_emu10k1_fx8010_playback_open,
        .close =                snd_emu10k1_fx8010_playback_close,
        .ioctl =                snd_pcm_lib_ioctl,
index 3c60b433de9ff5d25686563c2458a411951e52f0..c11f1a29f35d03524cecf6bfe31314ae68366fd3 100644 (file)
@@ -300,37 +300,29 @@ static int snd_p16v_pcm_open_capture(struct snd_pcm_substream *substream)
 static int snd_p16v_pcm_hw_params_playback(struct snd_pcm_substream *substream,
                                      struct snd_pcm_hw_params *hw_params)
 {
-       int result;
-       result = snd_pcm_lib_malloc_pages(substream,
+       return snd_pcm_lib_malloc_pages(substream,
                                        params_buffer_bytes(hw_params));
-       return result;
 }
 
 /* hw_params callback */
 static int snd_p16v_pcm_hw_params_capture(struct snd_pcm_substream *substream,
                                      struct snd_pcm_hw_params *hw_params)
 {
-       int result;
-       result = snd_pcm_lib_malloc_pages(substream,
+       return snd_pcm_lib_malloc_pages(substream,
                                        params_buffer_bytes(hw_params));
-       return result;
 }
 
 
 /* hw_free callback */
 static int snd_p16v_pcm_hw_free_playback(struct snd_pcm_substream *substream)
 {
-       int result;
-       result = snd_pcm_lib_free_pages(substream);
-       return result;
+       return snd_pcm_lib_free_pages(substream);
 }
 
 /* hw_free callback */
 static int snd_p16v_pcm_hw_free_capture(struct snd_pcm_substream *substream)
 {
-       int result;
-       result = snd_pcm_lib_free_pages(substream);
-       return result;
+       return snd_pcm_lib_free_pages(substream);
 }
 
 
@@ -601,7 +593,7 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
 }
 
 /* operators */
-static struct snd_pcm_ops snd_p16v_playback_front_ops = {
+static const struct snd_pcm_ops snd_p16v_playback_front_ops = {
        .open =        snd_p16v_pcm_open_playback_front,
        .close =       snd_p16v_pcm_close_playback,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -612,7 +604,7 @@ static struct snd_pcm_ops snd_p16v_playback_front_ops = {
        .pointer =     snd_p16v_pcm_pointer_playback,
 };
 
-static struct snd_pcm_ops snd_p16v_capture_ops = {
+static const struct snd_pcm_ops snd_p16v_capture_ops = {
        .open =        snd_p16v_pcm_open_capture,
        .close =       snd_p16v_pcm_close_capture,
        .ioctl =       snd_pcm_lib_ioctl,
index 626cd2167d29032e7369ed94c447445acbb9451d..7e760fed07282dc94324bc06dca18a692578fa7f 100644 (file)
@@ -1227,7 +1227,7 @@ static int snd_ensoniq_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ensoniq_playback1_ops = {
+static const struct snd_pcm_ops snd_ensoniq_playback1_ops = {
        .open =         snd_ensoniq_playback1_open,
        .close =        snd_ensoniq_playback1_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1238,7 +1238,7 @@ static struct snd_pcm_ops snd_ensoniq_playback1_ops = {
        .pointer =      snd_ensoniq_playback1_pointer,
 };
 
-static struct snd_pcm_ops snd_ensoniq_playback2_ops = {
+static const struct snd_pcm_ops snd_ensoniq_playback2_ops = {
        .open =         snd_ensoniq_playback2_open,
        .close =        snd_ensoniq_playback2_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1249,7 +1249,7 @@ static struct snd_pcm_ops snd_ensoniq_playback2_ops = {
        .pointer =      snd_ensoniq_playback2_pointer,
 };
 
-static struct snd_pcm_ops snd_ensoniq_capture_ops = {
+static const struct snd_pcm_ops snd_ensoniq_capture_ops = {
        .open =         snd_ensoniq_capture_open,
        .close =        snd_ensoniq_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 8963d7688fb039db81abed97db9a5898e40401f2..68135582948456a15572d5cc5054b35091adf7d6 100644 (file)
@@ -992,7 +992,7 @@ static int snd_es1938_playback_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_es1938_playback_ops = {
+static const struct snd_pcm_ops snd_es1938_playback_ops = {
        .open =         snd_es1938_playback_open,
        .close =        snd_es1938_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1003,7 +1003,7 @@ static struct snd_pcm_ops snd_es1938_playback_ops = {
        .pointer =      snd_es1938_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_es1938_capture_ops = {
+static const struct snd_pcm_ops snd_es1938_capture_ops = {
        .open =         snd_es1938_capture_open,
        .close =        snd_es1938_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 514f2604086e837dd3e986bf6433f8829b224977..8146fb76a4adf7e3db39b96ad5be19c84079d2b3 100644 (file)
@@ -1677,7 +1677,7 @@ static int snd_es1968_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_es1968_playback_ops = {
+static const struct snd_pcm_ops snd_es1968_playback_ops = {
        .open =         snd_es1968_playback_open,
        .close =        snd_es1968_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1688,7 +1688,7 @@ static struct snd_pcm_ops snd_es1968_playback_ops = {
        .pointer =      snd_es1968_pcm_pointer,
 };
 
-static struct snd_pcm_ops snd_es1968_capture_ops = {
+static const struct snd_pcm_ops snd_es1968_capture_ops = {
        .open =         snd_es1968_capture_open,
        .close =        snd_es1968_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index bade9b907b9267dd7741305cc74b3e03f226d3d4..c47287d793065de1f65d0dce58c52cb64eabcf50 100644 (file)
@@ -691,7 +691,7 @@ static int snd_fm801_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_fm801_playback_ops = {
+static const struct snd_pcm_ops snd_fm801_playback_ops = {
        .open =         snd_fm801_playback_open,
        .close =        snd_fm801_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -702,7 +702,7 @@ static struct snd_pcm_ops snd_fm801_playback_ops = {
        .pointer =      snd_fm801_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_fm801_capture_ops = {
+static const struct snd_pcm_ops snd_fm801_capture_ops = {
        .open =         snd_fm801_capture_open,
        .close =        snd_fm801_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 27de8015717d95fdf45ac512a77c60eb32202d67..500878556578c2d7c153f33a6785a9482b1f037b 100644 (file)
 #include <linux/module.h>
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
+
+#ifdef CONFIG_X86
+/* for art-tsc conversion */
+#include <asm/tsc.h>
+#endif
+
 #include <sound/core.h>
 #include <sound/initval.h>
 #include "hda_controller.h"
@@ -337,12 +343,173 @@ static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream *substream)
                               azx_get_position(chip, azx_dev));
 }
 
+/*
+ * azx_scale64: Scale base by mult/div while not overflowing sanely
+ *
+ * Derived from scale64_check_overflow in kernel/time/timekeeping.c
+ *
+ * The tmestamps for a 48Khz stream can overflow after (2^64/10^9)/48K which
+ * is about 384307 ie ~4.5 days.
+ *
+ * This scales the calculation so that overflow will happen but after 2^64 /
+ * 48000 secs, which is pretty large!
+ *
+ * In caln below:
+ *     base may overflow, but since there isn’t any additional division
+ *     performed on base it’s OK
+ *     rem can’t overflow because both are 32-bit values
+ */
+
+#ifdef CONFIG_X86
+static u64 azx_scale64(u64 base, u32 num, u32 den)
+{
+       u64 rem;
+
+       rem = do_div(base, den);
+
+       base *= num;
+       rem *= num;
+
+       do_div(rem, den);
+
+       return base + rem;
+}
+
+static int azx_get_sync_time(ktime_t *device,
+               struct system_counterval_t *system, void *ctx)
+{
+       struct snd_pcm_substream *substream = ctx;
+       struct azx_dev *azx_dev = get_azx_dev(substream);
+       struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
+       struct azx *chip = apcm->chip;
+       struct snd_pcm_runtime *runtime;
+       u64 ll_counter, ll_counter_l, ll_counter_h;
+       u64 tsc_counter, tsc_counter_l, tsc_counter_h;
+       u32 wallclk_ctr, wallclk_cycles;
+       bool direction;
+       u32 dma_select;
+       u32 timeout = 200;
+       u32 retry_count = 0;
+
+       runtime = substream->runtime;
+
+       if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+               direction = 1;
+       else
+               direction = 0;
+
+       /* 0th stream tag is not used, so DMA ch 0 is for 1st stream tag */
+       do {
+               timeout = 100;
+               dma_select = (direction << GTSCC_CDMAS_DMA_DIR_SHIFT) |
+                                       (azx_dev->core.stream_tag - 1);
+               snd_hdac_chip_writel(azx_bus(chip), GTSCC, dma_select);
+
+               /* Enable the capture */
+               snd_hdac_chip_updatel(azx_bus(chip), GTSCC, 0, GTSCC_TSCCI_MASK);
+
+               while (timeout) {
+                       if (snd_hdac_chip_readl(azx_bus(chip), GTSCC) &
+                                               GTSCC_TSCCD_MASK)
+                               break;
+
+                       timeout--;
+               }
+
+               if (!timeout) {
+                       dev_err(chip->card->dev, "GTSCC capture Timedout!\n");
+                       return -EIO;
+               }
+
+               /* Read wall clock counter */
+               wallclk_ctr = snd_hdac_chip_readl(azx_bus(chip), WALFCC);
+
+               /* Read TSC counter */
+               tsc_counter_l = snd_hdac_chip_readl(azx_bus(chip), TSCCL);
+               tsc_counter_h = snd_hdac_chip_readl(azx_bus(chip), TSCCU);
+
+               /* Read Link counter */
+               ll_counter_l = snd_hdac_chip_readl(azx_bus(chip), LLPCL);
+               ll_counter_h = snd_hdac_chip_readl(azx_bus(chip), LLPCU);
+
+               /* Ack: registers read done */
+               snd_hdac_chip_writel(azx_bus(chip), GTSCC, GTSCC_TSCCD_SHIFT);
+
+               tsc_counter = (tsc_counter_h << TSCCU_CCU_SHIFT) |
+                                               tsc_counter_l;
+
+               ll_counter = (ll_counter_h << LLPC_CCU_SHIFT) | ll_counter_l;
+               wallclk_cycles = wallclk_ctr & WALFCC_CIF_MASK;
+
+               /*
+                * An error occurs near frame "rollover". The clocks in
+                * frame value indicates whether this error may have
+                * occurred. Here we use the value of 10 i.e.,
+                * HDA_MAX_CYCLE_OFFSET
+                */
+               if (wallclk_cycles < HDA_MAX_CYCLE_VALUE - HDA_MAX_CYCLE_OFFSET
+                                       && wallclk_cycles > HDA_MAX_CYCLE_OFFSET)
+                       break;
+
+               /*
+                * Sleep before we read again, else we may again get
+                * value near to MAX_CYCLE. Try to sleep for different
+                * amount of time so we dont hit the same number again
+                */
+               udelay(retry_count++);
+
+       } while (retry_count != HDA_MAX_CYCLE_READ_RETRY);
+
+       if (retry_count == HDA_MAX_CYCLE_READ_RETRY) {
+               dev_err_ratelimited(chip->card->dev,
+                       "Error in WALFCC cycle count\n");
+               return -EIO;
+       }
+
+       *device = ns_to_ktime(azx_scale64(ll_counter,
+                               NSEC_PER_SEC, runtime->rate));
+       *device = ktime_add_ns(*device, (wallclk_cycles * NSEC_PER_SEC) /
+                              ((HDA_MAX_CYCLE_VALUE + 1) * runtime->rate));
+
+       *system = convert_art_to_tsc(tsc_counter);
+
+       return 0;
+}
+
+#else
+static int azx_get_sync_time(ktime_t *device,
+               struct system_counterval_t *system, void *ctx)
+{
+       return -ENXIO;
+}
+#endif
+
+static int azx_get_crosststamp(struct snd_pcm_substream *substream,
+                             struct system_device_crosststamp *xtstamp)
+{
+       return get_device_system_crosststamp(azx_get_sync_time,
+                                       substream, NULL, xtstamp);
+}
+
+static inline bool is_link_time_supported(struct snd_pcm_runtime *runtime,
+                               struct snd_pcm_audio_tstamp_config *ts)
+{
+       if (runtime->hw.info & SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME)
+               if (ts->type_requested == SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED)
+                       return true;
+
+       return false;
+}
+
 static int azx_get_time_info(struct snd_pcm_substream *substream,
                        struct timespec *system_ts, struct timespec *audio_ts,
                        struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
                        struct snd_pcm_audio_tstamp_report *audio_tstamp_report)
 {
        struct azx_dev *azx_dev = get_azx_dev(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct system_device_crosststamp xtstamp;
+       int ret;
        u64 nsec;
 
        if ((substream->runtime->hw.info & SNDRV_PCM_INFO_HAS_LINK_ATIME) &&
@@ -361,8 +528,37 @@ static int azx_get_time_info(struct snd_pcm_substream *substream,
                audio_tstamp_report->accuracy_report = 1; /* rest of structure is valid */
                audio_tstamp_report->accuracy = 42; /* 24 MHz WallClock == 42ns resolution */
 
-       } else
+       } else if (is_link_time_supported(runtime, audio_tstamp_config)) {
+
+               ret = azx_get_crosststamp(substream, &xtstamp);
+               if (ret)
+                       return ret;
+
+               switch (runtime->tstamp_type) {
+               case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC:
+                       return -EINVAL;
+
+               case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
+                       *system_ts = ktime_to_timespec(xtstamp.sys_monoraw);
+                       break;
+
+               default:
+                       *system_ts = ktime_to_timespec(xtstamp.sys_realtime);
+                       break;
+
+               }
+
+               *audio_ts = ktime_to_timespec(xtstamp.device);
+
+               audio_tstamp_report->actual_type =
+                       SNDRV_PCM_AUDIO_TSTAMP_TYPE_LINK_SYNCHRONIZED;
+               audio_tstamp_report->accuracy_report = 1;
+               /* 24 MHz WallClock == 42ns resolution */
+               audio_tstamp_report->accuracy = 42;
+
+       } else {
                audio_tstamp_report->actual_type = SNDRV_PCM_AUDIO_TSTAMP_TYPE_DEFAULT;
+       }
 
        return 0;
 }
@@ -412,6 +608,11 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
                goto unlock;
        }
        runtime->private_data = azx_dev;
+
+       if (chip->gts_present)
+               azx_pcm_hw.info = azx_pcm_hw.info |
+                       SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME;
+
        runtime->hw = azx_pcm_hw;
        runtime->hw.channels_min = hinfo->channels_min;
        runtime->hw.channels_max = hinfo->channels_max;
@@ -495,7 +696,7 @@ static int azx_pcm_mmap(struct snd_pcm_substream *substream,
        return snd_pcm_lib_default_mmap(substream, area);
 }
 
-static struct snd_pcm_ops azx_pcm_ops = {
+static const struct snd_pcm_ops azx_pcm_ops = {
        .open = azx_pcm_open,
        .close = azx_pcm_close,
        .ioctl = snd_pcm_lib_ioctl,
index ec63bbf1ec6dccf9eb5dd14463a15ad4f763d77d..a50e0532622a180fc7386d2331995df211145068 100644 (file)
@@ -159,6 +159,9 @@ struct azx {
        unsigned int region_requested:1;
        unsigned int disabled:1; /* disabled by vga_switcheroo */
 
+       /* GTS present */
+       unsigned int gts_present:1;
+
 #ifdef CONFIG_SND_HDA_DSP_LOADER
        struct azx_dev saved_azx_dev;
 #endif
index 160c7f71372289034f87953de4650fb08498298a..c3469f756ec258cccba7f1a339a4335d318bcc23 100644 (file)
@@ -54,6 +54,7 @@
 /* for snoop control */
 #include <asm/pgtable.h>
 #include <asm/cacheflush.h>
+#include <asm/cpufeature.h>
 #endif
 #include <sound/core.h>
 #include <sound/initval.h>
@@ -1663,6 +1664,22 @@ static int azx_first_init(struct azx *chip)
                return -ENXIO;
        }
 
+       if (IS_SKL_PLUS(pci))
+               snd_hdac_bus_parse_capabilities(bus);
+
+       /*
+        * Some Intel CPUs has always running timer (ART) feature and
+        * controller may have Global time sync reporting capability, so
+        * check both of these before declaring synchronized time reporting
+        * capability SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME
+        */
+       chip->gts_present = false;
+
+#ifdef CONFIG_X86
+       if (bus->ppcap && boot_cpu_has(X86_FEATURE_ART))
+               chip->gts_present = true;
+#endif
+
        if (chip->msi) {
                if (chip->driver_caps & AZX_DCAPS_NO_MSI64) {
                        dev_dbg(card->dev, "Disabling 64bit MSI\n");
index 9ceb2bc36e68026bd02dfca8bdca4f9ffab2e849..ad06866d7c69e46c61f20860be8d111fc7a54228 100644 (file)
@@ -4018,7 +4018,7 @@ static int ca0132_build_controls(struct hda_codec *codec)
 /*
  * PCM
  */
-static struct hda_pcm_stream ca0132_pcm_analog_playback = {
+static const struct hda_pcm_stream ca0132_pcm_analog_playback = {
        .substreams = 1,
        .channels_min = 2,
        .channels_max = 6,
@@ -4029,7 +4029,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_playback = {
        },
 };
 
-static struct hda_pcm_stream ca0132_pcm_analog_capture = {
+static const struct hda_pcm_stream ca0132_pcm_analog_capture = {
        .substreams = 1,
        .channels_min = 2,
        .channels_max = 2,
@@ -4040,7 +4040,7 @@ static struct hda_pcm_stream ca0132_pcm_analog_capture = {
        },
 };
 
-static struct hda_pcm_stream ca0132_pcm_digital_playback = {
+static const struct hda_pcm_stream ca0132_pcm_digital_playback = {
        .substreams = 1,
        .channels_min = 2,
        .channels_max = 2,
@@ -4052,7 +4052,7 @@ static struct hda_pcm_stream ca0132_pcm_digital_playback = {
        },
 };
 
-static struct hda_pcm_stream ca0132_pcm_digital_capture = {
+static const struct hda_pcm_stream ca0132_pcm_digital_capture = {
        .substreams = 1,
        .channels_min = 2,
        .channels_max = 2,
@@ -4614,7 +4614,7 @@ static void ca0132_free(struct hda_codec *codec)
        kfree(codec->spec);
 }
 
-static struct hda_codec_ops ca0132_patch_ops = {
+static const struct hda_codec_ops ca0132_patch_ops = {
        .build_controls = ca0132_build_controls,
        .build_pcms = ca0132_build_pcms,
        .init = ca0132_init,
index 32cbcf8618d01f38b9a95918bd91ff0d6930e028..1fe8750df8de714503edda2d58594027748d2f2d 100644 (file)
@@ -5264,6 +5264,8 @@ static const struct hda_fixup alc269_fixups[] = {
        [ALC269_FIXUP_THINKPAD_ACPI] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = hda_fixup_thinkpad_acpi,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_SKU_IGNORE,
        },
        [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
                .type = HDA_FIXUP_FUNC,
index 8ae3bb7975d1a1a1807dce63e681f96e2fcac50e..b4aa4c1370a85f9561cf3d40c9af312a95041407 100644 (file)
@@ -847,7 +847,7 @@ static int snd_ice1712_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ice1712_playback_ops = {
+static const struct snd_pcm_ops snd_ice1712_playback_ops = {
        .open =         snd_ice1712_playback_open,
        .close =        snd_ice1712_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -858,7 +858,7 @@ static struct snd_pcm_ops snd_ice1712_playback_ops = {
        .pointer =      snd_ice1712_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_ice1712_playback_ds_ops = {
+static const struct snd_pcm_ops snd_ice1712_playback_ds_ops = {
        .open =         snd_ice1712_playback_ds_open,
        .close =        snd_ice1712_playback_ds_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -869,7 +869,7 @@ static struct snd_pcm_ops snd_ice1712_playback_ds_ops = {
        .pointer =      snd_ice1712_playback_ds_pointer,
 };
 
-static struct snd_pcm_ops snd_ice1712_capture_ops = {
+static const struct snd_pcm_ops snd_ice1712_capture_ops = {
        .open =         snd_ice1712_capture_open,
        .close =        snd_ice1712_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1228,7 +1228,7 @@ static int snd_ice1712_capture_pro_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ice1712_playback_pro_ops = {
+static const struct snd_pcm_ops snd_ice1712_playback_pro_ops = {
        .open =         snd_ice1712_playback_pro_open,
        .close =        snd_ice1712_playback_pro_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1239,7 +1239,7 @@ static struct snd_pcm_ops snd_ice1712_playback_pro_ops = {
        .pointer =      snd_ice1712_playback_pro_pointer,
 };
 
-static struct snd_pcm_ops snd_ice1712_capture_pro_ops = {
+static const struct snd_pcm_ops snd_ice1712_capture_pro_ops = {
        .open =         snd_ice1712_capture_pro_open,
        .close =        snd_ice1712_capture_pro_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 0b22c00642bba475629007a7920426cbb1b84fbe..e5c52ed9b6747003993d93ff4f1e2f1a760ced3e 100644 (file)
@@ -620,9 +620,7 @@ static const unsigned int stdclock_rate_list[16] = {
 
 static unsigned int stdclock_get_rate(struct snd_ice1712 *ice)
 {
-       unsigned int rate;
-       rate = stdclock_rate_list[inb(ICEMT1724(ice, RATE)) & 15];
-       return rate;
+       return stdclock_rate_list[inb(ICEMT1724(ice, RATE)) & 15];
 }
 
 static void stdclock_set_rate(struct snd_ice1712 *ice, unsigned int rate)
@@ -1113,7 +1111,7 @@ static int snd_vt1724_capture_pro_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_vt1724_playback_pro_ops = {
+static const struct snd_pcm_ops snd_vt1724_playback_pro_ops = {
        .open =         snd_vt1724_playback_pro_open,
        .close =        snd_vt1724_playback_pro_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1124,7 +1122,7 @@ static struct snd_pcm_ops snd_vt1724_playback_pro_ops = {
        .pointer =      snd_vt1724_playback_pro_pointer,
 };
 
-static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
+static const struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
        .open =         snd_vt1724_capture_pro_open,
        .close =        snd_vt1724_capture_pro_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1292,7 +1290,7 @@ static int snd_vt1724_capture_spdif_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_vt1724_playback_spdif_ops = {
+static const struct snd_pcm_ops snd_vt1724_playback_spdif_ops = {
        .open =         snd_vt1724_playback_spdif_open,
        .close =        snd_vt1724_playback_spdif_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1303,7 +1301,7 @@ static struct snd_pcm_ops snd_vt1724_playback_spdif_ops = {
        .pointer =      snd_vt1724_pcm_pointer,
 };
 
-static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = {
+static const struct snd_pcm_ops snd_vt1724_capture_spdif_ops = {
        .open =         snd_vt1724_capture_spdif_open,
        .close =        snd_vt1724_capture_spdif_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1437,7 +1435,7 @@ static int snd_vt1724_playback_indep_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_vt1724_playback_indep_ops = {
+static const struct snd_pcm_ops snd_vt1724_playback_indep_ops = {
        .open =         snd_vt1724_playback_indep_open,
        .close =        snd_vt1724_playback_indep_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 9e1ad119a3ce0430579d648ae34e6eedc3b7af10..565f7f55c3ca4d44bf0156e7da0c7bafe3863271 100644 (file)
@@ -1681,7 +1681,7 @@ static int snd_korg1212_capture_copy(struct snd_pcm_substream *substream,
        return snd_korg1212_copy_to(korg1212, dst, pos, count, 0, korg1212->channels * 2);
 }
 
-static struct snd_pcm_ops snd_korg1212_playback_ops = {
+static const struct snd_pcm_ops snd_korg1212_playback_ops = {
         .open =                snd_korg1212_playback_open,
         .close =       snd_korg1212_playback_close,
         .ioctl =       snd_korg1212_ioctl,
@@ -1693,7 +1693,7 @@ static struct snd_pcm_ops snd_korg1212_playback_ops = {
         .silence =     snd_korg1212_playback_silence,
 };
 
-static struct snd_pcm_ops snd_korg1212_capture_ops = {
+static const struct snd_pcm_ops snd_korg1212_capture_ops = {
        .open =         snd_korg1212_capture_open,
        .close =        snd_korg1212_capture_close,
        .ioctl =        snd_korg1212_ioctl,
index 3bd6985430e824b72e2fd71432ff13afd864a000..1268ba329016f77c54bb7ed4769ab4a7ea31cc4a 100644 (file)
@@ -586,7 +586,7 @@ void lola_pcm_update(struct lola *chip, struct lola_pcm *pcm, unsigned int bits)
        }
 }
 
-static struct snd_pcm_ops lola_pcm_ops = {
+static const struct snd_pcm_ops lola_pcm_ops = {
        .open = lola_pcm_open,
        .close = lola_pcm_close,
        .ioctl = snd_pcm_lib_ioctl,
index 8b8e2e54fba3f1520d3ed6c6f22185274ca6ae5b..c0f0c349c3ec19fd26ab3955e1a202d9796f611b 100644 (file)
@@ -804,7 +804,7 @@ mac_ready:
        return err;
 }
 
-static struct snd_pcm_ops lx_ops_playback = {
+static const struct snd_pcm_ops lx_ops_playback = {
        .open      = lx_pcm_open,
        .close     = lx_pcm_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -815,7 +815,7 @@ static struct snd_pcm_ops lx_ops_playback = {
        .pointer   = lx_pcm_stream_pointer,
 };
 
-static struct snd_pcm_ops lx_ops_capture = {
+static const struct snd_pcm_ops lx_ops_capture = {
        .open      = lx_pcm_open,
        .close     = lx_pcm_close,
        .ioctl     = snd_pcm_lib_ioctl,
index 17ae92613de4bc7502f33ff64d4dc076177ef992..cafea6dc5c0105b6d1bdedc3545c5b1bcac925ec 100644 (file)
@@ -1834,7 +1834,7 @@ snd_m3_capture_close(struct snd_pcm_substream *subs)
  * create pcm instance
  */
 
-static struct snd_pcm_ops snd_m3_playback_ops = {
+static const struct snd_pcm_ops snd_m3_playback_ops = {
        .open =         snd_m3_playback_open,
        .close =        snd_m3_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1845,7 +1845,7 @@ static struct snd_pcm_ops snd_m3_playback_ops = {
        .pointer =      snd_m3_pcm_pointer,
 };
 
-static struct snd_pcm_ops snd_m3_capture_ops = {
+static const struct snd_pcm_ops snd_m3_capture_ops = {
        .open =         snd_m3_capture_open,
        .close =        snd_m3_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 25c0ddd3a53bb6219ca41c00bfaef708b374a34b..80d439944cb52777af180a5cadfb9dcc344cbf15 100644 (file)
@@ -922,7 +922,7 @@ static snd_pcm_uframes_t snd_mixart_stream_pointer(struct snd_pcm_substream *sub
 
 
 
-static struct snd_pcm_ops snd_mixart_playback_ops = {
+static const struct snd_pcm_ops snd_mixart_playback_ops = {
        .open      = snd_mixart_playback_open,
        .close     = snd_mixart_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -933,7 +933,7 @@ static struct snd_pcm_ops snd_mixart_playback_ops = {
        .pointer   = snd_mixart_stream_pointer,
 };
 
-static struct snd_pcm_ops snd_mixart_capture_ops = {
+static const struct snd_pcm_ops snd_mixart_capture_ops = {
        .open      = snd_mixart_capture_open,
        .close     = snd_mixart_close,
        .ioctl     = snd_pcm_lib_ioctl,
index 4735e27cc773688fe672a9bc7f609b3b38be85e4..103fe311e5a9827a6fba13e54d035f736b69370d 100644 (file)
@@ -902,7 +902,7 @@ snd_nm256_capture_close(struct snd_pcm_substream *substream)
 /*
  * create a pcm instance
  */
-static struct snd_pcm_ops snd_nm256_playback_ops = {
+static const struct snd_pcm_ops snd_nm256_playback_ops = {
        .open =         snd_nm256_playback_open,
        .close =        snd_nm256_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -917,7 +917,7 @@ static struct snd_pcm_ops snd_nm256_playback_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_nm256_capture_ops = {
+static const struct snd_pcm_ops snd_nm256_capture_ops = {
        .open =         snd_nm256_capture_open,
        .close =        snd_nm256_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index aa2ebd1d6d12ed2fe9714a5664f4c809c4f93a51..042a2439fea5241bc545a0a58368e2ff3ec9c8c6 100644 (file)
@@ -631,7 +631,7 @@ static snd_pcm_uframes_t oxygen_pointer(struct snd_pcm_substream *substream)
        return bytes_to_frames(runtime, curr_addr - (u32)runtime->dma_addr);
 }
 
-static struct snd_pcm_ops oxygen_rec_a_ops = {
+static const struct snd_pcm_ops oxygen_rec_a_ops = {
        .open      = oxygen_rec_a_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -642,7 +642,7 @@ static struct snd_pcm_ops oxygen_rec_a_ops = {
        .pointer   = oxygen_pointer,
 };
 
-static struct snd_pcm_ops oxygen_rec_b_ops = {
+static const struct snd_pcm_ops oxygen_rec_b_ops = {
        .open      = oxygen_rec_b_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -653,7 +653,7 @@ static struct snd_pcm_ops oxygen_rec_b_ops = {
        .pointer   = oxygen_pointer,
 };
 
-static struct snd_pcm_ops oxygen_rec_c_ops = {
+static const struct snd_pcm_ops oxygen_rec_c_ops = {
        .open      = oxygen_rec_c_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -664,7 +664,7 @@ static struct snd_pcm_ops oxygen_rec_c_ops = {
        .pointer   = oxygen_pointer,
 };
 
-static struct snd_pcm_ops oxygen_spdif_ops = {
+static const struct snd_pcm_ops oxygen_spdif_ops = {
        .open      = oxygen_spdif_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -675,7 +675,7 @@ static struct snd_pcm_ops oxygen_spdif_ops = {
        .pointer   = oxygen_pointer,
 };
 
-static struct snd_pcm_ops oxygen_multich_ops = {
+static const struct snd_pcm_ops oxygen_multich_ops = {
        .open      = oxygen_multich_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
@@ -686,7 +686,7 @@ static struct snd_pcm_ops oxygen_multich_ops = {
        .pointer   = oxygen_pointer,
 };
 
-static struct snd_pcm_ops oxygen_ac97_ops = {
+static const struct snd_pcm_ops oxygen_ac97_ops = {
        .open      = oxygen_ac97_open,
        .close     = oxygen_close,
        .ioctl     = snd_pcm_lib_ioctl,
index 9293235281dc41a104f3f9748cea1cfd337f8528..bb7eee9d0c2bbb695159641368843620f9aa32c4 100644 (file)
@@ -1146,7 +1146,7 @@ static snd_pcm_uframes_t pcxhr_stream_pointer(struct snd_pcm_substream *subs)
 }
 
 
-static struct snd_pcm_ops pcxhr_ops = {
+static const struct snd_pcm_ops pcxhr_ops = {
        .open      = pcxhr_open,
        .close     = pcxhr_close,
        .ioctl     = snd_pcm_lib_ioctl,
index 067a91207d8e53bc521988b449cd7a65b4308f63..ada5f01d479c1eece5e553a78a035af477d7e2ca 100644 (file)
@@ -644,7 +644,7 @@ static struct lbuspath lbus_play_paths[] = {
         .mono = lbus_play_mono3,
         },
 };
-static struct lbuspath lbus_rec_path = {
+static const struct lbuspath lbus_rec_path = {
        .noconv = lbus_rec_noconv1,
        .stereo = lbus_rec_stereo1,
        .mono = lbus_rec_mono1,
@@ -1669,7 +1669,7 @@ static int snd_riptide_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_riptide_playback_ops = {
+static const struct snd_pcm_ops snd_riptide_playback_ops = {
        .open = snd_riptide_playback_open,
        .close = snd_riptide_playback_close,
        .ioctl = snd_pcm_lib_ioctl,
@@ -1680,7 +1680,7 @@ static struct snd_pcm_ops snd_riptide_playback_ops = {
        .trigger = snd_riptide_trigger,
        .pointer = snd_riptide_pointer,
 };
-static struct snd_pcm_ops snd_riptide_capture_ops = {
+static const struct snd_pcm_ops snd_riptide_capture_ops = {
        .open = snd_riptide_capture_open,
        .close = snd_riptide_capture_close,
        .ioctl = snd_pcm_lib_ioctl,
index cd94ac548ba383a99ee10886c94343877f760211..96d15db65dfd28230e6514c7d2a833d41148ebca 100644 (file)
@@ -1196,7 +1196,7 @@ snd_rme32_capture_fd_pointer(struct snd_pcm_substream *substream)
 }
 
 /* for halfduplex mode */
-static struct snd_pcm_ops snd_rme32_playback_spdif_ops = {
+static const struct snd_pcm_ops snd_rme32_playback_spdif_ops = {
        .open =         snd_rme32_playback_spdif_open,
        .close =        snd_rme32_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1210,7 +1210,7 @@ static struct snd_pcm_ops snd_rme32_playback_spdif_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme32_capture_spdif_ops = {
+static const struct snd_pcm_ops snd_rme32_capture_spdif_ops = {
        .open =         snd_rme32_capture_spdif_open,
        .close =        snd_rme32_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1223,7 +1223,7 @@ static struct snd_pcm_ops snd_rme32_capture_spdif_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme32_playback_adat_ops = {
+static const struct snd_pcm_ops snd_rme32_playback_adat_ops = {
        .open =         snd_rme32_playback_adat_open,
        .close =        snd_rme32_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1236,7 +1236,7 @@ static struct snd_pcm_ops snd_rme32_playback_adat_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme32_capture_adat_ops = {
+static const struct snd_pcm_ops snd_rme32_capture_adat_ops = {
        .open =         snd_rme32_capture_adat_open,
        .close =        snd_rme32_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1249,7 +1249,7 @@ static struct snd_pcm_ops snd_rme32_capture_adat_ops = {
 };
 
 /* for fullduplex mode */
-static struct snd_pcm_ops snd_rme32_playback_spdif_fd_ops = {
+static const struct snd_pcm_ops snd_rme32_playback_spdif_fd_ops = {
        .open =         snd_rme32_playback_spdif_open,
        .close =        snd_rme32_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1261,7 +1261,7 @@ static struct snd_pcm_ops snd_rme32_playback_spdif_fd_ops = {
        .ack =          snd_rme32_playback_fd_ack,
 };
 
-static struct snd_pcm_ops snd_rme32_capture_spdif_fd_ops = {
+static const struct snd_pcm_ops snd_rme32_capture_spdif_fd_ops = {
        .open =         snd_rme32_capture_spdif_open,
        .close =        snd_rme32_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1273,7 +1273,7 @@ static struct snd_pcm_ops snd_rme32_capture_spdif_fd_ops = {
        .ack =          snd_rme32_capture_fd_ack,
 };
 
-static struct snd_pcm_ops snd_rme32_playback_adat_fd_ops = {
+static const struct snd_pcm_ops snd_rme32_playback_adat_fd_ops = {
        .open =         snd_rme32_playback_adat_open,
        .close =        snd_rme32_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1284,7 +1284,7 @@ static struct snd_pcm_ops snd_rme32_playback_adat_fd_ops = {
        .ack =          snd_rme32_playback_fd_ack,
 };
 
-static struct snd_pcm_ops snd_rme32_capture_adat_fd_ops = {
+static const struct snd_pcm_ops snd_rme32_capture_adat_fd_ops = {
        .open =         snd_rme32_capture_adat_open,
        .close =        snd_rme32_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 41c31db650390c651617530ce08b44e11a889e2f..05b9da30990dcd4f3b78c4d3907a29320c661e6a 100644 (file)
@@ -1505,7 +1505,7 @@ snd_rme96_capture_pointer(struct snd_pcm_substream *substream)
        return snd_rme96_capture_ptr(rme96);
 }
 
-static struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
+static const struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
        .open =         snd_rme96_playback_spdif_open,
        .close =        snd_rme96_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1518,7 +1518,7 @@ static struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
+static const struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
        .open =         snd_rme96_capture_spdif_open,
        .close =        snd_rme96_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1530,7 +1530,7 @@ static struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme96_playback_adat_ops = {
+static const struct snd_pcm_ops snd_rme96_playback_adat_ops = {
        .open =         snd_rme96_playback_adat_open,
        .close =        snd_rme96_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1543,7 +1543,7 @@ static struct snd_pcm_ops snd_rme96_playback_adat_ops = {
        .mmap =         snd_pcm_lib_mmap_iomem,
 };
 
-static struct snd_pcm_ops snd_rme96_capture_adat_ops = {
+static const struct snd_pcm_ops snd_rme96_capture_adat_ops = {
        .open =         snd_rme96_capture_adat_open,
        .close =        snd_rme96_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 7c8941b8b2defd9b21b8159f1cef333659ce423d..b94fc6357139e17c207107b18a3dadc6d177ce06 100644 (file)
@@ -4861,7 +4861,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
        return 0;
 }
 
-static struct snd_pcm_ops snd_hdsp_playback_ops = {
+static const struct snd_pcm_ops snd_hdsp_playback_ops = {
        .open =         snd_hdsp_playback_open,
        .close =        snd_hdsp_playback_release,
        .ioctl =        snd_hdsp_ioctl,
@@ -4873,7 +4873,7 @@ static struct snd_pcm_ops snd_hdsp_playback_ops = {
        .silence =      snd_hdsp_hw_silence,
 };
 
-static struct snd_pcm_ops snd_hdsp_capture_ops = {
+static const struct snd_pcm_ops snd_hdsp_capture_ops = {
        .open =         snd_hdsp_capture_open,
        .close =        snd_hdsp_capture_release,
        .ioctl =        snd_hdsp_ioctl,
index a4a999a0317eaefc30eeb2265fd38b784c4afd8a..14bbf55c1ef9601d87611af3136cf91cf7fca51d 100644 (file)
@@ -1666,7 +1666,7 @@ static int hdspm_set_rate(struct hdspm * hdspm, int rate, int called_internally)
                            HDSPM_AUTOSYNC_FROM_NONE) {
 
                                dev_warn(hdspm->card->dev,
-                                        "Detected no Externel Sync\n");
+                                        "Detected no External Sync\n");
                                not_set = 1;
 
                        } else if (rate != external_freq) {
@@ -6361,7 +6361,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
        return 0;
 }
 
-static struct snd_pcm_ops snd_hdspm_ops = {
+static const struct snd_pcm_ops snd_hdspm_ops = {
        .open = snd_hdspm_open,
        .close = snd_hdspm_release,
        .ioctl = snd_hdspm_ioctl,
index fdbc0aa2776a3934e9f71aba48e52d0808650493..55172c6899919f1ec9bb0e9a8245fce7f7233ef1 100644 (file)
@@ -2368,7 +2368,7 @@ static int snd_rme9652_capture_release(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_rme9652_playback_ops = {
+static const struct snd_pcm_ops snd_rme9652_playback_ops = {
        .open =         snd_rme9652_playback_open,
        .close =        snd_rme9652_playback_release,
        .ioctl =        snd_rme9652_ioctl,
@@ -2380,7 +2380,7 @@ static struct snd_pcm_ops snd_rme9652_playback_ops = {
        .silence =      snd_rme9652_hw_silence,
 };
 
-static struct snd_pcm_ops snd_rme9652_capture_ops = {
+static const struct snd_pcm_ops snd_rme9652_capture_ops = {
        .open =         snd_rme9652_capture_open,
        .close =        snd_rme9652_capture_release,
        .ioctl =        snd_rme9652_ioctl,
index 1b6fad7d4d562e86c54836aa352fead389209798..e1a13870bb804422bf58a2eedc8b1d9e1f9f917f 100644 (file)
@@ -857,7 +857,7 @@ static int snd_sonicvibes_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_sonicvibes_playback_ops = {
+static const struct snd_pcm_ops snd_sonicvibes_playback_ops = {
        .open =         snd_sonicvibes_playback_open,
        .close =        snd_sonicvibes_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -868,7 +868,7 @@ static struct snd_pcm_ops snd_sonicvibes_playback_ops = {
        .pointer =      snd_sonicvibes_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_sonicvibes_capture_ops = {
+static const struct snd_pcm_ops snd_sonicvibes_capture_ops = {
        .open =         snd_sonicvibes_capture_open,
        .close =        snd_sonicvibes_capture_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 599d2b7eb5b8022b4a8ea0f6f6b9eef72656f470..27f0ed8409798849fb375947e4f490e5eb4ece77 100644 (file)
@@ -2070,7 +2070,7 @@ static int snd_trident_foldback_close(struct snd_pcm_substream *substream)
    PCM operations
   ---------------------------------------------------------------------------*/
 
-static struct snd_pcm_ops snd_trident_playback_ops = {
+static const struct snd_pcm_ops snd_trident_playback_ops = {
        .open =         snd_trident_playback_open,
        .close =        snd_trident_playback_close,
        .ioctl =        snd_trident_ioctl,
@@ -2081,7 +2081,7 @@ static struct snd_pcm_ops snd_trident_playback_ops = {
        .pointer =      snd_trident_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_trident_nx_playback_ops = {
+static const struct snd_pcm_ops snd_trident_nx_playback_ops = {
        .open =         snd_trident_playback_open,
        .close =        snd_trident_playback_close,
        .ioctl =        snd_trident_ioctl,
@@ -2115,7 +2115,7 @@ static struct snd_pcm_ops snd_trident_si7018_capture_ops = {
        .pointer =      snd_trident_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_trident_foldback_ops = {
+static const struct snd_pcm_ops snd_trident_foldback_ops = {
        .open =         snd_trident_foldback_open,
        .close =        snd_trident_foldback_close,
        .ioctl =        snd_trident_ioctl,
@@ -2126,7 +2126,7 @@ static struct snd_pcm_ops snd_trident_foldback_ops = {
        .pointer =      snd_trident_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_trident_nx_foldback_ops = {
+static const struct snd_pcm_ops snd_trident_nx_foldback_ops = {
        .open =         snd_trident_foldback_open,
        .close =        snd_trident_foldback_close,
        .ioctl =        snd_trident_ioctl,
@@ -2138,7 +2138,7 @@ static struct snd_pcm_ops snd_trident_nx_foldback_ops = {
        .page =         snd_pcm_sgbuf_ops_page,
 };
 
-static struct snd_pcm_ops snd_trident_spdif_ops = {
+static const struct snd_pcm_ops snd_trident_spdif_ops = {
        .open =         snd_trident_spdif_open,
        .close =        snd_trident_spdif_close,
        .ioctl =        snd_trident_ioctl,
@@ -2149,7 +2149,7 @@ static struct snd_pcm_ops snd_trident_spdif_ops = {
        .pointer =      snd_trident_spdif_pointer,
 };
 
-static struct snd_pcm_ops snd_trident_spdif_7018_ops = {
+static const struct snd_pcm_ops snd_trident_spdif_7018_ops = {
        .open =         snd_trident_spdif_open,
        .close =        snd_trident_spdif_close,
        .ioctl =        snd_trident_ioctl,
index 3dd038bdb2042127f8480c0f3fcb83e1193ca5c5..38a17b4342a6561b5e6d58e0514dfd4446d9de4f 100644 (file)
@@ -1366,7 +1366,7 @@ static int snd_via8233_playback_close(struct snd_pcm_substream *substream)
 
 
 /* via686 playback callbacks */
-static struct snd_pcm_ops snd_via686_playback_ops = {
+static const struct snd_pcm_ops snd_via686_playback_ops = {
        .open =         snd_via686_playback_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1379,7 +1379,7 @@ static struct snd_pcm_ops snd_via686_playback_ops = {
 };
 
 /* via686 capture callbacks */
-static struct snd_pcm_ops snd_via686_capture_ops = {
+static const struct snd_pcm_ops snd_via686_capture_ops = {
        .open =         snd_via82xx_capture_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1392,7 +1392,7 @@ static struct snd_pcm_ops snd_via686_capture_ops = {
 };
 
 /* via823x DSX playback callbacks */
-static struct snd_pcm_ops snd_via8233_playback_ops = {
+static const struct snd_pcm_ops snd_via8233_playback_ops = {
        .open =         snd_via8233_playback_open,
        .close =        snd_via8233_playback_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1405,7 +1405,7 @@ static struct snd_pcm_ops snd_via8233_playback_ops = {
 };
 
 /* via823x multi-channel playback callbacks */
-static struct snd_pcm_ops snd_via8233_multi_ops = {
+static const struct snd_pcm_ops snd_via8233_multi_ops = {
        .open =         snd_via8233_multi_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -1418,7 +1418,7 @@ static struct snd_pcm_ops snd_via8233_multi_ops = {
 };
 
 /* via823x capture callbacks */
-static struct snd_pcm_ops snd_via8233_capture_ops = {
+static const struct snd_pcm_ops snd_via8233_capture_ops = {
        .open =         snd_via82xx_capture_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 99b9137bc67726f28750eb5fd07636cf301994e2..2f6d40f10618569e047a473cd465822f4d04ee0e 100644 (file)
@@ -804,7 +804,7 @@ static int snd_via82xx_pcm_close(struct snd_pcm_substream *substream)
 
 
 /* via686 playback callbacks */
-static struct snd_pcm_ops snd_via686_playback_ops = {
+static const struct snd_pcm_ops snd_via686_playback_ops = {
        .open =         snd_via82xx_playback_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
@@ -817,7 +817,7 @@ static struct snd_pcm_ops snd_via686_playback_ops = {
 };
 
 /* via686 capture callbacks */
-static struct snd_pcm_ops snd_via686_capture_ops = {
+static const struct snd_pcm_ops snd_via686_capture_ops = {
        .open =         snd_via82xx_capture_open,
        .close =        snd_via82xx_pcm_close,
        .ioctl =        snd_pcm_lib_ioctl,
index 4c26076dbf78ba10decce834e019d64dccd9a51b..ffee284898b37d0dd2d649b1b7882941909fa00d 100644 (file)
@@ -1123,7 +1123,7 @@ static int snd_ymfpci_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ymfpci_playback_ops = {
+static const struct snd_pcm_ops snd_ymfpci_playback_ops = {
        .open =                 snd_ymfpci_playback_open,
        .close =                snd_ymfpci_playback_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1134,7 +1134,7 @@ static struct snd_pcm_ops snd_ymfpci_playback_ops = {
        .pointer =              snd_ymfpci_playback_pointer,
 };
 
-static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
+static const struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
        .open =                 snd_ymfpci_capture_rec_open,
        .close =                snd_ymfpci_capture_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1169,7 +1169,7 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device)
                                     snd_pcm_std_chmaps, 2, 0, NULL);
 }
 
-static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
+static const struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
        .open =                 snd_ymfpci_capture_ac97_open,
        .close =                snd_ymfpci_capture_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1203,7 +1203,7 @@ int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
+static const struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
        .open =                 snd_ymfpci_playback_spdif_open,
        .close =                snd_ymfpci_playback_spdif_close,
        .ioctl =                snd_pcm_lib_ioctl,
@@ -1236,7 +1236,7 @@ int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device)
        return 0;
 }
 
-static struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = {
+static const struct snd_pcm_ops snd_ymfpci_playback_4ch_ops = {
        .open =                 snd_ymfpci_playback_4ch_open,
        .close =                snd_ymfpci_playback_4ch_close,
        .ioctl =                snd_pcm_lib_ioctl,
index 368242519279ae56054d1cfe097104f8a1bbd2cc..b84d7d34f1886b6c72f669f17b4a3cef5a196ef0 100644 (file)
@@ -564,9 +564,7 @@ static int snd_ps3_pcm_hw_params(struct snd_pcm_substream *substream,
 
 static int snd_ps3_pcm_hw_free(struct snd_pcm_substream *substream)
 {
-       int ret;
-       ret = snd_pcm_lib_free_pages(substream);
-       return ret;
+       return snd_pcm_lib_free_pages(substream);
 };
 
 static int snd_ps3_delay_to_bytes(struct snd_pcm_substream *substream,
index 5bbaa667bec1c608c35968c983eaeece020ad8db..c8455b47388bcd901290e6a70ec178d4e48aa11a 100644 (file)
@@ -184,15 +184,9 @@ struct sst_byt {
 
 static inline u64 sst_byt_header(int msg_id, int data, bool large, int str_id)
 {
-       u64 header;
-
-       header = IPC_HEADER_MSG_ID(msg_id) |
-                IPC_HEADER_STR_ID(str_id) |
-                IPC_HEADER_LARGE(large) |
-                IPC_HEADER_DATA(data) |
-                SST_BYT_IPCX_BUSY;
-
-       return header;
+       return IPC_HEADER_MSG_ID(msg_id) | IPC_HEADER_STR_ID(str_id) |
+              IPC_HEADER_LARGE(large) | IPC_HEADER_DATA(data) |
+              SST_BYT_IPCX_BUSY;
 }
 
 static inline u16 sst_byt_header_msg_id(u64 header)
index 44ab595ce21ab111e1a9297858561019aac0abe2..83a731fc884ea0967358333185aed672e963a1ff 100644 (file)
@@ -296,7 +296,7 @@ int skl_suspend_dsp(struct skl *skl)
        int ret;
 
        /* if ppcap is not supported return 0 */
-       if (!skl->ebus.ppcap)
+       if (!skl->ebus.bus.ppcap)
                return 0;
 
        ret = skl_dsp_sleep(ctx->dsp);
@@ -316,7 +316,7 @@ int skl_resume_dsp(struct skl *skl)
        int ret;
 
        /* if ppcap is not supported return 0 */
-       if (!skl->ebus.ppcap)
+       if (!skl->ebus.bus.ppcap)
                return 0;
 
        /* enable ppcap interrupt */
index 6e05bf8622f7ad1f1cf0ac6f9b11516469e4b86f..5ae86c227d453eceb39852cd50e4015483f44e3f 100644 (file)
@@ -106,7 +106,7 @@ static void skl_set_pcm_constrains(struct hdac_ext_bus *ebus,
 
 static enum hdac_ext_stream_type skl_get_host_stream_type(struct hdac_ext_bus *ebus)
 {
-       if (ebus->ppcap)
+       if ((ebus_to_hbus(ebus))->ppcap)
                return HDAC_EXT_STREAM_TYPE_HOST;
        else
                return HDAC_EXT_STREAM_TYPE_COUPLED;
@@ -188,7 +188,7 @@ static int skl_get_format(struct snd_pcm_substream *substream,
        struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
        int format_val = 0;
 
-       if (ebus->ppcap) {
+       if ((ebus_to_hbus(ebus))->ppcap) {
                struct snd_pcm_runtime *runtime = substream->runtime;
 
                format_val = snd_hdac_calc_stream_format(runtime->rate,
@@ -1020,7 +1020,7 @@ static int skl_platform_pcm_trigger(struct snd_pcm_substream *substream,
 {
        struct hdac_ext_bus *ebus = get_bus_ctx(substream);
 
-       if (!ebus->ppcap)
+       if ((ebus_to_hbus(ebus))->ppcap)
                return skl_coupled_trigger(substream, cmd);
 
        return 0;
@@ -1144,7 +1144,7 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
        struct skl *skl = ebus_to_skl(ebus);
        int ret;
 
-       if (ebus->ppcap) {
+       if ((ebus_to_hbus(ebus))->ppcap) {
                ret = skl_tplg_init(platform, ebus);
                if (ret < 0) {
                        dev_err(platform->dev, "Failed to init topology!\n");
index e3e7641677657ecffb828ec94c865d0e80201dbf..2989c164dafe3a719ed219d2f47ddf73a20ea64d 100644 (file)
@@ -587,7 +587,7 @@ static int skl_first_init(struct hdac_ext_bus *ebus)
                return -ENXIO;
        }
 
-       snd_hdac_ext_bus_parse_capabilities(ebus);
+       snd_hdac_bus_parse_capabilities(bus);
 
        if (skl_acquire_irq(ebus, 0) < 0)
                return -EBUSY;
@@ -684,7 +684,7 @@ static int skl_probe(struct pci_dev *pci,
        skl_dmic_data.dmic_num = skl_get_dmic_geo(skl);
 
        /* check if dsp is there */
-       if (ebus->ppcap) {
+       if (bus->ppcap) {
                err = skl_machine_device_register(skl,
                                  (void *)pci_id->driver_data);
                if (err < 0)
@@ -698,7 +698,7 @@ static int skl_probe(struct pci_dev *pci,
                skl->skl_sst->enable_miscbdcge = skl_enable_miscbdcge;
 
        }
-       if (ebus->mlcap)
+       if (bus->mlcap)
                snd_hdac_ext_bus_get_ml_capabilities(ebus);
 
        /* create device for soc dmic */
index 327f8642ca80e66de2d0c880034cbd530f046dd1..8f66ba730d69d943196ddd7629e777083846b9ec 100644 (file)
@@ -739,7 +739,6 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret)
        for (i = 0; i < N_URBS; i++) {
                urbs[i] = usb_alloc_urb(FRAMES_PER_URB, GFP_KERNEL);
                if (!urbs[i]) {
-                       dev_err(dev, "unable to usb_alloc_urb(), OOM!?\n");
                        *ret = -ENOMEM;
                        return urbs;
                }
index 71778ca4b26aafcb3dacedcc660947a5df61f7e2..111b0f009afa493c1aab56ae7fd6c4b07b648996 100644 (file)
@@ -92,7 +92,7 @@ struct snd_usb_endpoint {
        unsigned int curframesize;      /* current packet size in frames (for capture) */
        unsigned int syncmaxsize;       /* sync endpoint packet size */
        unsigned int fill_max:1;        /* fill max packet size always */
-       unsigned int udh01_fb_quirk:1;  /* corrupted feedback data */
+       unsigned int tenor_fb_quirk:1;  /* corrupted feedback data */
        unsigned int datainterval;      /* log_2 of data packet interval */
        unsigned int syncinterval;      /* P for adaptive mode, 0 otherwise */
        unsigned char silence_value;
index c07a7eda42a28eee533752e28f787ccfd2230ed2..c470251cea4b251269bcd3822f27d0e09e3cd1b2 100644 (file)
@@ -502,10 +502,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip,
                        ep->syncinterval = 3;
 
                ep->syncmaxsize = le16_to_cpu(get_endpoint(alts, 1)->wMaxPacketSize);
-
-               if (chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ &&
-                   ep->syncmaxsize == 4)
-                       ep->udh01_fb_quirk = 1;
        }
 
        list_add_tail(&ep->list, &chip->ep_list);
@@ -1171,15 +1167,16 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
        if (f == 0)
                return;
 
-       if (unlikely(sender->udh01_fb_quirk)) {
+       if (unlikely(sender->tenor_fb_quirk)) {
                /*
-                * The TEAC UD-H01 firmware sometimes changes the feedback value
+                * Devices based on Tenor 8802 chipsets (TEAC UD-H01
+                * and others) sometimes change the feedback value
                 * by +/- 0x1.0000.
                 */
                if (f < ep->freqn - 0x8000)
-                       f += 0x10000;
+                       f += 0xf000;
                else if (f > ep->freqn + 0x8000)
-                       f -= 0x10000;
+                       f -= 0xf000;
        } else if (unlikely(ep->freqshift == INT_MIN)) {
                /*
                 * The first time we see a feedback value, determine its format
index 789d19ec035daf4aab2e2094d1952be71e25f822..2c44386e5569f0099c0a535a9def0bafe54d008b 100644 (file)
@@ -176,10 +176,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
                int r, idx;
 
                fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
-               if (fp->rate_table == NULL) {
-                       usb_audio_err(chip, "cannot malloc\n");
+               if (fp->rate_table == NULL)
                        return -ENOMEM;
-               }
 
                fp->nr_rates = 0;
                fp->rate_min = fp->rate_max = 0;
index 152292e5ee2b2246ab649a65a920ce4b1f7e1669..2782155ae3ce02f2d7e31ebabd96245df479952c 100644 (file)
@@ -1217,6 +1217,12 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
             ep->chip->usb_id == USB_ID(0x0763, 0x2031)) &&
            ep->type == SND_USB_ENDPOINT_TYPE_DATA)
                ep->skip_packets = 16;
+
+       /* Work around devices that report unreasonable feedback data */
+       if ((ep->chip->usb_id == USB_ID(0x0644, 0x8038) ||  /* TEAC UD-H01 */
+            ep->chip->usb_id == USB_ID(0x1852, 0x5034)) && /* T+A Dac8 */
+           ep->syncmaxsize == 4)
+               ep->tenor_fb_quirk = 1;
 }
 
 void snd_usb_set_interface_quirk(struct usb_device *dev)
This page took 0.125711 seconds and 5 git commands to generate.