Changeset 711


Ignore:
Timestamp:
Aug 5, 2022, 4:38:17 AM (3 years ago)
Author:
Paul Smedley
Message:

Update source to 5.15.59

Location:
GPL/branches/uniaud32-next
Files:
62 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/core/init.c

    r710 r711  
    214214 * is added automatically.  In that way, the resource disconnection is assured
    215215 * at first, then released in the expected order.
     216 *
     217 * If an error happens at the probe before snd_card_register() is called and
     218 * there have been other devres resources, you'd need to free the card manually
     219 * via snd_card_free() call in the error; otherwise it may lead to UAF due to
     220 * devres call orders.  You can use snd_card_free_on_error() helper for
     221 * handling it more easily.
    216222 */
    217223int snd_devm_card_new(struct device *parent, int idx, const char *xid,
     
    239245}
    240246EXPORT_SYMBOL_GPL(snd_devm_card_new);
     247
     248/**
     249 * snd_card_free_on_error - a small helper for handling devm probe errors
     250 * @dev: the managed device object
     251 * @ret: the return code from the probe callback
     252 *
     253 * This function handles the explicit snd_card_free() call at the error from
     254 * the probe callback.  It's just a small helper for simplifying the error
     255 * handling with the managed devices.
     256 */
     257int snd_card_free_on_error(struct device *dev, int ret)
     258{
     259        struct snd_card *card;
     260
     261        if (!ret)
     262                return 0;
     263        card = devres_find(dev, __snd_card_release, NULL, NULL);
     264        if (card)
     265                snd_card_free(card);
     266        return ret;
     267}
     268EXPORT_SYMBOL_GPL(snd_card_free_on_error);
    241269
    242270static int snd_card_init(struct snd_card *card, struct device *parent,
  • GPL/branches/uniaud32-next/alsa-kernel/core/jack.c

    r693 r711  
    4343        struct snd_jack *jack = device->device_data;
    4444
    45         if (!jack->input_dev)
     45        mutex_lock(&jack->input_dev_lock);
     46        if (!jack->input_dev) {
     47                mutex_unlock(&jack->input_dev_lock);
    4648                return 0;
     49        }
    4750
    4851        /* If the input device is registered with the input subsystem
     
    5356                input_free_device(jack->input_dev);
    5457        jack->input_dev = NULL;
     58        mutex_unlock(&jack->input_dev_lock);
    5559#endif /* CONFIG_SND_JACK_INPUT_DEV */
    5660        return 0;
     
    6367        struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl;
    6468
     69        down_write(&card->controls_rwsem);
    6570        list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list, struct snd_jack_kctl) {
    6671                list_del_init(&jack_kctl->list);
    6772                snd_ctl_remove(card, jack_kctl->kctl);
    6873        }
     74        up_write(&card->controls_rwsem);
     75
    6976        if (jack->private_free)
    7077                jack->private_free(jack);
     
    8895                 card->shortname, jack->id);
    8996
    90         if (!jack->input_dev)
     97        mutex_lock(&jack->input_dev_lock);
     98        if (!jack->input_dev) {
     99                mutex_unlock(&jack->input_dev_lock);
    91100                return 0;
     101        }
    92102
    93103        jack->input_dev->name = jack->name;
     
    114124                jack->registered = 1;
    115125
     126        mutex_unlock(&jack->input_dev_lock);
    116127        return err;
    117128}
     
    510521
    511522        jack->id = kstrdup(id, GFP_KERNEL);
    512 
    513         /* don't creat input device for phantom jack */
     523        if (jack->id == NULL) {
     524                kfree(jack);
     525                return -ENOMEM;
     526        }
     527
     528#ifdef CONFIG_SND_JACK_INPUT_DEV
     529        mutex_init(&jack->input_dev_lock);
     530
     531        /* don't create input device for phantom jack */
    514532        if (!phantom_jack) {
    515 #ifdef CONFIG_SND_JACK_INPUT_DEV
    516533                int i;
    517534
     
    531548                                                     jack_switch_types[i]);
    532549
     550        }
    533551#endif /* CONFIG_SND_JACK_INPUT_DEV */
    534         }
    535552
    536553        err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
     
    572589{
    573590        WARN_ON(jack->registered);
    574         if (!jack->input_dev)
     591        mutex_lock(&jack->input_dev_lock);
     592        if (!jack->input_dev) {
     593                mutex_unlock(&jack->input_dev_lock);
    575594                return;
     595        }
    576596
    577597        jack->input_dev->dev.parent = parent;
     598        mutex_unlock(&jack->input_dev_lock);
    578599}
    579600EXPORT_SYMBOL(snd_jack_set_parent);
     
    623644/**
    624645 * snd_jack_report - Report the current status of a jack
     646 * Note: This function uses mutexes and should be called from a
     647 * context which can sleep (such as a workqueue).
    625648 *
    626649 * @jack:   The jack to report status for
     
    648671
    649672#ifdef CONFIG_SND_JACK_INPUT_DEV
    650         if (!jack->input_dev)
     673        mutex_lock(&jack->input_dev_lock);
     674        if (!jack->input_dev) {
     675                mutex_unlock(&jack->input_dev_lock);
    651676                return;
     677        }
    652678
    653679        for (i = 0; i < ARRAY_SIZE(jack->key); i++) {
     
    669695
    670696        input_sync(jack->input_dev);
     697        mutex_unlock(&jack->input_dev_lock);
    671698#endif /* CONFIG_SND_JACK_INPUT_DEV */
    672699}
  • GPL/branches/uniaud32-next/alsa-kernel/core/misc.c

    r629 r711  
    113113        const struct snd_pci_quirk *q;
    114114
    115         for (q = list; q->subvendor; q++) {
     115        for (q = list; q->subvendor || q->subdevice; q++) {
    116116                if (q->subvendor != vendor)
    117117                        continue;
  • GPL/branches/uniaud32-next/alsa-kernel/core/oss/pcm_oss.c

    r697 r711  
    152152 * Return the maximum value for field PAR.
    153153 */
    154 static unsigned int
     154static int
    155155snd_pcm_hw_param_value_max(const struct snd_pcm_hw_params *params,
    156156                           snd_pcm_hw_param_t var, int *dir)
     
    691691                                   struct snd_pcm_hw_params *slave_params)
    692692{
    693         size_t s;
    694         size_t oss_buffer_size, oss_period_size, oss_periods;
    695         size_t min_period_size, max_period_size;
     693        ssize_t s;
     694        ssize_t oss_buffer_size;
     695        ssize_t oss_period_size, oss_periods;
     696        ssize_t min_period_size, max_period_size;
    696697        struct snd_pcm_runtime *runtime = substream->runtime;
    697698        size_t oss_frame_size;
     
    700701                         params_channels(oss_params) / 8;
    701702
     703        oss_buffer_size = snd_pcm_hw_param_value_max(slave_params,
     704                                                     SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
     705                                                     NULL);
     706        if (oss_buffer_size <= 0)
     707                return -EINVAL;
    702708        oss_buffer_size = snd_pcm_plug_client_size(substream,
    703                                                    snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, NULL)) * oss_frame_size;
    704         if (!oss_buffer_size)
     709                                                   oss_buffer_size * oss_frame_size);
     710        if (oss_buffer_size <= 0)
    705711                return -EINVAL;
    706712        oss_buffer_size = rounddown_pow_of_two(oss_buffer_size);
     
    739745        min_period_size = snd_pcm_plug_client_size(substream,
    740746                                                   snd_pcm_hw_param_value_min(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
    741         if (min_period_size) {
     747        if (min_period_size > 0) {
    742748                min_period_size *= oss_frame_size;
    743749                min_period_size = roundup_pow_of_two(min_period_size);
     
    748754        max_period_size = snd_pcm_plug_client_size(substream,
    749755                                                   snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, NULL));
    750         if (max_period_size) {
     756        if (max_period_size > 0) {
    751757                max_period_size *= oss_frame_size;
    752758                max_period_size = rounddown_pow_of_two(max_period_size);
     
    762768
    763769        s = snd_pcm_hw_param_value_max(slave_params, SNDRV_PCM_HW_PARAM_PERIODS, NULL);
    764         if (runtime->oss.maxfrags && s > runtime->oss.maxfrags)
     770        if (s > 0 && runtime->oss.maxfrags && s > runtime->oss.maxfrags)
    765771                s = runtime->oss.maxfrags;
    766772        if (oss_periods > s)
     
    778784        if (oss_period_size < 16)
    779785                return -EINVAL;
     786
     787        /* don't allocate too large period; 1MB period must be enough */
     788        if (oss_period_size > 1024 * 1024)
     789                return -ENOMEM;
     790
    780791        runtime->oss.period_bytes = oss_period_size;
    781792        runtime->oss.period_frames = 1;
     
    888899                goto failure;
    889900        }
    890         choose_rate(substream, sparams, runtime->oss.rate);
    891         snd_pcm_hw_param_near(substream, sparams, SNDRV_PCM_HW_PARAM_CHANNELS, runtime->oss.channels, NULL);
     901
     902        err = choose_rate(substream, sparams, runtime->oss.rate);
     903        if (err < 0)
     904                goto failure;
     905        err = snd_pcm_hw_param_near(substream, sparams,
     906                                    SNDRV_PCM_HW_PARAM_CHANNELS,
     907                                    runtime->oss.channels, NULL);
     908        if (err < 0)
     909                goto failure;
    892910
    893911        format = snd_pcm_oss_format_from(runtime->oss.format);
     
    10401058        }
    10411059#endif
    1042         oss_period_size *= oss_frame_size;
    1043 
    1044         oss_buffer_size = oss_period_size * runtime->oss.periods;
    1045         if (oss_buffer_size < 0) {
     1060        oss_period_size = array_size(oss_period_size, oss_frame_size);
     1061        oss_buffer_size = array_size(oss_period_size, runtime->oss.periods);
     1062        if (oss_buffer_size <= 0) {
    10461063                err = -EINVAL;
    10471064                goto failure;
     
    19701987                return -EINVAL;
    19711988        fragshift = val & 0xffff;
    1972         if (fragshift >= 31)
     1989        if (fragshift >= 25) /* should be large enough */
    19731990                return -EINVAL;
    19741991        runtime->oss.fragshift = fragshift;
     
    20662083
    20672084#ifdef OSS_DEBUG
    2068         pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger);
     2085        pr_debug("pcm_oss: trigger = 0x%x\n", trigger);
    20692086#endif
    20702087       
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm.c

    r697 r711  
    818818{
    819819        if (pstr->chmap_kctl) {
    820                 snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl);
     820                struct snd_card *card = pstr->pcm->card;
     821
     822                down_write(&card->controls_rwsem);
     823                snd_ctl_remove(card, pstr->chmap_kctl);
     824                up_write(&card->controls_rwsem);
    821825                pstr->chmap_kctl = NULL;
    822826        }
     
    973977
    974978        runtime->status->state = SNDRV_PCM_STATE_OPEN;
     979        mutex_init(&runtime->buffer_mutex);
     980        atomic_set(&runtime->buffer_accessing, 0);
    975981
    976982        substream->runtime = runtime;
     
    10061012                substream->runtime = NULL;
    10071013        }
     1014        mutex_destroy(&runtime->buffer_mutex);
    10081015        kfree(runtime);
    10091016        put_pid(substream->pid);
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm_lib.c

    r697 r711  
    23032303                        goto _end_unlock;
    23042304                }
     2305#ifndef TARGET_OS2
     2306                if (!atomic_inc_unless_negative(&runtime->buffer_accessing)) {
     2307                        err = -EBUSY;
     2308                        goto _end_unlock;
     2309                }
     2310#endif
    23052311                snd_pcm_stream_unlock_irq(substream);
    23062312                err = writer(substream, appl_ofs, data, offset, frames,
    23072313                             transfer);
    23082314                snd_pcm_stream_lock_irq(substream);
     2315#ifndef TARGET_OS2
     2316                atomic_dec(&runtime->buffer_accessing);
     2317#endif
    23092318                if (err < 0)
    23102319                        goto _end_unlock;
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm_memory.c

    r710 r711  
    159159        struct snd_dma_buffer new_dmab;
    160160
     161        mutex_lock(&substream->pcm->open_mutex);
    161162        if (substream->runtime) {
    162163                buffer->error = -EBUSY;
    163                 return;
     164                goto unlock;
    164165        }
    165166        if (!snd_info_get_line(buffer, line, sizeof(line))) {
     
    168169                if ((size != 0 && size < 8192) || size > substream->dma_max) {
    169170                        buffer->error = -EINVAL;
    170                         return;
     171                        goto unlock;
    171172                }
    172173                if (substream->dma_buffer.bytes == size)
    173                         return;
     174                        goto unlock;
    174175                memset(&new_dmab, 0, sizeof(new_dmab));
    175176                new_dmab.dev = substream->dma_buffer.dev;
     
    184185                                         substream->stream ? 'c' : 'p', substream->number,
    185186                                         substream->pcm->name, size);
    186                                 return;
     187                                goto unlock;
    187188                        }
    188189                        substream->buffer_bytes_max = size;
     
    196197                buffer->error = -EINVAL;
    197198        }
     199 unlock:
     200        mutex_unlock(&substream->pcm->open_mutex);
    198201}
    199202
     
    444447int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream)
    445448{
    446         struct snd_card *card = substream->pcm->card;
    447449        struct snd_pcm_runtime *runtime;
    448450
     
    453455                return 0;
    454456        if (runtime->dma_buffer_p != &substream->dma_buffer) {
     457                struct snd_card *card = substream->pcm->card;
     458
    455459                /* it's a newly allocated buffer.  release it now. */
    456460                do_free_pages(card, runtime->dma_buffer_p);
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm_misc.c

    r697 r711  
    434434        width = pcm_formats[(INT)format].phys; /* physical width */
    435435        pat = pcm_formats[(INT)format].silence;
    436         if (! width)
     436        if (!width || !pat)
    437437                return -EINVAL;
    438438        /* signed or 1 byte data */
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm_native.c

    r710 r711  
    677677}
    678678
     679#ifndef TARGET_OS2
     680/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise
     681 * block the further r/w operations
     682 */
     683static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
     684{
     685        if (!atomic_dec_unless_positive(&runtime->buffer_accessing))
     686                return -EBUSY;
     687        mutex_lock(&runtime->buffer_mutex);
     688        return 0; /* keep buffer_mutex, unlocked by below */
     689}
     690#endif
     691
     692/* release buffer_mutex and clear r/w access flag */
     693static void snd_pcm_buffer_access_unlock(struct snd_pcm_runtime *runtime)
     694{
     695        mutex_unlock(&runtime->buffer_mutex);
     696        atomic_inc(&runtime->buffer_accessing);
     697}
     698
     699#if IS_ENABLED(CONFIG_SND_PCM_OSS)
     700#define is_oss_stream(substream)        ((substream)->oss.oss)
     701#else
     702#define is_oss_stream(substream)        false
     703#endif
     704
    679705static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
    680706                             struct snd_pcm_hw_params *params)
     
    688714                return -ENXIO;
    689715        runtime = substream->runtime;
     716#ifndef TARGET_OS2
     717        err = snd_pcm_buffer_access_lock(runtime);
     718        if (err < 0)
     719                return err;
     720#endif
    690721        snd_pcm_stream_lock_irq(substream);
    691722        switch (runtime->status->state) {
     
    693724        case SNDRV_PCM_STATE_SETUP:
    694725        case SNDRV_PCM_STATE_PREPARED:
     726                if (!is_oss_stream(substream) &&
     727                    atomic_read(&substream->mmap_count))
     728                        err = -EBADFD;
    695729                break;
    696730        default:
    697                 snd_pcm_stream_unlock_irq(substream);
    698                 return -EBADFD;
     731                err = -EBADFD;
     732                break;
    699733        }
    700734        snd_pcm_stream_unlock_irq(substream);
    701 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS)
    702         if (!substream->oss.oss)
    703 #endif
    704                 if (atomic_read(&substream->mmap_count))
    705                         return -EBADFD;
     735        if (err)
     736                goto unlock;
    706737
    707738        snd_pcm_sync_stop(substream, true);
     
    791822                cpu_latency_qos_add_request(&substream->latency_pm_qos_req,
    792823                                            usecs);
    793         return 0;
     824        err = 0;
    794825 _error:
    795         /* hardware might be unusable from this time,
    796            so we force application to retry to set
    797            the correct hardware parameter settings */
    798         snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
    799         if (substream->ops->hw_free != NULL)
    800                 substream->ops->hw_free(substream);
    801         if (substream->managed_buffer_alloc)
    802                 snd_pcm_lib_free_pages(substream);
     826        if (err) {
     827                /* hardware might be unusable from this time,
     828                 * so we force application to retry to set
     829                 * the correct hardware parameter settings
     830                 */
     831                snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
     832                if (substream->ops->hw_free != NULL)
     833                        substream->ops->hw_free(substream);
     834                if (substream->managed_buffer_alloc)
     835                        snd_pcm_lib_free_pages(substream);
     836        }
     837 unlock:
     838        snd_pcm_buffer_access_unlock(runtime);
    803839        return err;
    804840}
     
    840876{
    841877        struct snd_pcm_runtime *runtime;
    842         int result;
     878        int result = 0;
    843879
    844880        if (PCM_RUNTIME_CHECK(substream))
    845881                return -ENXIO;
    846882        runtime = substream->runtime;
     883#ifndef TARGET_OS2
     884        result = snd_pcm_buffer_access_lock(runtime);
     885        if (result < 0)
     886                return result;
     887#endif
    847888        snd_pcm_stream_lock_irq(substream);
    848889        switch (runtime->status->state) {
    849890        case SNDRV_PCM_STATE_SETUP:
    850891        case SNDRV_PCM_STATE_PREPARED:
     892                if (atomic_read(&substream->mmap_count))
     893                        result = -EBADFD;
    851894                break;
    852895        default:
    853                 snd_pcm_stream_unlock_irq(substream);
    854                 return -EBADFD;
     896                result = -EBADFD;
     897                break;
    855898        }
    856899        snd_pcm_stream_unlock_irq(substream);
    857         if (atomic_read(&substream->mmap_count))
    858                 return -EBADFD;
     900        if (result)
     901                goto unlock;
    859902        result = do_hw_free(substream);
    860903        snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
    861904        cpu_latency_qos_remove_request(&substream->latency_pm_qos_req);
     905 unlock:
     906        snd_pcm_buffer_access_unlock(runtime);
    862907        return result;
    863908}
     
    11861231                                struct snd_pcm_substream *substream,
    11871232                                snd_pcm_state_t state,
    1188                                 bool do_lock)
     1233                                bool stream_lock)
    11891234{
    11901235        struct snd_pcm_substream *s = NULL;
     
    11931238
    11941239        snd_pcm_group_for_each_entry(s, substream) {
    1195                 if (do_lock && s != substream) {
    1196                         if (s->pcm->nonatomic)
     1240                if (s != substream) {
     1241                        if (!stream_lock)
     1242                                mutex_lock_nested(&s->runtime->buffer_mutex, depth);
     1243                        else if (s->pcm->nonatomic)
    11971244                                mutex_lock_nested(&s->self_group.mutex, depth);
    11981245                        else
     
    12221269        }
    12231270 _unlock:
    1224         if (do_lock) {
    1225                 /* unlock streams */
    1226                 snd_pcm_group_for_each_entry(s1, substream) {
    1227                         if (s1 != substream) {
    1228                                 if (s1->pcm->nonatomic)
    1229                                         mutex_unlock(&s1->self_group.mutex);
    1230                                 else
    1231                                         spin_unlock(&s1->self_group.lock);
    1232                         }
    1233                         if (s1 == s)    /* end */
    1234                                 break;
     1271        /* unlock streams */
     1272        snd_pcm_group_for_each_entry(s1, substream) {
     1273                if (s1 != substream) {
     1274                        if (!stream_lock)
     1275                                mutex_unlock(&s1->runtime->buffer_mutex);
     1276                        else if (s1->pcm->nonatomic)
     1277                                mutex_unlock(&s1->self_group.mutex);
     1278                        else
     1279                                spin_unlock(&s1->self_group.lock);
    12351280                }
     1281                if (s1 == s)    /* end */
     1282                        break;
    12361283        }
    12371284        return res;
     
    13631410        /* Guarantee the group members won't change during non-atomic action */
    13641411        down_read(&snd_pcm_link_rwsem);
     1412#ifndef TARGET_OS2
     1413        res = snd_pcm_buffer_access_lock(substream->runtime);
     1414        if (res < 0)
     1415                goto unlock;
     1416#endif
    13651417        if (snd_pcm_stream_linked(substream))
    13661418                res = snd_pcm_action_group(ops, substream, state, false);
    13671419        else
    13681420                res = snd_pcm_action_single(ops, substream, state);
     1421        snd_pcm_buffer_access_unlock(substream->runtime);
     1422 unlock:
    13691423        up_read(&snd_pcm_link_rwsem);
    13701424        return res;
     
    18561910        if (err < 0)
    18571911                return err;
     1912        snd_pcm_stream_lock_irq(substream);
    18581913        runtime->hw_ptr_base = 0;
    18591914        runtime->hw_ptr_interrupt = runtime->status->hw_ptr -
     
    18611916        runtime->silence_start = runtime->status->hw_ptr;
    18621917        runtime->silence_filled = 0;
     1918        snd_pcm_stream_unlock_irq(substream);
    18631919        return 0;
    18641920}
     
    18681924{
    18691925        struct snd_pcm_runtime *runtime = substream->runtime;
     1926        snd_pcm_stream_lock_irq(substream);
    18701927        runtime->control->appl_ptr = runtime->status->hw_ptr;
    18711928        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
    18721929            runtime->silence_size > 0)
    18731930                snd_pcm_playback_silence(substream, ULONG_MAX);
     1931        snd_pcm_stream_unlock_irq(substream);
    18741932}
    18751933
  • GPL/branches/uniaud32-next/alsa-kernel/core/rawmidi.c

    r710 r711  
    465465                goto __error;
    466466        }
     467        rawmidi_file->user_pversion = 0;
    467468        init_waitqueue_entry(&wait, current);
    468469        add_wait_queue(&rmidi->open_wait, &wait);
  • GPL/branches/uniaud32-next/alsa-kernel/core/seq/seq_queue.c

    r697 r711  
    236236/* -------------------------------------------------------- */
    237237
     238#define MAX_CELL_PROCESSES_IN_QUEUE     1000
     239
    238240void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
    239241{
     
    242244        snd_seq_tick_time_t cur_tick;
    243245        snd_seq_real_time_t cur_time;
     246        int processed = 0;
    244247
    245248        if (q == NULL)
     
    264267                        break;
    265268                snd_seq_dispatch_event(cell, atomic, hop);
     269                if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE)
     270                        goto out; /* the rest processed at the next batch */
    266271        }
    267272
     
    273278                        break;
    274279                snd_seq_dispatch_event(cell, atomic, hop);
    275         }
    276 
     280                if (++processed >= MAX_CELL_PROCESSES_IN_QUEUE)
     281                        goto out; /* the rest processed at the next batch */
     282        }
     283
     284 out:
    277285        /* free lock */
    278286        spin_lock_irqsave(&q->check_lock, flags);
    279287        if (q->check_again) {
    280288                q->check_again = 0;
    281                 spin_unlock_irqrestore(&q->check_lock, flags);
    282                 goto __again;
     289                if (processed < MAX_CELL_PROCESSES_IN_QUEUE) {
     290                        spin_unlock_irqrestore(&q->check_lock, flags);
     291                        goto __again;
     292                }
    283293        }
    284294        q->check_blocked = 0;
  • GPL/branches/uniaud32-next/alsa-kernel/core/timer.c

    r693 r711  
    626626                return -EINVAL;
    627627        spin_lock_irqsave(&timer->lock, flags);
     628        list_del_init(&timeri->ack_list);
     629        list_del_init(&timeri->active_list);
    628630        if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING |
    629631                               SNDRV_TIMER_IFLG_START))) {
     
    631633                goto unlock;
    632634        }
    633         list_del_init(&timeri->ack_list);
    634         list_del_init(&timeri->active_list);
    635635        if (timer->card && timer->card->shutdown)
    636636                goto unlock;
     
    667667{
    668668        unsigned long flags;
     669        bool running;
    669670
    670671        spin_lock_irqsave(&slave_active_lock, flags);
    671         if (!(timeri->flags & SNDRV_TIMER_IFLG_RUNNING)) {
    672                 spin_unlock_irqrestore(&slave_active_lock, flags);
    673                 return -EBUSY;
    674         }
     672        running = timeri->flags & SNDRV_TIMER_IFLG_RUNNING;
    675673        timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
    676674        if (timeri->timer) {
     
    678676                list_del_init(&timeri->ack_list);
    679677                list_del_init(&timeri->active_list);
    680                 snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
    681                                   SNDRV_TIMER_EVENT_PAUSE);
     678                if (running)
     679                        snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP :
     680                                          SNDRV_TIMER_EVENT_PAUSE);
    682681                spin_unlock(&timeri->timer->lock);
    683682        }
    684683        spin_unlock_irqrestore(&slave_active_lock, flags);
    685         return 0;
     684        return running ? 0 : -EBUSY;
    686685}
    687686
  • GPL/branches/uniaud32-next/alsa-kernel/drivers/opl3/opl3_midi.c

    r697 r711  
    401401        if (instr_4op) {
    402402                vp2 = &opl3->voices[voice + 3];
    403                 if (vp->state > 0) {
     403                if (vp2->state > 0) {
    404404                        opl3_reg = reg_side | (OPL3_REG_KEYON_BLOCK +
    405405                                               voice_offset + 3);
  • GPL/branches/uniaud32-next/alsa-kernel/hda/ext/hdac_ext_stream.c

    r693 r711  
    107107EXPORT_SYMBOL_GPL(snd_hdac_stream_free_all);
    108108
    109 /**
    110  * snd_hdac_ext_stream_decouple - decouple the hdac stream
    111  * @bus: HD-audio core bus
    112  * @stream: HD-audio ext core stream object to initialize
    113  * @decouple: flag to decouple
    114  */
    115 void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
    116                                 struct hdac_ext_stream *stream, bool decouple)
     109void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
     110                                         struct hdac_ext_stream *stream,
     111                                         bool decouple)
    117112{
    118113        struct hdac_stream *hstream = &stream->hstream;
     
    120115        int mask = AZX_PPCTL_PROCEN(hstream->index);
    121116
    122         spin_lock_irq(&bus->reg_lock);
    123117        val = readw(bus->ppcap + AZX_REG_PP_PPCTL) & mask;
    124118
     
    129123
    130124        stream->decoupled = decouple;
     125}
     126EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple_locked);
     127
     128/**
     129 * snd_hdac_ext_stream_decouple - decouple the hdac stream
     130 * @bus: HD-audio core bus
     131 * @stream: HD-audio ext core stream object to initialize
     132 * @decouple: flag to decouple
     133 */
     134void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
     135                                  struct hdac_ext_stream *stream, bool decouple)
     136{
     137        spin_lock_irq(&bus->reg_lock);
     138        snd_hdac_ext_stream_decouple_locked(bus, stream, decouple);
    131139        spin_unlock_irq(&bus->reg_lock);
    132140}
     
    253261        }
    254262
     263        spin_lock_irq(&bus->reg_lock);
    255264        list_for_each_entry(stream, &bus->stream_list, list) {
    256265                struct hdac_ext_stream *hstream = container_of(stream,
     
    267276
    268277                if (!hstream->link_locked) {
    269                         snd_hdac_ext_stream_decouple(bus, hstream, true);
     278                        snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
    270279                        res = hstream;
    271280                        break;
     
    273282        }
    274283        if (res) {
    275                 spin_lock_irq(&bus->reg_lock);
    276284                res->link_locked = 1;
    277285                res->link_substream = substream;
    278                 spin_unlock_irq(&bus->reg_lock);
    279         }
     286        }
     287        spin_unlock_irq(&bus->reg_lock);
    280288        return res;
    281289}
     
    293301        }
    294302
     303        spin_lock_irq(&bus->reg_lock);
    295304        list_for_each_entry(stream, &bus->stream_list, list) {
    296305                struct hdac_ext_stream *hstream = container_of(stream,
     
    302311                if (!stream->opened) {
    303312                        if (!hstream->decoupled)
    304                                 snd_hdac_ext_stream_decouple(bus, hstream, true);
     313                                snd_hdac_ext_stream_decouple_locked(bus, hstream, true);
    305314                        res = hstream;
    306315                        break;
     
    308317        }
    309318        if (res) {
    310                 spin_lock_irq(&bus->reg_lock);
    311319                res->hstream.opened = 1;
    312320                res->hstream.running = 0;
    313321                res->hstream.substream = substream;
    314                 spin_unlock_irq(&bus->reg_lock);
    315         }
     322        }
     323        spin_unlock_irq(&bus->reg_lock);
    316324
    317325        return res;
     
    379387
    380388        case HDAC_EXT_STREAM_TYPE_HOST:
     389                spin_lock_irq(&bus->reg_lock);
    381390                if (stream->decoupled && !stream->link_locked)
    382                         snd_hdac_ext_stream_decouple(bus, stream, false);
     391                        snd_hdac_ext_stream_decouple_locked(bus, stream, false);
     392                spin_unlock_irq(&bus->reg_lock);
    383393                snd_hdac_stream_release(&stream->hstream);
    384394                break;
    385395
    386396        case HDAC_EXT_STREAM_TYPE_LINK:
     397                spin_lock_irq(&bus->reg_lock);
    387398                if (stream->decoupled && !stream->hstream.opened)
    388                         snd_hdac_ext_stream_decouple(bus, stream, false);
    389                 spin_lock_irq(&bus->reg_lock);
     399                        snd_hdac_ext_stream_decouple_locked(bus, stream, false);
    390400                stream->link_locked = 0;
    391401                stream->link_substream = NULL;
  • GPL/branches/uniaud32-next/alsa-kernel/hda/hdac_device.c

    r629 r711  
    675675        { 0x17e8, "Chrontel" },
    676676        { 0x1854, "LG" },
     677        { 0x19e5, "Huawei" },
    677678        { 0x1aec, "Wolfson Microelectronics" },
    678679        { 0x1af4, "QEMU" },
  • GPL/branches/uniaud32-next/alsa-kernel/hda/hdac_stream.c

    r694 r711  
    302302                (substream->stream + 1);
    303303
     304        spin_lock_irq(&bus->reg_lock);
    304305        list_for_each_entry(azx_dev, &bus->stream_list, list, struct hdac_stream) {
    305306                if (azx_dev->direction != substream->stream)
     
    315316        }
    316317        if (res) {
    317                 spin_lock_irq(&bus->reg_lock);
    318318                res->opened = 1;
    319319                res->running = 0;
    320320                res->assigned_key = key;
    321321                res->substream = substream;
    322                 spin_unlock_irq(&bus->reg_lock);
    323         }
     322        }
     323        spin_unlock_irq(&bus->reg_lock);
    324324        return res;
    325325}
     
    539539        cc->mask = CLOCKSOURCE_MASK(32);
    540540
     541#ifndef TARGET_OS2
     542        /*
     543         * Calculate the optimal mult/shift values. The counter wraps
     544         * around after ~178.9 seconds.
     545         */
     546        clocks_calc_mult_shift(&cc->mult, &cc->shift, 24000000,
     547                               NSEC_PER_SEC, 178);
     548#else
    541549        /*
    542550         * Converting from 24 MHz to ns means applying a 125/3 factor.
     
    551559        cc->mult = 125; /* saturation after 195 years */
    552560        cc->shift = 0;
    553 
     561#endif
    554562        nsec = 0; /* audio time is elapsed time since trigger */
    555563        timecounter_init(tc, cc, nsec);
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/core.h

    r710 r711  
    288288int snd_card_free(struct snd_card *card);
    289289int snd_card_free_when_closed(struct snd_card *card);
     290int snd_card_free_on_error(struct device *dev, int ret);
    290291void snd_card_set_id(struct snd_card *card, const char *id);
    291292int snd_card_register(struct snd_card *card);
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/hda_codec.h

    r710 r711  
    99#define __SOUND_HDA_CODEC_H
    1010
    11 #include <linux/kref.h>
     11#include <linux/refcount.h>
    1212#include <linux/mod_devicetable.h>
    1313#include <sound/info.h>
     
    167167        /* private: */
    168168        struct hda_codec *codec;
    169         struct kref kref;
    170169        struct list_head list;
     170        unsigned int disconnected:1;
    171171};
    172172
     
    188188        /* PCM to create, set by patch_ops.build_pcms callback */
    189189        struct list_head pcm_list_head;
     190        refcount_t pcm_ref;
     191        wait_queue_head_t remove_sleep;
    190192
    191193        /* codec specific info */
     
    423425static inline void snd_hda_codec_pcm_get(struct hda_pcm *pcm)
    424426{
    425         kref_get(&pcm->kref);
     427        refcount_inc(&pcm->codec->pcm_ref);
    426428}
    427429void snd_hda_codec_pcm_put(struct hda_pcm *pcm);
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/hdaudio_ext.h

    r710 r711  
    8989                                           int type);
    9090void snd_hdac_ext_stream_release(struct hdac_ext_stream *azx_dev, int type);
     91void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
     92                                  struct hdac_ext_stream *azx_dev, bool decouple);
    9193void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
    9294                                struct hdac_ext_stream *azx_dev, bool decouple);
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/jack.h

    r693 r711  
    6363#ifdef CONFIG_SND_JACK_INPUT_DEV
    6464        struct input_dev *input_dev;
     65        struct mutex input_dev_lock;
    6566        int registered;
    6667        int type;
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/pcm.h

    r710 r711  
    399399        struct fasync_struct *fasync;
    400400        bool stop_operating;            /* sync_stop will be called */
     401        struct mutex buffer_mutex;      /* protect for buffer changes */
     402        atomic_t buffer_accessing;      /* >0: in r/w operation, <0: blocked */
    401403
    402404        /* -- private section -- */
  • GPL/branches/uniaud32-next/alsa-kernel/include/sound/soc-topology.h

    r697 r711  
    189189#else
    190190
    191 static inline int snd_soc_tplg_component_remove(struct snd_soc_component *comp,
    192                                                 u32 index)
     191static inline int snd_soc_tplg_component_remove(struct snd_soc_component *comp)
    193192{
    194193        return 0;
  • GPL/branches/uniaud32-next/alsa-kernel/include/uapi/sound/asound.h

    r710 r711  
    8181 ****************************************************************************/
    8282
     83#define AES_IEC958_STATUS_SIZE          24
     84
    8385struct snd_aes_iec958 {
    84         unsigned char status[24];       /* AES/IEC958 channel status bits */
     86        unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
    8587        unsigned char subcode[147];     /* AES/IEC958 subcode bits */
    8688        unsigned char pad;              /* nothing */
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ac97/ac97_codec.c

    r697 r711  
    947947       
    948948        mutex_lock(&ac97->page_mutex);
    949         ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31);
    950         ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31);
     949        ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31);
     950        ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31);
    951951        mutex_unlock(&ac97->page_mutex);
    952952        return 0;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ali5451/ali5451.c

    r710 r711  
    21322132}
    21332133
    2134 static int snd_ali_probe(struct pci_dev *pci,
    2135                          const struct pci_device_id *pci_id)
     2134static int __snd_ali_probe(struct pci_dev *pci,
     2135                           const struct pci_device_id *pci_id)
    21362136{
    21372137        struct snd_card *card;
     
    21762176        pci_set_drvdata(pci, card);
    21772177        return 0;
     2178}
     2179
     2180static int snd_ali_probe(struct pci_dev *pci,
     2181                         const struct pci_device_id *pci_id)
     2182{
     2183        return snd_card_free_on_error(&pci->dev, __snd_ali_probe(pci, pci_id));
    21782184}
    21792185
  • GPL/branches/uniaud32-next/alsa-kernel/pci/als4000.c

    r710 r711  
    810810}
    811811
    812 static int snd_card_als4000_probe(struct pci_dev *pci,
    813                                   const struct pci_device_id *pci_id)
     812static int __snd_card_als4000_probe(struct pci_dev *pci,
     813                                    const struct pci_device_id *pci_id)
    814814{
    815815        static int dev;
     
    934934}
    935935
     936static int snd_card_als4000_probe(struct pci_dev *pci,
     937                                  const struct pci_device_id *pci_id)
     938{
     939        return snd_card_free_on_error(&pci->dev, __snd_card_als4000_probe(pci, pci_id));
     940}
     941
    936942#ifdef CONFIG_PM_SLEEP
    937943static int snd_als4000_suspend(struct device *dev)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/atiixp.c

    r710 r711  
    16011601
    16021602
    1603 static int snd_atiixp_probe(struct pci_dev *pci,
    1604                             const struct pci_device_id *pci_id)
     1603static int __snd_atiixp_probe(struct pci_dev *pci,
     1604                              const struct pci_device_id *pci_id)
    16051605{
    16061606        struct snd_card *card;
     
    16561656}
    16571657
     1658static int snd_atiixp_probe(struct pci_dev *pci,
     1659                            const struct pci_device_id *pci_id)
     1660{
     1661        return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id));
     1662}
     1663
    16581664static struct pci_driver atiixp_driver = {
    16591665        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/au88x0/au88x0.c

    r710 r711  
    194194// constructor -- see "Constructor" sub-section
    195195static int
    196 snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
     196__snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
    197197{
    198198        static int dev;
     
    311311}
    312312
     313static int
     314snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
     315{
     316        return snd_card_free_on_error(&pci->dev, __snd_vortex_probe(pci, pci_id));
     317}
     318
    313319// pci_driver definition
    314320static struct pci_driver vortex_driver = {
  • GPL/branches/uniaud32-next/alsa-kernel/pci/bt87x.c

    r710 r711  
    824824}
    825825
    826 static int snd_bt87x_probe(struct pci_dev *pci,
    827                            const struct pci_device_id *pci_id)
     826static int __snd_bt87x_probe(struct pci_dev *pci,
     827                             const struct pci_device_id *pci_id)
    828828{
    829829        static int dev;
     
    908908}
    909909
     910static int snd_bt87x_probe(struct pci_dev *pci,
     911                           const struct pci_device_id *pci_id)
     912{
     913        return snd_card_free_on_error(&pci->dev, __snd_bt87x_probe(pci, pci_id));
     914}
     915
    910916/* default entries for all Bt87x cards - it's not exported */
    911917/* driver_data is set to 0 to call detection */
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ca0106/ca0106_main.c

    r710 r711  
    17371737
    17381738
    1739 static int snd_ca0106_probe(struct pci_dev *pci,
    1740                                         const struct pci_device_id *pci_id)
     1739static int __snd_ca0106_probe(struct pci_dev *pci,
     1740                              const struct pci_device_id *pci_id)
    17411741{
    17421742        static int dev;
     
    17961796        dev++;
    17971797        return 0;
     1798}
     1799
     1800static int snd_ca0106_probe(struct pci_dev *pci,
     1801                            const struct pci_device_id *pci_id)
     1802{
     1803        return snd_card_free_on_error(&pci->dev, __snd_ca0106_probe(pci, pci_id));
    17981804}
    17991805
  • GPL/branches/uniaud32-next/alsa-kernel/pci/cmipci.c

    r710 r711  
    308308#define CM_MICGAINZ_SHIFT       0
    309309
    310 #define CM_REG_MIXER3           0x24
    311310#define CM_REG_AUX_VOL          0x26
    312311#define CM_VAUXL_MASK           0xf0
     
    32803279        err = snd_cmipci_create(card, pci, dev);
    32813280        if (err < 0)
    3282                 return err;
     3281                goto error;
    32833282
    32843283        err = snd_card_register(card);
    32853284        if (err < 0)
    3286                 return err;
     3285                goto error;
    32873286
    32883287        pci_set_drvdata(pci, card);
    32893288        dev++;
    32903289        return 0;
     3290
     3291 error:
     3292        snd_card_free(card);
     3293        return err;
    32913294}
    32923295
     
    32973300static const unsigned char saved_regs[] = {
    32983301        CM_REG_FUNCTRL1, CM_REG_CHFORMAT, CM_REG_LEGACY_CTRL, CM_REG_MISC_CTRL,
    3299         CM_REG_MIXER0, CM_REG_MIXER1, CM_REG_MIXER2, CM_REG_MIXER3, CM_REG_PLL,
     3302        CM_REG_MIXER0, CM_REG_MIXER1, CM_REG_MIXER2, CM_REG_AUX_VOL, CM_REG_PLL,
    33003303        CM_REG_CH0_FRAME1, CM_REG_CH0_FRAME2,
    33013304        CM_REG_CH1_FRAME1, CM_REG_CH1_FRAME2, CM_REG_EXT_MISC,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/cs4281.c

    r710 r711  
    18501850}
    18511851
    1852 static int snd_cs4281_probe(struct pci_dev *pci,
    1853                             const struct pci_device_id *pci_id)
     1852static int __snd_cs4281_probe(struct pci_dev *pci,
     1853                              const struct pci_device_id *pci_id)
    18541854{
    18551855        static int dev;
     
    19111911}
    19121912
     1913static int snd_cs4281_probe(struct pci_dev *pci,
     1914                            const struct pci_device_id *pci_id)
     1915{
     1916        return snd_card_free_on_error(&pci->dev, __snd_cs4281_probe(pci, pci_id));
     1917}
     1918
    19131919/*
    19141920 * Power Management
  • GPL/branches/uniaud32-next/alsa-kernel/pci/cs46xx/cs46xx.c

    r710 r711  
    8282                                external_amp[dev], thinkpad[dev]);
    8383        if (err < 0)
    84                 return err;
     84                goto error;
    8585        card->private_data = chip;
    8686        chip->accept_valid = mmap_valid[dev];
    8787        err = snd_cs46xx_pcm(chip, 0);
    8888        if (err < 0)
    89                 return err;
     89                goto error;
    9090#ifdef CONFIG_SND_CS46XX_NEW_DSP
    9191        err = snd_cs46xx_pcm_rear(chip, 1);
    9292        if (err < 0)
    93                 return err;
     93                goto error;
    9494        err = snd_cs46xx_pcm_iec958(chip, 2);
    9595        if (err < 0)
    96                 return err;
     96                goto error;
    9797#endif
    9898        err = snd_cs46xx_mixer(chip, 2);
    9999        if (err < 0)
    100                 return err;
     100                goto error;
    101101#ifdef CONFIG_SND_CS46XX_NEW_DSP
    102102        if (chip->nr_ac97_codecs ==2) {
    103103                err = snd_cs46xx_pcm_center_lfe(chip, 3);
    104104                if (err < 0)
    105                         return err;
     105                        goto error;
    106106        }
    107107#endif
    108108        err = snd_cs46xx_midi(chip, 0);
    109109        if (err < 0)
    110                 return err;
     110                goto error;
    111111        err = snd_cs46xx_start_dsp(chip);
    112112        if (err < 0)
    113                 return err;
     113                goto error;
    114114
    115115        snd_cs46xx_gameport(chip);
     
    125125        err = snd_card_register(card);
    126126        if (err < 0)
    127                 return err;
     127                goto error;
    128128
    129129        pci_set_drvdata(pci, card);
    130130        dev++;
    131131        return 0;
     132
     133 error:
     134        snd_card_free(card);
     135        return err;
    132136}
    133137
  • GPL/branches/uniaud32-next/alsa-kernel/pci/cs5535audio/cs5535audio.c

    r710 r711  
    286286}
    287287
    288 static int snd_cs5535audio_probe(struct pci_dev *pci,
    289                                  const struct pci_device_id *pci_id)
     288static int __snd_cs5535audio_probe(struct pci_dev *pci,
     289                                   const struct pci_device_id *pci_id)
    290290{
    291291        static int dev;
     
    334334        dev++;
    335335        return 0;
     336}
     337
     338static int snd_cs5535audio_probe(struct pci_dev *pci,
     339                                 const struct pci_device_id *pci_id)
     340{
     341        return snd_card_free_on_error(&pci->dev, __snd_cs5535audio_probe(pci, pci_id));
    336342}
    337343
  • GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/emu10k1x.c

    r710 r711  
    14991499}
    15001500
    1501 static int snd_emu10k1x_probe(struct pci_dev *pci,
    1502                               const struct pci_device_id *pci_id)
     1501static int __snd_emu10k1x_probe(struct pci_dev *pci,
     1502                                const struct pci_device_id *pci_id)
    15031503{
    15041504        static int dev;
     
    15621562}
    15631563
     1564static int snd_emu10k1x_probe(struct pci_dev *pci,
     1565                              const struct pci_device_id *pci_id)
     1566{
     1567        return snd_card_free_on_error(&pci->dev, __snd_emu10k1x_probe(pci, pci_id));
     1568}
     1569
    15641570// PCI IDs
    15651571static const struct pci_device_id snd_emu10k1x_ids[] = {
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ens1370.c

    r710 r711  
    23302330}
    23312331
    2332 static int snd_audiopci_probe(struct pci_dev *pci,
    2333                               const struct pci_device_id *pci_id)
     2332static int __snd_audiopci_probe(struct pci_dev *pci,
     2333                                const struct pci_device_id *pci_id)
    23342334{
    23352335        static int dev;
     
    23952395}
    23962396
     2397static int snd_audiopci_probe(struct pci_dev *pci,
     2398                              const struct pci_device_id *pci_id)
     2399{
     2400        return snd_card_free_on_error(&pci->dev, __snd_audiopci_probe(pci, pci_id));
     2401}
     2402
    23972403static struct pci_driver ens137x_driver = {
    23982404        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/es1938.c

    r710 r711  
    17521752       
    17531753
    1754 static int snd_es1938_probe(struct pci_dev *pci,
    1755                             const struct pci_device_id *pci_id)
     1754static int __snd_es1938_probe(struct pci_dev *pci,
     1755                              const struct pci_device_id *pci_id)
    17561756{
    17571757        static int dev;
     
    18321832}
    18331833
     1834static int snd_es1938_probe(struct pci_dev *pci,
     1835                            const struct pci_device_id *pci_id)
     1836{
     1837        return snd_card_free_on_error(&pci->dev, __snd_es1938_probe(pci, pci_id));
     1838}
     1839
    18341840static struct pci_driver es1938_driver = {
    18351841        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/es1968.c

    r710 r711  
    27912791/*
    27922792 */
    2793 static int snd_es1968_probe(struct pci_dev *pci,
    2794                             const struct pci_device_id *pci_id)
     2793static int __snd_es1968_probe(struct pci_dev *pci,
     2794                              const struct pci_device_id *pci_id)
    27952795{
    27962796        static int dev;
     
    28982898}
    28992899
     2900static int snd_es1968_probe(struct pci_dev *pci,
     2901                            const struct pci_device_id *pci_id)
     2902{
     2903        return snd_card_free_on_error(&pci->dev, __snd_es1968_probe(pci, pci_id));
     2904}
     2905
    29002906static struct pci_driver es1968_driver = {
    29012907        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/fm801.c

    r710 r711  
    12921292}
    12931293
    1294 static int snd_card_fm801_probe(struct pci_dev *pci,
    1295                                 const struct pci_device_id *pci_id)
     1294static int __snd_card_fm801_probe(struct pci_dev *pci,
     1295                                  const struct pci_device_id *pci_id)
    12961296{
    12971297        static int dev;
     
    13551355        dev++;
    13561356        return 0;
     1357}
     1358
     1359static int snd_card_fm801_probe(struct pci_dev *pci,
     1360                                const struct pci_device_id *pci_id)
     1361{
     1362        return snd_card_free_on_error(&pci->dev, __snd_card_fm801_probe(pci, pci_id));
    13571363}
    13581364
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_auto_parser.c

    r710 r711  
    828828}
    829829
    830 static void apply_fixup(struct hda_codec *codec, int id, int action, int depth)
     830void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth)
    831831{
    832832        const char *modelname = codec->fixup_name;
     
    838838                        break;
    839839                if (fix->chained_before)
    840                         apply_fixup(codec, fix->chain_id, action, depth + 1);
     840                        __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1);
    841841
    842842                switch (fix->type) {
     
    879879        }
    880880}
     881EXPORT_SYMBOL_GPL(__snd_hda_apply_fixup);
    881882
    882883/**
     
    888889{
    889890        if (codec->fixup_list)
    890                 apply_fixup(codec, codec->fixup_id, action, 0);
     891                __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0);
    891892}
    892893EXPORT_SYMBOL_GPL(snd_hda_apply_fixup);
     
    990991        const char *name = NULL;
    991992        const char *type = NULL;
    992         int vendor, device;
     993        unsigned int vendor, device;
    993994
    994995        if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_bind.c

    r710 r711  
    158158                return codec->bus->core.ext_ops->hdev_detach(&codec->core);
    159159        }
     160
     161        refcount_dec(&codec->pcm_ref);
     162        snd_hda_codec_disconnect_pcms(codec);
     163        wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
     164        snd_power_sync_ref(codec->bus->card);
    160165
    161166        if (codec->patch_ops.free)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_codec.c

    r710 r711  
    712712 * PCM device
    713713 */
    714 static void release_pcm(struct kref *kref)
    715 {
    716         struct hda_pcm *pcm = container_of(kref, struct hda_pcm, kref);
    717 #ifndef TARGET_OS2
    718 /* don't do this on OS/2 - results in the device being free'd and can't be re-opened */
    719         if (pcm->pcm)
    720                 snd_device_free(pcm->codec->card, pcm->pcm);
    721 #endif
    722         clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);
    723         kfree(pcm->name);
    724         kfree(pcm);
    725 }
    726714
    727715void snd_hda_codec_pcm_put(struct hda_pcm *pcm)
    728716{
    729         kref_put(&pcm->kref, release_pcm);
     717        if (refcount_dec_and_test(&pcm->codec->pcm_ref))
     718                wake_up(&pcm->codec->remove_sleep);
    730719}
    731720EXPORT_SYMBOL_GPL(snd_hda_codec_pcm_put);
     
    742731
    743732        pcm->codec = codec;
    744         kref_init(&pcm->kref);
    745733        va_start(args, fmt);
    746734        pcm->name = kvasprintf(GFP_KERNEL, fmt, args);
     
    752740
    753741        list_add_tail(&pcm->list, &codec->pcm_list_head);
     742        refcount_inc(&codec->pcm_ref);
    754743        return pcm;
    755744}
     
    759748 * codec destructor
    760749 */
    761 static void codec_release_pcms(struct hda_codec *codec)
    762 {
    763         struct hda_pcm *pcm, *n;
    764 
    765         list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) {
    766                 list_del_init(&pcm->list);
     750void snd_hda_codec_disconnect_pcms(struct hda_codec *codec)
     751{
     752        struct hda_pcm *pcm;
     753
     754        list_for_each_entry(pcm, &codec->pcm_list_head, list, struct hda_pcm) {
     755                if (pcm->disconnected)
     756                        continue;
    767757                if (pcm->pcm)
    768758                        snd_device_disconnect(codec->card, pcm->pcm);
    769759                snd_hda_codec_pcm_put(pcm);
     760                pcm->disconnected = 1;
     761        }
     762}
     763
     764static void codec_release_pcms(struct hda_codec *codec)
     765{
     766        struct hda_pcm *pcm, *n;
     767
     768        list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) {
     769                list_del(&pcm->list);
     770                if (pcm->pcm)
     771                        snd_device_free(pcm->codec->card, pcm->pcm);
     772                clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);
     773                kfree(pcm->name);
     774                kfree(pcm);
    770775        }
    771776}
     
    780785        }
    781786
     787        snd_hda_codec_disconnect_pcms(codec);
    782788        cancel_delayed_work_sync(&codec->jackpoll_work);
    783789        if (!codec->in_freeing)
     
    803809        snd_hdac_regmap_exit(&codec->core);
    804810        codec->configured = 0;
     811        refcount_set(&codec->pcm_ref, 1); /* reset refcount */
    805812}
    806813EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup_for_unbind);
     
    969976        INIT_LIST_HEAD(&codec->conn_list);
    970977        INIT_LIST_HEAD(&codec->pcm_list_head);
     978        refcount_set(&codec->pcm_ref, 1);
     979        init_waitqueue_head(&codec->remove_sleep);
    971980
    972981        INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
     
    17381747        int i;
    17391748        struct hda_nid_item *items = codec->mixers.list;
     1749
     1750        down_write(&codec->card->controls_rwsem);
    17401751        for (i = 0; i < codec->mixers.used; i++)
    17411752                snd_ctl_remove(codec->card, items[i].kctl);
     1753        up_write(&codec->card->controls_rwsem);
    17421754        snd_array_free(&codec->mixers);
    17431755        snd_array_free(&codec->nids);
     
    30043016{
    30053017        struct hda_pcm *cpcm;
     3018
     3019        /* Skip the shutdown if codec is not registered */
     3020        if (!codec->registered)
     3021                return;
    30063022
    30073023        list_for_each_entry(cpcm, &codec->pcm_list_head, list, struct hda_pcm)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_controller.c

    r710 r711  
    524524
    525525                nsec = timecounter_read(&azx_dev->core.tc);
    526                 nsec = div_u64(nsec, 3); /* can be optimized */
    527526                if (audio_tstamp_config->report_delay)
    528527                        nsec = azx_adjust_codec_delay(substream, nsec);
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_generic.c

    r710 r711  
    9595        snd_array_free(&spec->paths);
    9696        snd_array_free(&spec->loopback_list);
     97#ifdef CONFIG_SND_HDA_GENERIC_LEDS
     98        if (spec->led_cdevs[LED_AUDIO_MUTE])
     99                led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]);
     100        if (spec->led_cdevs[LED_AUDIO_MICMUTE])
     101                led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]);
     102#endif
    97103}
    98104
     
    39343940                                bool micmute)
    39353941{
     3942        struct hda_gen_spec *spec = codec->spec;
    39363943        struct led_classdev *cdev;
     3944        int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE;
     3945        int err;
    39373946
    39383947        cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);
     
    39443953        cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
    39453954        cdev->brightness_set_blocking = callback;
    3946         cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);
     3955        cdev->brightness = ledtrig_audio_get(idx);
    39473956        cdev->flags = LED_CORE_SUSPENDRESUME;
    39483957
    3949         return devm_led_classdev_register(&codec->core.dev, cdev);
     3958        err = led_classdev_register(&codec->core.dev, cdev);
     3959        if (err < 0)
     3960                return err;
     3961        spec->led_cdevs[idx] = cdev;
     3962        return 0;
    39503963}
    39513964
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_generic.h

    r710 r711  
    295295        void (*mic_autoswitch_hook)(struct hda_codec *codec,
    296296                                    struct hda_jack_callback *cb);
     297
     298        /* leds */
     299        struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
    297300};
    298301
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_intel.c

    r710 r711  
    354354                                        ((pci)->device == 0x0d0c) || \
    355355                                        ((pci)->device == 0x160c) || \
    356                                         ((pci)->device == 0x490d))
     356                                        ((pci)->device == 0x490d) || \
     357                                        ((pci)->device == 0x4f90) || \
     358                                        ((pci)->device == 0x4f91) || \
     359                                        ((pci)->device == 0x4f92))
    357360
    358361#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
     
    657660 * data is processed.  So, we need to process it afterwords in a
    658661 * workqueue.
     662 *
     663 * Returns 1 if OK to proceed, 0 for delay handling, -1 for skipping update
    659664 */
    660665static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
    661666{
    662667        struct snd_pcm_substream *substream = azx_dev->core.substream;
     668        struct snd_pcm_runtime *runtime = substream->runtime;
    663669        int stream = substream->stream;
    664670        u32 wallclk;
    665671        unsigned int pos;
     672        snd_pcm_uframes_t hwptr, target;
    666673
    667674        wallclk = azx_readl(chip, WALLCLK) - azx_dev->core.start_wallclk;
     
    707714                return chip->bdl_pos_adj ? 0 : -1;
    708715        azx_dev->core.start_wallclk += wallclk;
     716
     717        if (azx_dev->core.no_period_wakeup)
     718                return 1; /* OK, no need to check period boundary */
     719
     720        if (runtime->hw_ptr_base != runtime->hw_ptr_interrupt)
     721                return 1; /* OK, already in hwptr updating process */
     722
     723        /* check whether the period gets really elapsed */
     724        pos = bytes_to_frames(runtime, pos);
     725        hwptr = runtime->hw_ptr_base + pos;
     726        if (hwptr < runtime->status->hw_ptr)
     727                hwptr += runtime->buffer_size;
     728        target = runtime->hw_ptr_interrupt + runtime->period_size;
     729        if (hwptr < target) {
     730                /* too early wakeup, process it later */
     731                return chip->bdl_pos_adj ? 0 : -1;
     732        }
     733
    709734        return 1; /* OK, it's fine */
    710735}
     
    883908        /* just read back the calculated value in the above */
    884909        return substream->runtime->delay;
    885 }
    886 
    887 static unsigned int azx_skl_get_dpib_pos(struct azx *chip,
    888                                          struct azx_dev *azx_dev)
    889 {
    890         return _snd_hdac_chip_readl(azx_bus(chip),
    891                                     AZX_REG_VS_SDXDPIB_XBASE +
    892                                     (AZX_REG_VS_SDXDPIB_XINTERVAL *
    893                                      azx_dev->core.index));
    894 }
    895 
    896 /* get the current DMA position with correction on SKL+ chips */
    897 static unsigned int azx_get_pos_skl(struct azx *chip, struct azx_dev *azx_dev)
    898 {
    899         /* DPIB register gives a more accurate position for playback */
    900         if (azx_dev->core.substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
    901                 return azx_skl_get_dpib_pos(chip, azx_dev);
    902 
    903         /* For capture, we need to read posbuf, but it requires a delay
    904          * for the possible boundary overlap; the read of DPIB fetches the
    905          * actual posbuf
    906          */
    907         udelay(20);
    908         azx_skl_get_dpib_pos(chip, azx_dev);
    909         return azx_get_pos_posbuf(chip, azx_dev);
    910910}
    911911
     
    16071607                [POS_FIX_VIACOMBO] = azx_via_get_position,
    16081608                [POS_FIX_COMBO] = azx_get_pos_lpib,
    1609                 [POS_FIX_SKL] = azx_get_pos_skl,
     1609                [POS_FIX_SKL] = azx_get_pos_posbuf,
    16101610                [POS_FIX_FIFO] = azx_get_pos_fifo,
    16111611        };
     
    16451645        SND_PCI_QUIRK(0x1043, 0x1262, "ASUS W5Fm", 0x103),
    16461646        SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103),
     1647        SND_PCI_QUIRK(0x1558, 0x0351, "Schenker Dock 15", 0x105),
    16471648        /* WinFast VP200 H (Teradici) user reported broken communication */
    16481649        SND_PCI_QUIRK(0x3a21, 0x040d, "WinFast VP200 H", 0x101),
     
    18321833        assign_position_fix(chip, check_position_fix(chip, position_fix[dev]));
    18331834
    1834         check_probe_mask(chip, dev);
    1835 
    18361835        if (single_cmd < 0) /* allow fallback to single_cmd at errors */
    18371836                chip->fallback_to_single_cmd = 1;
     
    18581857                chip->bus.core.needs_damn_long_delay = 1;
    18591858        }
     1859
     1860        check_probe_mask(chip, dev);
    18601861
    18611862        err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
     
    23832384out_free:
    23842385        if (err < 0) {
    2385                 azx_free(chip);
     2386                pci_set_drvdata(pci, NULL);
     2387                snd_card_free(chip->card);
    23862388                return err;
    23872389        }
     
    25262528        /* DG1 */
    25272529        { PCI_DEVICE(0x8086, 0x490d),
     2530          .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
     2531        /* DG2 */
     2532        { PCI_DEVICE(0x8086, 0x4f90),
     2533          .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
     2534        { PCI_DEVICE(0x8086, 0x4f91),
     2535          .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
     2536        { PCI_DEVICE(0x8086, 0x4f92),
    25282537          .driver_data = AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE},
    25292538        /* Alderlake-S */
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_local.h

    r710 r711  
    138138void snd_hda_codec_register(struct hda_codec *codec);
    139139void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec);
     140void snd_hda_codec_disconnect_pcms(struct hda_codec *codec);
    140141
    141142#define snd_hda_regmap_sync(codec)      snd_hdac_regmap_sync(&(codec)->core)
     
    364365                           const struct hda_pintbl *cfg);
    365366void snd_hda_apply_fixup(struct hda_codec *codec, int action);
     367void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth);
    366368void snd_hda_pick_fixup(struct hda_codec *codec,
    367369                        const struct hda_model_fixup *models,
     
    452454#define for_each_hda_codec_node(nid, codec) \
    453455        for ((nid) = (codec)->core.start_nid; (nid) < (codec)->core.end_nid; (nid)++)
     456
     457/* Set the codec power_state flag to indicate to allow unsol event handling;
     458 * see hda_codec_unsol_event() in hda_bind.c.  Calling this might confuse the
     459 * state tracking, so use with care.
     460 */
     461static inline void snd_hda_codec_allow_unsol_events(struct hda_codec *codec)
     462{
     463        codec->core.dev.power.power_state = PMSG_ON;
     464}
    454465
    455466/*
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_conexant.c

    r710 r711  
    10051005        SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
    10061006        SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
     1007        SND_PCI_QUIRK(0x103c, 0x82b4, "HP ProDesk 600 G3", CXT_FIXUP_HP_MIC_NO_PRESENCE),
    10071008        SND_PCI_QUIRK(0x103c, 0x836e, "HP ProBook 455 G5", CXT_FIXUP_MUTE_LED_GPIO),
    10081009        SND_PCI_QUIRK(0x103c, 0x837f, "HP ProBook 470 G5", CXT_FIXUP_MUTE_LED_GPIO),
     
    11131114                                   cxt5051_fixups, cxt_fixups);
    11141115                break;
     1116        case 0x14f15098:
     1117                codec->pin_amp_workaround = 1;
     1118                spec->gen.mixer_nid = 0x22;
     1119                spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
     1120                snd_hda_pick_fixup(codec, cxt5066_fixup_models,
     1121                                   cxt5066_fixups, cxt_fixups);
     1122                break;
    11151123        case 0x14f150f2:
    11161124                codec->power_save_node = 1;
     
    11331141                goto error;
    11341142
    1135         err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
     1143        err = cx_auto_parse_beep(codec);
    11361144        if (err < 0)
    11371145                goto error;
    11381146
    1139         err = cx_auto_parse_beep(codec);
     1147        err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
    11401148        if (err < 0)
    11411149                goto error;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_hdmi.c

    r710 r711  
    14001400 last_try:
    14011401        /* the last try; check the empty slots in pins */
    1402         for (i = 0; i < spec->num_nids; i++) {
     1402        for (i = 0; i < spec->pcm_used; i++) {
    14031403                if (!test_bit(i, &spec->pcm_bitmap))
    14041404                        return i;
     
    16301630        struct hdmi_spec *spec = codec->spec;
    16311631        struct hdmi_eld *eld = &spec->temp_eld;
     1632        struct device *dev = hda_codec_dev(codec);
    16321633        hda_nid_t pin_nid = per_pin->pin_nid;
    16331634        int dev_id = per_pin->dev_id;
     
    16431644        int ret;
    16441645
     1646#ifdef  CONFIG_PM
     1647        if (dev->power.runtime_status == RPM_SUSPENDING)
     1648                return;
     1649#endif
     1650
    16451651        ret = snd_hda_power_up_pm(codec);
    1646         if (ret < 0 && pm_runtime_suspended(hda_codec_dev(codec)))
     1652        if (ret < 0 && pm_runtime_suspended(dev))
    16471653                goto out;
    16481654
     
    22702276         */
    22712277
    2272         if (codec->mst_no_extra_pcms)
     2278        if (spec->dyn_pcm_no_legacy && codec->mst_no_extra_pcms)
     2279                pcm_num = spec->num_cvts;
     2280        else if (codec->mst_no_extra_pcms)
    22732281                pcm_num = spec->num_nids;
    22742282        else
     
    29642972/* Intel Haswell and onwards; audio component with eld notifier */
    29652973static int intel_hsw_common_init(struct hda_codec *codec, hda_nid_t vendor_nid,
    2966                                  const int *port_map, int port_num, int dev_num)
     2974                                 const int *port_map, int port_num, int dev_num,
     2975                                 bool send_silent_stream)
    29672976{
    29682977        struct hdmi_spec *spec;
     
    29973006         * module param or Kconfig option
    29983007         */
    2999         if (enable_silent_stream)
     3008        if (send_silent_stream)
    30003009                spec->send_silent_stream = true;
    30013010
     
    30053014static int patch_i915_hsw_hdmi(struct hda_codec *codec)
    30063015{
    3007         return intel_hsw_common_init(codec, 0x08, NULL, 0, 3);
     3016        return intel_hsw_common_init(codec, 0x08, NULL, 0, 3,
     3017                                     enable_silent_stream);
    30083018}
    30093019
    30103020static int patch_i915_glk_hdmi(struct hda_codec *codec)
    30113021{
    3012         return intel_hsw_common_init(codec, 0x0b, NULL, 0, 3);
     3022        /*
     3023         * Silent stream calls audio component .get_power() from
     3024         * .pin_eld_notify(). On GLK this will deadlock in i915 due
     3025         * to the audio vs. CDCLK workaround.
     3026         */
     3027        return intel_hsw_common_init(codec, 0x0b, NULL, 0, 3, false);
    30133028}
    30143029
     
    30213036        static const int map[] = {0x0, 0x4, 0x6, 0x8, 0xa, 0xb};
    30223037
    3023         return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 3);
     3038        return intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 3,
     3039                                     enable_silent_stream);
    30243040}
    30253041
     
    30333049        int ret;
    30343050
    3035         ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4);
     3051        ret = intel_hsw_common_init(codec, 0x02, map, ARRAY_SIZE(map), 4,
     3052                                    enable_silent_stream);
    30363053        if (!ret) {
    30373054                struct hdmi_spec *spec = codec->spec;
     
    43974414HDA_CODEC_ENTRY(0x80862814, "DG1 HDMI", patch_i915_tgl_hdmi),
    43984415HDA_CODEC_ENTRY(0x80862815, "Alderlake HDMI",   patch_i915_tgl_hdmi),
    4399 HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi),
    44004416HDA_CODEC_ENTRY(0x80862816, "Rocketlake HDMI",  patch_i915_tgl_hdmi),
     4417HDA_CODEC_ENTRY(0x80862819, "DG2 HDMI", patch_i915_tgl_hdmi),
    44014418HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI",  patch_i915_icl_hdmi),
    44024419HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi),
     4420HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_tgl_hdmi),
    44034421HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI",  patch_generic_hdmi),
    44044422HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi),
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_realtek.c

    r710 r711  
    103103        struct alc_coef_led mute_led_coef;
    104104        struct alc_coef_led mic_led_coef;
     105        struct mutex coef_mutex;
    105106
    106107        hda_nid_t headset_mic_pin;
     
    138139 */
    139140
    140 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
    141                                unsigned int coef_idx)
     141static void coef_mutex_lock(struct hda_codec *codec)
     142{
     143        struct alc_spec *spec = codec->spec;
     144
     145        snd_hda_power_up_pm(codec);
     146        mutex_lock(&spec->coef_mutex);
     147}
     148
     149static void coef_mutex_unlock(struct hda_codec *codec)
     150{
     151        struct alc_spec *spec = codec->spec;
     152
     153        mutex_unlock(&spec->coef_mutex);
     154        snd_hda_power_down_pm(codec);
     155}
     156
     157static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
     158                                 unsigned int coef_idx)
    142159{
    143160        unsigned int val;
     
    148165}
    149166
     167static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
     168                               unsigned int coef_idx)
     169{
     170        unsigned int val;
     171
     172        coef_mutex_lock(codec);
     173        val = __alc_read_coefex_idx(codec, nid, coef_idx);
     174        coef_mutex_unlock(codec);
     175        return val;
     176}
     177
    150178#define alc_read_coef_idx(codec, coef_idx) \
    151179        alc_read_coefex_idx(codec, 0x20, coef_idx)
    152180
     181static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
     182                                   unsigned int coef_idx, unsigned int coef_val)
     183{
     184        snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
     185        snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
     186}
     187
    153188static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
    154189                                 unsigned int coef_idx, unsigned int coef_val)
    155190{
    156         snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
    157         snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
     191        coef_mutex_lock(codec);
     192        __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
     193        coef_mutex_unlock(codec);
    158194}
    159195
    160196#define alc_write_coef_idx(codec, coef_idx, coef_val) \
    161197        alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
     198
     199static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
     200                                    unsigned int coef_idx, unsigned int mask,
     201                                    unsigned int bits_set)
     202{
     203        unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
     204
     205        if (val != -1)
     206                __alc_write_coefex_idx(codec, nid, coef_idx,
     207                                       (val & ~mask) | bits_set);
     208}
    162209
    163210static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
     
    165212                                  unsigned int bits_set)
    166213{
    167         unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
    168 
    169         if (val != -1)
    170                 alc_write_coefex_idx(codec, nid, coef_idx,
    171                                      (val & ~mask) | bits_set);
     214        coef_mutex_lock(codec);
     215        __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
     216        coef_mutex_unlock(codec);
    172217}
    173218
     
    202247                                const struct coef_fw *fw)
    203248{
     249        coef_mutex_lock(codec);
    204250        for (; fw->nid; fw++) {
    205251                if (fw->mask == (unsigned short)-1)
    206                         alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
     252                        __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
    207253                else
    208                         alc_update_coefex_idx(codec, fw->nid, fw->idx,
    209                                               fw->mask, fw->val);
    210         }
     254                        __alc_update_coefex_idx(codec, fw->nid, fw->idx,
     255                                                fw->mask, fw->val);
     256        }
     257        coef_mutex_unlock(codec);
    211258}
    212259
     
    399446        case 0x10ec0255:
    400447        case 0x10ec0256:
     448        case 0x19e58326:
    401449        case 0x10ec0257:
    402450        case 0x10ec0282:
     
    536584        case 0x10ec0236:
    537585        case 0x10ec0256:
     586        case 0x19e58326:
    538587        case 0x10ec0283:
    539588        case 0x10ec0286:
     
    894943}
    895944
     945#define alc_free        snd_hda_gen_free
     946
     947#ifdef CONFIG_PM
    896948static inline void alc_shutup(struct hda_codec *codec)
    897949{
     
    907959}
    908960
    909 #define alc_free        snd_hda_gen_free
    910 
    911 #ifdef CONFIG_PM
    912961static void alc_power_eapd(struct hda_codec *codec)
    913962{
     
    923972        return 0;
    924973}
    925 #endif
    926 
    927 #ifdef CONFIG_PM
     974
    928975static int alc_resume(struct hda_codec *codec)
    929976{
     
    11571204        codec->forced_resume = 1;
    11581205        codec->patch_ops = alc_patch_ops;
     1206        mutex_init(&spec->coef_mutex);
    11591207
    11601208        err = alc_codec_rename_from_preset(codec);
     
    22852333        ALC887_FIXUP_BASS_CHMAP,
    22862334        ALC1220_FIXUP_GB_DUAL_CODECS,
     2335        ALC1220_FIXUP_GB_X570,
    22872336        ALC1220_FIXUP_CLEVO_P950,
    22882337        ALC1220_FIXUP_CLEVO_PB51ED,
     
    22902339        ALC887_FIXUP_ASUS_AUDIO,
    22912340        ALC887_FIXUP_ASUS_HMIC,
     2341        ALCS1200A_FIXUP_MIC_VREF,
    22922342};
    22932343
     
    24702520                           "Rear-Panel Capture Switch" :
    24712521                           "Front-Panel Capture Switch");
     2522                break;
     2523        }
     2524}
     2525
     2526static void alc1220_fixup_gb_x570(struct hda_codec *codec,
     2527                                     const struct hda_fixup *fix,
     2528                                     int action)
     2529{
     2530        static const hda_nid_t conn1[] = { 0x0c };
     2531        static const struct coef_fw gb_x570_coefs[] = {
     2532                WRITE_COEF(0x07, 0x03c0),
     2533                WRITE_COEF(0x1a, 0x01c1),
     2534                WRITE_COEF(0x1b, 0x0202),
     2535                WRITE_COEF(0x43, 0x3005),
     2536                {0}
     2537        };
     2538
     2539        switch (action) {
     2540        case HDA_FIXUP_ACT_PRE_PROBE:
     2541                snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
     2542                snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
     2543                break;
     2544        case HDA_FIXUP_ACT_INIT:
     2545                alc_process_coef_fw(codec, gb_x570_coefs);
    24722546                break;
    24732547        }
     
    29623036                .v.func = alc1220_fixup_gb_dual_codecs,
    29633037        },
     3038        [ALC1220_FIXUP_GB_X570] = {
     3039                .type = HDA_FIXUP_FUNC,
     3040                .v.func = alc1220_fixup_gb_x570,
     3041        },
    29643042        [ALC1220_FIXUP_CLEVO_P950] = {
    29653043                .type = HDA_FIXUP_FUNC,
     
    29953073                .chain_id = ALC887_FIXUP_ASUS_AUDIO,
    29963074        },
     3075#ifdef TARGET_OS2xxx
     3076        [ALCS1200A_FIXUP_MIC_VREF] = {
     3077                .type = HDA_FIXUP_PINCTLS,
     3078                .v.pins = (const struct hda_pintbl[]) {
     3079                        { 0x18, PIN_VREF50 }, /* rear mic */
     3080                        { 0x19, PIN_VREF50 }, /* front mic */
     3081                        {}
     3082                }
     3083        },
     3084#endif
    29973085};
    29983086
     
    30323120        SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
    30333121        SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
     3122        SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
    30343123        SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
    30353124        SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
     
    30663155        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
    30673156        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
    3068         SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
    3069         SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
     3157        SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
     3158        SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
     3159        SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
    30703160        SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
    30713161        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
     
    30853175        SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30863176        SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
     3177        SND_PCI_QUIRK(0x1558, 0x65f5, "Clevo PD50PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30873178        SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30883179        SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30893180        SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
     3181        SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
     3182        SND_PCI_QUIRK(0x1558, 0x67f5, "Clevo PD70PN[NRT]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30903183        SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
    30913184        SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
     
    31413234        {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
    31423235        {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
     3236        {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
    31433237        {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
    31443238        {0}
     
    36893783        ALC269_TYPE_ALC215,
    36903784        ALC269_TYPE_ALC225,
     3785        ALC269_TYPE_ALC245,
    36913786        ALC269_TYPE_ALC287,
    36923787        ALC269_TYPE_ALC294,
     
    37263821        case ALC269_TYPE_ALC215:
    37273822        case ALC269_TYPE_ALC225:
     3823        case ALC269_TYPE_ALC245:
    37283824        case ALC269_TYPE_ALC287:
    37293825        case ALC269_TYPE_ALC294:
     
    37953891        case 0x10ec0236:
    37963892        case 0x10ec0256:
     3893        case 0x19e58326:
    37973894                alc_write_coef_idx(codec, 0x48, 0x0);
    37983895                alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
     
    38233920        case 0x10ec0236:
    38243921        case 0x10ec0256:
     3922        case 0x19e58326:
    38253923                alc_write_coef_idx(codec, 0x48, 0xd011);
    38263924                alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
     
    41764274         * when booting with headset plugged. So skip setting it for the codec alc257
    41774275         */
    4178         if (spec->codec_variant != ALC269_TYPE_ALC257 &&
    4179             spec->codec_variant != ALC269_TYPE_ALC256)
     4276        if (codec->core.vendor_id != 0x10ec0236 &&
     4277            codec->core.vendor_id != 0x10ec0257)
    41804278                alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
    41814279
     
    42554353        bool hp1_pin_sense, hp2_pin_sense;
    42564354
    4257         if (spec->codec_variant != ALC269_TYPE_ALC287)
     4355        if (spec->codec_variant != ALC269_TYPE_ALC287 &&
     4356                spec->codec_variant != ALC269_TYPE_ALC245)
    42584357                /* required only at boot or S3 and S4 resume time */
    42594358#ifndef TARGET_OS2
     
    50185117{
    50195118        alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
     5119}
     5120
     5121static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
     5122                                const struct hda_fixup *fix, int action)
     5123{
     5124        struct alc_spec *spec = codec->spec;
     5125
     5126        if (action == HDA_FIXUP_ACT_PRE_PROBE)
     5127                spec->micmute_led_polarity = 1;
     5128        alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
    50205129}
    50215130
     
    54945603        case 0x10ec0236:
    54955604        case 0x10ec0256:
     5605        case 0x19e58326:
    54965606                alc_process_coef_fw(codec, coef0256);
    54975607                break;
     
    56095719        case 0x10ec0236:
    56105720        case 0x10ec0256:
     5721        case 0x19e58326:
    56115722                alc_write_coef_idx(codec, 0x45, 0xc489);
    56125723                snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
     
    57595870        case 0x10ec0236:
    57605871        case 0x10ec0256:
     5872        case 0x19e58326:
    57615873                alc_write_coef_idx(codec, 0x1b, 0x0e4b);
    57625874                alc_write_coef_idx(codec, 0x45, 0xc089);
     
    58585970        case 0x10ec0236:
    58595971        case 0x10ec0256:
     5972        case 0x19e58326:
    58605973                alc_process_coef_fw(codec, coef0256);
    58615974                break;
     
    59726085        case 0x10ec0236:
    59736086        case 0x10ec0256:
     6087        case 0x19e58326:
    59746088                alc_process_coef_fw(codec, coef0256);
    59756089                break;
     
    60736187        case 0x10ec0236:
    60746188        case 0x10ec0256:
     6189        case 0x19e58326:
    60756190                alc_write_coef_idx(codec, 0x1b, 0x0e4b);
    60766191                alc_write_coef_idx(codec, 0x06, 0x6104);
     
    63696484        case 0x10ec0236:
    63706485        case 0x10ec0256:
     6486        case 0x19e58326:
    63716487                alc_process_coef_fw(codec, alc256fw);
    63726488                break;
     
    69727088        case 0x10ec0255:
    69737089        case 0x10ec0256:
     7090        case 0x19e58326:
    69747091                alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
    69757092                alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
     
    71887305#include "ideapad_s740_helper.c"
    71897306
    7190 static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec,
    7191                                                             const struct hda_fixup *fix,
    7192                                                             int action)
     7307static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
     7308        WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
     7309        WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
     7310        WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
     7311        {0}
     7312};
     7313
     7314static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
     7315                                           const struct hda_fixup *fix,
     7316                                           int action)
    71937317{
    71947318        /*
    7195         * A certain other OS sets these coeffs to different values. On at least one TongFang
    7196         * barebone these settings might survive even a cold reboot. So to restore a clean slate the
    7197         * values are explicitly reset to default here. Without this, the external microphone is
    7198         * always in a plugged-in state, while the internal microphone is always in an unplugged
    7199         * state, breaking the ability to use the internal microphone.
    7200         */
    7201         alc_write_coef_idx(codec, 0x24, 0x0000);
    7202         alc_write_coef_idx(codec, 0x26, 0x0000);
    7203         alc_write_coef_idx(codec, 0x29, 0x3000);
    7204         alc_write_coef_idx(codec, 0x37, 0xfe05);
    7205         alc_write_coef_idx(codec, 0x45, 0x5089);
     7319         * A certain other OS sets these coeffs to different values. On at least
     7320         * one TongFang barebone these settings might survive even a cold
     7321         * reboot. So to restore a clean slate the values are explicitly reset
     7322         * to default here. Without this, the external microphone is always in a
     7323         * plugged-in state, while the internal microphone is always in an
     7324         * unplugged state, breaking the ability to use the internal microphone.
     7325         */
     7326        alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
     7327}
     7328
     7329static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
     7330        WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
     7331        WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
     7332        WRITE_COEF(0x49, 0x0149),
     7333        {0}
     7334};
     7335
     7336static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
     7337                                       const struct hda_fixup *fix,
     7338                                       int action)
     7339{
     7340        /*
     7341         * The audio jack input and output is not detected on the ASRock NUC Box
     7342         * 1100 series when cold booting without this fix. Warm rebooting from a
     7343         * certain other OS makes the audio functional, as COEF settings are
     7344         * preserved in this case. This fix sets these altered COEF values as
     7345         * the default.
     7346         */
     7347        alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
     7348}
     7349
     7350static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
     7351                                                    const struct hda_fixup *fix,
     7352                                                    int action)
     7353{
     7354        /*
     7355         * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
     7356         * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
     7357         * needs an additional quirk for sound working after suspend and resume.
     7358         */
     7359        if (codec->core.vendor_id == 0x10ec0256) {
     7360                alc_update_coef_idx(codec, 0x10, 1<<9, 0);
     7361                snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
     7362        } else {
     7363                snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
     7364        }
    72067365}
    72077366
     
    73197478        ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
    73207479        ALC269_FIXUP_ATIV_BOOK_8,
     7480        ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE,
    73217481        ALC221_FIXUP_HP_MIC_NO_PRESENCE,
    73227482        ALC256_FIXUP_ASUS_HEADSET_MODE,
     
    73807540        ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
    73817541        ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
     7542        ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
    73827543        ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
    73837544        ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
     
    74057566        ALC287_FIXUP_HP_GPIO_LED,
    74067567        ALC256_FIXUP_HP_HEADSET_MIC,
     7568        ALC245_FIXUP_HP_GPIO_LED,
    74077569        ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
    74087570        ALC282_FIXUP_ACER_DISABLE_LINEOUT,
     
    74217583        ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
    74227584        ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
     7585        ALC298_FIXUP_LENOVO_C940_DUET7,
    74237586        ALC287_FIXUP_13S_GEN2_SPEAKERS,
    7424         ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS,
    7425 };
     7587        ALC256_FIXUP_SET_COEF_DEFAULTS,
     7588        ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
     7589        ALC233_FIXUP_NO_AUDIO_JACK,
     7590        ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
     7591        ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
     7592        ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
     7593};
     7594
     7595/* A special fixup for Lenovo C940 and Yoga Duet 7;
     7596 * both have the very same PCI SSID, and we need to apply different fixups
     7597 * depending on the codec ID
     7598 */
     7599static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
     7600                                           const struct hda_fixup *fix,
     7601                                           int action)
     7602{
     7603        int id;
     7604
     7605        if (codec->core.vendor_id == 0x10ec0298)
     7606                id = ALC298_FIXUP_LENOVO_SPK_VOLUME; /* C940 */
     7607        else
     7608                id = ALC287_FIXUP_YOGA7_14ITL_SPEAKERS; /* Duet 7 */
     7609        __snd_hda_apply_fixup(codec, id, action, 0);
     7610}
    74267611
    74277612#ifdef TARGET_OS2
     
    83168501                .type = HDA_FIXUP_FUNC,
    83178502                .v.func = alc245_fixup_hp_x360_amp,
     8503                .chained = true,
     8504                .chain_id = ALC245_FIXUP_HP_GPIO_LED
    83188505        },
    83198506        [ALC288_FIXUP_DELL_HEADSET_MODE] = {
     
    85178704        },
    85188705#ifdef TARGET_OS2xxx
     8706        [ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE] = {
     8707                .type = HDA_FIXUP_PINS,
     8708                .v.pins = (const struct hda_pintbl[]) {
     8709                        { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
     8710                        { 0x1a, 0x01813030 }, /* use as headphone mic, without its own jack detect */
     8711                        { }
     8712                },
     8713                .chained = true,
     8714                .chain_id = ALC269_FIXUP_HEADSET_MODE
     8715        },
    85198716        [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
    85208717                .type = HDA_FIXUP_PINS,
     
    90169213                },
    90179214        },
     9215        [ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
     9216                .type = HDA_FIXUP_VERBS,
     9217                .v.verbs = (const struct hda_verb[]) {
     9218                        { 0x20, AC_VERB_SET_COEF_INDEX, 0x08},
     9219                        { 0x20, AC_VERB_SET_PROC_COEF, 0x2fcf},
     9220                        { }
     9221                },
     9222        },
    90189223        [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
    90199224                .type = HDA_FIXUP_PINS,
     
    93289533                .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
    93299534        },
     9535        [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
     9536                .type = HDA_FIXUP_FUNC,
     9537                .v.func = alc285_fixup_ideapad_s740_coef,
     9538                .chained = true,
     9539                .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
     9540        },
     9541        [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
     9542                .type = HDA_FIXUP_FUNC,
     9543                .v.func = alc287_fixup_legion_15imhg05_speakers,
     9544                .chained = true,
     9545                .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
     9546        },
    93309547#ifdef TARGET_OS2xxx
    93319548        [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
     
    94159632                .chained = true,
    94169633                .chain_id = ALC269_FIXUP_HEADSET_MODE,
     9634        },
     9635        [ALC298_FIXUP_LENOVO_C940_DUET7] = {
     9636                .type = HDA_FIXUP_FUNC,
     9637                .v.func = alc298_fixup_lenovo_c940_duet7,
    94179638        },
    94189639        [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
     
    94399660        },
    94409661#endif
    9441         [ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS] = {
    9442                 .type = HDA_FIXUP_FUNC,
    9443                 .v.func = alc256_fixup_tongfang_reset_persistent_settings,
     9662        [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
     9663                .type = HDA_FIXUP_FUNC,
     9664                .v.func = alc256_fixup_set_coef_defaults,
     9665        },
     9666#ifdef TARGET_OS2xxx
     9667        [ALC245_FIXUP_HP_GPIO_LED] = {
     9668                .type = HDA_FIXUP_FUNC,
     9669                .v.func = alc245_fixup_hp_gpio_led,
     9670        },
     9671        [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
     9672                .type = HDA_FIXUP_PINS,
     9673                .v.pins = (const struct hda_pintbl[]) {
     9674                        { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
     9675                        { }
     9676                },
     9677                .chained = true,
     9678                .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
     9679        },
     9680#endif
     9681        [ALC233_FIXUP_NO_AUDIO_JACK] = {
     9682                .type = HDA_FIXUP_FUNC,
     9683                .v.func = alc233_fixup_no_audio_jack,
     9684        },
     9685        [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
     9686                .type = HDA_FIXUP_FUNC,
     9687                .v.func = alc256_fixup_mic_no_presence_and_resume,
     9688                .chained = true,
     9689                .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
    94449690        },
    94459691};
     
    94759721        SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
    94769722        SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
     9723        SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
    94779724        SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
    94789725        SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
    94799726        SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
    94809727        SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
     9728        SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
    94819729        SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
    94829730        SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
    94839731        SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
    94849732        SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
     9733        SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
    94859734        SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
    94869735        SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
     
    95379786        SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
    95389787        SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
     9788        SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
    95399789        SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
    95409790        SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
     
    95969846        SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
    95979847        SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
     9848        SND_PCI_QUIRK(0x103c, 0x2b5e, "HP 288 Pro G2 MT", ALC221_FIXUP_HP_288PRO_MIC_NO_PRESENCE),
    95989849        SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
    95999850        SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
     
    96129863        SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
    96139864        SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
     9865        SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
    96149866        SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
    96159867        SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
     
    96189870        SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
    96199871        SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
     9872        SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
    96209873        SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
    96219874        SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
     9875        SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
    96229876        SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
    96239877        SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
     
    96289882        SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
    96299883                      ALC285_FIXUP_HP_GPIO_AMP_INIT),
     9884        SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
     9885        SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
    96309886        SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
    96319887        SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
     
    96549910        SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
    96559911        SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
     9912        SND_PCI_QUIRK(0x103c, 0x89aa, "HP EliteBook 630 G9", ALC236_FIXUP_HP_GPIO_LED),
     9913        SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
     9914        SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
     9915        SND_PCI_QUIRK(0x103c, 0x8a78, "HP Dev One", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
     9916        SND_PCI_QUIRK(0x103c, 0x8aa0, "HP ProBook 440 G9 (MB 8A9E)", ALC236_FIXUP_HP_GPIO_LED),
     9917        SND_PCI_QUIRK(0x103c, 0x8aa3, "HP ProBook 450 G9 (MB 8AA1)", ALC236_FIXUP_HP_GPIO_LED),
     9918        SND_PCI_QUIRK(0x103c, 0x8aa8, "HP EliteBook 640 G9 (MB 8AA6)", ALC236_FIXUP_HP_GPIO_LED),
     9919        SND_PCI_QUIRK(0x103c, 0x8aab, "HP EliteBook 650 G9 (MB 8AA9)", ALC236_FIXUP_HP_GPIO_LED),
    96569920        SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
    96579921        SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
     
    96799943        SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
    96809944        SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
     9945        SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
    96819946        SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
    96829947        SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
     
    96949959        SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
    96959960        SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
     9961        SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
     9962        SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
    96969963        SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
    96979964        SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
     
    97269993        SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
    97279994        SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
     9995        SND_PCI_QUIRK(0x144d, 0xc832, "Samsung Galaxy Book Flex Alpha (NP730QCJ)", ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
    97289996        SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
    97299997        SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
     
    974210010        SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    974310011        SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10012        SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10013        SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    974410014        SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    974510015        SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    974710017        SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    974810018        SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10019        SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10020        SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    974910021        SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    975010022        SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    976110033        SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    976210034        SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10035        SND_PCI_QUIRK(0x1558, 0x7716, "Clevo NS50PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10036        SND_PCI_QUIRK(0x1558, 0x7718, "Clevo L140PU", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    976310037        SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    976410038        SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    977210046        SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
    977310047        SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10048        SND_PCI_QUIRK(0x1558, 0x866d, "Clevo NP5[05]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10049        SND_PCI_QUIRK(0x1558, 0x867c, "Clevo NP7[01]PNP", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10050        SND_PCI_QUIRK(0x1558, 0x867d, "Clevo NP7[01]PN[HJK]", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    977410051        SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    9775         SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     10052        SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
    977610053        SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
    977710054        SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
     
    983910116        SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
    984010117        SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
    9841         SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
     10118        SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo Yoga DuetITL 2021", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
     10119        SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
     10120        SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940 / Yoga Duet 7", ALC298_FIXUP_LENOVO_C940_DUET7),
     10121        SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
     10122        SND_PCI_QUIRK(0x17aa, 0x3820, "Yoga Duet 7 13ITL6", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
     10123        SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
    984210124        SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
     10125        SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
     10126        SND_PCI_QUIRK(0x17aa, 0x383d, "Legion Y9000X 2019", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
    984310127        SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
    9844         SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
     10128        SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
    984510129        SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
    984610130        SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
    9847         SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
    984810131        SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
    984910132        SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
     
    986510148        SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
    986610149        SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
     10150        SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
    986710151        SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
    986810152        SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
    986910153        SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
    987010154        SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
     10155        SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
    987110156        SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
    987210157        SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
     
    987610161        SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
    987710162        SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
    9878         SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_TONGFANG_RESET_PERSISTENT_SETTINGS),
     10163        SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
     10164        SND_PCI_QUIRK(0x1d05, 0x1096, "TongFang GMxMRxx", ALC269_FIXUP_NO_SHUTUP),
     10165        SND_PCI_QUIRK(0x1d05, 0x1100, "TongFang GKxNRxx", ALC269_FIXUP_NO_SHUTUP),
     10166        SND_PCI_QUIRK(0x1d05, 0x1111, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
     10167        SND_PCI_QUIRK(0x1d05, 0x1119, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
     10168        SND_PCI_QUIRK(0x1d05, 0x1129, "TongFang GMxZGxx", ALC269_FIXUP_NO_SHUTUP),
     10169        SND_PCI_QUIRK(0x1d05, 0x1147, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
     10170        SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
     10171        SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
    987910172        SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
    988010173        SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
    988110174        SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
     10175        SND_PCI_QUIRK(0x1d72, 0x1945, "Redmi G", ALC256_FIXUP_ASUS_HEADSET_MIC),
    988210176        SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
    988310177        SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
     
    1005710351        {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
    1005810352        {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
     10353        {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
    1005910354        {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
    1006010355        {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
     
    1006610361        {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
    1006710362        {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
     10363        {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
    1006810364        {0}
    1006910365};
     
    1066110957        case 0x10ec0236:
    1066210958        case 0x10ec0256:
     10959        case 0x19e58326:
    1066310960                spec->codec_variant = ALC269_TYPE_ALC256;
    1066410961                spec->shutup = alc256_shutup;
     
    1067610973        case 0x10ec0285:
    1067710974        case 0x10ec0289:
    10678                 spec->codec_variant = ALC269_TYPE_ALC215;
     10975                if (alc_get_coef0(codec) & 0x0010)
     10976                        spec->codec_variant = ALC269_TYPE_ALC245;
     10977                else
     10978                        spec->codec_variant = ALC269_TYPE_ALC215;
    1067910979                spec->shutup = alc225_shutup;
    1068010980                spec->init_hook = alc225_init;
     
    1121811518                alc_write_coef_idx(codec, 0x19, 0xa054);
    1121911519                break;
     11520        }
     11521}
     11522
     11523static void alc897_hp_automute_hook(struct hda_codec *codec,
     11524                                         struct hda_jack_callback *jack)
     11525{
     11526        struct alc_spec *spec = codec->spec;
     11527        int vref;
     11528
     11529        snd_hda_gen_hp_automute(codec, jack);
     11530        vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
     11531        snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
     11532                            vref);
     11533}
     11534
     11535static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
     11536                                     const struct hda_fixup *fix, int action)
     11537{
     11538        struct alc_spec *spec = codec->spec;
     11539        if (action == HDA_FIXUP_ACT_PRE_PROBE) {
     11540                spec->gen.hp_automute_hook = alc897_hp_automute_hook;
    1122011541        }
    1122111542}
     
    1130111622        ALC668_FIXUP_HEADSET_MIC,
    1130211623        ALC668_FIXUP_MIC_DET_COEF,
     11624        ALC897_FIXUP_LENOVO_HEADSET_MIC,
     11625        ALC897_FIXUP_HEADSET_MIC_PIN,
     11626        ALC897_FIXUP_HP_HSMIC_VERB,
    1130311627};
    1130411628
     
    1189112215                        { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
    1189212216                        {}
     12217                },
     12218        },
     12219#endif
     12220        [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
     12221                .type = HDA_FIXUP_FUNC,
     12222                .v.func = alc897_fixup_lenovo_headset_mic,
     12223        },
     12224#ifdef TARGET_OS2xxx
     12225        [ALC897_FIXUP_HEADSET_MIC_PIN] = {
     12226                .type = HDA_FIXUP_PINS,
     12227                .v.pins = (const struct hda_pintbl[]) {
     12228                        { 0x1a, 0x03a11050 },
     12229                        { }
     12230                },
     12231                .chained = true,
     12232                .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
     12233        },
     12234        [ALC897_FIXUP_HP_HSMIC_VERB] = {
     12235                .type = HDA_FIXUP_PINS,
     12236                .v.pins = (const struct hda_pintbl[]) {
     12237                        { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
     12238                        { }
    1189312239                },
    1189412240        },
     
    1191912265        SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
    1192012266        SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
     12267        SND_PCI_QUIRK(0x103c, 0x8719, "HP", ALC897_FIXUP_HP_HSMIC_VERB),
    1192112268        SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
     12269        SND_PCI_QUIRK(0x103c, 0x877e, "HP 288 Pro G6", ALC671_FIXUP_HP_HEADSET_MIC2),
     12270        SND_PCI_QUIRK(0x103c, 0x885f, "HP 288 Pro G8", ALC671_FIXUP_HP_HEADSET_MIC2),
    1192212271        SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
    1192312272        SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
     
    1193812287        SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
    1193912288        SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
     12289        SND_PCI_QUIRK(0x17aa, 0x1057, "Lenovo P360", ALC897_FIXUP_HEADSET_MIC_PIN),
     12290        SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
     12291        SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
     12292        SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
     12293        SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
    1194012294        SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
    1194112295        SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
     
    1229612650        HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
    1229712651        HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
     12652        HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269),
    1229812653        {0} /* terminator */
    1229912654};
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/patch_via.c

    r696 r711  
    529529                return err;
    530530
     531        err = auto_parse_beep(codec);
     532        if (err < 0)
     533                return err;
     534
    531535        err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
    532         if (err < 0)
    533                 return err;
    534 
    535         err = auto_parse_beep(codec);
    536536        if (err < 0)
    537537                return err;
  • GPL/branches/uniaud32-next/alsa-kernel/pci/intel8x0.c

    r710 r711  
    31433143}
    31443144
    3145 static int snd_intel8x0_probe(struct pci_dev *pci,
    3146                               const struct pci_device_id *pci_id)
     3145static int __snd_intel8x0_probe(struct pci_dev *pci,
     3146                                const struct pci_device_id *pci_id)
    31473147{
    31483148        struct snd_card *card;
     
    32233223}
    32243224
     3225static int snd_intel8x0_probe(struct pci_dev *pci,
     3226                              const struct pci_device_id *pci_id)
     3227{
     3228        return snd_card_free_on_error(&pci->dev, __snd_intel8x0_probe(pci, pci_id));
     3229}
     3230
    32253231static struct pci_driver intel8x0_driver = {
    32263232        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/korg1212/korg1212.c

    r710 r711  
    23562356        err = snd_korg1212_create(card, pci);
    23572357        if (err < 0)
    2358                 return err;
     2358                goto error;
    23592359
    23602360        strcpy(card->driver, "korg1212");
     
    23672367        err = snd_card_register(card);
    23682368        if (err < 0)
    2369                 return err;
     2369                goto error;
    23702370        pci_set_drvdata(pci, card);
    23712371        dev++;
    23722372        return 0;
     2373
     2374 error:
     2375        snd_card_free(card);
     2376        return err;
    23732377}
    23742378
  • GPL/branches/uniaud32-next/alsa-kernel/pci/maestro3.c

    r710 r711  
    26622662 */
    26632663static int
    2664 snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
     2664__snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
    26652665{
    26662666        static int dev;
     
    27272727}
    27282728
     2729static int
     2730snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
     2731{
     2732        return snd_card_free_on_error(&pci->dev, __snd_m3_probe(pci, pci_id));
     2733}
     2734
    27292735static struct pci_driver m3_driver = {
    27302736        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/pci/nm256/nm256.c

    r710 r711  
    15781578
    15791579        snd_nm256_init_chip(chip);
    1580         card->private_free = snd_nm256_free;
    15811580
    15821581        // pci_set_master(pci); /* needed? */
     
    16851684        if (err < 0)
    16861685                return err;
     1686        card->private_free = snd_nm256_free;
    16871687
    16881688        pci_set_drvdata(pci, card);
  • GPL/branches/uniaud32-next/alsa-kernel/pci/rme9652/hdsp.c

    r710 r711  
    469469        u32                   io_loopback;          /* output loopback channel states*/
    470470
    471         struct snd_dma_buffer *capture_dma_buf;
    472         struct snd_dma_buffer *playback_dma_buf;
     471        /* DMA buffers; those are copied instances from the original snd_dma_buf
     472         * objects (which are managed via devres) for the address alignments
     473         */
     474        struct snd_dma_buffer capture_dma_buf;
     475        struct snd_dma_buffer playback_dma_buf;
    473476        unsigned char        *capture_buffer;       /* suitably aligned address */
    474477        unsigned char        *playback_buffer;      /* suitably aligned address */
     
    37653768static int snd_hdsp_initialize_memory(struct hdsp *hdsp)
    37663769{
    3767         unsigned long pb_bus, cb_bus;
    3768 
    3769         hdsp->capture_dma_buf =
    3770                 snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES);
    3771         hdsp->playback_dma_buf =
    3772                 snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES);
    3773         if (!hdsp->capture_dma_buf || !hdsp->playback_dma_buf) {
     3770        struct snd_dma_buffer *capture_dma, *playback_dma;
     3771
     3772        capture_dma = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES);
     3773        playback_dma = snd_hammerfall_get_buffer(hdsp->pci, HDSP_DMA_AREA_BYTES);
     3774        if (!capture_dma || !playback_dma) {
    37743775                dev_err(hdsp->card->dev,
    37753776                        "%s: no buffers available\n", hdsp->card_name);
     
    37773778        }
    37783779
     3780        /* copy to the own data for alignment */
     3781        hdsp->capture_dma_buf = *capture_dma;
     3782        hdsp->playback_dma_buf = *playback_dma;
     3783
    37793784        /* Align to bus-space 64K boundary */
    3780 
    3781         cb_bus = ALIGN(hdsp->capture_dma_buf->addr, 0x10000ul);
    3782         pb_bus = ALIGN(hdsp->playback_dma_buf->addr, 0x10000ul);
     3785        hdsp->capture_dma_buf.addr = ALIGN(capture_dma->addr, 0x10000ul);
     3786        hdsp->playback_dma_buf.addr = ALIGN(playback_dma->addr, 0x10000ul);
    37833787
    37843788        /* Tell the card where it is */
    3785 
    3786         hdsp_write(hdsp, HDSP_inputBufferAddress, cb_bus);
    3787         hdsp_write(hdsp, HDSP_outputBufferAddress, pb_bus);
    3788 
    3789         hdsp->capture_buffer = hdsp->capture_dma_buf->area + (cb_bus - hdsp->capture_dma_buf->addr);
    3790         hdsp->playback_buffer = hdsp->playback_dma_buf->area + (pb_bus - hdsp->playback_dma_buf->addr);
     3789        hdsp_write(hdsp, HDSP_inputBufferAddress, hdsp->capture_dma_buf.addr);
     3790        hdsp_write(hdsp, HDSP_outputBufferAddress, hdsp->playback_dma_buf.addr);
     3791
     3792        hdsp->capture_dma_buf.area += hdsp->capture_dma_buf.addr - capture_dma->addr;
     3793        hdsp->playback_dma_buf.area += hdsp->playback_dma_buf.addr - playback_dma->addr;
     3794        hdsp->capture_buffer = hdsp->capture_dma_buf.area;
     3795        hdsp->playback_buffer = hdsp->playback_dma_buf.area;
    37913796
    37923797        return 0;
     
    45084513
    45094514        runtime->hw = snd_hdsp_playback_subinfo;
    4510         snd_pcm_set_runtime_buffer(substream, hdsp->playback_dma_buf);
     4515        snd_pcm_set_runtime_buffer(substream, &hdsp->playback_dma_buf);
    45114516
    45124517        hdsp->playback_pid = current->pid;
     
    45844589
    45854590        runtime->hw = snd_hdsp_capture_subinfo;
    4586         snd_pcm_set_runtime_buffer(substream, hdsp->capture_dma_buf);
     4591        snd_pcm_set_runtime_buffer(substream, &hdsp->capture_dma_buf);
    45874592
    45884593        hdsp->capture_pid = current->pid;
     
    54405445        err = snd_hdsp_create(card, hdsp);
    54415446        if (err)
    5442                 return err;
     5447                goto error;
    54435448
    54445449        strcpy(card->shortname, "Hammerfall DSP");
     
    54475452        err = snd_card_register(card);
    54485453        if (err)
    5449                 return err;
     5454                goto error;
    54505455        pci_set_drvdata(pci, card);
    54515456        dev++;
    54525457        return 0;
     5458
     5459 error:
     5460        snd_card_free(card);
     5461        return err;
    54535462}
    54545463
  • GPL/branches/uniaud32-next/alsa-kernel/pci/rme9652/hdspm.c

    r710 r711  
    68966896        err = snd_hdspm_create(card, hdspm);
    68976897        if (err < 0)
    6898                 return err;
     6898                goto error;
    68996899
    69006900        if (hdspm->io_type != MADIface) {
     
    69156915        err = snd_card_register(card);
    69166916        if (err < 0)
    6917                 return err;
     6917                goto error;
    69186918
    69196919        pci_set_drvdata(pci, card);
     
    69216921        dev++;
    69226922        return 0;
     6923
     6924 error:
     6925        snd_card_free(card);
     6926        return err;
    69236927}
    69246928
  • GPL/branches/uniaud32-next/alsa-kernel/pci/rme9652/rme9652.c

    r710 r711  
    209209        unsigned char ss_channels;      /* different for hammerfall/hammerfall-light */
    210210
    211         struct snd_dma_buffer *playback_dma_buf;
    212         struct snd_dma_buffer *capture_dma_buf;
     211        /* DMA buffers; those are copied instances from the original snd_dma_buf
     212         * objects (which are managed via devres) for the address alignments
     213         */
     214        struct snd_dma_buffer playback_dma_buf;
     215        struct snd_dma_buffer capture_dma_buf;
    213216
    214217        unsigned char *capture_buffer;  /* suitably aligned address */
     
    17201723static int snd_rme9652_initialize_memory(struct snd_rme9652 *rme9652)
    17211724{
    1722         unsigned long pb_bus, cb_bus;
    1723 
    1724         rme9652->capture_dma_buf =
    1725                 snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES);
    1726         rme9652->playback_dma_buf =
    1727                 snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES);
    1728         if (!rme9652->capture_dma_buf || !rme9652->playback_dma_buf) {
     1725        struct snd_dma_buffer *capture_dma, *playback_dma;
     1726
     1727        capture_dma = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES);
     1728        playback_dma = snd_hammerfall_get_buffer(rme9652->pci, RME9652_DMA_AREA_BYTES);
     1729        if (!capture_dma || !playback_dma) {
    17291730                dev_err(rme9652->card->dev,
    17301731                        "%s: no buffers available\n", rme9652->card_name);
     
    17321733        }
    17331734
     1735        /* copy to the own data for alignment */
     1736        rme9652->capture_dma_buf = *capture_dma;
     1737        rme9652->playback_dma_buf = *playback_dma;
     1738
    17341739        /* Align to bus-space 64K boundary */
    1735 
    1736         cb_bus = ALIGN(rme9652->capture_dma_buf->addr, 0x10000ul);
    1737         pb_bus = ALIGN(rme9652->playback_dma_buf->addr, 0x10000ul);
     1740        rme9652->capture_dma_buf.addr = ALIGN(capture_dma->addr, 0x10000ul);
     1741        rme9652->playback_dma_buf.addr = ALIGN(playback_dma->addr, 0x10000ul);
    17381742
    17391743        /* Tell the card where it is */
    1740 
    1741         rme9652_write(rme9652, RME9652_rec_buffer, cb_bus);
    1742         rme9652_write(rme9652, RME9652_play_buffer, pb_bus);
    1743 
    1744         rme9652->capture_buffer = rme9652->capture_dma_buf->area + (cb_bus - rme9652->capture_dma_buf->addr);
    1745         rme9652->playback_buffer = rme9652->playback_dma_buf->area + (pb_bus - rme9652->playback_dma_buf->addr);
     1744        rme9652_write(rme9652, RME9652_rec_buffer, rme9652->capture_dma_buf.addr);
     1745        rme9652_write(rme9652, RME9652_play_buffer, rme9652->playback_dma_buf.addr);
     1746
     1747        rme9652->capture_dma_buf.area += rme9652->capture_dma_buf.addr - capture_dma->addr;
     1748        rme9652->playback_dma_buf.area += rme9652->playback_dma_buf.addr - playback_dma->addr;
     1749        rme9652->capture_buffer = rme9652->capture_dma_buf.area;
     1750        rme9652->playback_buffer = rme9652->playback_dma_buf.area;
    17461751
    17471752        return 0;
     
    22602265
    22612266        runtime->hw = snd_rme9652_playback_subinfo;
    2262         snd_pcm_set_runtime_buffer(substream, rme9652->playback_dma_buf);
     2267        snd_pcm_set_runtime_buffer(substream, &rme9652->playback_dma_buf);
    22632268
    22642269        if (rme9652->capture_substream == NULL) {
     
    23192324
    23202325        runtime->hw = snd_rme9652_capture_subinfo;
    2321         snd_pcm_set_runtime_buffer(substream, rme9652->capture_dma_buf);
     2326        snd_pcm_set_runtime_buffer(substream, &rme9652->capture_dma_buf);
    23222327
    23232328        if (rme9652->playback_substream == NULL) {
     
    25682573        err = snd_rme9652_create(card, rme9652, precise_ptr[dev]);
    25692574        if (err)
    2570                 return err;
     2575                goto error;
    25712576
    25722577        strcpy(card->shortname, rme9652->card_name);
     
    25762581        err = snd_card_register(card);
    25772582        if (err)
    2578                 return err;
     2583                goto error;
    25792584        pci_set_drvdata(pci, card);
    25802585        dev++;
    25812586        return 0;
     2587
     2588 error:
     2589        snd_card_free(card);
     2590        return err;
    25822591}
    25832592
  • GPL/branches/uniaud32-next/alsa-kernel/pci/via82xx.c

    r710 r711  
    24792479};
    24802480
    2481 static int snd_via82xx_probe(struct pci_dev *pci,
    2482                              const struct pci_device_id *pci_id)
     2481static int __snd_via82xx_probe(struct pci_dev *pci,
     2482                               const struct pci_device_id *pci_id)
    24832483{
    24842484        struct snd_card *card;
     
    25902590}
    25912591
     2592static int snd_via82xx_probe(struct pci_dev *pci,
     2593                             const struct pci_device_id *pci_id)
     2594{
     2595        return snd_card_free_on_error(&pci->dev, __snd_via82xx_probe(pci, pci_id));
     2596}
     2597
    25922598static struct pci_driver via82xx_driver = {
    25932599        .name = KBUILD_MODNAME,
  • GPL/branches/uniaud32-next/alsa-kernel/synth/emux/emux.c

    r697 r711  
    9595        emu->voices = kcalloc(emu->max_voices, sizeof(struct snd_emux_voice),
    9696                              GFP_KERNEL);
    97         if (emu->voices == NULL)
     97        if (emu->name == NULL || emu->voices == NULL)
    9898                return -ENOMEM;
    9999
  • GPL/branches/uniaud32-next/include/linux/leds.h

    r647 r711  
    2020};
    2121
     22enum led_audio {
     23        LED_AUDIO_MUTE,         /* master mute LED */
     24        LED_AUDIO_MICMUTE,      /* mic mute LED */
     25        NUM_AUDIO_LEDS
     26};
    2227#endif /* _LINUX_LEDS_H */
  • GPL/branches/uniaud32-next/include/linux/pm.h

    r686 r711  
    246246        struct device           * pm_parent;
    247247        struct list_head        entry;
     248        enum rpm_status         runtime_status;
    248249};
    249250
Note: See TracChangeset for help on using the changeset viewer.