From patchwork Wed Aug 20 08:06:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 4747901 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E137E9F375 for ; Wed, 20 Aug 2014 08:07:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBD4F2014A for ; Wed, 20 Aug 2014 08:07:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3EB922016C for ; Wed, 20 Aug 2014 08:07:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751802AbaHTIGw (ORCPT ); Wed, 20 Aug 2014 04:06:52 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:47332 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbaHTIGc (ORCPT ); Wed, 20 Aug 2014 04:06:32 -0400 Received: by mail-pa0-f48.google.com with SMTP id et14so11565400pad.21 for ; Wed, 20 Aug 2014 01:06:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=B1LDwOu8ovNkN1CvwrY6mc6FYuMmPcbKLNgjZMF84zk=; b=I7gPNtpy5bDwCatcJ1dXCCAw3lovkDXrmRE6PpkL1j4e33dsS+ZEPastA0jzpRls7m bHQ+O9qc0vZj9OIBZQYem/pZDgent3IoewU2Eak3JnMebTNsBkr5I0CfMeFr3JLUv5nD 7qJfWwYiKS5sxiItpl9WX4ogXzwjll/SSlNRMC4GIbIT7zafbbsDKCjOTSFKMeviFnYp KQq7bM0FhfSsgHbCuiTSZR2VCFB/AjPl2T9cPVcwupHI3+l+dG/D8naQ5ZSiwVwBOsHy O5LtUVhnJIVvNfjUao8NTmv6f6ej6Ncb5ZEHkKAdGs8OiOziSD5viXkcrzXOt3yD5286 6bPA== X-Gm-Message-State: ALoCoQmkEaMFfsm7Yl5mBTf2K6VsoLOgzEF9Of2+cJsdnpAgn9ipYQ3I1+kPF3YW8kz/NZsdWipc X-Received: by 10.70.37.134 with SMTP id y6mr57016506pdj.33.1408521986321; Wed, 20 Aug 2014 01:06:26 -0700 (PDT) Received: from [192.168.1.4] ([117.198.93.65]) by mx.google.com with ESMTPSA id t5sm21579071pbs.4.2014.08.20.01.06.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 20 Aug 2014 01:06:24 -0700 (PDT) Message-ID: <53F456F3.3000309@linaro.org> Date: Wed, 20 Aug 2014 09:06:11 +0100 From: Srinivas Kandagatla User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "Ivan T. Ivanov" , Linus Walleij , Grant Likely , Rob Herring CC: Bjorn Andersson , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/6] pinctrl: Introduce pinctrl driver for Qualcomm SSBI PMIC's References: <1407771634-14946-1-git-send-email-iivanov@mm-sol.com> <1407771634-14946-3-git-send-email-iivanov@mm-sol.com> In-Reply-To: <1407771634-14946-3-git-send-email-iivanov@mm-sol.com> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Bjorn, Two things which I noticed while trying out this driver to drive a reset line. 1> gpio numbering for pinconf vs gpio are not consistent, they differ by an offset of 1. For example to control GPIO43 I had to do something like this in pinconf: wlan_default_gpios: wlan-gpios { pios { pins = "gpio43"; function = "normal"; bias-disable; power-source = ; }; }; for same pin for gpio I had to do: reset-gpio = <&pm8921_gpio 42 GPIO_ACTIVE_LOW>; This offset by 1 is bit confusing and can easily lead to errors which are hard to find. I think this should be easy to fix.. 2> Looking back at v3.4 kernel, for gpio modes, BIT(0) of bank 0 is set to enable gpio mode. without this bit driver does not work for output pins. here is the patch which fixes this: From 5a5c5171a3371cf38ccd157922ea140bfd0253d5 Mon Sep 17 00:00:00 2001 From: Srinivas Kandagatla Date: Wed, 20 Aug 2014 07:18:03 +0100 Subject: [PATCH] pinctrl:qcom:ssbi: Enable gpio mode Looking back at 3.4 kernel driver, it looks like the gpio enable bit is missing in this driver. This patch is just a hack to get the wlan reset line working. Signed-off-by: Srinivas Kandagatla --- drivers/pinctrl/qcom/pinctrl-ssbi-pmic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) val = pin->direction << 2; diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-pmic.c b/drivers/pinctrl/qcom/pinctrl-ssbi-pmic.c index 27e5ec9..2633ea1 100644 --- a/drivers/pinctrl/qcom/pinctrl-ssbi-pmic.c +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-pmic.c @@ -49,6 +49,7 @@ #define SSBI_REG_ADDR_GPIO_BASE 0x150 #define SSBI_REG_ADDR_GPIO(n) (SSBI_REG_ADDR_GPIO_BASE + n) +#define PM8XXX_GPIO_MODE_ENABLE BIT(0) #define PM8XXX_GPIO_WRITE BIT(7) #define PM8XXX_MAX_GPIOS 44 @@ -493,7 +494,8 @@ static int pm8xxx_gpio_config_set(struct pinctrl_dev *pctldev, } if (banks & BIT(0)) - pm8xxx_gpio_write(pctrl, offset, 0, pin->power_source << 1); + pm8xxx_gpio_write(pctrl, offset, 0, pin->power_source << 1 | + PM8XXX_GPIO_MODE_ENABLE); if (banks & BIT(1)) {