From patchwork Fri Apr 4 13:08:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3938111 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 7C8E3BFF02 for ; Fri, 4 Apr 2014 13:08:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A348A202FF for ; Fri, 4 Apr 2014 13:08:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 72332202AE for ; Fri, 4 Apr 2014 13:08:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 34E23265801; Fri, 4 Apr 2014 15:08:36 +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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id C103A2657DB; Fri, 4 Apr 2014 15:08:26 +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 9F45E2657E4; Fri, 4 Apr 2014 15:08:24 +0200 (CEST) Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by alsa0.perex.cz (Postfix) with ESMTP id 566462657D4 for ; Fri, 4 Apr 2014 15:08:16 +0200 (CEST) Received: by mail-pa0-f43.google.com with SMTP id bj1so3429699pad.2 for ; Fri, 04 Apr 2014 06:08:14 -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=ULuBnOGo+vjB9WNQ75e9s71FZ9NJzNDTz2k3x289SYE=; b=eR2krJJtl0IGBaOv/IMz4coiS6FTYsHn6ur8dr0MNUkjHAFU51c5gQYbhTtomJy2A6 GGKbmSrGQfmfkbX9tT+dj/3WmNYF8QcEfs+QUqfBA3K9G+jSiFIHwNIIkIEhaKXbi2Eg Zm6/z5+9Z4ah/nkk/R0KN99jeS5XQsCI61I2oaTcGAm06CWduPZ3wyz7Q/P+OrTXcc1v ZbWYEI3Huwc8As3jTAus5R+9qhzYcE30e3aI1nsglBeUt+vHweW+fBJwTrCBxeXguwKa dq89b1GTbvg0ht5ue5BZBGEJeYE0ugB1gmMbpua8/cpFE+rXABw9LqGmQrMV/5g1ICxS CCHA== X-Gm-Message-State: ALoCoQlDidERByr2wDck3QAw46peM8LhUjnzvj2j/5UfFZMwbgZtINYIbH2+uEflcpZvn8oSK3ap X-Received: by 10.66.164.36 with SMTP id yn4mr14765893pab.25.1396616894639; Fri, 04 Apr 2014 06:08:14 -0700 (PDT) Received: from [192.168.0.102] (218-164-138-19.dynamic.hinet.net. [218.164.138.19]) by mx.google.com with ESMTPSA id vo1sm40491120pab.32.2014.04.04.06.08.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Apr 2014 06:08:14 -0700 (PDT) Message-ID: <1396616889.13903.2.camel@phoenix> From: Axel Lin To: Mark Brown Date: Fri, 04 Apr 2014 21:08:09 +0800 X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Cc: Brian Austin , alsa-devel@alsa-project.org, Liam Girdwood , Paul Handrigan Subject: [alsa-devel] [PATCH] ASoC: cs42l52: Report correct chip id and revision 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 According to the datasheet: Chip I.D and Revision Register (Address 01h) BIT[0:2] REVID BIT[3:7] CHIPID (CS42L52: 11100) REVID takes 3 bits, so CS42L52_CHIP_REV_MASK should be 0x07. While at it, also adds define for CS42L52_CHIP_REV_B1. The CHIPID takes BIT[3:7], so this patch updates the defines and the code to show correct chip id for this chip. Signed-off-by: Axel Lin --- sound/soc/codecs/cs42l52.c | 4 ++-- sound/soc/codecs/cs42l52.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index f0ca6be..277df17 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -1249,7 +1249,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, ret); ret = regmap_read(cs42l52->regmap, CS42L52_CHIP, ®); - devid = reg & CS42L52_CHIP_ID_MASK; + devid = (reg & CS42L52_CHIP_ID_MASK) >> 3; if (devid != CS42L52_CHIP_ID) { ret = -ENODEV; dev_err(&i2c_client->dev, @@ -1259,7 +1259,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, } dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n", - reg & 0xFF); + reg & CS42L52_CHIP_REV_MASK); /* Set Platform Data */ if (cs42l52->pdata.mica_diff_cfg) diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h index 6fb8f00..ce7ce5a 100644 --- a/sound/soc/codecs/cs42l52.h +++ b/sound/soc/codecs/cs42l52.h @@ -32,12 +32,13 @@ #define CS42L52_FIX_BITS_CTL 0x00 #define CS42L52_CHIP 0x01 -#define CS42L52_CHIP_ID 0xE0 -#define CS42L52_CHIP_ID_MASK 0xF8 +#define CS42L52_CHIP_ID 0x1C +#define CS42L52_CHIP_ID_MASK (0x1F << 3) #define CS42L52_CHIP_REV_A0 0x00 #define CS42L52_CHIP_REV_A1 0x01 #define CS42L52_CHIP_REV_B0 0x02 -#define CS42L52_CHIP_REV_MASK 0x03 +#define CS42L52_CHIP_REV_B1 0x03 +#define CS42L52_CHIP_REV_MASK 0x07 #define CS42L52_PWRCTL1 0x02 #define CS42L52_PWRCTL1_PDN_ALL 0x9F