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: 649610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FCF5C05027 for ; Wed, 1 Feb 2023 08:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229770AbjBAIDN (ORCPT ); Wed, 1 Feb 2023 03:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbjBAIDL (ORCPT ); Wed, 1 Feb 2023 03:03:11 -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 9636D7ECD for ; Wed, 1 Feb 2023 00:03:05 -0800 (PST) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20230201080303aab45c580edeccd61a 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 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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; }