From patchwork Sat Nov 8 13:40:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 5256811 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 6D3129F39B for ; Sat, 8 Nov 2014 13:41:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EBD320148 for ; Sat, 8 Nov 2014 13:41:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6B8DF20138 for ; Sat, 8 Nov 2014 13:40:59 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 07D842604B6; Sat, 8 Nov 2014 14:40:58 +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, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 28642260455; Sat, 8 Nov 2014 14:40:49 +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 1FCF9260492; Sat, 8 Nov 2014 14:40:48 +0100 (CET) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by alsa0.perex.cz (Postfix) with ESMTP id 1A076260455 for ; Sat, 8 Nov 2014 14:40:40 +0100 (CET) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 53B4B40017; Sat, 8 Nov 2014 14:40:39 +0100 (CET) Received: from localhost.localdomain (217-210-101-82-no95.business.telia.com [217.210.101.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id B368340009; Sat, 8 Nov 2014 14:40:36 +0100 (CET) From: Peter Rosin To: alsa-devel@alsa-project.org Date: Sat, 8 Nov 2014 14:40:16 +0100 Message-Id: <1415454017-4146-1-git-send-email-peda@lysator.liu.se> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20141107111737.GJ8509@sirena.org.uk> References: <20141107111737.GJ8509@sirena.org.uk> X-Virus-Scanned: ClamAV using ClamSMTP Cc: Mark Brown , Liam Girdwood , Peter Rosin , linux-kernel@vger.kernel.org Subject: [alsa-devel] NXP Semiconductors TFA9879 Amplifier Driver 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 Mark Brown wrote: > On Thu, Nov 06, 2014 at 05:39:45PM +0100, Peter Rosin wrote: > > > + { TFA9879_MISC_STATUS, 0x0000 }, /* 0x15, read-only > */ > > The fix here is the wrong way round - if the device is reporting status > here there should be no default and there should be a volatile operation > (though it's not the end of the world to omit that if it's not used). > > Otherwise this looks good. Ok, I think I finally see what you mean... Diff since v2 below. Cheers, Peter diff --git a/sound/soc/codecs/tfa9879.c b/sound/soc/codecs/tfa9879.c index c48022639a29..16f1b71edb55 100644 --- a/sound/soc/codecs/tfa9879.c +++ b/sound/soc/codecs/tfa9879.c @@ -182,9 +182,13 @@ static struct reg_default tfa9879_regs[] = { { TFA9879_HIGH_PASS_FILTER, 0x0004 }, /* 0x12 */ { TFA9879_VOLUME_CONTROL, 0x10bd }, /* 0x13 */ { TFA9879_MISC_CONTROL, 0x0000 }, /* 0x14 */ - { TFA9879_MISC_STATUS, 0x0000 }, /* 0x15, read-only */ }; +static bool tfa9879_volatile_reg(struct device *dev, unsigned int reg) +{ + return reg == TFA9879_MISC_STATUS; +} + static const DECLARE_TLV_DB_SCALE(volume_tlv, -7050, 50, 1); static const DECLARE_TLV_DB_SCALE(tb_gain_tlv, -1800, 200, 0); static const char * const tb_freq_text[] = { @@ -240,6 +244,7 @@ static const struct regmap_config tfa9879_regmap = { .reg_bits = 8, .val_bits = 16, + .volatile_reg = tfa9879_volatile_reg, .max_register = TFA9879_MISC_STATUS, .reg_defaults = tfa9879_regs, .num_reg_defaults = ARRAY_SIZE(tfa9879_regs), @@ -285,7 +290,7 @@ static int tfa9879_i2c_probe(struct i2c_client *i2c, return PTR_ERR(tfa9879->regmap); /* Ensure the device is in reset state */ - for (i = 0; i < ARRAY_SIZE(tfa9879_regs) - 1; i++) + for (i = 0; i < ARRAY_SIZE(tfa9879_regs); i++) regmap_write(tfa9879->regmap, tfa9879_regs[i].reg, tfa9879_regs[i].def);