Changeset 703 for GPL/trunk/alsa-kernel/pci/ac97
- Timestamp:
- Sep 26, 2021, 6:18:40 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
alsa-kernel/pci/ac97/ac97_codec.c (modified) (37 diffs)
-
alsa-kernel/pci/ac97/ac97_patch.c (modified) (25 diffs)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-next merged: 696-702
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/ac97/ac97_codec.c
r679 r703 1333 1333 if (snd_ac97_try_bit(ac97, reg, 15)) { 1334 1334 sprintf(name, "%s Switch", pfx); 1335 if ((err = snd_ac97_cmute_new_stereo(card, name, reg, 1336 check_stereo, check_amix, 1337 ac97)) < 0) 1335 err = snd_ac97_cmute_new_stereo(card, name, reg, 1336 check_stereo, check_amix, 1337 ac97); 1338 if (err < 0) 1338 1339 return err; 1339 1340 } … … 1341 1342 if (lo_max) { 1342 1343 sprintf(name, "%s Volume", pfx); 1343 if ((err = snd_ac97_cvol_new(card, name, reg, lo_max, hi_max, ac97)) < 0) 1344 err = snd_ac97_cvol_new(card, name, reg, lo_max, hi_max, ac97); 1345 if (err < 0) 1344 1346 return err; 1345 1347 } … … 1380 1382 if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER)) 1381 1383 && !(ac97->flags & AC97_AD_MULTI)) { 1382 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97))) < 0) 1384 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_center[0], ac97)); 1385 if (err < 0) 1383 1386 return err; 1384 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_center[1], ac97))) < 0) 1387 err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_center[1], ac97)); 1388 if (err < 0) 1385 1389 return err; 1386 1390 snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 0, &max); … … 1394 1398 if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER+1)) 1395 1399 && !(ac97->flags & AC97_AD_MULTI)) { 1396 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_lfe[0], ac97))) < 0) 1400 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_lfe[0], ac97)); 1401 if (err < 0) 1397 1402 return err; 1398 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_lfe[1], ac97))) < 0) 1403 err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_lfe[1], ac97)); 1404 if (err < 0) 1399 1405 return err; 1400 1406 snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 8, &max); … … 1409 1415 && !(ac97->flags & AC97_AD_MULTI)) { 1410 1416 /* Surround Master (0x38) is with stereo mutes */ 1411 if ((err = snd_ac97_cmix_new_stereo(card, "Surround Playback", 1412 AC97_SURROUND_MASTER, 1, 0, 1413 ac97)) < 0) 1417 err = snd_ac97_cmix_new_stereo(card, "Surround Playback", 1418 AC97_SURROUND_MASTER, 1, 0, 1419 ac97); 1420 if (err < 0) 1414 1421 return err; 1415 1422 } … … 1417 1424 /* build headphone controls */ 1418 1425 if (snd_ac97_try_volume_mix(ac97, AC97_HEADPHONE)) { 1419 if ((err = snd_ac97_cmix_new(card, "Headphone Playback", 1420 AC97_HEADPHONE, 0, ac97)) < 0) 1426 err = snd_ac97_cmix_new(card, "Headphone Playback", 1427 AC97_HEADPHONE, 0, ac97); 1428 if (err < 0) 1421 1429 return err; 1422 1430 } … … 1424 1432 /* build master mono controls */ 1425 1433 if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_MONO)) { 1426 if ((err = snd_ac97_cmix_new(card, "Master Mono Playback", 1427 AC97_MASTER_MONO, 0, ac97)) < 0) 1434 err = snd_ac97_cmix_new(card, "Master Mono Playback", 1435 AC97_MASTER_MONO, 0, ac97); 1436 if (err < 0) 1428 1437 return err; 1429 1438 } … … 1433 1442 if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) { 1434 1443 for (idx = 0; idx < 2; idx++) { 1435 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) 1444 kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97); 1445 err = snd_ctl_add(card, kctl); 1446 if (err < 0) 1436 1447 return err; 1437 1448 if (ac97->id == AC97_ID_YMF743 || … … 1449 1460 ((ac97->flags & AC97_HAS_PC_BEEP) || 1450 1461 snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) { 1451 for (idx = 0; idx < 2; idx++) 1452 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0) 1462 for (idx = 0; idx < 2; idx++) { 1463 kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97); 1464 err = snd_ctl_add(card, kctl); 1465 if (err < 0) 1453 1466 return err; 1467 } 1454 1468 set_tlv_db_scale(kctl, db_scale_4bit); 1455 1469 snd_ac97_write_cache( … … 1464 1478 if (!(ac97->flags & AC97_HAS_NO_PHONE)) { 1465 1479 if (snd_ac97_try_volume_mix(ac97, AC97_PHONE)) { 1466 if ((err = snd_ac97_cmix_new(card, "Phone Playback", 1467 AC97_PHONE, 1, ac97)) < 0) 1480 err = snd_ac97_cmix_new(card, "Phone Playback", 1481 AC97_PHONE, 1, ac97); 1482 if (err < 0) 1468 1483 return err; 1469 1484 } … … 1473 1488 if (!(ac97->flags & AC97_HAS_NO_MIC)) { 1474 1489 if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) { 1475 if ((err = snd_ac97_cmix_new(card, "Mic Playback", 1476 AC97_MIC, 1, ac97)) < 0) 1490 err = snd_ac97_cmix_new(card, "Mic Playback", 1491 AC97_MIC, 1, ac97); 1492 if (err < 0) 1477 1493 return err; 1478 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0) 1494 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97)); 1495 if (err < 0) 1479 1496 return err; 1480 1497 } … … 1483 1500 /* build Line controls */ 1484 1501 if (snd_ac97_try_volume_mix(ac97, AC97_LINE)) { 1485 if ((err = snd_ac97_cmix_new(card, "Line Playback", 1486 AC97_LINE, 1, ac97)) < 0) 1502 err = snd_ac97_cmix_new(card, "Line Playback", 1503 AC97_LINE, 1, ac97); 1504 if (err < 0) 1487 1505 return err; 1488 1506 } … … 1491 1509 if (!(ac97->flags & AC97_HAS_NO_CD)) { 1492 1510 if (snd_ac97_try_volume_mix(ac97, AC97_CD)) { 1493 if ((err = snd_ac97_cmix_new(card, "CD Playback", 1494 AC97_CD, 1, ac97)) < 0) 1511 err = snd_ac97_cmix_new(card, "CD Playback", 1512 AC97_CD, 1, ac97); 1513 if (err < 0) 1495 1514 return err; 1496 1515 } … … 1500 1519 if (!(ac97->flags & AC97_HAS_NO_VIDEO)) { 1501 1520 if (snd_ac97_try_volume_mix(ac97, AC97_VIDEO)) { 1502 if ((err = snd_ac97_cmix_new(card, "Video Playback", 1503 AC97_VIDEO, 1, ac97)) < 0) 1521 err = snd_ac97_cmix_new(card, "Video Playback", 1522 AC97_VIDEO, 1, ac97); 1523 if (err < 0) 1504 1524 return err; 1505 1525 } … … 1509 1529 if (!(ac97->flags & AC97_HAS_NO_AUX)) { 1510 1530 if (snd_ac97_try_volume_mix(ac97, AC97_AUX)) { 1511 if ((err = snd_ac97_cmix_new(card, "Aux Playback", 1512 AC97_AUX, 1, ac97)) < 0) 1531 err = snd_ac97_cmix_new(card, "Aux Playback", 1532 AC97_AUX, 1, ac97); 1533 if (err < 0) 1513 1534 return err; 1514 1535 } … … 1522 1543 else 1523 1544 init_val = 0x9f1f; 1524 for (idx = 0; idx < 2; idx++) 1525 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97))) < 0) 1545 for (idx = 0; idx < 2; idx++) { 1546 kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97); 1547 err = snd_ctl_add(card, kctl); 1548 if (err < 0) 1526 1549 return err; 1550 } 1527 1551 set_tlv_db_scale(kctl, db_scale_5bit); 1528 1552 ac97->spec.ad18xx.pcmreg[0] = init_val; 1529 1553 if (ac97->scaps & AC97_SCAP_SURROUND_DAC) { 1530 for (idx = 0; idx < 2; idx++) 1531 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97))) < 0) 1554 for (idx = 0; idx < 2; idx++) { 1555 kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97); 1556 err = snd_ctl_add(card, kctl); 1557 if (err < 0) 1532 1558 return err; 1559 } 1533 1560 set_tlv_db_scale(kctl, db_scale_5bit); 1534 1561 ac97->spec.ad18xx.pcmreg[1] = init_val; 1535 1562 } 1536 1563 if (ac97->scaps & AC97_SCAP_CENTER_LFE_DAC) { 1537 for (idx = 0; idx < 2; idx++) 1538 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97))) < 0) 1564 for (idx = 0; idx < 2; idx++) { 1565 kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97); 1566 err = snd_ctl_add(card, kctl); 1567 if (err < 0) 1539 1568 return err; 1569 } 1540 1570 set_tlv_db_scale(kctl, db_scale_5bit); 1541 for (idx = 0; idx < 2; idx++) 1542 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97))) < 0) 1571 for (idx = 0; idx < 2; idx++) { 1572 kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97); 1573 err = snd_ctl_add(card, kctl); 1574 if (err < 0) 1543 1575 return err; 1576 } 1544 1577 set_tlv_db_scale(kctl, db_scale_5bit); 1545 1578 ac97->spec.ad18xx.pcmreg[2] = init_val; … … 1562 1595 /* build Capture controls */ 1563 1596 if (!(ac97->flags & AC97_HAS_NO_REC_GAIN)) { 1564 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_control_capture_src, ac97))) < 0) 1597 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_control_capture_src, ac97)); 1598 if (err < 0) 1565 1599 return err; 1566 1600 if (snd_ac97_try_bit(ac97, AC97_REC_GAIN, 15)) { … … 1570 1604 return err; 1571 1605 } 1572 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97))) < 0) 1606 kctl = snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97); 1607 err = snd_ctl_add(card, kctl); 1608 if (err < 0) 1573 1609 return err; 1574 1610 set_tlv_db_scale(kctl, db_scale_rec_gain); … … 1578 1614 /* build MIC Capture controls */ 1579 1615 if (snd_ac97_try_volume_mix(ac97, AC97_REC_GAIN_MIC)) { 1580 for (idx = 0; idx < 2; idx++) 1581 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97))) < 0) 1616 for (idx = 0; idx < 2; idx++) { 1617 kctl = snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97); 1618 err = snd_ctl_add(card, kctl); 1619 if (err < 0) 1582 1620 return err; 1621 } 1583 1622 set_tlv_db_scale(kctl, db_scale_rec_gain); 1584 1623 snd_ac97_write_cache(ac97, AC97_REC_GAIN_MIC, 0x0000); … … 1587 1626 /* build PCM out path & mute control */ 1588 1627 if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 15)) { 1589 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_PCM_OUT], ac97))) < 0) 1628 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_PCM_OUT], ac97)); 1629 if (err < 0) 1590 1630 return err; 1591 1631 } … … 1593 1633 /* build Simulated Stereo Enhancement control */ 1594 1634 if (ac97->caps & AC97_BC_SIM_STEREO) { 1595 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0) 1635 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97)); 1636 if (err < 0) 1596 1637 return err; 1597 1638 } … … 1599 1640 /* build 3D Stereo Enhancement control */ 1600 1641 if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 13)) { 1601 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_3D], ac97))) < 0) 1642 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_3D], ac97)); 1643 if (err < 0) 1602 1644 return err; 1603 1645 } … … 1605 1647 /* build Loudness control */ 1606 1648 if (ac97->caps & AC97_BC_LOUDNESS) { 1607 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0) 1649 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97)); 1650 if (err < 0) 1608 1651 return err; 1609 1652 } … … 1611 1654 /* build Mono output select control */ 1612 1655 if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 9)) { 1613 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MONO], ac97))) < 0) 1656 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MONO], ac97)); 1657 if (err < 0) 1614 1658 return err; 1615 1659 } … … 1617 1661 /* build Mic select control */ 1618 1662 if (snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 8)) { 1619 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MIC], ac97))) < 0) 1663 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_MIC], ac97)); 1664 if (err < 0) 1620 1665 return err; 1621 1666 } … … 1623 1668 /* build ADC/DAC loopback control */ 1624 1669 if (enable_loopback && snd_ac97_try_bit(ac97, AC97_GENERAL_PURPOSE, 7)) { 1625 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOOPBACK], ac97))) < 0) 1670 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOOPBACK], ac97)); 1671 if (err < 0) 1626 1672 return err; 1627 1673 } … … 1639 1685 val = snd_ac97_read(ac97, AC97_3D_CONTROL); 1640 1686 val = val == 0x0606; 1641 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0) 1687 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); 1688 err = snd_ctl_add(card, kctl); 1689 if (err < 0) 1642 1690 return err; 1643 1691 if (val) 1644 1692 kctl->private_value = AC97_3D_CONTROL | (9 << 8) | (7 << 16); 1645 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[1], ac97))) < 0) 1693 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[1], ac97); 1694 err = snd_ctl_add(card, kctl); 1695 if (err < 0) 1646 1696 return err; 1647 1697 if (val) … … 1660 1710 if ((ac97->ext_id & AC97_EI_SPDIF) && !(ac97->scaps & AC97_SCAP_NO_SPDIF)) { 1661 1711 if (ac97->build_ops->build_spdif) { 1662 if ((err = ac97->build_ops->build_spdif(ac97)) < 0) 1712 err = ac97->build_ops->build_spdif(ac97); 1713 if (err < 0) 1663 1714 return err; 1664 1715 } else { 1665 for (idx = 0; idx < 5; idx++) 1666 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_spdif[idx], ac97))) < 0) 1716 for (idx = 0; idx < 5; idx++) { 1717 err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_spdif[idx], ac97)); 1718 if (err < 0) 1667 1719 return err; 1720 } 1668 1721 if (ac97->build_ops->build_post_spdif) { 1669 if ((err = ac97->build_ops->build_post_spdif(ac97)) < 0) 1722 err = ac97->build_ops->build_post_spdif(ac97); 1723 if (err < 0) 1670 1724 return err; 1671 1725 } … … 1679 1733 1680 1734 /* build chip specific controls */ 1681 if (ac97->build_ops->build_specific) 1682 if ((err = ac97->build_ops->build_specific(ac97)) < 0) 1735 if (ac97->build_ops->build_specific) { 1736 err = ac97->build_ops->build_specific(ac97); 1737 if (err < 0) 1683 1738 return err; 1739 } 1684 1740 1685 1741 if (snd_ac97_try_bit(ac97, AC97_POWERDOWN, 15)) { … … 1689 1745 if (ac97->scaps & AC97_SCAP_INV_EAPD) 1690 1746 set_inv_eapd(ac97, kctl); 1691 if ((err = snd_ctl_add(card, kctl)) < 0) 1747 err = snd_ctl_add(card, kctl); 1748 if (err < 0) 1692 1749 return err; 1693 1750 } … … 1711 1768 1712 1769 /* build modem switches */ 1713 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) 1714 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97))) < 0) 1770 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_modem_switches); idx++) { 1771 err = snd_ctl_add(card, snd_ctl_new1(&snd_ac97_controls_modem_switches[idx], ac97)); 1772 if (err < 0) 1715 1773 return err; 1774 } 1716 1775 1717 1776 /* build chip specific controls */ 1718 if (ac97->build_ops->build_specific) 1719 if ((err = ac97->build_ops->build_specific(ac97)) < 0) 1777 if (ac97->build_ops->build_specific) { 1778 err = ac97->build_ops->build_specific(ac97); 1779 if (err < 0) 1720 1780 return err; 1781 } 1721 1782 1722 1783 return 0; … … 1963 2024 spin_lock_init(&bus->bus_lock); 1964 2025 snd_ac97_bus_proc_init(bus); 1965 if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops)) < 0) { 2026 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); 2027 if (err < 0) { 1966 2028 snd_ac97_bus_free(bus); 1967 2029 return err; … … 1992 2054 ac97->bus->card->number, ac97->num, 1993 2055 snd_ac97_get_short_name(ac97)); 1994 if ((err = device_register(&ac97->dev)) < 0) { 2056 err = device_register(&ac97->dev); 2057 if (err < 0) { 1995 2058 ac97_err(ac97, "Can't register ac97 bus\n"); 1996 2059 ac97->dev.bus = NULL; … … 2147 2210 /* test if we can write to the record gain volume register */ 2148 2211 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x8a06); 2149 if (((err = snd_ac97_read(ac97, AC97_REC_GAIN)) & 0x7fff) == 0x0a06) 2212 err = snd_ac97_read(ac97, AC97_REC_GAIN); 2213 if ((err & 0x7fff) == 0x0a06) 2150 2214 ac97->scaps |= AC97_SCAP_AUDIO; 2151 2215 } … … 2300 2364 } 2301 2365 sprintf(comp, "AC97a:%08x", ac97->id); 2302 if ((err = snd_component_add(card, comp)) < 0) { 2366 err = snd_component_add(card, comp); 2367 if (err < 0) { 2303 2368 snd_ac97_free(ac97); 2304 2369 return err; … … 2320 2385 } 2321 2386 sprintf(comp, "AC97m:%08x", ac97->id); 2322 if ((err = snd_component_add(card, comp)) < 0) { 2387 err = snd_component_add(card, comp); 2388 if (err < 0) { 2323 2389 snd_ac97_free(ac97); 2324 2390 return err; … … 2332 2398 update_power_regs(ac97); 2333 2399 snd_ac97_proc_init(ac97); 2334 if ((err = snd_device_new(card, SNDRV_DEV_CODEC, ac97, &ops)) < 0) { 2400 err = snd_device_new(card, SNDRV_DEV_CODEC, ac97, &ops); 2401 if (err < 0) { 2335 2402 snd_ac97_free(ac97); 2336 2403 return err; -
GPL/trunk/alsa-kernel/pci/ac97/ac97_patch.c
r679 r703 30 30 int idx, err; 31 31 32 for (idx = 0; idx < count; idx++) 33 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97))) < 0) 32 for (idx = 0; idx < count; idx++) { 33 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97)); 34 if (err < 0) 34 35 return err; 36 } 35 37 return 0; 36 38 } … … 417 419 int err; 418 420 419 if ((err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif))) < 0) 421 err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_controls_spdif)); 422 if (err < 0) 420 423 return err; 421 424 return 0; … … 462 465 463 466 for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) { 464 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0) 467 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97)); 468 if (err < 0) 465 469 return err; 466 470 } … … 492 496 int err, i; 493 497 for (i = 0; i < ARRAY_SIZE(wm9704_snd_ac97_controls); i++) { 494 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97))) < 0) 498 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97)); 499 if (err < 0) 495 500 return err; 496 501 } … … 632 637 633 638 for (i = 0; i < ARRAY_SIZE(wm9711_snd_ac97_controls); i++) { 634 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0) 639 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97)); 640 if (err < 0) 635 641 return err; 636 642 } … … 799 805 800 806 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) { 801 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0) 807 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97)); 808 if (err < 0) 802 809 return err; 803 810 } … … 810 817 811 818 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls); i++) { 812 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0) 819 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97)); 820 if (err < 0) 813 821 return err; 814 822 } … … 884 892 int err; 885 893 886 if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0) 894 err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97)); 895 if (err < 0) 887 896 return err; 888 897 strcpy(kctl->id.name, "3D Control Sigmatel - Depth"); … … 897 906 int err; 898 907 899 if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0) 908 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); 909 err = snd_ctl_add(ac97->bus->card, kctl); 910 if (err < 0) 900 911 return err; 901 912 strcpy(kctl->id.name, "3D Control Sigmatel - Depth"); 902 913 kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 0, 3, 0); 903 if ((err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97))) < 0) 914 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); 915 err = snd_ctl_add(ac97->bus->card, kctl); 916 if (err < 0) 904 917 return err; 905 918 strcpy(kctl->id.name, "3D Control Sigmatel - Rear Depth"); … … 928 941 929 942 snd_ac97_write_cache(ac97, AC97_SIGMATEL_ANALOG, snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG) & ~0x0003); 930 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 1)) 931 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1)) < 0) 943 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 1)) { 944 err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1); 945 if (err < 0) 932 946 return err; 933 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 0)) 934 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1)) < 0) 947 } 948 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 0)) { 949 err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1); 950 if (err < 0) 935 951 return err; 936 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 2)) 937 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1)) < 0) 952 } 953 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 2)) { 954 err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1); 955 if (err < 0) 938 956 return err; 939 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 3)) 940 if ((err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1)) < 0) 957 } 958 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 3)) { 959 err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1); 960 if (err < 0) 941 961 return err; 962 } 942 963 return 0; 943 964 } … … 985 1006 986 1007 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Sigmatel Surround Playback"); 987 if ((err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1)) < 0) 1008 err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1); 1009 if (err < 0) 988 1010 return err; 989 1011 return patch_sigmatel_stac97xx_specific(ac97); … … 1263 1285 1264 1286 /* con mask, pro mask, default */ 1265 if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0) 1287 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); 1288 if (err < 0) 1266 1289 return err; 1267 1290 /* switch, spsa */ 1268 if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1)) < 0) 1291 err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1); 1292 if (err < 0) 1269 1293 return err; 1270 1294 switch (ac97->id & AC97_ID_CS_MASK) { 1271 1295 case AC97_ID_CS4205: 1272 if ((err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1)) < 0) 1296 err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1); 1297 if (err < 0) 1273 1298 return err; 1274 1299 break; … … 1325 1350 1326 1351 /* con mask, pro mask, default */ 1327 if ((err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3)) < 0) 1352 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); 1353 if (err < 0) 1328 1354 return err; 1329 1355 /* switch */ 1330 if ((err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1)) < 0) 1356 err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1); 1357 if (err < 0) 1331 1358 return err; 1332 1359 /* set default PCM S/PDIF params */ … … 1593 1620 int err; 1594 1621 1595 if ((err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885))) < 0) 1622 err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885)); 1623 if (err < 0) 1596 1624 return err; 1597 1625 reset_tlv(ac97, "Headphone Playback Volume", … … 1876 1904 int err; 1877 1905 1878 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 1906 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); 1907 if (err < 0) 1879 1908 return err; 1880 1909 if (check_list(ac97, ad1981_jacks_denylist)) … … 2061 2090 int err; 2062 2091 2063 if ((err = patch_ad1888_specific(ac97)) < 0) 2092 err = patch_ad1888_specific(ac97); 2093 if (err < 0) 2064 2094 return err; 2065 2095 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); … … 2169 2199 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); 2170 2200 2171 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 2201 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); 2202 if (err < 0) 2172 2203 return err; 2173 2204 … … 2461 2492 int err; 2462 2493 2463 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 2494 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); 2495 if (err < 0) 2464 2496 return err; 2465 2497 … … 2583 2615 int err; 2584 2616 2585 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc650, ARRAY_SIZE(snd_ac97_controls_alc650))) < 0) 2617 err = patch_build_controls(ac97, snd_ac97_controls_alc650, ARRAY_SIZE(snd_ac97_controls_alc650)); 2618 if (err < 0) 2586 2619 return err; 2587 2620 if (ac97->ext_id & AC97_EI_SPDIF) { 2588 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650, ARRAY_SIZE(snd_ac97_spdif_controls_alc650))) < 0) 2621 err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650, ARRAY_SIZE(snd_ac97_spdif_controls_alc650)); 2622 if (err < 0) 2589 2623 return err; 2590 2624 } … … 2736 2770 int err; 2737 2771 2738 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655))) < 0) 2772 err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655)); 2773 if (err < 0) 2739 2774 return err; 2740 2775 if (ac97->ext_id & AC97_EI_SPDIF) { 2741 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0) 2776 err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655)); 2777 if (err < 0) 2742 2778 return err; 2743 2779 } … … 2848 2884 int err; 2849 2885 2850 if ((err = patch_build_controls(ac97, snd_ac97_controls_alc850, ARRAY_SIZE(snd_ac97_controls_alc850))) < 0) 2886 err = patch_build_controls(ac97, snd_ac97_controls_alc850, ARRAY_SIZE(snd_ac97_controls_alc850)); 2887 if (err < 0) 2851 2888 return err; 2852 2889 if (ac97->ext_id & AC97_EI_SPDIF) { 2853 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655))) < 0) 2890 err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_controls_alc655)); 2891 if (err < 0) 2854 2892 return err; 2855 2893 } … … 3438 3476 int err; 3439 3477 3440 if (snd_ac97_try_bit(ac97, 0x5a, 9)) 3441 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1)) < 0) 3478 if (snd_ac97_try_bit(ac97, 0x5a, 9)) { 3479 err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1); 3480 if (err < 0) 3442 3481 return err; 3443 if ((err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1)) < 0) 3482 } 3483 err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1); 3484 if (err < 0) 3444 3485 return err; 3445 3486 … … 3811 3852 { 3812 3853 int err; 3813 if ((err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646))) < 0) 3854 err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646)); 3855 if (err < 0) 3814 3856 return err; 3815 if ((err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646, ARRAY_SIZE(snd_ac97_spdif_controls_it2646))) < 0) 3857 err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646, ARRAY_SIZE(snd_ac97_spdif_controls_it2646)); 3858 if (err < 0) 3816 3859 return err; 3817 3860 return 0; … … 3846 3889 { 3847 3890 int idx, err; 3848 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++) 3849 if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97))) < 0) 3891 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_si3036); idx++) { 3892 err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97)); 3893 if (err < 0) 3850 3894 return err; 3895 } 3851 3896 return 0; 3852 3897 } … … 3913 3958 { 3914 3959 int idx, err; 3915 for (idx = 0; idx < ARRAY_SIZE(snd_ac97_controls_ucb1400); idx++) 3916 if ((err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_ucb1400[idx], ac97))) < 0) 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) 3917 3963 return err; 3964 } 3918 3965 return 0; 3919 3966 }
Note:
See TracChangeset
for help on using the changeset viewer.
