]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00209739-3 MX6DQ/DL_SABRESD: operate WM8962 MCLK by callback
authorGary Zhang <b13634@freescale.com>
Mon, 21 May 2012 10:34:26 +0000 (18:34 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:34:41 +0000 (08:34 +0200)
operate WM8962 MCLK by callback

Signed-off-by: Gary Zhang <b13634@freescale.com>
arch/arm/mach-mx6/board-mx6q_sabresd.c

index f8263f880706bc60f10f5457c5fe2dab25b6d366..e749bc448a1719a06d48b2ff995bb5b164816d2b 100644 (file)
 #define SABRESD_ELAN_INT       IMX_GPIO_NR(3, 28)
 
 static struct clk *sata_clk;
+static struct clk *clko;
 static int mma8451_position = 1;
 static int mag3110_position = 2;
 static int max11801_mode = 1;
@@ -389,26 +390,20 @@ static struct platform_device mx6_sabresd_audio_wm8962_device = {
        .name = "imx-wm8962",
 };
 
-static struct wm8962_pdata wm8962_config_data = {
-       .gpio_init = {
-               [2] = WM8962_GPIO_FN_DMICCLK,
-               [4] = 0x8000 | WM8962_GPIO_FN_DMICDAT,
-       },
-};
+static struct mxc_audio_platform_data wm8962_data;
 
-static struct mxc_audio_platform_data wm8962_data = {
-       .ssi_num = 1,
-       .src_port = 2,
-       .ext_port = 3,
-       .hp_gpio = SABRESD_HEADPHONE_DET,
-       .hp_active_low = 1,
-       .mic_gpio = SABRESD_MICROPHONE_DET,
-       .mic_active_low = 1,
-};
+static int wm8962_clk_enable(int enable)
+{
+       if (enable)
+               clk_enable(clko);
+       else
+               clk_disable(clko);
+
+       return 0;
+}
 
 static int mxc_wm8962_init(void)
 {
-       struct clk *clko;
        int rate;
 
        clko = clk_get(NULL, "clko_clk");
@@ -418,13 +413,32 @@ static int mxc_wm8962_init(void)
        }
        /* both audio codec and comera use CLKO clk*/
        rate = clk_round_rate(clko, 22000000);
+       clk_set_rate(clko, rate);
 
        wm8962_data.sysclk = rate;
-       clk_set_rate(clko, rate);
 
        return 0;
 }
 
+static struct wm8962_pdata wm8962_config_data = {
+       .gpio_init = {
+               [2] = WM8962_GPIO_FN_DMICCLK,
+               [4] = 0x8000 | WM8962_GPIO_FN_DMICDAT,
+       },
+};
+
+static struct mxc_audio_platform_data wm8962_data = {
+       .ssi_num = 1,
+       .src_port = 2,
+       .ext_port = 3,
+       .hp_gpio = SABRESD_HEADPHONE_DET,
+       .hp_active_low = 1,
+       .mic_gpio = SABRESD_MICROPHONE_DET,
+       .mic_active_low = 1,
+       .init = mxc_wm8962_init,
+       .clock_enable = wm8962_clk_enable,
+};
+
 static struct regulator_consumer_supply sabresd_vwm8962_consumers[] = {
        REGULATOR_SUPPLY("SPKVDD1", "0-001a"),
        REGULATOR_SUPPLY("SPKVDD2", "0-001a"),