Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3279450iob; Mon, 16 May 2022 18:00:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRsTUPVKlbT80IfT/QcnzGzOuUi1W5grV+I0Gai6e5KpFXfLB21HyJJtIh+2lkHqTsrr7k X-Received: by 2002:a17:90b:17d0:b0:1dc:ddce:9c25 with SMTP id me16-20020a17090b17d000b001dcddce9c25mr33476094pjb.232.1652749209878; Mon, 16 May 2022 18:00:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1652749209; cv=pass; d=google.com; s=arc-20160816; b=AUlrB3s5933wLV65QxlfLjIi3Nu6Y4EJR59/1M+qbtdPKykuOooWEy9+o4Xm+HBb30 ULNDDketzgZyKGtU9Km1O5zrKWDJS50qXBTzS6rCiDOTzoSXover19Ns4zynQoreAILS Fo6wM2W0eDiYcB9Fqssbc2bZTMV1+8sXAJKZdzwAuC6qev2t9Vx8T7ZuA8IiNaM6Y0OQ 7w/ccetej7lQHLjY4b1DrXV/kPQKGG6TArRD8bNSL0peBI9FjlHS+Z2X/n5SULAQLOyV xyPRSycEzth94gMIPnBCLgO3rhoJPIqyBPH31LfqQmAcL9eqYiH4H1WNPLuJqv8hDcbR 2nlA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id; bh=bwDy906R8zFoWuOG3vh+sGkKJlZnX4rJHAAS+PoV7c4=; b=H93RLbs40IjbqgIxsgTZMZomD+pz932WNRtGvO9vSJ0lPk/FMvk2qvgHoXpTF8LfZh bUVMU6+4OJjA9S6F6zGthODGTNESLMOyWfM9Sby4yGogHrboXGnPEmjYKF87RZeJeSab ufka7P90e0igm6GpayS7HALanyHsX+2muT6JG1cEhieGFMecIWipCHSl2bA2hZBSqUpn Z2BdbNs5G2gFbCll2PcezLxgaiL+bNMURlFxBtPZkVWrCXUu6u95nzZKc1kDOmmbg+sq cLqoBYM6LBeAEJs8MpTBf0Z+6/DAd37dQdyJKnF61MiTBOEosZytgfe/Gn5otg2Q+Y2p a+lw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); 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=fail (p=NONE sp=NONE dis=NONE) header.from=jsfamily.in Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a637551000000b003db5e25c8b2si14401022pgn.101.2022.05.16.17.59.57; Mon, 16 May 2022 18:00:09 -0700 (PDT) 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; arc=pass (i=1); 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=fail (p=NONE sp=NONE dis=NONE) header.from=jsfamily.in Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235327AbiEPM47 (ORCPT + 99 others); Mon, 16 May 2022 08:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243670AbiEPM4z (ORCPT ); Mon, 16 May 2022 08:56:55 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2051.outbound.protection.outlook.com [40.92.19.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A91E393E0; Mon, 16 May 2022 05:56:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DpvUdK5t7jV0TAjNjV0ajcz78lVM4cSZOPmXJWAqXECe31keC5x8vlxXxH/GFLDKvSgroEjwCU6k4PNttcWW8yjZkGlOZuMPbGgM/L2H39Y3fv7bwV+cEB5CJH2UCWPcCxdF1jm218ODZXfyaf5P0+CMNq0cGrXG2ALPcEl18/AMb5H1AG37CoAevx6hLQIvRxCJEBDJ3QueMYHWo/uBdN2kQcjvQQ5r/2AgkLt6kY8V19IFkT8EJPN+9zj5igIpMDO6t0+NEC4PuzJ2AwAOIBuUWuIIT7X7D/XHVh9veZHa7TQFegmGbRc9Dnwnw77znYwfW1y+oGvmkYTqQxMzYA== 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=bwDy906R8zFoWuOG3vh+sGkKJlZnX4rJHAAS+PoV7c4=; b=YMjdmycHJjx6JmnW3U09oM7rhS4xKIlNg5IsQcqmUv8Ugy7MR44XIjntftqWERZVeqF4EJfq65DgXTAfu7R1kGvpPp9ofnMh6Xx54HTsnzN2kgt99jHtusxeO/1kpVFxv2Io0VN2hfcg8dptOferg0JVKhnp29mLkBlqca/dSfE2cxZ02hdzaI2SelBRpdN8wIxePTXRITOSa7jURjU8q51jypPFp70HYcyng/Yu796KwS3CCpKQp01Kjd8vIzZuoyNk3uyo8Yj8O8EgIPJXkHyEwKYbB5TkPO/kHsYyQ3SYdtt8m/PvSS2Stl8exTvi3ekSwkMrNNsRW7SeCaatfw== 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 PH7PR02MB9052.namprd02.prod.outlook.com (2603:10b6:510:1f0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5250.18; Mon, 16 May 2022 12:56:51 +0000 Received: from BY5PR02MB7009.namprd02.prod.outlook.com ([fe80::303a:ab1:17c1:2d16]) by BY5PR02MB7009.namprd02.prod.outlook.com ([fe80::303a:ab1:17c1:2d16%8]) with mapi id 15.20.5250.018; Mon, 16 May 2022 12:56:51 +0000 Message-ID: Date: Mon, 16 May 2022 18:26:38 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH 3/3] drm/panel: introduce ebbg,ft8719 panel Content-Language: en-US To: Linus Walleij Cc: devicetree@vger.kernel.org, Hao Fang , David Airlie , Shawn Guo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Oleksij Rempel , Rob Herring , Thierry Reding , Corentin Labbe , phone-devel@vger.kernel.org, Sam Ravnborg , Stanislav Jakubek , ~postmarketos/upstreaming@lists.sr.ht References: From: Joel Selvaraj In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TMN: [n0i7MlgpymcXPupIYSrhvR27AjFasYamlhtX6qAZWi8XJ16Ga33WNNPGOF6yY5m/] X-ClientProxiedBy: PN3PR01CA0007.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:95::13) To BY5PR02MB7009.namprd02.prod.outlook.com (2603:10b6:a03:236::13) X-Microsoft-Original-Message-ID: <9cbbca03-dfeb-d456-651e-67394c2762e8@jsfamily.in> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f5e4ad5-5b6a-4023-e7b0-08da373b8b61 X-MS-TrafficTypeDiagnostic: PH7PR02MB9052:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oSprm4vWHu9udrfCx+e8EI+ZrMSKCLuab2aYtCXfTqTgfOYLAsgOedC7MqVjOabikcVWvOtg8gZxwjdIXLu2hNGcCZCHWsHqJ1Zpiksi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planNSMmxaRDdSbmkvenJ1S0Z2VlB0T1d3N1VWb0k5?= =?utf-8?B?Vno4T1hqOXFoYndUaVhZTVFGanZhaUFtNFJUQS8rai9EQ0F1Mmt3Y0VqOXhC?= =?utf-8?B?RE8wQU44bE4rZW8xNy8rcW5Bb1hPeUw1ZEMra2RvK1I0NXJDQk5mNVd2TE5U?= =?utf-8?B?Y3JvNU4weUhvcFdrRGcvL0pCd1pia3ExQllSWGh4NUdncHNHRzVNYTIxM0Zl?= =?utf-8?B?TktYNjV1MTFSSzFEdGpLY3U4UytpbzhHVzV3dDJDRlZ3R2pLamprWGI2VXo1?= =?utf-8?B?ZktJNzczNlBIMXFUeFZ2YzgvbVlUdU9xZDJxRVNXZW9aL2pKZzJLemZySWRY?= =?utf-8?B?anNsdE1QT3dmcWFUazgyc3BqdHFwNll4OEpPdWxuMG1UMGJMak5lb2dwTXFF?= =?utf-8?B?TXdNK2NHemlJdG8wVDF0aU9MM0UvYzVVWTk1STVBMXBCTGZGOWwzQmNmQTNy?= =?utf-8?B?dVNKRnRvQ1pMb0ZoSGxFMzg5MUkzZVRGSnJYVTJNRjJUMEhpT3U1MGVLbVhr?= =?utf-8?B?ZnRrQmhleVhDK1IwaWpmMnZaaTE4R3AxRzFGbnRPK010anZWYmI0ZVk1YWhI?= =?utf-8?B?M0xuRUpJRU5oY2orVTBySWZieDhjT1hOalhVb1FSeUwxY3hHWWVpb1BOelZW?= =?utf-8?B?Y3ZhNDZueDY1d2RiWlkrZGVxM281ZnhsVVVYVEFkSVM4Y2lhakdEZ09kQ0hm?= =?utf-8?B?eXY3alY1UGVBPT0=?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-99c3d.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 4f5e4ad5-5b6a-4023-e7b0-08da373b8b61 X-MS-Exchange-CrossTenant-AuthSource: BY5PR02MB7009.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2022 12:56:51.3018 (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: PH7PR02MB9052 X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Linus Walleij, On 13/05/22 03:21, Linus Walleij wrote: > On Fri, May 6, 2022 at 2:18 PM Joel Selvaraj wrote: >> +#define dsi_dcs_write_seq(dsi, seq...) do { \ >> + static const u8 d[] = { seq }; \ >> + int ret; \ >> + ret = mipi_dsi_dcs_write_buffer(dsi, d, ARRAY_SIZE(d)); \ >> + if (ret < 0) \ >> + return ret; \ >> + } while (0) > > First I don't see what the do {} while (0) buys you, just use > a basic block {}. The do {} while (0) in macro ensures there is a semicolon when it's used. With normal blocking, it would have issues with if conditions? I read about them here: https://stackoverflow.com/a/2381339 > Second look at mipi_dbi_command() in include/drm/drm_mipi_dbi.h > this is very similar. Does the ({..}) style blocking used in mipi_dbi_command help workaround the semicolon issue I mentioned above? > So this utility macro should be in a generic file such as > include/drm/drm_mipi_dsi.h. (Can be added in a separate > patch.) I agree. Could be done in another patch. > Third I think you need only one macro (see below). > >> +static int ebbg_ft8719_on(struct ebbg_ft8719 *ctx) >> +{ >> + struct mipi_dsi_device *dsi = ctx->dsi; >> + struct device *dev = &dsi->dev; >> + int ret; >> + >> + dsi->mode_flags |= MIPI_DSI_MODE_LPM; >> + >> + dsi_dcs_write_seq(dsi, 0x00, 0x00); >> + dsi_generic_write_seq(dsi, 0xff, 0x87, 0x19, 0x01); > > It's dubious that you always have dsi_dcs_write_seq() > followed by dsi_generic_write_seq(). > > That means mipi_dsi_generic_write() followed by > mipi_dsi_dcs_write_buffer(). But if you look at these > commands in drivers/gpu/drm/drm_mipi_dsi.c > you see that they do the same thing! They almost do the same thing except for the msg.type values? Mostly the msg.type value is used to just check whether it's a long or short write in the msm dsi_host code. However, in mipi_dsi_create_packet function, the msg->type value is used to calculate packet->header[0] as follows: packet->header[0] = ((msg->channel & 0x3) << 6) | (msg->type & 0x3f); Wouldn't the difference between the mipi_dsi_dcs_write_buffer's and mipi_dsi_generic_write's msg.type values cause issue here? I tried using mipi_dsi_dcs_write_buffer for all commands and the panel worked fine, but I am not sure if it's correct to do so? > Lots of magic numbers. You don't have a datasheet do you? > So you could #define some of the magic? Unfortunately, I don't have a datasheet and the power on sequence is taken from downstream android dts. It works pretty well though. So I don't think I can #define any of these magic. > Doesn't it work to combine them into one call for each > pair? >> + dsi_dcs_write_seq(dsi, 0x00, 0x80); >> + dsi_generic_write_seq(dsi, 0xff, 0x87, 0x19); By using a macro? We can... but I am not sure what (0x00, 0x80), (0x00, 0xa0),etc type of commands signify without the datasheet, so I am not sure what to name them in the macro and make any sensible meaning out of it. > >> + if (ctx->prepared) >> + return 0; > (...) >> + ctx->prepared = true; >> + return 0; > (...) >> + if (!ctx->prepared) >> + return 0; > (...) >> + ctx->prepared = false; >> + return 0; > > Drop this state variable it is a reimplementation of something > that the core will track for you. ok. Will drop them in the next version. > The rest looks nice! Thanks for your review! > Yours, > Linus Walleij Best Regards, Joel Selvaraj