From patchwork Tue Jan 15 12:56:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 1977791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 8E7AADF264 for ; Tue, 15 Jan 2013 13:08:26 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Tv6Ab-0000RY-2n; Tue, 15 Jan 2013 13:03:13 +0000 Received: from wi-in-x022a.1e100.net ([2a00:1450:400c:c05::22a] helo=mail-wi0-x22a.google.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tv64b-0006h9-E7 for linux-arm-kernel@lists.infradead.org; Tue, 15 Jan 2013 12:57:06 +0000 Received: by mail-wi0-f170.google.com with SMTP id hq7so2315657wib.5 for ; Tue, 15 Jan 2013 04:57:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=EBMU2Ed/+PJM7Tca/j1QSvNVffFlTF17X3G1/zPJRXU=; b=g/Qnn/CgOc03OPKAUoBlvywBfM+YJizgRZA2S9PyHsgEiOWLHpLsyNioN/CIr7K3s0 lWmotcYKLRnr+M8Ugmh5ZI16qHchTz2/d3+jU1RK0e7YDjmFCT7/5ro8VsjWoLU5h+pO v/DWYSggG6hjOOGHwj78C8oTgXq7Wl0h4IbQOfXC8ctuRqrC9qfXdwEr4dg7QbPKrYg8 bspvf8S6PLcGnjAVd1RAekM/KlHaYS1IHWJB5EbbKdPFzz/R7qDrX0zltozRr4tHdLc+ WVW7Wp4BzG+52GBaZPpj2WMBpfGn2IVUwZmGtA5RlZ3PB26yeCUt6dGGw+1xsRI56DZP 4ItQ== X-Received: by 10.195.13.67 with SMTP id ew3mr53972633wjd.59.1358254620007; Tue, 15 Jan 2013 04:57:00 -0800 (PST) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id eo10sm3672833wib.9.2013.01.15.04.56.58 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 04:56:59 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 20/26] mfd ab8500-gpadc: Introduce new AB version detection Date: Tue, 15 Jan 2013 12:56:00 +0000 Message-Id: <1358254566-12419-21-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358254566-12419-1-git-send-email-lee.jones@linaro.org> References: <1358254566-12419-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQmUqc/WClkLcABLK9RGiygWTvrHacAGPAxVToCGTiN2Rzm5rSstNFJlhbWwQxhvEF2Kw4hg X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130115_075702_077906_6B28FE7F X-CRM114-Status: GOOD ( 14.72 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linus.walleij@stericsson.com, arnd@arndb.de, Bengt Jonsson , Michel JAOUEN , Maxime Coquelin , Lee Jones , sameo@linux.intel.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Michel JAOUEN Add support for AB8505 and AB9540 Signed-off-by: Lee Jones Signed-off-by: Maxime Coquelin Signed-off-by: Bengt Jonsson Reviewed-by: Rabin VINCENT --- drivers/mfd/ab8500-gpadc.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c index 3883b93..6f97c599 100644 --- a/drivers/mfd/ab8500-gpadc.c +++ b/drivers/mfd/ab8500-gpadc.c @@ -102,10 +102,10 @@ struct adc_cal_data { /** * struct ab8500_gpadc - AB8500 GPADC device information - * @chip_id ABB chip id * @dev: pointer to the struct device * @node: a list of AB8500 GPADCs, hence prepared for reentrance + * @parent: pointer to the struct ab8500 * @ab8500_gpadc_complete: pointer to the struct completion, to indicate * the completion of gpadc conversion * @ab8500_gpadc_lock: structure of type mutex @@ -114,9 +114,9 @@ struct adc_cal_data { * @cal_data array of ADC calibration data structs */ struct ab8500_gpadc { - u8 chip_id; struct device *dev; struct list_head node; + struct ab8500 *parent; struct completion ab8500_gpadc_complete; struct mutex ab8500_gpadc_lock; struct regulator *regu; @@ -332,7 +332,7 @@ int ab8500_gpadc_read_raw(struct ab8500_gpadc *gpadc, u8 channel) EN_BUF | EN_ICHAR); break; case BTEMP_BALL: - if (gpadc->chip_id >= AB8500_CUT3P0) { + if (!is_ab8500_2p0_or_earlier(gpadc->parent)) { /* Turn on btemp pull-up on ABB 3.0 */ ret = abx500_mask_and_set_register_interruptible( gpadc->dev, @@ -591,6 +591,7 @@ static int __devinit ab8500_gpadc_probe(struct platform_device *pdev) } gpadc->dev = &pdev->dev; + gpadc->parent = dev_get_drvdata(pdev->dev.parent); mutex_init(&gpadc->ab8500_gpadc_lock); /* Initialize completion used to notify completion of conversion */ @@ -607,14 +608,6 @@ static int __devinit ab8500_gpadc_probe(struct platform_device *pdev) goto fail; } - /* Get Chip ID of the ABB ASIC */ - ret = abx500_get_chip_id(gpadc->dev); - if (ret < 0) { - dev_err(gpadc->dev, "failed to get chip ID\n"); - goto fail_irq; - } - gpadc->chip_id = (u8) ret; - /* VTVout LDO used to power up ab8500-GPADC */ gpadc->regu = regulator_get(&pdev->dev, "vddadc"); if (IS_ERR(gpadc->regu)) {