Ignore:
Timestamp:
Apr 19, 2025, 8:08:37 PM (7 months ago)
Author:
David Azarewicz
Message:

Merge in changes from 6.6-LTS branch.
Fixed additional 25+ problems.

Location:
GPL/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • GPL/trunk

  • GPL/trunk/alsa-kernel/pci/ac97/ac97_codec.c

    r717 r772  
    153153{ 0x4e534331, 0xffffffff, "LM4549",             NULL,           NULL },
    154154{ 0x4e534350, 0xffffffff, "LM4550",             patch_lm4550,   NULL }, // volume wrap fix
    155 { 0x50534304, 0xffffffff, "UCB1400",            patch_ucb1400,  NULL },
    156155{ 0x53494c20, 0xffffffe0, "Si3036,8",           mpatch_si3036,  mpatch_si3036, AC97_MODEM_PATCH },
    157156{ 0x53544d02, 0xffffffff, "ST7597",             NULL,           NULL },
     
    20572056        if (err < 0) {
    20582057                ac97_err(ac97, "Can't register ac97 bus\n");
     2058                put_device(&ac97->dev);
    20592059                ac97->dev.bus = NULL;
    20602060                return err;
     
    21212121        };
    21222122
    2123         if (rac97)
    2124                 *rac97 = NULL;
    2125         if (snd_BUG_ON(!bus || !template))
     2123        if (snd_BUG_ON(!bus || !template || !rac97))
    21262124                return -EINVAL;
     2125        *rac97 = NULL;
    21272126        if (snd_BUG_ON(template->num >= 4))
    21282127                return -EINVAL;
     
    27092708static void set_ctl_name(char *dst, const char *src, const char *suffix)
    27102709{
    2711         if (suffix)
    2712                 sprintf(dst, "%s %s", src, suffix);
    2713         else
    2714                 strcpy(dst, src);
    2715 }       
     2710        const size_t msize = SNDRV_CTL_ELEM_ID_NAME_MAXLEN;
     2711
     2712        if (suffix) {
     2713                if (snprintf(dst, msize, "%s %s", src, suffix) >= msize)
     2714                        pr_warn("ALSA: AC97 control name '%s %s' truncated to '%s'\n",
     2715                                src, suffix, dst);
     2716        } else {
     2717                if (strscpy(dst, src, msize) < 0)
     2718                        pr_warn("ALSA: AC97 control name '%s' truncated to '%s'\n",
     2719                                src, dst);
     2720        }
     2721}
    27162722
    27172723/* remove the control with the given name and optional suffix */
     
    27402746{
    27412747        struct snd_kcontrol *kctl = ctl_find(ac97, src, suffix);
     2748        char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
     2749
    27422750        if (kctl) {
    2743                 set_ctl_name(kctl->id.name, dst, suffix);
     2751                set_ctl_name(name, dst, suffix);
     2752                snd_ctl_rename(ac97->bus->card, kctl, name);
    27442753                return 0;
    27452754        }
     
    27602769{
    27612770        struct snd_kcontrol *kctl1, *kctl2;
     2771        char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
     2772
    27622773        kctl1 = ctl_find(ac97, s1, suffix);
    27632774        kctl2 = ctl_find(ac97, s2, suffix);
    27642775        if (kctl1 && kctl2) {
    2765                 set_ctl_name(kctl1->id.name, s2, suffix);
    2766                 set_ctl_name(kctl2->id.name, s1, suffix);
     2776                set_ctl_name(name, s2, suffix);
     2777                snd_ctl_rename(ac97->bus->card, kctl1, name);
     2778
     2779                set_ctl_name(name, s1, suffix);
     2780                snd_ctl_rename(ac97->bus->card, kctl2, name);
     2781
    27672782                return 0;
    27682783        }
  • GPL/trunk/alsa-kernel/pci/ac97/ac97_patch.c

    r703 r772  
    34323432                                                    const char *name)
    34333433{
    3434         struct snd_ctl_elem_id id;
    3435         memset(&id, 0, sizeof(id));
    3436         id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
    3437         strcpy(id.name, name);
    3438         return snd_ctl_find_id(ac97->bus->card, &id);
     3434        return snd_ctl_find_id_mixer(ac97->bus->card, name);
    34393435}
    34403436
     
    34453441{
    34463442        struct snd_kcontrol *kctl;
    3447         const char * const *s;
    34483443        int err;
    34493444
     
    34553450                return err;
    34563451
    3457         for (s = followers; *s; s++) {
    3458                 struct snd_kcontrol *sctl;
    3459 
    3460                 sctl = snd_ac97_find_mixer_ctl(ac97, *s);
    3461                 if (!sctl) {
    3462                         dev_dbg(ac97->bus->card->dev,
    3463                                 "Cannot find follower %s, skipped\n", *s);
    3464                         continue;
    3465                 }
    3466                 err = snd_ctl_add_follower(kctl, sctl);
    3467                 if (err < 0)
    3468                         return err;
    3469         }
    3470         return 0;
     3452        return snd_ctl_add_followers(ac97->bus->card, kctl, followers);
    34713453}
    34723454
     
    39383920        return 0;
    39393921}
    3940 
    3941 /*
    3942  *  UCB1400 codec (http://www.semiconductors.philips.com/acrobat_download/datasheets/UCB1400-02.pdf)
    3943  */
    3944 static const struct snd_kcontrol_new snd_ac97_controls_ucb1400[] = {
    3945 /* enable/disable headphone driver which allows direct connection to
    3946    stereo headphone without the use of external DC blocking
    3947    capacitors */
    3948 AC97_SINGLE("Headphone Driver", 0x6a, 6, 1, 0),
    3949 /* Filter used to compensate the DC offset is added in the ADC to remove idle
    3950    tones from the audio band. */
    3951 AC97_SINGLE("DC Filter", 0x6a, 4, 1, 0),
    3952 /* Control smart-low-power mode feature. Allows automatic power down
    3953    of unused blocks in the ADC analog front end and the PLL. */
    3954 AC97_SINGLE("Smart Low Power Mode", 0x6c, 4, 3, 0),
    3955 };
    3956 
    3957 static int patch_ucb1400_specific(struct snd_ac97 * ac97)
    3958 {
    3959         int idx, err;
    3960         for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++) {
    3961                 err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_ucb1400[idx], ac97));
    3962                 if (err < 0)
    3963                         return err;
    3964         }
    3965         return 0;
    3966 }
    3967 
    3968 static const struct snd_ac97_build_ops patch_ucb1400_ops = {
    3969         .build_specific = patch_ucb1400_specific,
    3970 };
    3971 
    3972 static int patch_ucb1400(struct snd_ac97 * ac97)
    3973 {
    3974         ac97->build_ops = &patch_ucb1400_ops;
    3975         /* enable headphone driver and smart low power mode by default */
    3976         snd_ac97_write_cache(ac97, 0x6a, 0x0050);
    3977         snd_ac97_write_cache(ac97, 0x6c, 0x0030);
    3978         return 0;
    3979 }
  • GPL/trunk/alsa-kernel/pci/ac97/ac97_pcm.c

    r679 r772  
    232232 * for SPDIF).
    233233 *
    234  * The valid registers are AC97_PMC_MIC_ADC_RATE,
     234 * The valid registers are AC97_PCM_MIC_ADC_RATE,
    235235 * AC97_PCM_FRONT_DAC_RATE, AC97_PCM_LR_ADC_RATE.
    236236 * AC97_PCM_SURR_DAC_RATE and AC97_PCM_LFE_DAC_RATE are accepted
Note: See TracChangeset for help on using the changeset viewer.