From patchwork Wed Feb 1 08:01:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 51218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp145222wrn; Wed, 1 Feb 2023 00:09:00 -0800 (PST) X-Google-Smtp-Source: AK7set+LEwoTuqhxCiUe+vpQAtCOEdsrDqZ9T37WhQw6MQZB2zfQ7oQReUuYAkFmz6+XKo749+rE X-Received: by 2002:a05:6a20:8b9e:b0:b8:bc13:c838 with SMTP id m30-20020a056a208b9e00b000b8bc13c838mr1451516pzh.53.1675238940582; Wed, 01 Feb 2023 00:09:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675238940; cv=none; d=google.com; s=arc-20160816; b=0A4G2ZvVqSQCst2AvxpxUcE8B+wwb/Wc2w9X7AGMNfxayoGl2H7dMyGo0IJqAq+O4R 8uf1Fpu4RMQWAt6jOywQdwOKoUS77Vyc8fWYD1+iGMLDiIFkpQV4qf1MrXjz1y8Ctti8 CgsIiMO6ud8dmj7VmpN7EPUEqdjEiBP2litE9JfkPLIXwX+z8W34XtznesH8w0IkpDmb j7NRARQLLT7zMM0rGHmFIs0PZu+kXMXGkPSxnc4rkkxm8lryKZvaeBnz7WzIKvAb0W9A dVTWpsPI4F3shZlmuwz6s2yYI/0efsz4n5J3Sz3KoAr1QxuCT1x2nBsWfoCMSU8pM/sq F3kQ== 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=elcIhDVoOIB5QTRWadNTq7kGuOttosLIVV3EInhEIOg=; b=CYs70aSzBokYlCd29JOt9W0s1njOOugjEIOrTAb7IlUQ648lgoSfNMSo9JBr+oFdmU YeD40gy7a1w9RDZo6U3C0XJnm0VdIEpQhfr3xc5U9+ARBB/lvh1KDv+YMGDOfQJUT0Wr SZuolxjzjX7ZhUuFrDTmMYqfsz9yVFtQVDiXIB0/1Vcq2f5yYxwnbjY8J0Jkzt+hxxAd z0c/KQBfpeevHeleaXBR1ARdp61QDZwIp70STaPoduPgWpWQk5X0RKfSS7Kcippppig/ YdHhSsPjTd3jv2GxJ2AuI5zWr5cDilXwz/SA+Ou0WOUB5y7JM2KqjHQ/RDzTZtnyexed S5rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=QJe70xUc; 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 m18-20020a637112000000b004df4af6841asi17459801pgc.84.2023.02.01.00.08.48; Wed, 01 Feb 2023 00:09:00 -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=QJe70xUc; 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 S231252AbjBAIDR (ORCPT + 99 others); Wed, 1 Feb 2023 03:03:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230255AbjBAIDL (ORCPT ); Wed, 1 Feb 2023 03:03:11 -0500 Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC9E6A5CA for ; Wed, 1 Feb 2023 00:03:06 -0800 (PST) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20230201080303835fe8e237f386372a for ; Wed, 01 Feb 2023 09:03:03 +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=elcIhDVoOIB5QTRWadNTq7kGuOttosLIVV3EInhEIOg=; b=QJe70xUcaVZtN3xPn+QwR2XYEcGRuSBwTC2ObW7olOzpwnfJc5IaGj+3/eQmFMfHqcztxI 0FdkTBkwL9U5auLn8njpo0dqTsVOYZRs1JH6V0wchnd0LvBi3uAR13SH4h1LbdK91tTkF70R wcdijkWIqqQawVw0xlj6s9rf07foM=; 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 2/3] tty: n_gsm: add RING/CD control support Date: Wed, 1 Feb 2023 09:01:50 +0100 Message-Id: <20230201080151.2068-2-daniel.starke@siemens.com> In-Reply-To: <20230201080151.2068-1-daniel.starke@siemens.com> References: <20230201080151.2068-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=ham 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?1756615347190366751?= X-GMAIL-MSGID: =?utf-8?q?1756615347190366751?= 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(+) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 98577b54f1fd..118511c1fa37 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; }