From patchwork Thu Feb 2 14:59:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 51983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp290097wrn; Thu, 2 Feb 2023 07:05:16 -0800 (PST) X-Google-Smtp-Source: AK7set8fY49YhDvteShq1od3NgochyjFnLZxf90ufCatI4qRbVMBH6r6o+2hVwMgQO52vo7YX5ZT X-Received: by 2002:a17:906:c5a:b0:88e:e926:8bb1 with SMTP id t26-20020a1709060c5a00b0088ee9268bb1mr1703540ejf.76.1675350316333; Thu, 02 Feb 2023 07:05:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675350316; cv=none; d=google.com; s=arc-20160816; b=VExy8MnZELafpZJobqcHNBz//1qdzv3rrvTRpE+rfQIirf8ylJZtMpszgk84cC1Y/o Hn6FgVydAKJeq2LPtRftjXgiWevXp3ykXATi/Tmix2fyCl/9Rn8wmqu9ZtlRdtgdKoSv jb1rSWaMzSYOoKBYesvODqfRSTJuW91/ZaPWjan1A65+3NUmwr67APXiM396PFJEaFNu gm4HFKVI254o8a9MAWmgjw3ZePbe+9odmOxaPigBdySxedwoCPgTlfReyQhfjy5Vjijf HIOzUuQ9pvO6NMG4kCSvVAe0NcjAGpNyQGkUUioOGFKgTe8XQjJ9m/5kTrKtzGacNYb8 x0NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CGxEhyAoxwEddJ0xl4OF2ojfXEmQZFbiyIt4XcYZYMI=; b=mlAtiFL9DY7hPgLoLq7qCOk8gcCK5DZF3+ZggKt4ejF+SynJXuNJP2JejZKANbf5Qy 2Y9lMoRzGA5wjgDvmFIsTwxZMg86P1FpC53q9DyjMbarz0o7DULS0z8CAWMh58FEQjal 0PRx0VjbG1RZzDymbvu49BFurAKj1BrNM0TX+/QYSmsFvtrLrzU5bTaSrkLCsSkUYBRy 4LX7XSzrCycbeHzUBd/xAYzGZUKyU6BBBjjhAPxAo6HrQScxzWvSERS6H+DRge5Ngaz1 BPUfxLkd33g+MMPdMzCqbRrMU1vsbrQg0ia+iUaDVoqzthQ3+DKUjIcEFKGjjZzjCXs+ pQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=oFm7tsEb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ew24-20020a170907951800b0088c377392acsi9305324ejc.466.2023.02.02.07.04.51; Thu, 02 Feb 2023 07:05:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=oFm7tsEb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231835AbjBBPBB (ORCPT + 99 others); Thu, 2 Feb 2023 10:01:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbjBBPA4 (ORCPT ); Thu, 2 Feb 2023 10:00:56 -0500 Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CAF61E28E for ; Thu, 2 Feb 2023 07:00:54 -0800 (PST) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20230202150051f2b4f0df1809a26236 for ; Thu, 02 Feb 2023 16:00:52 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=daniel.starke@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=CGxEhyAoxwEddJ0xl4OF2ojfXEmQZFbiyIt4XcYZYMI=; b=oFm7tsEbzNjln8ACwbYSnM8fp5u8CRuWKKLUxzh4QBJSiSe2NXcTPMrOAYNrMOFzYSSOXe sUVP86thOq5sefEzlqiL2VWEeT2g6n9SZXzRotnTvT5jn43+U3w7lzz0bJf9HwLO/k8Kj6pG /quUsM1DNz0abYmXxhdJlbTsB3LBU=; From: "D. Starke" To: linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, ilpo.jarvinen@linux.intel.com Cc: linux-kernel@vger.kernel.org, Daniel Starke Subject: [PATCH v2 2/3] tty: n_gsm: add RING/CD control support Date: Thu, 2 Feb 2023 15:59:33 +0100 Message-Id: <20230202145934.22641-2-daniel.starke@siemens.com> In-Reply-To: <20230202145934.22641-1-daniel.starke@siemens.com> References: <20230202145934.22641-1-daniel.starke@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-314044:519-21489:flowmailer X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756732133350836148?= X-GMAIL-MSGID: =?utf-8?q?1756732133350836148?= From: Daniel Starke The status lines ring and carrier detect are used by the modem to signal incoming calls (RING) or an established connection (CD). This is implemented as physical lines on a standard RS232 connection. However, the muxer protocol encodes these status lines as modem bits IC and DV. These incoming lines are masked by tty driver (see tty_io.c) and cannot be set by a user application. Allow setting RING via TIOCM_OUT1 and CD via TIOCM_OUT2 to allow implementation of a modem or modem emulator. Signed-off-by: Daniel Starke --- drivers/tty/n_gsm.c | 5 +++++ 1 file changed, 5 insertions(+) v1 -> v2: No changes. diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index d068df1cf2fd..cf1ab7d619d9 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -546,6 +546,11 @@ static u8 gsm_encode_modem(const struct gsm_dlci *dlci) modembits |= MDM_IC; if (dlci->modem_tx & TIOCM_CD || dlci->gsm->initiator) modembits |= MDM_DV; + /* special mappings for passive side to operate as UE */ + if (dlci->modem_tx & TIOCM_OUT1) + modembits |= MDM_IC; + if (dlci->modem_tx & TIOCM_OUT2) + modembits |= MDM_DV; return modembits; }