Changeset 772 for GPL/trunk/alsa-kernel/pci/ymfpci
- Timestamp:
- Apr 19, 2025, 8:08:37 PM (6 months ago)
- Location:
- GPL/trunk
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
alsa-kernel/pci/ymfpci/ymfpci.c (modified) (8 diffs)
-
alsa-kernel/pci/ymfpci/ymfpci.h (modified) (3 diffs)
-
alsa-kernel/pci/ymfpci/ymfpci_main.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-6.6-LTS (added) merged: 765,768-769 /GPL/branches/uniaud32-exp (added) merged: 735-741,743-744,748-751,753-760,762-764 /GPL/branches/uniaud32-next merged: 718-734
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.c
r717 r772 103 103 case 0x205: legacy_ctrl2 |= 3 << 6; break; 104 104 default: 105 dev_err(chip->card->dev, 106 "invalid joystick port %#x", io_port); 105 if (io_port > 0) 106 dev_err(chip->card->dev, 107 "The %s does not support arbitrary IO ports for the game port (requested 0x%x)\n", 108 chip->card->shortname, (unsigned int)io_port); 107 109 return -EINVAL; 108 110 } … … 155 157 #endif /* SUPPORT_JOYSTICK */ 156 158 157 static int snd_card_ymfpci_probe(struct pci_dev *pci,158 const struct pci_device_id *pci_id)159 static int __snd_card_ymfpci_probe(struct pci_dev *pci, 160 const struct pci_device_id *pci_id) 159 161 { 160 162 static int dev; … … 175 177 } 176 178 177 err = snd_ card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,179 err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, 178 180 sizeof(*chip), &card); 179 181 if (err < 0) … … 191 193 } 192 194 195 strcpy(card->driver, str); 196 sprintf(card->shortname, "Yamaha %s (%s)", model, str); 197 sprintf(card->longname, "%s at 0x%lx, irq %i", 198 card->shortname, 199 chip->reg_area_phys, 200 chip->irq); 201 193 202 legacy_ctrl = 0; 194 203 legacy_ctrl2 = 0x0800; /* SBEN = 0, SMOD = 01, LAD = 0 */ … … 223 232 case 0x3a0: legacy_ctrl2 |= 2; break; 224 233 case 0x3a8: legacy_ctrl2 |= 3; break; 225 default: fm_port[dev] = 0; break; 234 default: 235 if (fm_port[dev] > 0) 236 dev_err(card->dev, 237 "The %s does not support arbitrary IO ports for FM (requested 0x%x)\n", 238 card->shortname, (unsigned int)fm_port[dev]); 239 fm_port[dev] = 0; 240 break; 226 241 } 227 242 if (fm_port[dev] > 0) … … 239 254 case 0x332: legacy_ctrl2 |= 2 << 4; break; 240 255 case 0x334: legacy_ctrl2 |= 3 << 4; break; 241 default: mpu_port[dev] = 0; break; 256 default: 257 if (mpu_port[dev] > 0) 258 dev_err(card->dev, 259 "The %s does not support arbitrary IO ports for MPU-401 (requested 0x%x)\n", 260 card->shortname, (unsigned int)mpu_port[dev]); 261 mpu_port[dev] = 0; 262 break; 242 263 } 243 264 if (mpu_port[dev] > 0) … … 262 283 return err; 263 284 264 strcpy(card->driver, str);265 sprintf(card->shortname, "Yamaha %s (%s)", model, str);266 sprintf(card->longname, "%s at 0x%lx, irq %i",267 card->shortname,268 chip->reg_area_phys,269 chip->irq);270 285 err = snd_ymfpci_pcm(chip, 0); 271 286 if (err < 0) … … 338 353 } 339 354 355 static int snd_card_ymfpci_probe(struct pci_dev *pci, 356 const struct pci_device_id *pci_id) 357 { 358 return snd_card_free_on_error(&pci->dev, __snd_card_ymfpci_probe(pci, pci_id)); 359 } 360 340 361 static struct pci_driver ymfpci_driver = { 341 362 .name = KBUILD_MODNAME, 342 363 .id_table = snd_ymfpci_ids, 343 364 .probe = snd_card_ymfpci_probe, 344 #ifdef CONFIG_PM_SLEEP345 365 .driver = { 346 .pm = &snd_ymfpci_pm,366 .pm = pm_sleep_ptr(&snd_ymfpci_pm), 347 367 }, 348 #endif349 368 }; 350 369 -
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci.h
r717 r772 269 269 }; 270 270 271 static const int saved_regs_index[] = { 272 /* spdif */ 273 YDSXGR_SPDIFOUTCTRL, 274 YDSXGR_SPDIFOUTSTATUS, 275 YDSXGR_SPDIFINCTRL, 276 /* volumes */ 277 YDSXGR_PRIADCLOOPVOL, 278 YDSXGR_NATIVEDACINVOL, 279 YDSXGR_NATIVEDACOUTVOL, 280 YDSXGR_BUF441OUTVOL, 281 YDSXGR_NATIVEADCINVOL, 282 YDSXGR_SPDIFLOOPVOL, 283 YDSXGR_SPDIFOUTVOL, 284 YDSXGR_ZVOUTVOL, 285 YDSXGR_LEGACYOUTVOL, 286 /* address bases */ 287 YDSXGR_PLAYCTRLBASE, 288 YDSXGR_RECCTRLBASE, 289 YDSXGR_EFFCTRLBASE, 290 YDSXGR_WORKBASE, 291 /* capture set up */ 292 YDSXGR_MAPOFREC, 293 YDSXGR_RECFORMAT, 294 YDSXGR_RECSLOTSR, 295 YDSXGR_ADCFORMAT, 296 YDSXGR_ADCSLOTSR, 297 }; 298 #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index) 299 300 static const int pci_saved_regs_index[] = { 301 /* All Chips */ 302 PCIR_DSXG_LEGACY, 303 PCIR_DSXG_ELEGACY, 304 /* YMF 744/754 */ 305 PCIR_DSXG_FMBASE, 306 PCIR_DSXG_SBBASE, 307 PCIR_DSXG_MPU401BASE, 308 PCIR_DSXG_JOYBASE, 309 }; 310 #define DSXG_PCI_NUM_SAVED_REGS ARRAY_SIZE(pci_saved_regs_index) 311 #define DSXG_PCI_NUM_SAVED_LEGACY_REGS 2 312 #ifndef TARGET_OS2 313 static_assert(DSXG_PCI_NUM_SAVED_LEGACY_REGS <= DSXG_PCI_NUM_SAVED_REGS); 314 #endif 315 271 316 struct snd_ymfpci { 272 317 int irq; … … 277 322 void __iomem *reg_area_virt; 278 323 279 u nsigned shortold_legacy_ctrl;324 u16 old_legacy_ctrl; 280 325 #ifdef SUPPORT_JOYSTICK 281 326 struct gameport *gameport; … … 346 391 const struct firmware *controller_microcode; 347 392 348 #ifdef CONFIG_PM_SLEEP 349 u32 *saved_regs; 393 u32 saved_regs[YDSXGR_NUM_SAVED_REGS]; 350 394 u32 saved_ydsxgr_mode; 351 u16 saved_dsxg_legacy; 352 u16 saved_dsxg_elegacy; 353 #endif 395 u16 saved_dsxg_pci_regs[DSXG_PCI_NUM_SAVED_REGS]; 354 396 }; 355 397 356 398 int snd_ymfpci_create(struct snd_card *card, 357 399 struct pci_dev *pci, 358 u nsigned shortold_legacy_ctrl);400 u16 old_legacy_ctrl); 359 401 void snd_ymfpci_free_gameport(struct snd_ymfpci *chip); 360 402 -
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c
r717 r772 35 35 36 36 static void snd_ymfpci_irq_wait(struct snd_ymfpci *chip); 37 38 static inline u8 snd_ymfpci_readb(struct snd_ymfpci *chip, u32 offset)39 {40 return readb(chip->reg_area_virt + offset);41 }42 37 43 38 static inline void snd_ymfpci_writeb(struct snd_ymfpci *chip, u32 offset, u8 val) … … 1832 1827 return -ENXIO; 1833 1828 kctl = snd_ctl_new1(&snd_ymfpci_spdif_default, chip); 1829 kctl->id.device = chip->pcm_spdif->device; 1834 1830 err = snd_ctl_add(chip->card, kctl); 1835 1831 if (err < 0) 1836 1832 return err; 1833 kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip); 1837 1834 kctl->id.device = chip->pcm_spdif->device; 1838 kctl = snd_ctl_new1(&snd_ymfpci_spdif_mask, chip);1839 1835 err = snd_ctl_add(chip->card, kctl); 1840 1836 if (err < 0) 1841 1837 return err; 1838 kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip); 1842 1839 kctl->id.device = chip->pcm_spdif->device; 1843 kctl = snd_ctl_new1(&snd_ymfpci_spdif_stream, chip);1844 1840 err = snd_ctl_add(chip->card, kctl); 1845 1841 if (err < 0) 1846 1842 return err; 1847 kctl->id.device = chip->pcm_spdif->device;1848 1843 chip->spdif_pcm_ctl = kctl; 1849 1844 … … 2170 2165 chip->work_base_addr = ptr_addr; 2171 2166 2172 snd_BUG_ON(ptr + chip->work_size!=2167 snd_BUG_ON(ptr + PAGE_ALIGN(chip->work_size) != 2173 2168 chip->work_ptr->area + chip->work_ptr->bytes); 2174 2169 … … 2224 2219 snd_ymfpci_free_gameport(chip); 2225 2220 2226 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);2221 pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, chip->old_legacy_ctrl); 2227 2222 2228 2223 release_firmware(chip->dsp_microcode); … … 2230 2225 } 2231 2226 2232 #ifdef CONFIG_PM_SLEEP2233 static const int saved_regs_index[] = {2234 /* spdif */2235 YDSXGR_SPDIFOUTCTRL,2236 YDSXGR_SPDIFOUTSTATUS,2237 YDSXGR_SPDIFINCTRL,2238 /* volumes */2239 YDSXGR_PRIADCLOOPVOL,2240 YDSXGR_NATIVEDACINVOL,2241 YDSXGR_NATIVEDACOUTVOL,2242 YDSXGR_BUF441OUTVOL,2243 YDSXGR_NATIVEADCINVOL,2244 YDSXGR_SPDIFLOOPVOL,2245 YDSXGR_SPDIFOUTVOL,2246 YDSXGR_ZVOUTVOL,2247 YDSXGR_LEGACYOUTVOL,2248 /* address bases */2249 YDSXGR_PLAYCTRLBASE,2250 YDSXGR_RECCTRLBASE,2251 YDSXGR_EFFCTRLBASE,2252 YDSXGR_WORKBASE,2253 /* capture set up */2254 YDSXGR_MAPOFREC,2255 YDSXGR_RECFORMAT,2256 YDSXGR_RECSLOTSR,2257 YDSXGR_ADCFORMAT,2258 YDSXGR_ADCSLOTSR,2259 };2260 #define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)2261 2262 2227 static int snd_ymfpci_suspend(struct device *dev) 2263 2228 { 2264 2229 struct snd_card *card = dev_get_drvdata(dev); 2265 2230 struct snd_ymfpci *chip = card->private_data; 2266 unsigned int i; 2267 2231 unsigned int i, legacy_reg_count = DSXG_PCI_NUM_SAVED_LEGACY_REGS; 2232 2233 if (chip->pci->device >= 0x0010) /* YMF 744/754 */ 2234 legacy_reg_count = DSXG_PCI_NUM_SAVED_REGS; 2235 2268 2236 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2269 2237 snd_ac97_suspend(chip->ac97); 2238 2270 2239 for (i = 0; i < YDSXGR_NUM_SAVED_REGS; i++) 2271 2240 chip->saved_regs[i] = snd_ymfpci_readl(chip, saved_regs_index[i]); 2241 2272 2242 chip->saved_ydsxgr_mode = snd_ymfpci_readl(chip, YDSXGR_MODE); 2273 pci_read_config_word(chip->pci, PCIR_DSXG_LEGACY, 2274 &chip->saved_dsxg_legacy); 2275 pci_read_config_word(chip->pci, PCIR_DSXG_ELEGACY, 2276 &chip->saved_dsxg_elegacy); 2243 2244 for (i = 0; i < legacy_reg_count; i++) 2245 pci_read_config_word(chip->pci, pci_saved_regs_index[i], 2246 chip->saved_dsxg_pci_regs + i); 2247 2277 2248 snd_ymfpci_writel(chip, YDSXGR_NATIVEDACOUTVOL, 0); 2278 2249 snd_ymfpci_writel(chip, YDSXGR_BUF441OUTVOL, 0); … … 2286 2257 struct snd_card *card = dev_get_drvdata(dev); 2287 2258 struct snd_ymfpci *chip = card->private_data; 2288 unsigned int i; 2259 unsigned int i, legacy_reg_count = DSXG_PCI_NUM_SAVED_LEGACY_REGS; 2260 2261 if (chip->pci->device >= 0x0010) /* YMF 744/754 */ 2262 legacy_reg_count = DSXG_PCI_NUM_SAVED_REGS; 2289 2263 2290 2264 snd_ymfpci_aclink_reset(pci); … … 2298 2272 snd_ac97_resume(chip->ac97); 2299 2273 2300 pci_write_config_word(chip->pci, PCIR_DSXG_LEGACY, 2301 chip->saved_dsxg_legacy); 2302 pci_write_config_word(chip->pci, PCIR_DSXG_ELEGACY, 2303 chip->saved_dsxg_elegacy); 2274 for (i = 0; i < legacy_reg_count; i++) 2275 pci_write_config_word(chip->pci, pci_saved_regs_index[i], 2276 chip->saved_dsxg_pci_regs[i]); 2304 2277 2305 2278 /* start hw again */ … … 2314 2287 } 2315 2288 2316 SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); 2317 #endif /* CONFIG_PM_SLEEP */ 2289 DEFINE_SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); 2318 2290 2319 2291 int snd_ymfpci_create(struct snd_card *card, 2320 2292 struct pci_dev *pci, 2321 u nsigned shortold_legacy_ctrl)2293 u16 old_legacy_ctrl) 2322 2294 { 2323 2295 struct snd_ymfpci *chip = card->private_data; … … 2384 2356 return err; 2385 2357 2386 #ifdef CONFIG_PM_SLEEP2387 chip->saved_regs = devm_kmalloc_array(&pci->dev, YDSXGR_NUM_SAVED_REGS,2388 sizeof(u32), GFP_KERNEL);2389 if (!chip->saved_regs)2390 return -ENOMEM;2391 #endif2392 2393 2358 snd_ymfpci_proc_init(card, chip); 2394 2359
Note:
See TracChangeset
for help on using the changeset viewer.
