Skip to content
Snippets Groups Projects
Select Git revision
  • 2e30baad228624e3868714af6ecab967c4445d4a
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

turbostat.c

Blame
  • simple-card.c 17.16 KiB
    /*
     * ASoC simple sound card support
     *
     * Copyright (C) 2012 Renesas Solutions Corp.
     * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    #include <linux/clk.h>
    #include <linux/device.h>
    #include <linux/gpio.h>
    #include <linux/module.h>
    #include <linux/of.h>
    #include <linux/of_gpio.h>
    #include <linux/platform_device.h>
    #include <linux/string.h>
    #include <sound/jack.h>
    #include <sound/simple_card.h>
    #include <sound/soc-dai.h>
    #include <sound/soc.h>
    
    struct simple_card_data {
    	struct snd_soc_card snd_card;
    	struct simple_dai_props {
    		struct asoc_simple_dai cpu_dai;
    		struct asoc_simple_dai codec_dai;
    		unsigned int mclk_fs;
    	} *dai_props;
    	unsigned int mclk_fs;
    	int gpio_hp_det;
    	int gpio_hp_det_invert;
    	int gpio_mic_det;
    	int gpio_mic_det_invert;
    	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
    };
    
    #define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
    #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
    #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
    
    static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
    {
    	struct snd_soc_pcm_runtime *rtd = substream->private_data;
    	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
    	struct simple_dai_props *dai_props =
    		&priv->dai_props[rtd->num];
    	int ret;
    
    	ret = clk_prepare_enable(dai_props->cpu_dai.clk);
    	if (ret)
    		return ret;
    	
    	ret = clk_prepare_enable(dai_props->codec_dai.clk);
    	if (ret)
    		clk_disable_unprepare(dai_props->cpu_dai.clk);
    
    	return ret;
    }
    
    static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
    {
    	struct snd_soc_pcm_runtime *rtd = substream->private_data;
    	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
    	struct simple_dai_props *dai_props =
    		&priv->dai_props[rtd->num];
    
    	clk_disable_unprepare(dai_props->cpu_dai.clk);