From patchwork Fri Feb 28 23:41:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3745471 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 8B6E9BF13A for ; Fri, 28 Feb 2014 23:50:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF3D7201BB for ; Fri, 28 Feb 2014 23:50:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7874E2012E for ; Fri, 28 Feb 2014 23:50:04 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 88D25266011; Sat, 1 Mar 2014 00:50:03 +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 E60D0265A96; Sat, 1 Mar 2014 00:43:22 +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 DFA4A265A95; Sat, 1 Mar 2014 00:43:19 +0100 (CET) Received: from mail-pd0-f201.google.com (mail-pd0-f201.google.com [209.85.192.201]) by alsa0.perex.cz (Postfix) with ESMTP id 9E99A2659B5 for ; Sat, 1 Mar 2014 00:42:52 +0100 (CET) Received: by mail-pd0-f201.google.com with SMTP id x10so174853pdj.0 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=SAiAlxdXIfhVLOHZCBg079HvmdALFJQ62XpOiS5edm8=; b=F2kCI9vrVbz+CjiNvnyXyd4xT4tVnY6Tm06Gyn8bI7AH92IMdxtTpQuj8DTi9fYtqd T+1PZ1S7GRh/xtPuvnKmxPcx5wW3LELGJLjK7eY7g5ja1Z1ReJA5c9rUd2W8D40dcl/P cMJL8zMCkkDsmBtzSojfULkEFfPal9fTkO5sFpA8bcaNznBBKqPw3X0a+CPX4O5mC2ok VLpgnFjX4m23xhXBtBW8Kfh7J+MvrjfL4EWC/EcP3XigBpn1CiWQ4LdeHgqhLlgNWaVd IWgLtXJnhEfUFr8DXlET3boheSFPOgMrxMbiN05nh6hadHuLI/XVo0uR3D819TOJq9Wp 0Xrg== X-Gm-Message-State: ALoCoQlo97o+V8vmo2J9w3EifPilmFjaYGFA4eBJFnqa2NXbjJW9QhJnvrzeem64JEzFpqPbqy3D/87A/VV68k4F3zaabuGz6NcJMBtWTxAGMjkt6G+h8NtNxcSLQ6784RZSQNwRgTKX3WGtp9qWZHCIdS1zvmYKoYbYhPbTRFIVOPSyAhLwYDQ4m1o381QsOpLVhWCfUABZlTNU7Sm3eKnL5S7BMWvsAYK6oLMd7tUumB5haZ55wSs= X-Received: by 10.67.4.202 with SMTP id cg10mr2384811pad.42.1393630971193; 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 o7si544238yhj.3.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 04F7931C1DD; Fri, 28 Feb 2014 15:42:51 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id A3A72181B96; Fri, 28 Feb 2014 15:42:50 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Fri, 28 Feb 2014 15:41:16 -0800 Message-Id: <1393630893-29010-6-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 05/22] ALSA: hda - Add function pointer for disabling MSI 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 is a PCI-only feature, but adding a callback for it in the chip structure breaks the PCI dependency in the RIRB code allowing the logic there to be re-used by the platform HDA driver. Signed-off-by: Dylan Reid --- sound/pci/hda/hda_intel.c | 23 ++++++++++++++++++----- sound/pci/hda/hda_priv.h | 4 ++++ 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 7630622..c4b6447 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -600,11 +600,8 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus, dev_warn(chip->card->dev, "No response from codec, disabling MSI: last cmd=0x%08x\n", chip->last_cmd[addr]); - free_irq(chip->irq, chip); - chip->irq = -1; - pci_disable_msi(chip->pci); - chip->msi = 0; - if (azx_acquire_irq(chip, 1) < 0) { + if (chip->ops->disable_msi_reset_irq && + chip->ops->disable_msi_reset_irq(chip) < 0) { bus->rirb_error = 1; return -1; } @@ -3469,6 +3466,21 @@ static u8 pci_azx_readb(u8 *addr) return readb(addr); } +static int disable_msi_reset_irq(struct azx *chip) +{ + int err; + + free_irq(chip->irq, chip); + chip->irq = -1; + pci_disable_msi(chip->pci); + chip->msi = 0; + err = azx_acquire_irq(chip, 1); + if (err < 0) + return err; + + return 0; +} + static const struct hda_controller_ops pci_hda_ops = { .writel = pci_azx_writel, .readl = pci_azx_readl, @@ -3476,6 +3488,7 @@ static const struct hda_controller_ops pci_hda_ops = { .readw = pci_azx_readw, .writeb = pci_azx_writeb, .readb = pci_azx_readb, + .disable_msi_reset_irq = disable_msi_reset_irq, }; static int azx_probe(struct pci_dev *pci, diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 17afe90..c231c11 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h @@ -285,6 +285,8 @@ struct azx_rb { u32 res[AZX_MAX_CODECS]; /* last read value */ }; +struct azx; + /* Functions to read/write to hda registers. */ struct hda_controller_ops { /* Register Access */ @@ -294,6 +296,8 @@ struct hda_controller_ops { u16 (*readw)(u16 *addr); void (*writeb)(u8 value, u8 *addr); u8 (*readb)(u8 *addr); + /* Disable msi if supported, PCI only */ + int (*disable_msi_reset_irq)(struct azx *); }; struct azx_pcm {