Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1019878ybl; Wed, 8 Jan 2020 09:36:13 -0800 (PST) X-Google-Smtp-Source: APXvYqxMxkEAOGoW82yfDDEV7XWXB0qKQvjy7iGo2tSg5Mx7vQ7tcGVF94Zt3EQzEquLNuxQ08q9 X-Received: by 2002:a05:6808:b13:: with SMTP id s19mr3767554oij.119.1578504973686; Wed, 08 Jan 2020 09:36:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578504973; cv=none; d=google.com; s=arc-20160816; b=b8LrmDdMPVz1zVHLCdc/IxkSopYK8joJigqm9iR3wwXIJHtizNKllsnNXe5o2E9VpF lmpx7St+SIEsgh4riAWEMrN/77cezFxt6Gxjrfdl0h60+3OK7xl7sccRk8q5wmGqVOMc EwvHUceonLi26vLo9M+FbXEsZbowTHyPQ7iRjPTSxjy68Gzlurl2N6O7AChQlM/0bp4d 1xOe3gx9nO7tw7fmqscvr69l0yHtiU7JPN6kAxJLq6kGHvCeeRFOZobT/gYJjunPPGNR GxT2PynaOCkSxTTFAvWWy8wYmiFt2ZMwusPxV6fFODQzIOJ70U3FM/z9NMoFuI8wvMCG wlOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=c+kKmDJHi7cB9OTqpdYGSI2iBAodqU59kVDu+/v1OuE=; b=PjQZ8vdByk8Wcy4FfLXk6n+XDw5X/eR4WD2ewY2gMKGhku2dRz1plsm+7F/vGKWF6L fe2ZQmAPuV/PRPDlvnbLep0j4Wb8qNXBgbIDbx77DcHoS1aYEM4B6JriTBWSjUk5CxuU U7tofbMuCseg6lYjQedBykMPnfPKR53YjAWAFAOS2ssxSWzPRl3PmLTyfCmCFXUUHnFD PP9JTGcRQfVDSNDKF1zUlnuDqYMzEONUdN8EppXHiPCmK0oyZO6gG17N9OdUmQZQMa7x VSCuy6eq/F9i6lwSpxmJTveVYamNaxR4wkgG3MgevImDIFcZZzKmBC66+e1R+It2f7CT YIjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3si2213670otr.245.2020.01.08.09.36.01; Wed, 08 Jan 2020 09:36:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728533AbgAHOpz (ORCPT + 99 others); Wed, 8 Jan 2020 09:45:55 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:36956 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbgAHOpz (ORCPT ); Wed, 8 Jan 2020 09:45:55 -0500 Received: by mail-lj1-f194.google.com with SMTP id o13so3597061ljg.4; Wed, 08 Jan 2020 06:45:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=c+kKmDJHi7cB9OTqpdYGSI2iBAodqU59kVDu+/v1OuE=; b=M4oG7U0a0zA34RF/C9NACDrbR0FAJf7uhJPxClf1vM4kPCOyYOsuivuN2XrUBLShWE PRF0gPseN5xNNY/8Wjp1uJERrW3Li+tuYWr1aWv0ZKY684Lxb3n+iz5GIm8M1werw3Xw aA2jCSHlRMTMwYQ23mEMdbsNEpGvKCkr19oJzkuF8We0A4SIlntOpwlChooT9JRQZ6XF l4yA+XTUKs1fw4rzoTFNpNaykGZBIgwB/M/2v6C2q1bMmW944sH4bhfxiRFvH0BXlg2g 5jiPxniJ8p2l4l41CY4sq/AnA1MXaLj9V2Y5vk+oL8RVtxrwzLbTtdd/CPTfDM0pwAT2 2KZQ== X-Gm-Message-State: APjAAAVhRqNCuFCsf5ckDQ0Uvb2HethSGWbEBoWqVvudSHg32rjnbXzW ZnNF7dKNn5+DLzCk2F3K3t8= X-Received: by 2002:a2e:880a:: with SMTP id x10mr3070313ljh.211.1578494752687; Wed, 08 Jan 2020 06:45:52 -0800 (PST) Received: from xi.terra (c-14b8e655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.184.20]) by smtp.gmail.com with ESMTPSA id y8sm1386428lji.56.2020.01.08.06.45.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2020 06:45:51 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.92.3) (envelope-from ) id 1ipCau-0001Hu-Sx; Wed, 08 Jan 2020 15:46:00 +0100 Date: Wed, 8 Jan 2020 15:46:00 +0100 From: Johan Hovold To: "Ji-Ze Hong (Peter Hong)" Cc: Johan Hovold , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, peter_hong@fintek.com.tw, "Ji-Ze Hong (Peter Hong)" Subject: Re: [PATCH V2 7/7] USB: serial: f81232: Add gpiolib to GPIO device Message-ID: <20200108144600.GK30908@localhost> References: <20190923022449.10952-1-hpeter+linux_kernel@gmail.com> <20190923022449.10952-8-hpeter+linux_kernel@gmail.com> <20191023122208.GW24768@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 30, 2019 at 10:00:12AM +0800, Ji-Ze Hong (Peter Hong) wrote: > Hi Johan, > > Johan Hovold 於 2019/10/23 下午 08:22 寫道: > > On Mon, Sep 23, 2019 at 10:24:49AM +0800, Ji-Ze Hong (Peter Hong) wrote: > >> The Fintek F81534A series contains 3 GPIOs per UART and The max GPIOs > >> is 12x3 = 36 GPIOs and this patch will implements GPIO device as a > >> gpiochip to control all GPIO pins even transforms to transceiver pins. > > > > Depending to your answer to my question whether these pins are truly > > general purpose or not, this may not be the right interface. > > Our F81534A series contains F81532A/534A/535/536. For the following link > of F81534A pin-out: > https://imgur.com/a/AZHqQ1N > > We had 2 type about GPIO pins, MODEx_y & GPIOxx. All MODEx_y & GPIOxx > are GPIOs and can be controlled by GPIO device, but they had some > difference about usage. > MODEx_y: > 1. 3 pins(x: 0/1/2) can be access by UART port y. > 2. Used to control UART's transceiver normally, but it > also can be configure as GPIO when UART disabled by > H/W (DTR strap to GND). > GPIOxx: > 1. Access only by GPIO device. > > The series patch only support RS233 mode for all serial port, So we'll > direct set all MODEx_y to (0/0/1) for our demo board for default. If > user really want to use the pin, we had provide the gpiolib with GPIO > device, but we'll recommend user to use GPIOxy first. Do you mean that you'd need to register a separate gpio chip per port in order to expose an interface for changing the MODEx_y pins for an enabled UART? Or can you do that through the "global" gpio device? > Is any suggest about this ? Could I maintain this for this series patch? I understood from your other mail that the gpio device would not be able to control the pins of an enabled port. In either case, I think you need to refuse a request for a pin that's already in use by the corresponding port. Also is there a way to determine the number of available pins by detecting the chip/package type? I'm assuming not all 36 pins are always accessible? > >> + status = devm_gpiochip_add_data(&intf->dev, &priv->chip, priv); > >> + if (status) { > >> + dev_err(&intf->dev, "failed to register gpiochip: %d\n", > >> + status); > >> + return status; > >> + } > > > > Have you tried disconnecting the device with gpios requested? This used > > to break gpiolib, but was fixed. Just want to make sure it hasn't > > regressed. > > I had try export GPIOs and detach the F81534A in kernel 5.0.0, it seems > no problem. Is any link about this issue for me to do more test ? Then it's hopefully fine. Thanks for verifying. Johan