From patchwork Sun Jul 19 01:14:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 6821501 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6454CC05AC for ; Sun, 19 Jul 2015 01:14:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A96D2060E for ; Sun, 19 Jul 2015 01:14:52 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 175E12060B for ; Sun, 19 Jul 2015 01:14:51 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 98149260524; Sun, 19 Jul 2015 03:14:47 +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=-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 D3020260506; Sun, 19 Jul 2015 03:14:40 +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 6CF3F260508; Sun, 19 Jul 2015 03:14:38 +0200 (CEST) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by alsa0.perex.cz (Postfix) with ESMTP id E66B9260504 for ; Sun, 19 Jul 2015 03:14:30 +0200 (CEST) Received: by padck2 with SMTP id ck2so81122245pad.0 for ; Sat, 18 Jul 2015 18:14:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=Zff7YzrYZ3jW34hLPFsyHlN5O0lMpCiWVWT5mnoQd4I=; b=Z0etgo4OAR3JP3EPK25tKtjLWOx7hM55NDA18DvLC5Qs4BpUMbF+JOtoymx9cYvtHv noi6Emj3CchwXZsTS0+GVfAjV9iWwem5HzMtCF00Wt1V9wgpM1XS/F6kwUZvhVpjb43P 5nugQ4ROaQznzMaSUtrjI68ybJq7OyVtrAxDWhPROhxaoerewMCBwrEl5TaFhoyazkQH xtgwWibDxv/iF0bsw8BCr+h8ThU83RUPXvL3luWNAAfZmxXWszadNoywj2XWKLczGg/O v/6QWOPGGwm+3QhlS0Va+2xWNbf/8sd2x95HPDSfqFPopsdzbCYLqtGK2us8uxNbV1LX jALA== X-Gm-Message-State: ALoCoQnKMwDd8T7I7CtXi4MWPNZhW60UZULz4vSuR7qv0+OLad7sPLv6KuxIRdW7KghKki4Hbct2 X-Received: by 10.66.63.9 with SMTP id c9mr43688448pas.40.1437268468926; Sat, 18 Jul 2015 18:14:28 -0700 (PDT) Received: from phoenix.local (118-171-143-53.dynamic.hinet.net. [118.171.143.53]) by smtp.gmail.com with ESMTPSA id be3sm4287400pbc.32.2015.07.18.18.14.25 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Jul 2015 18:14:27 -0700 (PDT) Message-ID: <1437268463.11309.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Sun, 19 Jul 2015 09:14:23 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Cc: Brian Austin , alsa-devel@alsa-project.org, Liam Girdwood , Paul Handrigan , Tim Howe Subject: [alsa-devel] [PATCH 1/2] ASoC: cs4349: Set .writeable_reg for cs4349_regmap 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 The first valid register index is 1 rather than 0, and the CS4349_CHIPID is readonly. So set .writeable_reg to avoid writing to these registers. Signed-off-by: Axel Lin Acked-by: Tim Howe --- sound/soc/codecs/cs4349.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/cs4349.c b/sound/soc/codecs/cs4349.c index f4fccc6..eb55889 100644 --- a/sound/soc/codecs/cs4349.c +++ b/sound/soc/codecs/cs4349.c @@ -54,14 +54,17 @@ struct cs4349_private { static bool cs4349_readable_register(struct device *dev, unsigned int reg) { switch (reg) { - case CS4349_CHIPID: - case CS4349_MODE: - case CS4349_VMI: - case CS4349_MUTE: - case CS4349_VOLA: - case CS4349_VOLB: - case CS4349_RMPFLT: - case CS4349_MISC: + case CS4349_CHIPID ... CS4349_MISC: + return true; + default: + return false; + } +} + +static bool cs4349_writeable_register(struct device *dev, unsigned int reg) +{ + switch (reg) { + case CS4349_MODE ... CS4349_MISC: return true; default: return false; @@ -272,6 +275,7 @@ static const struct regmap_config cs4349_regmap = { .reg_defaults = cs4349_reg_defaults, .num_reg_defaults = ARRAY_SIZE(cs4349_reg_defaults), .readable_reg = cs4349_readable_register, + .writeable_reg = cs4349_writeable_register, .cache_type = REGCACHE_RBTREE, };