From patchwork Mon Feb 4 11:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johanna Abrahamsson X-Patchwork-Id: 10795439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 130031669 for ; Mon, 4 Feb 2019 11:21:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F08FF2B06A for ; Mon, 4 Feb 2019 11:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E517F2B01D; Mon, 4 Feb 2019 11:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AE6E2B079 for ; Mon, 4 Feb 2019 11:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728468AbfBDLVi (ORCPT ); Mon, 4 Feb 2019 06:21:38 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33010 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727421AbfBDLVh (ORCPT ); Mon, 4 Feb 2019 06:21:37 -0500 Received: by mail-lj1-f195.google.com with SMTP id v1-v6so11246282ljd.0 for ; Mon, 04 Feb 2019 03:21:36 -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:mime-version :content-disposition:user-agent; bh=lwF2FwfAxYTw70SkywV3THq/LJxhyBFgDUruBInk8lU=; b=t2KvZhSnfy0GbxD/E3JtRVU6KdxWGVngDag+s81MazKcC+mQNodLexVyBJGGpeNoxz Ec1XRWeqYBmpdeK/YWPHaqfpAna+3vKt4xbto3j517+qLR3GhC2M4P0Z/7Myek7plyjz EsW7rvZbnN0+qEaeVXIUTwajM3lrJBzgK3IPqy6Xrn4S8OK0J4G+ueMLu76DoYATHYaJ upS1jUxJrqSQBtYKdBtfF32Bzr0dpl16EI5Go2IvdQj1cWzKZdPItkfGOtwg2XE49wm2 gYFhATAv6O0XUXMwDhKkzB+7LDGf3C7ZDJjc2dc0x+V+xt9HQ7l07XiXj5OSUI3NsjqH qSsg== X-Gm-Message-State: AHQUAuaZWfV+N97+qUsTFn0IYVVkjq5+yOelzb3I+O1aj7VDHo8tTbCH rXAMlN0lgT2k2XXXFAvA5uUqPMvd X-Google-Smtp-Source: AHgI3IZqum1G7rDZU3si4BwGoIFsT4WkQfujv6gZ0XJmhgS3DLPPtWg2kf9ghI+sZ3SH33KjS35jWw== X-Received: by 2002:a2e:3603:: with SMTP id d3-v6mr4004433lja.46.1549279295361; Mon, 04 Feb 2019 03:21:35 -0800 (PST) Received: from fedora-21-dvm ([194.103.240.26]) by smtp.gmail.com with ESMTPSA id c22sm2485164lfi.27.2019.02.04.03.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Feb 2019 03:21:34 -0800 (PST) Date: Mon, 4 Feb 2019 12:21:30 +0100 From: Johanna Abrahamsson To: linux-usb@vger.kernel.org Cc: johan@kernel.org, gregkh@linuxfoundation.org Subject: [PATCH] USB: serial: cp210x: add minimun baud rate for CP2105 SCI Message-ID: <20190204112125.GA1478@fedora-21-dvm> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johanna Abrahamsson This patch adds a minimum baud rate of 2400 for CP2105 SCI According to the datasheet for CP2105, the SCI supports 2400 as the lowest baud rate. As this is not heeded in the current code, an error message 'failed set req 0x1e size 4 status: -32' when trying to set a lower baud rate such as 300. Since this is, as far as I can tell, the only cp210x chip with a minimum baud rate higher than 300, I've added a special case to cp210x_change_speed rather than adding a min_speed field in cp210x_serial_private. Signed-off-by: Johanna Abrahamsson --- drivers/usb/serial/cp210x.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 336a3c0f9f2c..181abf7bb8c0 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -1111,9 +1111,12 @@ static void cp210x_change_speed(struct tty_struct *tty, */ if (priv->use_actual_rate) baud = cp210x_get_actual_rate(serial, baud); - else if (baud < 1000000) + else if (baud < 1000000) { + if (priv->partnum == CP210X_PARTNUM_CP2105 && + cp210x_interface_num(serial) == 1) + baud = clamp(baud, 2400u, priv->max_speed); baud = cp210x_get_an205_rate(baud); - else if (baud > priv->max_speed) + } else if (baud > priv->max_speed) baud = priv->max_speed; dev_dbg(&port->dev, "%s - setting baud rate to %u\n", __func__, baud);