From patchwork Mon Jan 30 18:05:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neeraj Sanjay Kale X-Patchwork-Id: 13121548 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 B03CDC636D3 for ; Mon, 30 Jan 2023 18:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237797AbjA3SGd (ORCPT ); Mon, 30 Jan 2023 13:06:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235264AbjA3SGa (ORCPT ); Mon, 30 Jan 2023 13:06:30 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2045.outbound.protection.outlook.com [40.107.7.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E57273B67F; Mon, 30 Jan 2023 10:06:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NscesATc6vyIEvoUutmeWhWZz7IFxv1NvHUNVkXbZ7t4H+rsrIOrJerVORWeVo11yvsk7HNBjAmLA4h1LsbWFGT+PNaSgb3DCGvSTbDI5VrX7nJuoS8O039ZeUV0ab68LhHNyQO0T8AODRZe4JXYhrvl7v2Bq3a9kag0cM6GpvJoRhuZh+KllsjmqE6GvCGjpM6q1I331NcN0Zvv7X4mZ5KXHAc6/m5PYyOuDBk4C5Xy/fy+RghkmfBdItYwgS10CwcByt5H7OKWuKFKrWZthBToI34i09mLVg5hOaQyGeUkru29uPB8mNJUhjecBSe3XguoL887UXWI/BgE78avlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L5nbcOgcVSHPFCPJqOWAGZJRAJK2XDDhd63lyUiHUYo=; b=hAps4KwLcfWfqTllEaLGYNNUVk9rah9NDQb83QKW+RLBVGDh+qqA+v1IR5li6apsL7I38MK7FrCD91W/x+ADYI7uad2z15ecXlzdajHDojLfzJq2kwydHjXcmWIPMtLuxplz17li4dhM1wlD4HEK56Gakf/YZFfAA863yLW6TGjU3Pmj3u2h440QkIPo0fEuf+PrWskpxmyrXyh2nH1j867keRfhtSQFBYMQjeSbzjpsJ8Ygc2CH8kfKrdiwtQonpG4zHDTSEqH3uEjn5+ajgSxISQePBjFaKTz8wzXgfchhpUyT4WJS8oIWOG5nPcyuJJQIYPECYNapmsHg+d92oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=L5nbcOgcVSHPFCPJqOWAGZJRAJK2XDDhd63lyUiHUYo=; b=RtXnHnBam2onWF9z4FZGw0cWVWqnULAVUfB+wjL7ct2hqDLAJQyUMO06m54EYU+Yw8Sxr/GWqketyTZoBn984gdmtxpfEl7/QV9S+ANWyX90B1VrBa60Zh3oUdav5Ik1Urk4NatQW5Q/Go/RZ+1oqFIRcXvvDux0vKYXDasfhC8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) by DB8PR04MB7129.eurprd04.prod.outlook.com (2603:10a6:10:127::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.28; Mon, 30 Jan 2023 18:06:26 +0000 Received: from AM9PR04MB8603.eurprd04.prod.outlook.com ([fe80::f8fe:ab7c:ef5d:9189]) by AM9PR04MB8603.eurprd04.prod.outlook.com ([fe80::f8fe:ab7c:ef5d:9189%6]) with mapi id 15.20.6043.036; Mon, 30 Jan 2023 18:06:26 +0000 From: Neeraj Sanjay Kale To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, alok.a.tiwari@oracle.com, hdanton@sina.com, ilpo.jarvinen@linux.intel.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-serial@vger.kernel.org, amitkumar.karwar@nxp.com, rohit.fule@nxp.com, sherry.sun@nxp.com, neeraj.sanjaykale@nxp.com Subject: [PATCH v2 1/3] serdev: Add method to assert break Date: Mon, 30 Jan 2023 23:35:02 +0530 Message-Id: <20230130180504.2029440-2-neeraj.sanjaykale@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130180504.2029440-1-neeraj.sanjaykale@nxp.com> References: <20230130180504.2029440-1-neeraj.sanjaykale@nxp.com> X-ClientProxiedBy: SI2P153CA0008.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::19) To AM9PR04MB8603.eurprd04.prod.outlook.com (2603:10a6:20b:43a::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8603:EE_|DB8PR04MB7129:EE_ X-MS-Office365-Filtering-Correlation-Id: da1bf7a7-b97c-4347-a6bf-08db02ecb43b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mpsDxg/vhwIi/mOIaGZhgP+HxVzcR0SqbvmaYLmgooic6J5ORO5VbdSJlQ7iBrBXfBjJhaMzDGP5g97wJAB/mRFUx3Hgq0m249qK48EEGV7IQdNqmYkRAekzDI8TGK2zqvPW6wYSUQWSUqmmFeqj3hyOBuTMamA+LE8e4LylLa+/9bngE5Vt2UmK+A75f0cH9Q9tcFYgJz49pJ1gnnHXanLMF5YTNQsyMkxOdR9X8WUKYzDOJk64oEoq4JGtIqmEuuEOubZc3Gs/gtkukuHTi7LCAKTwtf0l9AzVgdPX4tgjipi5bJvykAOQrQhTfada68pzb4jm9wMjNl4wVoajfaukeuYJpbPcIiddQZIJjJPSLNEnBv3O1EDYBnDYDg4I0UPf69UqhWtiOEzXwURFCQEHVkd1N7p5+3gwMxFi2SSu53SSja82r4aVWgF7mSY6fDG3xWZJwcojRHRLp5+s+IfAwDNgcUMGMV+ad3tanO6KjYox9D+6TDKSOabbZPAzINX+9+KzlbpLRw7OhTfgKlNxZ7igeMzz5iqHygMQbdfQTwsF/2RktDiX6VMAKtIm8itQyWRO3mIBiknUqiBpazdj73vM4tbqr0HyZbqWmifQrmRp07I69eyejUzi7v03ulTMKsyqyO9rOJ2czQReQnELw5liBiV/OYK47ybz+A+EmRCNKsKxHq+SvO1HWhgQSlVffaPk91cDWZNamoH2yFKTiNfO6B4sUSxCJ6E6lyQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8603.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(4636009)(366004)(346002)(376002)(136003)(39860400002)(396003)(451199018)(186003)(6512007)(86362001)(26005)(6506007)(1076003)(921005)(38350700002)(38100700002)(2616005)(36756003)(316002)(6486002)(6666004)(8936002)(52116002)(41300700001)(478600001)(7416002)(5660300002)(2906002)(66556008)(8676002)(4326008)(66946007)(66476007);DIR:OUT;SFP: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XdyN0AdJhKnx71dSGH74AOom+dGnO1LgJR5bpDGz0dICDZzMxufwZ+UU0ZpRrrWxfGI9cHJmAjRuN2/cP+Som/YuQAjA9xZ60M9WGEmY4a0Bmc05Zxc5wKpxE41PBX3GVubLZjoUkgaaD2HzM5ONaWuGzzho5Jtfo17Cw/zqcDZO6fGjmnNNeFiGhBieqRSDd2FU0OUn13TUEJPOFyWh8kqNZAvtGL2riIB7aUoaI5SzXkWTJmSVO1SKxrSO65DMSrTt3DV7y1t3eZmBuz8VcAUmjPUNCiGdktgPIQi4qnWauvd3IXFjfdsVRmFfYh92uaoGSupvJMQ81xUXIPSbYRMKtBhssFMuGfcFA4A73mSDKaoeLTjOEMTYhRqFl5TybrcvK+doX02+ejQUPA5l9ZqcGle375vckI4lzWgl7s63xGm1u7gFGutM4Ub7IBk2qmCWkxXeU8BBn/1iTuLMqo5NfxNLKm0mUrtl+7wkFPwE3kKs4QZRmvJ5jYrWNAiqxxaDz+sc3o1R81NNTzmUHW9XzV/Q6wXLkFASAs6PNo1eQC6PZghPvQ9XXeTQ5gexN2ffmezmVjmqy6lMg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: da1bf7a7-b97c-4347-a6bf-08db02ecb43b X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8603.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2023 18:06:26.4589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RVGKqg6+ld5L1jJ/Z4oyXHGHDGPICztzU06Jp/LmJKMkUdn8QlggPong5ldnbxTU7EfWeaNNmZHd2ZnK5VP4PpWVO2DN76BEBRHEH2wSEIQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB7129 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Adds serdev_device_break_ctl() and an implementation for ttyport. Signed-off-by: Neeraj Sanjay Kale --- drivers/tty/serdev/core.c | 11 +++++++++++ drivers/tty/serdev/serdev-ttyport.c | 12 ++++++++++++ include/linux/serdev.h | 6 ++++++ 3 files changed, 29 insertions(+) diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c index 0180e1e4e75d..26321ad7e71d 100644 --- a/drivers/tty/serdev/core.c +++ b/drivers/tty/serdev/core.c @@ -405,6 +405,17 @@ int serdev_device_set_tiocm(struct serdev_device *serdev, int set, int clear) } EXPORT_SYMBOL_GPL(serdev_device_set_tiocm); +int serdev_device_break_ctl(struct serdev_device *serdev, int break_state) +{ + struct serdev_controller *ctrl = serdev->ctrl; + + if (!ctrl || !ctrl->ops->break_ctl) + return -ENOTSUPP; + + return ctrl->ops->break_ctl(ctrl, break_state); +} +EXPORT_SYMBOL_GPL(serdev_device_break_ctl); + static int serdev_drv_probe(struct device *dev) { const struct serdev_device_driver *sdrv = to_serdev_device_driver(dev->driver); diff --git a/drivers/tty/serdev/serdev-ttyport.c b/drivers/tty/serdev/serdev-ttyport.c index d367803e2044..847b1f71ab73 100644 --- a/drivers/tty/serdev/serdev-ttyport.c +++ b/drivers/tty/serdev/serdev-ttyport.c @@ -247,6 +247,17 @@ static int ttyport_set_tiocm(struct serdev_controller *ctrl, unsigned int set, u return tty->ops->tiocmset(tty, set, clear); } +static int ttyport_break_ctl(struct serdev_controller *ctrl, unsigned int break_state) +{ + struct serport *serport = serdev_controller_get_drvdata(ctrl); + struct tty_struct *tty = serport->tty; + + if (!tty->ops->break_ctl) + return -ENOTSUPP; + + return tty->ops->break_ctl(tty, break_state); +} + static const struct serdev_controller_ops ctrl_ops = { .write_buf = ttyport_write_buf, .write_flush = ttyport_write_flush, @@ -259,6 +270,7 @@ static const struct serdev_controller_ops ctrl_ops = { .wait_until_sent = ttyport_wait_until_sent, .get_tiocm = ttyport_get_tiocm, .set_tiocm = ttyport_set_tiocm, + .break_ctl = ttyport_break_ctl, }; struct device *serdev_tty_port_register(struct tty_port *port, diff --git a/include/linux/serdev.h b/include/linux/serdev.h index 66f624fc618c..01b5b8f308cb 100644 --- a/include/linux/serdev.h +++ b/include/linux/serdev.h @@ -92,6 +92,7 @@ struct serdev_controller_ops { void (*wait_until_sent)(struct serdev_controller *, long); int (*get_tiocm)(struct serdev_controller *); int (*set_tiocm)(struct serdev_controller *, unsigned int, unsigned int); + int (*break_ctl)(struct serdev_controller *, unsigned int); }; /** @@ -202,6 +203,7 @@ int serdev_device_write_buf(struct serdev_device *, const unsigned char *, size_ void serdev_device_wait_until_sent(struct serdev_device *, long); int serdev_device_get_tiocm(struct serdev_device *); int serdev_device_set_tiocm(struct serdev_device *, int, int); +int serdev_device_break_ctl(struct serdev_device *, int); void serdev_device_write_wakeup(struct serdev_device *); int serdev_device_write(struct serdev_device *, const unsigned char *, size_t, long); void serdev_device_write_flush(struct serdev_device *); @@ -255,6 +257,10 @@ static inline int serdev_device_set_tiocm(struct serdev_device *serdev, int set, { return -ENOTSUPP; } +static inline int serdev_device_break_ctl(struct serdev_device *serdev, int break_state) +{ + return -ENOTSUPP; +} static inline int serdev_device_write(struct serdev_device *sdev, const unsigned char *buf, size_t count, unsigned long timeout) {