Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp222807yba; Fri, 3 May 2019 00:05:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzS4jKfmbP73S54hexv6qHb6/WvDREyvyEFpg7F+yf8FeYJC2njd6YDFsWQYsxWUuTigT0r X-Received: by 2002:aa7:8e14:: with SMTP id c20mr8858468pfr.14.1556867108920; Fri, 03 May 2019 00:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556867108; cv=none; d=google.com; s=arc-20160816; b=tByzPpOC1mHuxh87vntoCw3QchkJJ+cjKsA7vNXERmKjKM8CcHV96fB/LbXlbeQxPU WORLI1FGxg594z83TWAQa37IEjsCPnFFuRGOcUtZCQemJh08ZoRmwL5YaOgMPwS8i+WL SgvJA2924HCEu+YLZY4Phtxwk5jKN21AiHEhabkpsEdlSPyCQnNe6pokVLnGgSuImovJ Gbg8q73jogX7o9Flnp7MRM5vthTuelXuxZCUVRRDdvQGc/0ZHyb64qCf4yGTDN0+LLvK 3LpJ2iOGjbvP3MLYLNAi2qMGD3GnTsgTy95b0JJvOetcrOpK5tREyO91OIYJnxZxWYVD PWqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Iqk3xergUOsKAugJuc5t6KOxZcaZnh5miw46WUEvyZ8=; b=FFF1CBGWM8tEZKI5ldO4gcadw3h7s4shSj/HQz8gtGoo0glN7rtz/yYStO2mYlhJCf Ap9pNQ3Sg5rAksDwy/ztqqwsFgWQQazfMbaRefsZXy6U2stmUjpHDTo5xVmbGPb7xJBq hokBx/4qIwMXXVmXX20QcDCbhZBfDGpQO6yhPS7335EHiQapUGQn3B7RIxV4TzUjOT1F wltWYBj8DMYM5RmcGCNTFyoo1b7A1BQVRhXRmAeOfc1XIpyBl9NuYRjS2GwzbhxNHMLg 0Ypg8SdaWvD0vQnfVlq5oxHHEroMmofTTAsbTmvHT09j7K9sIt5hV1YwMOkXDBUndhFg 5uJw== 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 k14si1241654pgh.437.2019.05.03.00.04.53; Fri, 03 May 2019 00:05:08 -0700 (PDT) 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 S1726486AbfECHCJ (ORCPT + 99 others); Fri, 3 May 2019 03:02:09 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:35142 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbfECHCI (ORCPT ); Fri, 3 May 2019 03:02:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id z26so4373960ljj.2; Thu, 02 May 2019 23:59:11 -0700 (PDT) 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:in-reply-to:user-agent; bh=Iqk3xergUOsKAugJuc5t6KOxZcaZnh5miw46WUEvyZ8=; b=d99CEB95BnT5kT6nYuwo4XUE9+LijDslkebppPl3zeWTrN7tRjObi/3iIb2XB9/knw njZIDnYYS2q4uQb/rGd+x1PQpS1WdjjLgufi8wNBbBW5o3cqyslT8bQGdy7zctj/3S7n ASILmFXb7rBiDNgUEQa7IZnaUjJSXMibotux51Vq4MmrimBDovr7ARBGv/KMb36RiAwa TR1kUWlSvhqiGO+ILc9TjR5mxfbeees/F8LY/55/EBSqwRuNUTrthlZfL9rYMml5oH96 lR1EBQRrtXYj8tcaYwZhtEQwHlsbjj8oPiF4waxO9IibriqctMlpWTezzNeDL2jKCXCV WE4A== X-Gm-Message-State: APjAAAVE0SBOK4ZbGKm26mitXjbGMgYsa0FOmwuYqYxegbcTbQ+qvbQ7 m+CkSpOpEEGlvvLDPSCg6AM= X-Received: by 2002:a2e:655a:: with SMTP id z87mr4194357ljb.150.1556866745836; Thu, 02 May 2019 23:59:05 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id u12sm227951ljk.89.2019.05.02.23.59.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 May 2019 23:59:04 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1hMSA9-0004aP-7Z; Fri, 03 May 2019 08:59:17 +0200 Date: Fri, 3 May 2019 08:59:17 +0200 From: Johan Hovold To: "Ji-Ze Hong (Peter Hong)" Cc: peter_hong@fintek.com.tw, johan@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Ji-Ze Hong (Peter Hong)" Subject: Re: [PATCH V9 4/4] USB: serial: f81232: implement break control Message-ID: <20190503065917.GA26546@localhost> References: <1556587352-19500-1-git-send-email-hpeter+linux_kernel@gmail.com> <1556587352-19500-4-git-send-email-hpeter+linux_kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556587352-19500-4-git-send-email-hpeter+linux_kernel@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 09:22:32AM +0800, Ji-Ze Hong (Peter Hong) wrote: > Implement Fintek F81232 break on/off with LCR register. > It's the same with 16550A LCR register layout. > > Signed-off-by: Ji-Ze Hong (Peter Hong) > --- > static void f81232_break_ctl(struct tty_struct *tty, int break_state) > { > - /* FIXME - Stubbed out for now */ > + struct usb_serial_port *port = tty->driver_data; > + struct f81232_private *priv = usb_get_serial_port_data(port); > + int status; > > - /* > - * break_state = -1 to turn on break, and 0 to turn off break > - * see drivers/char/tty_io.c to see it used. > - * last_set_data_urb_value NEVER has the break bit set in it. > - */ > + mutex_lock(&priv->lock); > + > + if (break_state) > + priv->shadow_lcr |= UART_LCR_SBC; > + else > + priv->shadow_lcr &= ~UART_LCR_SBC; > + > + status = f81232_set_register(port, LINE_CONTROL_REGISTER, > + priv->shadow_lcr); > + if (status) > + dev_err(&port->dev, "set break failed: %d\n", status); > + > + mutex_unlock(&priv->lock); > } > @@ -519,6 +530,7 @@ static int f81232_port_disable(struct usb_serial_port *port) > static void f81232_set_termios(struct tty_struct *tty, > struct usb_serial_port *port, struct ktermios *old_termios) > { > + struct f81232_private *priv = usb_get_serial_port_data(port); > u8 new_lcr = 0; > int status = 0; > speed_t baudrate; > @@ -572,11 +584,16 @@ static void f81232_set_termios(struct tty_struct *tty, > break; > } > > + mutex_lock(&priv->lock); > + > + new_lcr |= (priv->shadow_lcr & UART_LCR_SBC); > status = f81232_set_register(port, LINE_CONTROL_REGISTER, new_lcr); > if (status) { > dev_err(&port->dev, "%s failed to set LCR: %d\n", > __func__, status); > } > + > + mutex_unlock(&priv->lock); You forgot to update shadow_lcr here so the line settings would be corrupted (e.g set to 5 bit words) whenever a break is signalled. Did you not test this version of the patch? I added the missing update, but please test the code that's in my usb-next branch in a minute and confirm everything works as expected. All four patches now applied. Thanks, Johan