From patchwork Fri Feb 3 14:50:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Starke" X-Patchwork-Id: 52546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp883112wrn; Fri, 3 Feb 2023 06:58:29 -0800 (PST) X-Google-Smtp-Source: AK7set9dSCenyfANrW/D26ujG2j5J8ZR9Wubh5Xz9GgoytiF26PWqXqT8cRrrL7dod9UkCbNXT6n X-Received: by 2002:a17:903:1110:b0:196:2124:c590 with SMTP id n16-20020a170903111000b001962124c590mr5132157plh.33.1675436309414; Fri, 03 Feb 2023 06:58:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436309; cv=none; d=google.com; s=arc-20160816; b=yWGX69DHfW5wa72rE+hxI8yCbuWFmHImYha9dSvuqFf5wY6zid7pwZ6QSCVZoKi+7b zIfriNZqSMHncNK7x9IaREaSkPIi6kcy7pqc8R54WPL4p1+275+2cWYJ4OQWr3iKu92M eTdmE+F68B22bo2nRoSTMob2I8tL3yhNx5AQL8fYF72TeyIRaJpwvaZO9BKjab2h5yuB jbGpxDz90QYAR3RRIih726+BoLEMlgDe1PEwdXLWhb2sy5MIHW62e1Noma4i1DBco6Io aDoCWVvLnr5kw+g/M1LysB+ziaH1P/R5PY+Pk39WZLgC7pUiOAl/nOe4uO9AMrLME66u BI6g== 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=+nOvG2X3HLgF03w2fTPt3ooPfqHvAZ6ZsfqKleubf/o=; b=ZGEss1I0D8VPCt5HICeDfQNiKMLR94VnvxKdDxVpA6v7noN9XzNwjF0N6tz6a78915 CatTO3Awu6z9uU4pQZMKV91yHXFwj4Th7fHZdZs6HW6AvZV4PKNsS6xbfZFWqEctkr8M gCZuaQtWGqza8dNLVC8mi0okkMaWdL1Fd3GJhMCEzrUzqvFP4fw+fVRZ7FYbOkSgvK65 NbjX1w3kysNCLR2SEprRpfypKbC2SIr17R50zCrNmld8znLfVuPjOTOfVDez3DyFzgOy V/f55kH4I+Nm7ccGOfWUoRRvKm3j9UoegF+E/FJQI1K+axivUdq6rqYTTfPsj8Bj2aPq opZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@siemens.com header.s=fm1 header.b=MSAb0Qsd; 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 y21-20020a1709027c9500b001933989d4f8si2280264pll.344.2023.02.03.06.58.16; Fri, 03 Feb 2023 06:58:29 -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=MSAb0Qsd; 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 S232959AbjBCOut (ORCPT + 99 others); Fri, 3 Feb 2023 09:50:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232611AbjBCOur (ORCPT ); Fri, 3 Feb 2023 09:50:47 -0500 Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DCC68F249 for ; Fri, 3 Feb 2023 06:50:44 -0800 (PST) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 20230203145042fe7659cbb89a805056 for ; Fri, 03 Feb 2023 15:50:43 +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=+nOvG2X3HLgF03w2fTPt3ooPfqHvAZ6ZsfqKleubf/o=; b=MSAb0QsdUJ/AWk9AaXt1zcoinF/++j29BUvdzRbtjI4GwNUBVaMDiNC1vBi1tNZuwvxgtH IqHAkhUURQjKAPPXif0ppEThsEQRbOfgUPadng0EwKW/sod2Jt+/PAkv5W7kFVndmfXoP44F 9hnGufJ2qIhBof5tihYoIIkLSUBNY=; 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 v3 3/4] tty: n_gsm: add RING/CD control support Date: Fri, 3 Feb 2023 15:50:22 +0100 Message-Id: <20230203145023.6012-3-daniel.starke@siemens.com> In-Reply-To: <20230203145023.6012-1-daniel.starke@siemens.com> References: <20230203145023.6012-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?1756822303235173576?= X-GMAIL-MSGID: =?utf-8?q?1756822303235173576?= 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(+) v2 -> v3: 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; }