From patchwork Fri Feb 28 06:35:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Reid X-Patchwork-Id: 3738881 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 0B3D99F2ED for ; Fri, 28 Feb 2014 06:40:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2EC7620260 for ; Fri, 28 Feb 2014 06:40:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EB7C420265 for ; Fri, 28 Feb 2014 06:40:20 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 1C0112659D7; Fri, 28 Feb 2014 07:40:20 +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 C1C682650A4; Fri, 28 Feb 2014 07:38:07 +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 8B26826507D; Fri, 28 Feb 2014 07:38:04 +0100 (CET) Received: from mail-yh0-f73.google.com (mail-yh0-f73.google.com [209.85.213.73]) by alsa0.perex.cz (Postfix) with ESMTP id 2D4B3265086 for ; Fri, 28 Feb 2014 07:37:13 +0100 (CET) Received: by mail-yh0-f73.google.com with SMTP id f73so34073yha.2 for ; Thu, 27 Feb 2014 22:37:12 -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=NSgfYfnKbP8EqPLpcgfHs4m+knhDrLCSkXjL84EMUUE=; b=kWOkJz/aJgbL1og63fEQ67fNpX6MDpqvoywEuT+Z+rC4s+Fja6txeo7uOWwakap7BH 9dP7vb5yS94kqybLWEH0qbLZjktSsqeEkH+JM3iqdkrCVrWHE0RPUMWA82dcT74vrs83 xVKx7Gccjt64SvY4eLJZ3mYbSXCvGVC3cp/gUrXIWkHhGkBqONXnLbBRQqiT81MVNNIC VmyONyPSeA1Y6nBuwiM8pFQS4dBesevK6B6zaEqiz2SnsrqHLgyXMX0QluANcgz4Zmba tzKbAq+6TlofKebvefTHoRmSK7JpZLqDiuIQT9gumLT0YJ7afGvP6bRagKEgZqYvjco0 LF9Q== X-Gm-Message-State: ALoCoQnvHe+Dge+isxrhrZIOQEMjDvjz099IfASZxe9WqF5ZC5jzgejMoD6gkB/6Qcutog5ZCZbdnBWtjNu6QVrenq8c8xS2YdWejE0onDoBFdNL2vooBLOgXu0c1/CZISxNY4KeKSXIYZxVzXfj/pB7bqq5kVYSHWkkWCpYWguDRroH5whytJNlVubhVEXH34qUhQ03WBN5UU8CyUC8BmOPdEw+Uy2rTf+6bVNBulwcmTPsyLZgwzI= X-Received: by 10.236.83.112 with SMTP id p76mr358622yhe.51.1393569432484; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id e21si112388yhl.7.2014.02.27.22.37.12 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: from hojo20.mtv.corp.google.com (hojo20.mtv.corp.google.com [172.22.72.28]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 552945A42C0; Thu, 27 Feb 2014 22:37:12 -0800 (PST) Received: by hojo20.mtv.corp.google.com (Postfix, from userid 123195) id E8CD6181DE7; Thu, 27 Feb 2014 22:37:11 -0800 (PST) From: Dylan Reid To: alsa-devel@alsa-project.org Date: Thu, 27 Feb 2014 22:35:51 -0800 Message-Id: <1393569362-27285-9-git-send-email-dgreid@chromium.org> X-Mailer: git-send-email 1.8.1.3.605.g02339dd In-Reply-To: <1393569362-27285-1-git-send-email-dgreid@chromium.org> References: <1393569362-27285-1-git-send-email-dgreid@chromium.org> Cc: tiwai@suse.de, Dylan Reid , swarren@wwwdotorg.org Subject: [alsa-devel] [RFC 08/19] 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 | 22 +++++++++++++++++----- sound/pci/hda/hda_priv.h | 3 +++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 33dc7ae..eaf8c78 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -543,11 +543,7 @@ 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->disable_msi_reset_irq(chip) < 0) { bus->rirb_error = 1; return -1; } @@ -1924,6 +1920,21 @@ static void azx_probe_work(struct work_struct *work) azx_probe_continue(container_of(work, struct azx, probe_work)); } +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; +} + /* * constructor */ @@ -1961,6 +1972,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci, chip->driver_type = driver_caps & 0xff; check_msi(chip); chip->dev_index = dev; + chip->disable_msi_reset_irq = disable_msi_reset_irq; INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); INIT_LIST_HEAD(&chip->pcm_list); INIT_LIST_HEAD(&chip->list); diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index 0e3bba1..f1fa6f4 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h @@ -378,6 +378,9 @@ struct azx { /* for debugging */ unsigned int last_cmd[AZX_MAX_CODECS]; + /* disable msi if supported, PCI only */ + int (*disable_msi_reset_irq)(struct azx *); + /* for pending irqs */ struct work_struct irq_pending_work;