Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753818AbeABDYc (ORCPT + 1 other); Mon, 1 Jan 2018 22:24:32 -0500 Received: from mail-pl0-f51.google.com ([209.85.160.51]:41545 "EHLO mail-pl0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751669AbeABDYa (ORCPT ); Mon, 1 Jan 2018 22:24:30 -0500 X-Google-Smtp-Source: ACJfBovow09VoUdf4BWrgQG0XcU3nSPMiitF20x8ECXu5pQcFiJ6Ud5ipmiKek5RrIIxscgamrDEkw== Subject: Re: [PATCH V1 3/4] usb: serial: f81534: add output pin control To: Johan Hovold Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ji-Ze Hong (Peter Hong)" References: <1510818369-10323-1-git-send-email-hpeter+linux_kernel@gmail.com> <1510818369-10323-3-git-send-email-hpeter+linux_kernel@gmail.com> <20171218160616.GC3374@localhost> <20171227103055.GN3374@localhost> From: "Ji-Ze Hong (Peter Hong)" Message-ID: Date: Tue, 2 Jan 2018 11:24:26 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20171227103055.GN3374@localhost> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Johan, >> In this code, I'm only read/write 3 registers of 0x2ae8, 0x2a90, 0x2a80, >> but some register will read/write more than once. Should I change the >> code from port_probe() to attach() and re-write it as: >> 1: read the 3 register >> 2: change them will 12 pin desire value >> 3: write it back >> Is it ok? > > Do you expect these pins to ever be changed after probe? If not, then > perhaps it can be moved to attach(), but otherwise I guess they should > be set at port_probe(). By using shadow registers, you should be able to > reduce the number of device accesses, but perhaps it's not worth the > complexity. > > Do you have a rough idea about how long these register updates take? I > was just worried that these changes will add up to really long probe > times. > I had measured the time of the loop in f81534_set_port_output_pin() via getnstimeofday() with 685.410 ~ 3681.682us per port, but normally with 600~800us per port. So I prefer remain the current method of f81534_set_port_output_pin(). Is it ok? Thanks -- With Best Regards, Peter Hong