From patchwork Wed Jun 1 08:24:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Selvaraj X-Patchwork-Id: 12866517 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D5C7C433F5 for ; Wed, 1 Jun 2022 08:24:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C988910E5C7; Wed, 1 Jun 2022 08:24:52 +0000 (UTC) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2076.outbound.protection.outlook.com [40.92.21.76]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFA6210E815 for ; Wed, 1 Jun 2022 08:24:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aWvv8Ksh4B4xVg6/rw14isyQHdroTdnnY/bMlHHi1SG+4UPgp1Y2Q489DCTtvEyyG6H7EZ2yua1TVMUhZ3fFXn0AR8/MPcvK+pUdIWVW1oxHXIRo3J+R6A/DleXHGcTnGTEQUEqDziRzoFwsJi8tg/l1J9p/VoEt2nHPaJvFkPssMq1Elzaao4d5EYtHQj2xUZU20Tcc1iEzueF8a8wCD7fhoYk+TVMJBLGKpYFoD3QkV76q+13s5vxHqRI4pm2j13qTdG39AMmHFfRVc7/AdaWyiZbvHqMr+P145qOhMwZqp3PGEdZbJW5fuSxPkZMsKugzFHS9cRUfKMy9ejVN3w== 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=01teW4+XM3jsguNCT3YB4liWxhJyorjF+Fi212cpK3M=; b=G/gioaPbL5nOBpNFI/QeleE0wyUp5e+ATzZeTGBGv4mETt92lLSrzPlgCeH8s08EhVAJ1VTohpAimzXe+PXZnzAMuxHf/XItI02iI4BwSNFjqlKLSZmpfIx0AN/Gv1MuS5Y52EuJr4/QlMcBoAbHgo65YbwFFwx476lrJNdDW1vhfifAmCRu4IJR0mLZA92yxkYdP9VSZiEfJUSJ2KSsCBtB3o7rC0TwifVKd4yO7G+ZbWY+5Ey7eBtby5C5mcWUizNFrupxve0leNml1V5vGeqR4Y+ZTpzK+1erJnXmCZH3EVTY4X+dE+RZoYemUPPaqS1W+K0aecc6lDaNGTa7Mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from BY5PR02MB7009.namprd02.prod.outlook.com (2603:10b6:a03:236::13) by DM6PR02MB5708.namprd02.prod.outlook.com (2603:10b6:5:7c::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.15; Wed, 1 Jun 2022 08:24:50 +0000 Received: from BY5PR02MB7009.namprd02.prod.outlook.com ([fe80::e179:40c4:4269:70e]) by BY5PR02MB7009.namprd02.prod.outlook.com ([fe80::e179:40c4:4269:70e%5]) with mapi id 15.20.5314.013; Wed, 1 Jun 2022 08:24:50 +0000 From: Joel Selvaraj To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Stanislav Jakubek , Shawn Guo , Krzysztof Kozlowski , Corentin Labbe , Linus Walleij , Hao Fang Subject: [PATCH v4 3/4] drm/mipi-dsi: Introduce mipi_dsi_dcs_write_seq macro Date: Wed, 1 Jun 2022 13:54:09 +0530 Message-ID: X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220601082410.55266-1-jo@jsfamily.in> References: <20220601082410.55266-1-jo@jsfamily.in> X-TMN: [Q0tBwNkyvEmGCV4nie/XLHXZIc5M2wiul8t1Wm1w/sayebWJbnx6qCUBq7XH0uXR] X-ClientProxiedBy: BM1P287CA0002.INDP287.PROD.OUTLOOK.COM (2603:1096:b00:40::13) To BY5PR02MB7009.namprd02.prod.outlook.com (2603:10b6:a03:236::13) X-Microsoft-Original-Message-ID: <20220601082410.55266-4-jo@jsfamily.in> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07683d07-c797-4476-48a7-08da43a83229 X-MS-TrafficTypeDiagnostic: DM6PR02MB5708:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0sJ7oqr9GGFAG5xc2E+A5nsGGbrjjQ5EZ1WXReVgre5DbY5Vm/JB1QIacOv6kBqNsmFzjBQczhDeabDlO+iuh0BiUNthZmvz5q8fOqbesb7Vfjmk9zCf+r0jH3urH2YkDPTnHnhF8aX7f4D/Q2xgIGQHo34fIkXLQKYxQOtRSvks5yTYRQqBtWPRol7IOOnyqfC40vpGHvJWJnO1KI86ik5Xw9YI+k/NHKqZ9sXfbKYUNwY0aD9KBWDFFi2dpqSTiqE/nYH2OoSbjtWiTVbGLp5cz/6W+1opQwZRgvxgX5MgtUbbpELdVtNYZPRXG5I8wRXE295VXNsAlNniJ51r31FTgkYrckUF5U5G1WmZGn32LtD56qRrKqp0T5gPjyqjp2vCE/r24bmYuuZT1o5GbkzBP2RtwaBXwcojGhGVaaJkP7ID3N2b94y2QdSkEY6ChmDOYuFSTCIAtkDRwiMyoGB7bKR3d9nvq+bsAyniOJkAmmEIAocnHAyrHx4IMfuyZPtuyCRzitFQ5Kbu/y3ZcA8XclqEZaKpOK01HRmsaS7Pt1Jf79dCGOC+5YDTndAaU2J3kFNKFX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s3YyyyqTqUNdAmnFIQHRURii+LIHLALDLlgdPEoJrPe0+SjplWpMIFC/fr8tDxwzhRdov7Up0mPN29Z3//8WEsZ2qEwtAD8WtvOgaIO8GQTC7YoVIvF2ka8UJx9VwmP945s7j/jvUTKp5vzo4nDuPCGJ8lKw6ozDCqj2EVQHPDqZw6bWojiBT079k0pT/55mw/YOs+i9Ol1ShxK4SNshNOV7gAIgu2ceNTNNB/eETvFgHqOIMLCMDzUMCQWekZDx7sQn0gdGquCl79mzYZNdAdlnQ1JZg1DHOqre6ECTDP/ai6Vwfkaqe2xfwVFxqRNhYIIkgm80d28Oj9WLH/uMrjY6DWnCnkVdtcuORlqV0k6o1sImYpSv8or8eTxRnc/lqD9j8gt4Raszblyf8Z/15OZXKKRMBWrAhRokG1iQ3y7a+e48DygxlUhThg4tQSw9uKO4rbe7kldYk2bWqeTtJftQVoNE0+VbrD5/nJ3OunKg/ajWC7GEiaXTdlJEgj3R15Q== X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-99c3d.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 07683d07-c797-4476-48a7-08da43a83229 X-MS-Exchange-CrossTenant-AuthSource: BY5PR02MB7009.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2022 08:24:50.3354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB5708 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Joel Selvaraj Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" A helper macro that can be used to simplify sending DCS commands. It is useful in scenarios like panel initialization which can sometimes involve sending lot of DCS commands. Signed-off-by: Joel Selvaraj Reviewed-by: Linus Walleij --- Changes in v4: (Linus Walleij's Suggestion) - Introduce mipi_dsi_dcs_write_seq macro in include/drm/drm_mipi_dsi.h include/drm/drm_mipi_dsi.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index 147e51b6d241..4a5996901689 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -293,6 +293,23 @@ int mipi_dsi_dcs_set_display_brightness(struct mipi_dsi_device *dsi, int mipi_dsi_dcs_get_display_brightness(struct mipi_dsi_device *dsi, u16 *brightness); +/** + * mipi_dsi_dcs_write_seq - transmit a DCS command with payload + * @dsi: DSI peripheral device + * @cmd: Command + * @seq: buffer containing data to be transmitted + */ +#define mipi_dsi_dcs_write_seq(dsi, cmd, seq...) do { \ + static const u8 d[] = { cmd, seq }; \ + struct device *dev = &dsi->dev; \ + int ret; \ + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ + if (ret < 0) { \ + dev_err_ratelimited(dev, "sending command %#02x failed: %d\n", cmd, ret); \ + return ret; \ + } \ + } while (0) + /** * struct mipi_dsi_driver - DSI driver * @driver: device driver model driver