~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to sound/soc/omap/omap-mcbsp.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Copyright (C) 2008 Nokia Corporation
5
5
 *
6
 
 * Contact: Jarkko Nikula <jhnikula@gmail.com>
 
6
 * Contact: Jarkko Nikula <jarkko.nikula@bitmer.com>
7
7
 *          Peter Ujfalusi <peter.ujfalusi@ti.com>
8
8
 *
9
9
 * This program is free software; you can redistribute it and/or
317
317
                return 0;
318
318
        }
319
319
 
 
320
        regs->rcr2      &= ~(RPHASE | RFRLEN2(0x7f) | RWDLEN2(7));
 
321
        regs->xcr2      &= ~(RPHASE | XFRLEN2(0x7f) | XWDLEN2(7));
 
322
        regs->rcr1      &= ~(RFRLEN1(0x7f) | RWDLEN1(7));
 
323
        regs->xcr1      &= ~(XFRLEN1(0x7f) | XWDLEN1(7));
320
324
        format = mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
321
325
        wpf = channels = params_channels(params);
322
326
        if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
369
373
                framesize = wlen * channels;
370
374
 
371
375
        /* Set FS period and length in terms of bit clock periods */
 
376
        regs->srgr2     &= ~FPER(0xfff);
 
377
        regs->srgr1     &= ~FWID(0xff);
372
378
        switch (format) {
373
379
        case SND_SOC_DAIFMT_I2S:
374
380
        case SND_SOC_DAIFMT_LEFT_J:
398
404
{
399
405
        struct omap_mcbsp_data *mcbsp_data = snd_soc_dai_get_drvdata(cpu_dai);
400
406
        struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
401
 
        unsigned int temp_fmt = fmt;
 
407
        bool inv_fs = false;
402
408
 
403
409
        if (mcbsp_data->configured)
404
410
                return 0;
430
436
                regs->xcr2      |= XDATDLY(0);
431
437
                regs->spcr1     |= RJUST(2);
432
438
                /* Invert FS polarity configuration */
433
 
                temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
 
439
                inv_fs = true;
434
440
                break;
435
441
        case SND_SOC_DAIFMT_DSP_A:
436
442
                /* 1-bit data delay */
437
443
                regs->rcr2      |= RDATDLY(1);
438
444
                regs->xcr2      |= XDATDLY(1);
439
445
                /* Invert FS polarity configuration */
440
 
                temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
 
446
                inv_fs = true;
441
447
                break;
442
448
        case SND_SOC_DAIFMT_DSP_B:
443
449
                /* 0-bit data delay */
444
450
                regs->rcr2      |= RDATDLY(0);
445
451
                regs->xcr2      |= XDATDLY(0);
446
452
                /* Invert FS polarity configuration */
447
 
                temp_fmt ^= SND_SOC_DAIFMT_NB_IF;
 
453
                inv_fs = true;
448
454
                break;
449
455
        default:
450
456
                /* Unsupported data format */
468
474
        }
469
475
 
470
476
        /* Set bit clock (CLKX/CLKR) and FS polarities */
471
 
        switch (temp_fmt & SND_SOC_DAIFMT_INV_MASK) {
 
477
        switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
472
478
        case SND_SOC_DAIFMT_NB_NF:
473
479
                /*
474
480
                 * Normal BCLK + FS.
489
495
        default:
490
496
                return -EINVAL;
491
497
        }
 
498
        if (inv_fs == true)
 
499
                regs->pcr0 ^= FSXP | FSRP;
492
500
 
493
501
        return 0;
494
502
}
503
511
                return -ENODEV;
504
512
 
505
513
        mcbsp_data->clk_div = div;
 
514
        regs->srgr1     &= ~CLKGDV(0xff);
506
515
        regs->srgr1     |= CLKGDV(div - 1);
507
516
 
508
517
        return 0;
516
525
        struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
517
526
        int err = 0;
518
527
 
519
 
        if (mcbsp_data->active)
 
528
        if (mcbsp_data->active) {
520
529
                if (freq == mcbsp_data->in_freq)
521
530
                        return 0;
522
531
                else
523
532
                        return -EBUSY;
 
533
        }
524
534
 
525
535
        /* The McBSP signal muxing functions are only available on McBSP1 */
526
536
        if (clk_id == OMAP_MCBSP_CLKR_SRC_CLKR ||
531
541
                        return -EINVAL;
532
542
 
533
543
        mcbsp_data->in_freq = freq;
 
544
        regs->srgr2     &= ~CLKSM;
 
545
        regs->pcr0      &= ~SCLKME;
534
546
 
535
547
        switch (clk_id) {
536
548
        case OMAP_MCBSP_SYSCLK_CLK:
605
617
        return 0;
606
618
}
607
619
 
608
 
static struct snd_soc_dai_driver omap_mcbsp_dai =
609
 
{
 
620
static struct snd_soc_dai_driver omap_mcbsp_dai = {
610
621
        .probe = mcbsp_dai_probe,
611
622
        .playback = {
612
623
                .channels_min = 1,
786
797
}
787
798
module_exit(snd_omap_mcbsp_exit);
788
799
 
789
 
MODULE_AUTHOR("Jarkko Nikula <jhnikula@gmail.com>");
 
800
MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>");
790
801
MODULE_DESCRIPTION("OMAP I2S SoC Interface");
791
802
MODULE_LICENSE("GPL");