aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/pcxhr/pcxhr.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/pcxhr/pcxhr.c')
-rw-r--r--sound/pci/pcxhr/pcxhr.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 0435f45e9513..e3ac1f768ff6 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1368,6 +1368,67 @@ static void pcxhr_proc_gpo_write(struct snd_info_entry *entry,
1368 } 1368 }
1369} 1369}
1370 1370
1371/* Access to the results of the CMD_GET_TIME_CODE RMH */
1372#define TIME_CODE_VALID_MASK 0x00800000
1373#define TIME_CODE_NEW_MASK 0x00400000
1374#define TIME_CODE_BACK_MASK 0x00200000
1375#define TIME_CODE_WAIT_MASK 0x00100000
1376
1377/* Values for the CMD_MANAGE_SIGNAL RMH */
1378#define MANAGE_SIGNAL_TIME_CODE 0x01
1379#define MANAGE_SIGNAL_MIDI 0x02
1380
1381/* linear time code read proc*/
1382static void pcxhr_proc_ltc(struct snd_info_entry *entry,
1383 struct snd_info_buffer *buffer)
1384{
1385 struct snd_pcxhr *chip = entry->private_data;
1386 struct pcxhr_mgr *mgr = chip->mgr;
1387 struct pcxhr_rmh rmh;
1388 unsigned int ltcHrs, ltcMin, ltcSec, ltcFrm;
1389 int err;
1390 /* commands available when embedded DSP is running */
1391 if (!(mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))) {
1392 snd_iprintf(buffer, "no firmware loaded\n");
1393 return;
1394 }
1395 if (!mgr->capture_ltc) {
1396 pcxhr_init_rmh(&rmh, CMD_MANAGE_SIGNAL);
1397 rmh.cmd[0] |= MANAGE_SIGNAL_TIME_CODE;
1398 err = pcxhr_send_msg(mgr, &rmh);
1399 if (err) {
1400 snd_iprintf(buffer, "ltc not activated (%d)\n", err);
1401 return;
1402 }
1403 if (mgr->is_hr_stereo)
1404 hr222_manage_timecode(mgr, 1);
1405 else
1406 pcxhr_write_io_num_reg_cont(mgr, REG_CONT_VALSMPTE,
1407 REG_CONT_VALSMPTE, NULL);
1408 mgr->capture_ltc = 1;
1409 }
1410 pcxhr_init_rmh(&rmh, CMD_GET_TIME_CODE);
1411 err = pcxhr_send_msg(mgr, &rmh);
1412 if (err) {
1413 snd_iprintf(buffer, "ltc read error (err=%d)\n", err);
1414 return ;
1415 }
1416 ltcHrs = 10*((rmh.stat[0] >> 8) & 0x3) + (rmh.stat[0] & 0xf);
1417 ltcMin = 10*((rmh.stat[1] >> 16) & 0x7) + ((rmh.stat[1] >> 8) & 0xf);
1418 ltcSec = 10*(rmh.stat[1] & 0x7) + ((rmh.stat[2] >> 16) & 0xf);
1419 ltcFrm = 10*((rmh.stat[2] >> 8) & 0x3) + (rmh.stat[2] & 0xf);
1420
1421 snd_iprintf(buffer, "timecode: %02u:%02u:%02u-%02u\n",
1422 ltcHrs, ltcMin, ltcSec, ltcFrm);
1423 snd_iprintf(buffer, "raw: 0x%04x%06x%06x\n", rmh.stat[0] & 0x00ffff,
1424 rmh.stat[1] & 0xffffff, rmh.stat[2] & 0xffffff);
1425 /*snd_iprintf(buffer, "dsp ref time: 0x%06x%06x\n",
1426 rmh.stat[3] & 0xffffff, rmh.stat[4] & 0xffffff);*/
1427 if (!(rmh.stat[0] & TIME_CODE_VALID_MASK)) {
1428 snd_iprintf(buffer, "warning: linear timecode not valid\n");
1429 }
1430}
1431
1371static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) 1432static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip)
1372{ 1433{
1373 struct snd_info_entry *entry; 1434 struct snd_info_entry *entry;
@@ -1383,6 +1444,8 @@ static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip)
1383 entry->c.text.write = pcxhr_proc_gpo_write; 1444 entry->c.text.write = pcxhr_proc_gpo_write;
1384 entry->mode |= S_IWUSR; 1445 entry->mode |= S_IWUSR;
1385 } 1446 }
1447 if (!snd_card_proc_new(chip->card, "ltc", &entry))
1448 snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc);
1386} 1449}
1387/* end of proc interface */ 1450/* end of proc interface */
1388 1451