From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6B6DC433E9 for ; Mon, 1 Mar 2021 08:59:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E31564DF2 for ; Mon, 1 Mar 2021 08:59:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233687AbhCAI7C (ORCPT ); Mon, 1 Mar 2021 03:59:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:59464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233709AbhCAI4O (ORCPT ); Mon, 1 Mar 2021 03:56:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BE27A6148E; Mon, 1 Mar 2021 08:55:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614588932; bh=1Lj3nNR9NY5QBEvwcUxtfqmYoLwL0qm3v3ID+sTuq6Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DJYAIlkCN4p0WxB/8R8oNXUUCM9KOLmVOPkojRWgZSjI6M8vPZWRfSYFN4zH64I7n Ln1mUvO/5ETHCibW1oI8zbKrQhFMft9W8ZANJBLYhrexeH0r41u26Xk+Rbx7pdiWgM /otkm6vIPfb7bpnZVlzVJR5CoK2K17RjUVUncAt2BiNwSzfMfT10330QaE+YCsAFa2 2vVtbI02rBqTSFJPmsKpO4IL1v0kXAZap0Xyx7XR1XzRVvECsT9VoZdnhwTUck8200 OgNVvySX+zRrLIQ+detvuyfYWcAsxlPmWh57tGI5XIVaXpwZco6jeq6hYLKnC3/IEe K1O/GoXbssvgw== Received: from johan by xi.lan with local (Exim 4.93.0.4) (envelope-from ) id 1lGeLG-0003sV-8A; Mon, 01 Mar 2021 09:55:50 +0100 Date: Mon, 1 Mar 2021 09:55:50 +0100 From: Johan Hovold To: Pho Tran Cc: "gregkh@linuxfoundation.org" , "linux-kernel@vger.kernel.org" , "linux-usb@vger.kernel.org" , Hung Nguyen Subject: Re: [PATCH] USB: serial: cp210x: Make the CP210x driver work with GPIOs of CP2108 Message-ID: References: <5F0FCC57-86C5-4FF2-AE75-C2DDC748901A@silabs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5F0FCC57-86C5-4FF2-AE75-C2DDC748901A@silabs.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Mon, Mar 01, 2021 at 08:13:46AM +0000, Pho Tran wrote: > Similar to other CP210x devices, GPIO interfaces (gpiochip) should be supported for CP2108. > > CP2108 has 4 serial interfaces but only 1 set of GPIO pins are shared to all of those interfaces. > So, just need to initialize GPIOs of CP2108 with only one interface (I use interface 0). > It means just only 1 gpiochip device file will be created for CP2108. > > CP2108 has 16 GPIOs, So data types of several variables need to be is u16 > instead of u8(in struct cp210x_serial_private). This doesn't affect other CP210x devices. > > Because CP2108 has 16 GPIO pins, the parameter which is passed by cp210x functions > will be different from other CP210x devices. So need to check part number of the device to use correct data format before sending commands to devices. > > Like CP2104, CP2108 have GPIO pins with configurable options. Therefore, in cp2108_gpio_init() function, > Should be mask all pins which are not in GPIO mode. Please break commit message lines at 72 cols or so (and try to keep code < 80 cols). There are still a few checkpatch.pl warnings on this one that look legitimate, please fix those up (e.g. spaces at start of lines). Also use the kernel u8 and u16 types instead of the c99 ones. Johan