From patchwork Mon Oct 5 14:10:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Thomson X-Patchwork-Id: 7327681 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D5EB19F1D5 for ; Mon, 5 Oct 2015 14:10:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEC8520688 for ; Mon, 5 Oct 2015 14:10:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 94001206AD for ; Mon, 5 Oct 2015 14:10:29 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 25390260633; Mon, 5 Oct 2015 16:10:27 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 186B32605B4; Mon, 5 Oct 2015 16:10:20 +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 F1C022605B8; Mon, 5 Oct 2015 16:10:17 +0200 (CEST) Received: from mail1.bemta5.messagelabs.com (mail1.bemta5.messagelabs.com [195.245.231.150]) by alsa0.perex.cz (Postfix) with ESMTP id 71154260599 for ; Mon, 5 Oct 2015 16:10:10 +0200 (CEST) Received: from [85.158.139.19] by server-14.bemta-5.messagelabs.com id 73/8F-22142-1C482165; Mon, 05 Oct 2015 14:10:09 +0000 X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-4.tower-178.messagelabs.com!1444054209!386443!1 X-Originating-IP: [87.137.64.195] X-StarScan-Received: X-StarScan-Version: 7.19.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 1780 invoked from network); 5 Oct 2015 14:10:09 -0000 Received: from unknown (HELO NB-EX-CASHUB01.diasemi.com) (87.137.64.195) by server-4.tower-178.messagelabs.com with AES128-SHA encrypted SMTP; 5 Oct 2015 14:10:09 -0000 Received: from mailrelay1.diasemi.com (10.1.17.243) by NB-EX-CASHUB01.diasemi.com (10.1.16.140) with Microsoft SMTP Server id 14.3.248.2; Mon, 5 Oct 2015 16:10:08 +0200 Received: from swsrvapps-01.diasemi.com (Not Verified[10.20.28.141]) by mailrelay1.diasemi.com with ESMTP Gateway id ; Mon, 05 Oct 2015 16:10:08 +0200 Received: (from athomson@localhost) by swsrvapps-01.diasemi.com (8.14.3/8.14.3/Submit/Dlg) id t95EA4KA004228; Mon, 5 Oct 2015 15:10:04 +0100 X-Authentication-Warning: swsrvapps-01.diasemi.com: athomson set sender to Adam.Thomson.Opensource@diasemi.com using -f Message-ID: <9f50566afde93ac58ae8205316cc9d1bc2088b2f.1444053230.git.Adam.Thomson.Opensource@diasemi.com> From: Adam Thomson Date: Mon, 5 Oct 2015 15:10:04 +0100 To: Mark Brown , Liam Girdwood , Jaroslav Kysela , Takashi Iwai MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: 8d172408-bd6a-42b1-8e53-daaedf35a5af Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Support Opensource Subject: [alsa-devel] [PATCH 1/1] ASoC: da7219: Improve error handling for regulator supplies 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Currently if bulk_enable() of supplies fails, the code still goes on to try and put the device into active state, and set expected IO voltage of the device. This doesn't really make sense so code now returns on bulk_enable() failure, with an error message. Also, to help with debug, failure to get supplies also provides an error message. Signed-off-by: Adam Thomson --- This patch is based on changes introduced under patch: 'ASoC: codecs: Add da7219 codec driver' (Commit 6d817c0e9fd7536be76690bfdee88e8a81c16f7d, kernel/git/broonie/sound.git) sound/soc/codecs/da7219.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 1.9.3 diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c index 76f8fc2..c86a833 100644 --- a/sound/soc/codecs/da7219.c +++ b/sound/soc/codecs/da7219.c @@ -1554,8 +1554,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec) ret = devm_regulator_bulk_get(codec->dev, DA7219_NUM_SUPPLIES, da7219->supplies); - if (ret) + if (ret) { + dev_err(codec->dev, "Failed to get supplies"); return ret; + } /* Determine VDDIO voltage provided */ vddio = da7219->supplies[DA7219_SUPPLY_VDDIO].consumer; @@ -1567,6 +1569,10 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec) /* Enable main supplies */ ret = regulator_bulk_enable(DA7219_NUM_SUPPLIES, da7219->supplies); + if (ret) { + dev_err(codec->dev, "Failed to enable supplies"); + return ret; + } /* Ensure device in active mode */ snd_soc_write(codec, DA7219_SYSTEM_ACTIVE, DA7219_SYSTEM_ACTIVE_MASK); @@ -1574,7 +1580,7 @@ static int da7219_handle_supplies(struct snd_soc_codec *codec) /* Update IO voltage level range */ snd_soc_write(codec, DA7219_IO_CTRL, io_voltage_lvl); - return ret; + return 0; } static void da7219_handle_pdata(struct snd_soc_codec *codec)