From patchwork Fri Feb 28 23:41:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745501 X-Patchwork-Delegate: tiwai@suse.de Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 17CB49F35F for ; Fri, 28 Feb 2014 23:51:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21EAA202AE for ; Fri, 28 Feb 2014 23:51:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B8F2F201BB for ; Fri, 28 Feb 2014 23:51:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5A54E2660C7; Sat, 1 Mar 2014 00:51:28 +0100 (CET) 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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 76FD7265AC8; Sat, 1 Mar 2014 00:43:24 +0100 (CET) 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 6EDBD2659CD; Sat, 1 Mar 2014 00:43:22 +0100 (CET) Received: from mail-pd0-f202.google.com (mail-pd0-f202.google.com [209.85.192.202]) by alsa0.perex.cz (Postfix) with ESMTP id C5B172659D3 for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-pd0-f202.google.com with SMTP id fp1so174978pdb.1 for ; Fri, 28 Feb 2014 15:42:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xTVThGEoK/Bqq8x/Je4gXkfIx7TR8rSvQWEWjhVkSfc=; b=d8n4QxARQYPhv2/b7RsBVxtZO8qT4hf/G9EGk12Bp25jGJIuVauY8hUfK/0V1TPsei lx1wgcHcq2dAhQiHne23NnpX4oJHq+7E5LJJPBUVLEQY+w1k2oDmowTKtXSdPSdkVnxg sP7s7NPZUebaukAfYL6V/WjoId7DHtHgaszAhqcCUKEtTX5HsLFMRc9B6eNM/kzJ5IYa 9uL9atTrF5SUKne8Gcbvfx5j+z17yLAyJvWdmjcePWPzUY108tOCmGQ8cifgAks9f0iK DdP1mu5A45Bxuyg2sgwpepX6L8dbciq3i7FuXmipwCAh6nM13/Mmjovi/FMMrOBbK4yi +7bw== X-Gm-Message-State: ALoCoQmvORVk8vcFj2LII07AATh+tAutmhogf5I6hb4fMR7ownYgWlt8GjApbYWf2tqPS1YAtPQZior7GQzQEgF8fh1vuZz5ZeNddHycmKGvtx+MNjybG2ujg8G24frLO+F1iSP9ZHXWXfKkQLLg7XOKPyQOLddp2Y4Vn/zwccSPYbpojdlmNVc0QCXCyWLKhJX1Ul2B7WdLaBbQzgSrzepoKc0ZfG8zgAiKycgibJGOUSOJGmKSA3I= X-Received: by 10.66.142.131 with SMTP id rw3mr2449180pab.18.1393630971802; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id k45si543997yhn.4.2014.02.28.15.42.51 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 8920331C1D8; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id 619CA181DE7; Fri, 28 Feb 2014 15:42:51 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Fri, 28 Feb 2014 15:41:29 -0800 Message-Id: <1393630893-29010-19-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393630893-29010-1-git-send-email-dgreid@chromium.org> References: <1393630893-29010-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFCv2 18/22] ALSA: hda - Move azx_interrupt to hda_controller 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 This code will be reused by an hda_platform driver as it has no PCI dependencies. This allows update_rirb to be static as all users are now in hda_controller.c. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_controller.c | 69 ++++++++++++++++++++++++++++++++++++++++-- sound/pci/hda/hda_controller.h | 2 +- sound/pci/hda/hda_intel.c | 65 --------------------------------------- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index bde4935..43b99b4 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1162,7 +1163,7 @@ static int azx_corb_send_cmd(struct hda_bus *bus, u32 val) #define ICH6_RIRB_EX_UNSOL_EV (1<<4) /* retrieve RIRB entry - called from interrupt handler */ -void azx_update_rirb(struct azx *chip) +static void azx_update_rirb(struct azx *chip) { unsigned int rp, wp; unsigned int addr; @@ -1205,7 +1206,6 @@ void azx_update_rirb(struct azx *chip) } } } -EXPORT_SYMBOL_GPL(azx_update_rirb); /* receive a response */ static unsigned int azx_rirb_get_response(struct hda_bus *bus, @@ -1747,5 +1747,70 @@ void azx_stop_chip(struct azx *chip) chip->initialized = 0; } +/* + * interrupt handler + */ +irqreturn_t azx_interrupt(int irq, void *dev_id) +{ + struct azx *chip = dev_id; + struct azx_dev *azx_dev; + u32 status; + u8 sd_status; + int i; + +#ifdef CONFIG_PM_RUNTIME + if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) + if (chip->card->dev->power.runtime_status != RPM_ACTIVE) + return IRQ_NONE; +#endif + + spin_lock(&chip->reg_lock); + + if (chip->disabled) { + spin_unlock(&chip->reg_lock); + return IRQ_NONE; + } + + status = azx_readl(chip, INTSTS); + if (status == 0 || status == 0xffffffff) { + spin_unlock(&chip->reg_lock); + return IRQ_NONE; + } + + for (i = 0; i < chip->num_streams; i++) { + azx_dev = &chip->azx_dev[i]; + if (status & azx_dev->sd_int_sta_mask) { + sd_status = azx_sd_readb(chip, azx_dev, SD_STS); + azx_sd_writeb(chip, azx_dev, SD_STS, SD_INT_MASK); + if (!azx_dev->substream || !azx_dev->running || + !(sd_status & SD_INT_COMPLETE)) + continue; + /* check whether this IRQ is really acceptable */ + if (!chip->ops->position_check || + chip->ops->position_check(chip, azx_dev)) { + spin_unlock(&chip->reg_lock); + snd_pcm_period_elapsed(azx_dev->substream); + spin_lock(&chip->reg_lock); + } + } + } + + /* clear rirb int */ + status = azx_readb(chip, RIRBSTS); + if (status & RIRB_INT_MASK) { + if (status & RIRB_INT_RESPONSE) { + if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY) + udelay(80); + azx_update_rirb(chip); + } + azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); + } + + spin_unlock(&chip->reg_lock); + + return IRQ_HANDLED; +} +EXPORT_SYMBOL_GPL(azx_interrupt); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Common HDA driver funcitons"); diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h index 67d9f28..fac9299 100644 --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h @@ -50,7 +50,6 @@ void azx_free_stream_pages(struct azx *chip); /* * CORB / RIRB interface */ -void azx_update_rirb(struct azx *chip); int azx_send_cmd(struct hda_bus *bus, unsigned int val); unsigned int azx_get_response(struct hda_bus *bus, unsigned int addr); @@ -59,5 +58,6 @@ unsigned int azx_get_response(struct hda_bus *bus, void azx_init_chip(struct azx *chip, int full_reset); void azx_stop_chip(struct azx *chip); void azx_enter_link_reset(struct azx *chip); +irqreturn_t azx_interrupt(int irq, void *dev_id); #endif /* __SOUND_HDA_CONTROLLER_H */ diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 53e4b40..96c22a3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -413,7 +413,6 @@ static void azx_init_pci(struct azx *chip) } } - static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev); /* called from IRQ */ @@ -434,70 +433,6 @@ static int azx_position_check(struct azx *chip, struct azx_dev *azx_dev) } /* - * interrupt handler - */ -static irqreturn_t azx_interrupt(int irq, void *dev_id) -{ - struct azx *chip = dev_id; - struct azx_dev *azx_dev; - u32 status; - u8 sd_status; - int i; - -#ifdef CONFIG_PM_RUNTIME - if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) - if (chip->card->dev->power.runtime_status != RPM_ACTIVE) - return IRQ_NONE; -#endif - - spin_lock(&chip->reg_lock); - - if (chip->disabled) { - spin_unlock(&chip->reg_lock); - return IRQ_NONE; - } - - status = azx_readl(chip, INTSTS); - if (status == 0 || status == 0xffffffff) { - spin_unlock(&chip->reg_lock); - return IRQ_NONE; - } - - for (i = 0; i < chip->num_streams; i++) { - azx_dev = &chip->azx_dev[i]; - if (status & azx_dev->sd_int_sta_mask) { - sd_status = azx_sd_readb(chip, azx_dev, SD_STS); - azx_sd_writeb(chip, azx_dev, SD_STS, SD_INT_MASK); - if (!azx_dev->substream || !azx_dev->running || - !(sd_status & SD_INT_COMPLETE)) - continue; - /* check whether this IRQ is really acceptable */ - if (!chip->ops->position_check || - chip->ops->position_check(chip, azx_dev)) { - spin_unlock(&chip->reg_lock); - snd_pcm_period_elapsed(azx_dev->substream); - spin_lock(&chip->reg_lock); - } - } - } - - /* clear rirb int */ - status = azx_readb(chip, RIRBSTS); - if (status & RIRB_INT_MASK) { - if (status & RIRB_INT_RESPONSE) { - if (chip->driver_caps & AZX_DCAPS_RIRB_PRE_DELAY) - udelay(80); - azx_update_rirb(chip); - } - azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); - } - - spin_unlock(&chip->reg_lock); - - return IRQ_HANDLED; -} - -/* * Probe the given codec address */ static int probe_codec(struct azx *chip, int addr)