From patchwork Thu Aug 23 10:33:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 961269 X-Patchwork-Delegate: bartekgola@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="BJ5p2eeZ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41x13n4m2Kz9s3C for ; Thu, 23 Aug 2018 20:33:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726611AbeHWOCz (ORCPT ); Thu, 23 Aug 2018 10:02:55 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:36035 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728156AbeHWOCz (ORCPT ); Thu, 23 Aug 2018 10:02:55 -0400 Received: by mail-lj1-f193.google.com with SMTP id u7-v6so3770160lji.3 for ; Thu, 23 Aug 2018 03:33:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6Ph8FOTe30oWA9DunxxoHHQkqbM6/3H5VfapCYKHjz8=; b=BJ5p2eeZvSyIc0FV9hey+AybPljaO2vN/E8U0iNBNtBFRIzBE1+kVLk4rebb3Cmm99 kkuJ8AZZZmuSEtvLfC46rntJNB94gUeEXtKhWh9B1lzn+9GiIzKpw7TibRLtEBtoIQcm 1r3fubglzqMR6h6o0x2EmdnZ3/qV1gKOGhH4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6Ph8FOTe30oWA9DunxxoHHQkqbM6/3H5VfapCYKHjz8=; b=IjE6OAO1Y/OuETG2ke+CpOKfBDUOwJVDPpi6TwLKEr2HrZ0zMLd/FimMKMmD4Rn+Hw 5YKCcYY76CQWnTZNAbQXqLJF40dqu40Akp5PVklIrEd9hGlvtIV4Yq36hl1YE9HQ27wx 1jn6pAhRaWK8gG6PAGuSWUQhDbFbxQO2mWBj1UTDoOl2N2HcEoIAK8g1Penb68py63sR h+6/WXE2QnVW79rogr74iCx45W4Up/erXGIycMi4I75zftcMg3grmfqqPeoEPaTxyTIq jm1XV6gUPCNPhpXAVP+CbXJ4WaEyjo/jIzTG1MFXyN1UDLPVqfZ8xQpP1dV9D2lL1yV3 28bg== X-Gm-Message-State: APzg51C+0Ko/htYOnSPJtb7OIJkMPJs7YYe9tyhCa++W0mnboAf+P9HV gpaE/wd8qYGZ4/9FJaIf74ciSg== X-Google-Smtp-Source: ANB0Vdas716KdYuMys1c9jYxKWu4bm3jvVKAbjwrAk/Yz5hTktKDzRijEVxjPcJsolBUHrjv3hsM0g== X-Received: by 2002:a2e:8807:: with SMTP id x7-v6mr5290625ljh.98.1535020429925; Thu, 23 Aug 2018 03:33:49 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s74-v6sm556898lfg.79.2018.08.23.03.33.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 Aug 2018 03:33:48 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, dev@lists.96boards.org Cc: John Stultz , Manivannan Sadhasivam , Rob Herring , Mark Rutland , Frank Rowand , Mark Brown , Michal Simek , Andy Shevchenko , Mika Westerberg , Arnd Bergmann , Linus Walleij , Bartosz Golaszewski , linux-i2c@vger.kernel.org Subject: [PATCH 1/4] eeprom: at24: Allow passing gpiodesc from pdata Date: Thu, 23 Aug 2018 12:33:29 +0200 Message-Id: <20180823103332.32047-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180823103332.32047-1-linus.walleij@linaro.org> References: <20180823103332.32047-1-linus.walleij@linaro.org> Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This makes it possible to pass an initialized GPIO descriptor to the driver through platform data. This is useful when we are dealing with EEPROMs on expansion boards where the GPIO has to be looked up indirectly using a connector abstraction (several systems using the same connector) so the machine descriptor tables cannot be used to associate the descriptor with the device and we then want to pass this descriptor on to the EEPROM driver this way instead. Cc: Bartosz Golaszewski Cc: linux-i2c@vger.kernel.org Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - No changes - Requesting an ACK from the EEPROM maintainer (Bartosz) so we can apply this to the ARM SoC tree with the series depending on it. --- drivers/misc/eeprom/at24.c | 6 +++++- include/linux/platform_data/at24.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index f5cc517d1131..d577cdbe221e 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -662,7 +662,11 @@ static int at24_probe(struct i2c_client *client) at24->client[0].client = client; at24->client[0].regmap = regmap; - at24->wp_gpio = devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_HIGH); + if (pdata.wp_gpiod) + at24->wp_gpio = pdata.wp_gpiod; + else + at24->wp_gpio = + devm_gpiod_get_optional(dev, "wp", GPIOD_OUT_HIGH); if (IS_ERR(at24->wp_gpio)) return PTR_ERR(at24->wp_gpio); diff --git a/include/linux/platform_data/at24.h b/include/linux/platform_data/at24.h index 63507ff464ee..5606fb2ef76c 100644 --- a/include/linux/platform_data/at24.h +++ b/include/linux/platform_data/at24.h @@ -11,6 +11,7 @@ #include #include #include +#include /** * struct at24_platform_data - data to set up at24 (generic eeprom) driver @@ -55,6 +56,7 @@ struct at24_platform_data { void (*setup)(struct nvmem_device *nvmem, void *context); void *context; + struct gpio_desc *wp_gpiod; }; #endif /* _LINUX_AT24_H */