From patchwork Sun Apr 10 10:34:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65436 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp922233lbl; Sun, 10 Apr 2016 03:34:40 -0700 (PDT) X-Received: by 10.50.43.129 with SMTP id w1mr12634910igl.47.1460284478408; Sun, 10 Apr 2016 03:34:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n39si12331652ioe.7.2016.04.10.03.34.38; Sun, 10 Apr 2016 03:34:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752447AbcDJKef (ORCPT + 4 others); Sun, 10 Apr 2016 06:34:35 -0400 Received: from mail-lf0-f45.google.com ([209.85.215.45]:33082 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752285AbcDJKef (ORCPT ); Sun, 10 Apr 2016 06:34:35 -0400 Received: by mail-lf0-f45.google.com with SMTP id e190so121796330lfe.0 for ; Sun, 10 Apr 2016 03:34:34 -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; bh=Jsx9WIlbdeFUrIkZo88jOS0lXeKayQF8wbC4pVsQDJs=; b=e0EnLKV6ple92jT4TBmxkHRTt0hVaWr4k2lT5Z16WN5ZZPC8JdPC3qezsy4Nzf1gkv Kw5aaVOX6QUHNPmtZg2o+Ggkfe3Qg3Qc7AObmtNaD/sjjy9j8ljMWqrEtrbCtshixGE7 ci1fTpLet7lBPKNDmCixQyJLURFwIzRIemcYE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Jsx9WIlbdeFUrIkZo88jOS0lXeKayQF8wbC4pVsQDJs=; b=hRphrTSmv2a2n2QrN5JhPFOVHHpkBILOzpifMOK1PmReP/55gRNjBUEsp4s3O/uTPr r2PS7Yk7oJ56p/bBz3cyIuL31S+5RJYE3rF8QefIUWtaGmGvT4dgG4hfZ0TKpcqLpFwm v2VS1H4kCZ+WzkU0eNGC/5UN3G7cm+b2GPJV5oCrvMDr9cJ8YRL4YsR/l1+DyzmUx+89 qNHfN60/rAq4h94kOeZ2R1Qr5kRSGte+E7t2FjekgxQfg5evB4NUz13BCEkazj/SOxcy iMMXs+7+TDuPjNPnBTC+I+32jQFp3PYbyP7jIvpRsnzedb0zg9Phg+OO0o6oU+vv+qUV CohQ== X-Gm-Message-State: AD7BkJLsDDGcZH+8aMiQ2s92KJWkD4D26w6AI+GS5jUz2/s52lq2z/foV4qHgXjGMPbAvoLj X-Received: by 10.25.218.196 with SMTP id r187mr6607643lfg.6.1460284473205; Sun, 10 Apr 2016 03:34:33 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-927b71d5.014-348-6c756e10.cust.bredbandsbolaget.se. [213.113.123.146]) by smtp.gmail.com with ESMTPSA id i9sm3607157lfe.31.2016.04.10.03.34.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Apr 2016 03:34:32 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Daniel Drake Subject: [PATCH] gpio: vx855: use the new open drain callback Date: Sun, 10 Apr 2016 12:34:28 +0200 Message-Id: <1460284468-10149-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org The vx855 driver clearly states it has three groups of lines: GPI, GPO and GPIO. The GPO are assumedly push-pull. The GPIO are implicit open drain, but if the GPIO subsystem ask for them to be explicitly open drain (i.e. set the flag on a machine table that we want open drain) it will currently misbehave: it will switch the GPIOs to input mode (emulate open drain). Instead: indicate in the .set_single_ended() callback that we support open drain and open drain only. Cc: Daniel Drake Signed-off-by: Linus Walleij --- drivers/gpio/gpio-vx855.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c index 8cdb9f7ec7e0..4e450121129b 100644 --- a/drivers/gpio/gpio-vx855.c +++ b/drivers/gpio/gpio-vx855.c @@ -186,6 +186,28 @@ static int vx855gpio_direction_output(struct gpio_chip *gpio, return 0; } +static int vx855gpio_set_single_ended(struct gpio_chip *gpio, + unsigned int nr, + enum single_ended_mode mode) +{ + /* The GPI cannot be single-ended */ + if (nr < NR_VX855_GPI) + return -EINVAL; + + /* The GPO's are push-pull */ + if (nr < NR_VX855_GPInO) { + if (mode != LINE_MODE_PUSH_PULL) + return -ENOTSUPP; + return 0; + } + + /* The GPIO's are open drain */ + if (mode != LINE_MODE_OPEN_DRAIN) + return -ENOTSUPP; + + return 0; +} + static const char *vx855gpio_names[NR_VX855_GP] = { "VX855_GPI0", "VX855_GPI1", "VX855_GPI2", "VX855_GPI3", "VX855_GPI4", "VX855_GPI5", "VX855_GPI6", "VX855_GPI7", "VX855_GPI8", "VX855_GPI9", @@ -209,6 +231,7 @@ static void vx855gpio_gpio_setup(struct vx855_gpio *vg) c->direction_output = vx855gpio_direction_output; c->get = vx855gpio_get; c->set = vx855gpio_set; + c->set_single_ended = vx855gpio_set_single_ended; c->dbg_show = NULL; c->base = 0; c->ngpio = NR_VX855_GP;