From patchwork Fri Feb 15 12:56:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 14891 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A6EE523E01 for ; Fri, 15 Feb 2013 12:57:35 +0000 (UTC) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by fiordland.canonical.com (Postfix) with ESMTP id 64B47A18025 for ; Fri, 15 Feb 2013 12:57:35 +0000 (UTC) Received: by mail-ve0-f171.google.com with SMTP id b10so3002731vea.2 for ; Fri, 15 Feb 2013 04:57:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=38Xj6brh1/wIeoNOZX8iHTlxw1w2GKT21BzzMskcaUA=; b=EMLmfRsrVGB3ZhOXIcqbW9HEq7RnSaObhkWb6FyyfJ7D/20Q279YGNB2ifCt+hzP+P SlA6QDkbl/PiNgk1rmR+s0NsSLBKvbWgnnZV3qwJIlKJw9ATtAeJJlYyZFcg+l5NMA55 jraK7YkGAne1nmyLmVSuLSe3XFacwMP0VuozYGb/4UdjO5/cmowOEZmkkV73r9rgJUSt deynWKJGoRGwkDdICGcS2SKQHSAJT4XYJAh64BmB35V5twZZJ9KNRWgy1+yCONVEfwo+ IgjNViGkKlUX8GoV1/WEIYF5AFSy05IyaliCCqKbjrtNvM60snvb8xzPVlpTqDVZULNP GLYg== X-Received: by 10.52.175.66 with SMTP id by2mr2667028vdc.53.1360933054929; Fri, 15 Feb 2013 04:57:34 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.221.4.5 with SMTP id oa5csp11365vcb; Fri, 15 Feb 2013 04:57:34 -0800 (PST) X-Received: by 10.180.77.9 with SMTP id o9mr5838539wiw.16.1360933052527; Fri, 15 Feb 2013 04:57:32 -0800 (PST) Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]) by mx.google.com with ESMTPS id o17si1048757wiv.72.2013.02.15.04.57.32 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:32 -0800 (PST) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::22a is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=2a00:1450:400c:c00::22a; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c00::22a is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wg0-f42.google.com with SMTP id 12so861740wgh.3 for ; Fri, 15 Feb 2013 04:57:32 -0800 (PST) X-Received: by 10.194.122.98 with SMTP id lr2mr4152918wjb.7.1360933052124; Fri, 15 Feb 2013 04:57:32 -0800 (PST) Received: from localhost.localdomain (cpc34-aztw25-2-0-cust250.18-1.cable.virginmedia.com. [86.16.136.251]) by mx.google.com with ESMTPS id j4sm2852410wiz.10.2013.02.15.04.57.30 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Feb 2013 04:57:31 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, sameo@linux.intel.com Cc: arnd@arndb.de, linus.walleij@stericsson.com, Marcus Cooper , Lee Jones Subject: [PATCH 06/35] mfd: ab8500-core: Sysfs chip id modification Date: Fri, 15 Feb 2013 12:56:37 +0000 Message-Id: <1360933026-30325-7-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> References: <1360933026-30325-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQl895LpQH3+X3mbQML+7s11tMZJhum7HV3lMCIhDV+MF0QzOqGHJWOFZTlgea/84SswvFux From: Marcus Cooper On newer variants of the ab a version and revision value can be read. This modification merges these two values to create a chip id. Signed-off-by: Marcus Cooper Signed-off-by: Lee Jones Reviewed-by: Mattias WALLIN Tested-by: Jonas ABERG --- drivers/mfd/ab8500-core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 7c20728..678afd0 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1095,9 +1095,15 @@ static ssize_t show_chip_id(struct device *dev, struct device_attribute *attr, char *buf) { struct ab8500 *ab8500; + int chip_id = -EINVAL; ab8500 = dev_get_drvdata(dev); - return sprintf(buf, "%#x\n", ab8500 ? ab8500->chip_id : -EINVAL); + if(ab8500) { + chip_id = ab8500->chip_id; + if((is_ab8505(ab8500) || is_ab9540(ab8500)) && ab8500->version != 0xFF) + chip_id = (ab8500->version << 8) | chip_id; + } + return sprintf(buf, "%#x\n", chip_id); } /*