From patchwork Thu Jul 3 14:51:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 4474751 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 0D266BEEAA for ; Thu, 3 Jul 2014 14:52:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4BB1120398 for ; Thu, 3 Jul 2014 14:52:07 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D3AA220265 for ; Thu, 3 Jul 2014 14:52:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id DD8A0261A49; Thu, 3 Jul 2014 16:52:03 +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.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 6F68D2654B3; Thu, 3 Jul 2014 16:51:53 +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 90B192654C6; Thu, 3 Jul 2014 16:51:51 +0200 (CEST) Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by alsa0.perex.cz (Postfix) with ESMTP id 6FCEA261A49 for ; Thu, 3 Jul 2014 16:51:43 +0200 (CEST) Received: by mail-we0-f176.google.com with SMTP id u56so371263wes.21 for ; Thu, 03 Jul 2014 07:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=MjriJai3gJrI4CVjmQl96nx7FMM6/6ZSj/Y8acVUnFQ=; b=X/1fDcbJXwf4PM4s8Li66HgLGI6Zwhja7THJoT8q1Kayi0goI7xUSomCDWYDiTaABl smrX+a2/d+JD5+1VEfhu1jD46WwqJ59sx6ktJWeC1UGOGPJEYBd2qOO2Km9P9HUc/gO5 17rC+QV/ja05AE2psP8IORdNJoN6ZfUUk807zCKM1FzE281O+0uLUdi+6mcGLeNpjZuH 8FvgAN/xy4Frrv2Sgg2Ocev0mZw3RLfxW7c69ADrwQSZYGVmC9EckDiHECqu48pzI1e+ c0HJ2ecvinBEGoDmvYWdhMsXs3BhUQnAxKoSUDicbDQrHNyfZn4+QuZiFy7enNdM8lBV vgUQ== X-Received: by 10.194.78.68 with SMTP id z4mr2795013wjw.126.1404399102956; Thu, 03 Jul 2014 07:51:42 -0700 (PDT) Received: from tamtam.fritz.box ([2001:4dd0:ff00:9394:224:d7ff:fec6:a0ec]) by mx.google.com with ESMTPSA id i12sm62493272wjr.32.2014.07.03.07.51.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Jul 2014 07:51:42 -0700 (PDT) From: Daniel Mack To: lars@metafoo.de Date: Thu, 3 Jul 2014 16:51:36 +0200 Message-Id: <1404399096-4056-1-git-send-email-zonque@gmail.com> X-Mailer: git-send-email 1.9.3 Cc: alsa-devel@alsa-project.org, broonie@kernel.org, Daniel Mack Subject: [alsa-devel] [PATCH] ASoC: adau1701: fix adau1701_reg_read() 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 Fix a long standing bug in the read register routing of adau1701. The bytes arrive in the buffer in big-endian, so the result has to be shifted before and-ing the bytes in the loop. Signed-off-by: Daniel Mack Acked-by: Lars-Peter Clausen --- sound/soc/codecs/adau1701.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c index defb277..15feb12 100644 --- a/sound/soc/codecs/adau1701.c +++ b/sound/soc/codecs/adau1701.c @@ -240,8 +240,10 @@ static int adau1701_reg_read(void *context, unsigned int reg, *value = 0; - for (i = 0; i < size; i++) - *value |= recv_buf[i] << (i * 8); + for (i = 0; i < size; i++) { + *value <<= 8; + *value |= recv_buf[i]; + } return 0; }