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: 14069 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 23B1623E2E for ; Tue, 15 Jan 2013 12:57:02 +0000 (UTC) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by fiordland.canonical.com (Postfix) with ESMTP id B85A5A1934B for ; Tue, 15 Jan 2013 12:57:01 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id fo13so54186vcb.35 for ; Tue, 15 Jan 2013 04:57:01 -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=EBMU2Ed/+PJM7Tca/j1QSvNVffFlTF17X3G1/zPJRXU=; b=hlq0h454ZKv3E9PEH39Ex4aWT5UPjbiU6o1N9MvP5MsCiU27yjVWTgFIbCd/VryiXM Cfk/iID3OswlXysdy0Usi68zJUAX8+gTUX2dntkmSw+iKoP0sJD3U320RphTUUHygmxU Z3FUBpKRjd62PT8Vt3yL4olIMPpnarXS7hQd3sGSVmKwTVQIpUCRAb6a433ZcXY69Hac 6/xzV/EQugD/bcY3wqqc+1Hu5KUCReg7/fE/P9ezU0ik4tTkYt5AeQ5xmFBYpCjnp2cp 6rbzntEqTXH69JfkV88LJ44uweD0ulrXtTFbmNZlQOr3tLLrc+YWYiE2eaCUcTXWULqn ExFg== X-Received: by 10.52.70.205 with SMTP id o13mr91711033vdu.75.1358254621276; Tue, 15 Jan 2013 04:57:01 -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.58.145.101 with SMTP id st5csp110627veb; Tue, 15 Jan 2013 04:57:00 -0800 (PST) X-Received: by 10.180.77.68 with SMTP id q4mr3601483wiw.10.1358254620394; Tue, 15 Jan 2013 04:57:00 -0800 (PST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id be5si27422992wjc.43.2013.01.15.04.57.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Jan 2013 04:57:00 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.176; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.176 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-wi0-f176.google.com with SMTP id hm6so2272007wib.15 for ; Tue, 15 Jan 2013 04:57:00 -0800 (PST) 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 Cc: arnd@arndb.de, linus.walleij@stericsson.com, sameo@linux.intel.com, Michel JAOUEN , Lee Jones , Maxime Coquelin , Bengt Jonsson 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: ALoCoQkfqkvYWzQverygyqzDBFEDueEexFtfG5/TiaEsvxs1gUs4Q6KQgriy92k7X8wgXfVFAC7W 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)) {