From patchwork Wed Jul 2 14:43:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Mengdong" X-Patchwork-Id: 4465931 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31144BEEAA for ; Wed, 2 Jul 2014 14:42:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5A68F20204 for ; Wed, 2 Jul 2014 14:42:04 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 28D0820117 for ; Wed, 2 Jul 2014 14:42:03 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 11C7A26578D; Wed, 2 Jul 2014 16:42:02 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1783326577A; Wed, 2 Jul 2014 16:41:44 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 38A49265327; Wed, 2 Jul 2014 16:41:42 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by alsa0.perex.cz (Postfix) with ESMTP id 192442657AD for ; Wed, 2 Jul 2014 16:41:24 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 02 Jul 2014 07:35:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,588,1400050800"; d="scan'208";a="556443773" Received: from amanda-hsw-pc.sh.intel.com ([10.239.37.27]) by fmsmga001.fm.intel.com with ESMTP; 02 Jul 2014 07:40:57 -0700 From: mengdong.lin@intel.com To: alsa-devel@alsa-project.org, tiwai@suse.de, jani.nikula@intel.com Date: Wed, 2 Jul 2014 22:43:55 +0800 Message-Id: <8b11a79ce0c5e28330577c0d390ed87301677190.1404311751.git.mengdong.lin@intel.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: References: Cc: Mengdong Lin Subject: [alsa-devel] [PATCH 2/3] ALSA: hda - define hda_get_display_clk to query CDCLK for Haswell/Broadwell X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mengdong Lin This patch defines hda_get_display_clk() to query Core Display Clock (CDCLK) from the i915 display driver, via a private API i915_get_cdclk_freq(). The audio driver will set M/N values as per the CDCLK for restoring BCLK of the display HD-A controller. Signed-off-by: Mengdong Lin diff --git a/sound/pci/hda/hda_i915.c b/sound/pci/hda/hda_i915.c index e9e8a4a..76db293 100644 --- a/sound/pci/hda/hda_i915.c +++ b/sound/pci/hda/hda_i915.c @@ -24,6 +24,7 @@ static int (*get_power)(void); static int (*put_power)(void); +static int (*get_cdclk)(void); int hda_display_power(bool enable) { @@ -38,6 +39,14 @@ int hda_display_power(bool enable) return put_power(); } +int hda_get_display_clk(void) +{ + if (!get_cdclk) + return -ENODEV; + + return get_cdclk(); +} + int hda_i915_init(void) { int err = 0; @@ -55,6 +64,15 @@ int hda_i915_init(void) return -ENODEV; } + get_cdclk = symbol_request(i915_get_cdclk_freq); + if (!get_cdclk) { + symbol_put(i915_request_power_well); + get_power = NULL; + symbol_put(i915_release_power_well); + put_power = NULL; + return -ENODEV; + } + pr_debug("HDA driver get symbol successfully from i915 module\n"); return err; @@ -70,6 +88,10 @@ int hda_i915_exit(void) symbol_put(i915_release_power_well); put_power = NULL; } + if (get_cdclk) { + symbol_put(i915_get_cdclk_freq); + get_cdclk = NULL; + } return 0; } diff --git a/sound/pci/hda/hda_i915.h b/sound/pci/hda/hda_i915.h index bfd835f..b4420e1 100644 --- a/sound/pci/hda/hda_i915.h +++ b/sound/pci/hda/hda_i915.h @@ -18,6 +18,7 @@ #ifdef CONFIG_SND_HDA_I915 int hda_display_power(bool enable); +int hda_get_display_clk(void); int hda_i915_init(void); int hda_i915_exit(void); #else