~ubuntu-audio-dev/alsa-driver/tiwai-trunk2

« back to all changes in this revision

Viewing changes to soc/fsl/fsl_sai.c

  • Committer: Canonistack server
  • Date: 2016-05-16 13:04:41 UTC
  • Revision ID: david.henningsson@canonical.com-20160516130441-xmcvo5v7n0mupdei
Test run of 623 machines: 3 failing with 3 errors and 0 warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <sound/core.h>
22
22
#include <sound/dmaengine_pcm.h>
23
23
#include <sound/pcm_params.h>
 
24
#include <linux/mfd/syscon.h>
 
25
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
24
26
 
25
27
#include "fsl_sai.h"
26
28
#include "imx-pcm.h"
786
788
{
787
789
        struct device_node *np = pdev->dev.of_node;
788
790
        struct fsl_sai *sai;
 
791
        struct regmap *gpr;
789
792
        struct resource *res;
790
793
        void __iomem *base;
791
794
        char tmp[8];
792
795
        int irq, ret, i;
 
796
        int index;
793
797
 
794
798
        sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
795
799
        if (!sai)
797
801
 
798
802
        sai->pdev = pdev;
799
803
 
800
 
        if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai"))
 
804
        if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx6sx-sai") ||
 
805
            of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai"))
801
806
                sai->sai_on_imx = true;
802
807
 
803
808
        sai->is_lsb_first = of_property_read_bool(np, "lsb-first");
877
882
                fsl_sai_dai.symmetric_samplebits = 0;
878
883
        }
879
884
 
 
885
        if (of_find_property(np, "fsl,sai-mclk-direction-output", NULL) &&
 
886
            of_device_is_compatible(pdev->dev.of_node, "fsl,imx6ul-sai")) {
 
887
                gpr = syscon_regmap_lookup_by_compatible("fsl,imx6ul-iomuxc-gpr");
 
888
                if (IS_ERR(gpr)) {
 
889
                        dev_err(&pdev->dev, "cannot find iomuxc registers\n");
 
890
                        return PTR_ERR(gpr);
 
891
                }
 
892
 
 
893
                index = of_alias_get_id(np, "sai");
 
894
                if (index < 0)
 
895
                        return index;
 
896
 
 
897
                regmap_update_bits(gpr, IOMUXC_GPR1, MCLK_DIR(index),
 
898
                                   MCLK_DIR(index));
 
899
        }
 
900
 
880
901
        sai->dma_params_rx.addr = res->start + FSL_SAI_RDR;
881
902
        sai->dma_params_tx.addr = res->start + FSL_SAI_TDR;
882
903
        sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX;
898
919
static const struct of_device_id fsl_sai_ids[] = {
899
920
        { .compatible = "fsl,vf610-sai", },
900
921
        { .compatible = "fsl,imx6sx-sai", },
 
922
        { .compatible = "fsl,imx6ul-sai", },
901
923
        { /* sentinel */ }
902
924
};
903
925
MODULE_DEVICE_TABLE(of, fsl_sai_ids);