From patchwork Sat Apr 9 14:13:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 65431 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp588428lbl; Sat, 9 Apr 2016 07:13:39 -0700 (PDT) X-Received: by 10.107.30.71 with SMTP id e68mr15114482ioe.145.1460211219555; Sat, 09 Apr 2016 07:13:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si9561138iol.108.2016.04.09.07.13.39; Sat, 09 Apr 2016 07:13:39 -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 S1752449AbcDIONj (ORCPT + 4 others); Sat, 9 Apr 2016 10:13:39 -0400 Received: from mail-lf0-f44.google.com ([209.85.215.44]:35739 "EHLO mail-lf0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbcDIONi (ORCPT ); Sat, 9 Apr 2016 10:13:38 -0400 Received: by mail-lf0-f44.google.com with SMTP id c126so108008225lfb.2 for ; Sat, 09 Apr 2016 07:13:37 -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=hJAHvsxgoqUfwYYRKAPMY1MPSPiNOEWSBBVD6WDneIc=; b=AgCpLQ912+HaQKs2vS3i+nSE2AZiHX66ejENFbxi2YMaLuTc8OyOXoVFPbG89lNtaq tXnOld95Y2tpuvt1Z/avaezBBrn33j2xSnd1MRPWbSe4HTZMdIoRLyrc4+izGHLFR/jj r4L/8Sro7bNxcqYeSn2G7+mdT6Mfv7RKekhiU= 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=hJAHvsxgoqUfwYYRKAPMY1MPSPiNOEWSBBVD6WDneIc=; b=f9Hl9esZGpr0ZOdCygM67F7X4OVUkIDB8w709SYC86/uiOAYTxYZZ85fCi8m1/5O7b izbuLz8i+JvM4Iz8r7DsCBJDeimjRXCeEp02efx9Tm+tTw2DEtZfjnXHDdMLY2EtkIlZ J2ULkUnJS00U4fKTH8gI6dwuNYFZ65zz1UWdELE85rQEGzHdi559tfXszUmkz5G5Fd2T vuRJdXt4gJSFHu1tNefy93Z8Us1KU5Jzi9qB2BVUp3e9QWYPruWM2mwRz9iUeheIUhRb yYmbE87zJ2k9jjgmASWRFRXJLktvnDhXSjOEPBFUhe4kgsM/uHAci0TDXj2++4dfxBl9 I2Ow== X-Gm-Message-State: AD7BkJJALniVLjAOjRqX8TF5egvNy3KBg5qZHt9f/OfmoP0Cn/Qtwui2ALUQ2pmtK8Rg5yCe X-Received: by 10.25.24.90 with SMTP id o87mr5821011lfi.47.1460211216299; Sat, 09 Apr 2016 07:13:36 -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 s193sm2930701lfe.29.2016.04.09.07.13.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Apr 2016 07:13:35 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Peter Hung , Andreas Bofjall , Simon Guinot Subject: [PATCH 2/2] gpio: f7188x: use the new open drain callback Date: Sat, 9 Apr 2016 16:13:32 +0200 Message-Id: <1460211212-2808-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 F7188x chips supports setting the pins in open drain mode. Activate the new .set_single_ended() callback. Cc: Peter Hung Cc: Andreas Bofjall Cc: Simon Guinot Signed-off-by: Linus Walleij --- drivers/gpio/gpio-f7188x.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 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-f7188x.c b/drivers/gpio/gpio-f7188x.c index 8b10fbf787f8..75667afce387 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -130,6 +130,9 @@ static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset); static int f7188x_gpio_direction_out(struct gpio_chip *chip, unsigned offset, int value); static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value); +static int f7188x_gpio_set_single_ended(struct gpio_chip *gc, + unsigned offset, + enum single_ended_mode mode); #define F7188X_GPIO_BANK(_base, _ngpio, _regbase) \ { \ @@ -140,6 +143,7 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value); .get = f7188x_gpio_get, \ .direction_output = f7188x_gpio_direction_out, \ .set = f7188x_gpio_set, \ + .set_single_ended = f7188x_gpio_set_single_ended, \ .base = _base, \ .ngpio = _ngpio, \ .can_sleep = true, \ @@ -301,6 +305,35 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) superio_exit(sio->addr); } +static int f7188x_gpio_set_single_ended(struct gpio_chip *gc, + unsigned offset, + enum single_ended_mode mode) +{ + int err; + struct f7188x_gpio_bank *bank = gpiochip_get_data(chip); + struct f7188x_sio *sio = bank->data->sio; + u8 data; + + if (mode != LINE_MODE_OPEN_DRAIN && + mode != LINE_MODE_PUSH_PULL) + return -ENOTSUPP; + + err = superio_enter(sio->addr); + if (err) + return err; + superio_select(sio->addr, SIO_LD_GPIO); + + data = superio_inb(sio->addr, gpio_out_mode(bank->regbase)); + if (mode == LINE_MODE_OPEN_DRAIN) + data &= ~BIT(offset); + else + data |= BIT(offset); + superio_outb(sio->addr, gpio_data_mode(bank->regbase), data); + + superio_exit(sio->addr); + return 0; +} + /* * Platform device and driver. */