diff options
Diffstat (limited to 'sound/pci/ymfpci')
-rw-r--r-- | sound/pci/ymfpci/ymfpci_main.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 05f1629760bc..997cf37cdddd 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -1421,17 +1421,15 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = { | |||
1421 | 1421 | ||
1422 | static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 1422 | static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) |
1423 | { | 1423 | { |
1424 | unsigned int mask = 1; | ||
1425 | |||
1426 | switch (kcontrol->private_value) { | 1424 | switch (kcontrol->private_value) { |
1427 | case YDSXGR_SPDIFOUTCTRL: break; | 1425 | case YDSXGR_SPDIFOUTCTRL: break; |
1428 | case YDSXGR_SPDIFINCTRL: break; | 1426 | case YDSXGR_SPDIFINCTRL: break; |
1429 | default: return -EINVAL; | 1427 | default: return -EINVAL; |
1430 | } | 1428 | } |
1431 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | 1429 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1432 | uinfo->count = 1; | 1430 | uinfo->count = 1; |
1433 | uinfo->value.integer.min = 0; | 1431 | uinfo->value.integer.min = 0; |
1434 | uinfo->value.integer.max = mask; | 1432 | uinfo->value.integer.max = 1; |
1435 | return 0; | 1433 | return 0; |
1436 | } | 1434 | } |
1437 | 1435 | ||
@@ -1439,7 +1437,7 @@ static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1439 | { | 1437 | { |
1440 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1438 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1441 | int reg = kcontrol->private_value; | 1439 | int reg = kcontrol->private_value; |
1442 | unsigned int shift = 0, mask = 1, invert = 0; | 1440 | unsigned int shift = 0, mask = 1; |
1443 | 1441 | ||
1444 | switch (kcontrol->private_value) { | 1442 | switch (kcontrol->private_value) { |
1445 | case YDSXGR_SPDIFOUTCTRL: break; | 1443 | case YDSXGR_SPDIFOUTCTRL: break; |
@@ -1447,8 +1445,6 @@ static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1447 | default: return -EINVAL; | 1445 | default: return -EINVAL; |
1448 | } | 1446 | } |
1449 | ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; | 1447 | ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; |
1450 | if (invert) | ||
1451 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | ||
1452 | return 0; | 1448 | return 0; |
1453 | } | 1449 | } |
1454 | 1450 | ||
@@ -1456,7 +1452,7 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1456 | { | 1452 | { |
1457 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1453 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1458 | int reg = kcontrol->private_value; | 1454 | int reg = kcontrol->private_value; |
1459 | unsigned int shift = 0, mask = 1, invert = 0; | 1455 | unsigned int shift = 0, mask = 1; |
1460 | int change; | 1456 | int change; |
1461 | unsigned int val, oval; | 1457 | unsigned int val, oval; |
1462 | 1458 | ||
@@ -1466,8 +1462,6 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1466 | default: return -EINVAL; | 1462 | default: return -EINVAL; |
1467 | } | 1463 | } |
1468 | val = (ucontrol->value.integer.value[0] & mask); | 1464 | val = (ucontrol->value.integer.value[0] & mask); |
1469 | if (invert) | ||
1470 | val = mask - val; | ||
1471 | val <<= shift; | 1465 | val <<= shift; |
1472 | spin_lock_irq(&chip->reg_lock); | 1466 | spin_lock_irq(&chip->reg_lock); |
1473 | oval = snd_ymfpci_readl(chip, reg); | 1467 | oval = snd_ymfpci_readl(chip, reg); |
@@ -1487,14 +1481,13 @@ static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1487 | static int snd_ymfpci_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 1481 | static int snd_ymfpci_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) |
1488 | { | 1482 | { |
1489 | unsigned int reg = kcontrol->private_value; | 1483 | unsigned int reg = kcontrol->private_value; |
1490 | unsigned int mask = 16383; | ||
1491 | 1484 | ||
1492 | if (reg < 0x80 || reg >= 0xc0) | 1485 | if (reg < 0x80 || reg >= 0xc0) |
1493 | return -EINVAL; | 1486 | return -EINVAL; |
1494 | uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | 1487 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
1495 | uinfo->count = 2; | 1488 | uinfo->count = 2; |
1496 | uinfo->value.integer.min = 0; | 1489 | uinfo->value.integer.min = 0; |
1497 | uinfo->value.integer.max = mask; | 1490 | uinfo->value.integer.max = 16383; |
1498 | return 0; | 1491 | return 0; |
1499 | } | 1492 | } |
1500 | 1493 | ||
@@ -1502,7 +1495,7 @@ static int snd_ymfpci_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1502 | { | 1495 | { |
1503 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1496 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1504 | unsigned int reg = kcontrol->private_value; | 1497 | unsigned int reg = kcontrol->private_value; |
1505 | unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0; | 1498 | unsigned int shift_left = 0, shift_right = 16, mask = 16383; |
1506 | unsigned int val; | 1499 | unsigned int val; |
1507 | 1500 | ||
1508 | if (reg < 0x80 || reg >= 0xc0) | 1501 | if (reg < 0x80 || reg >= 0xc0) |
@@ -1512,10 +1505,6 @@ static int snd_ymfpci_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1512 | spin_unlock_irq(&chip->reg_lock); | 1505 | spin_unlock_irq(&chip->reg_lock); |
1513 | ucontrol->value.integer.value[0] = (val >> shift_left) & mask; | 1506 | ucontrol->value.integer.value[0] = (val >> shift_left) & mask; |
1514 | ucontrol->value.integer.value[1] = (val >> shift_right) & mask; | 1507 | ucontrol->value.integer.value[1] = (val >> shift_right) & mask; |
1515 | if (invert) { | ||
1516 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | ||
1517 | ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; | ||
1518 | } | ||
1519 | return 0; | 1508 | return 0; |
1520 | } | 1509 | } |
1521 | 1510 | ||
@@ -1523,7 +1512,7 @@ static int snd_ymfpci_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1523 | { | 1512 | { |
1524 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); | 1513 | ymfpci_t *chip = snd_kcontrol_chip(kcontrol); |
1525 | unsigned int reg = kcontrol->private_value; | 1514 | unsigned int reg = kcontrol->private_value; |
1526 | unsigned int shift_left = 0, shift_right = 16, mask = 16383, invert = 0; | 1515 | unsigned int shift_left = 0, shift_right = 16, mask = 16383; |
1527 | int change; | 1516 | int change; |
1528 | unsigned int val1, val2, oval; | 1517 | unsigned int val1, val2, oval; |
1529 | 1518 | ||
@@ -1531,10 +1520,6 @@ static int snd_ymfpci_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1531 | return -EINVAL; | 1520 | return -EINVAL; |
1532 | val1 = ucontrol->value.integer.value[0] & mask; | 1521 | val1 = ucontrol->value.integer.value[0] & mask; |
1533 | val2 = ucontrol->value.integer.value[1] & mask; | 1522 | val2 = ucontrol->value.integer.value[1] & mask; |
1534 | if (invert) { | ||
1535 | val1 = mask - val1; | ||
1536 | val2 = mask - val2; | ||
1537 | } | ||
1538 | val1 <<= shift_left; | 1523 | val1 <<= shift_left; |
1539 | val2 <<= shift_right; | 1524 | val2 <<= shift_right; |
1540 | spin_lock_irq(&chip->reg_lock); | 1525 | spin_lock_irq(&chip->reg_lock); |