From patchwork Thu Jul 27 21:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alain Volmat X-Patchwork-Id: 127239 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp63089vqg; Thu, 27 Jul 2023 16:09:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlGifoG8PG/cKPM0UUKLlRen46uoqDDk72bhwH83nn5iIfrf4+Sb5VEdA8YdhEStDR6dOPEL X-Received: by 2002:a17:90a:2847:b0:268:1489:959e with SMTP id p7-20020a17090a284700b002681489959emr586537pjf.33.1690499344232; Thu, 27 Jul 2023 16:09:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690499344; cv=none; d=google.com; s=arc-20160816; b=sR4gyex/WoXHc6f26Dg27g3JhYQo6jbEqqBUOnu8Ra7cJ3LVt2Bu6DGINyjvlUVo1N ZIs+eec8th86Pdl8RKDeFQTkb/U7LNKyhkr9de2IX+OYMEZphYFvkrh/OwhU0N+sNe/P EOB2U9IcZUr/hkVVoZTvzlVq6+yBVwe59cG5MWVfzo+wTnmjW+GstiIsRsHCdolqZN6B YGBjlzNFGMQGHg3CWBLTXdzk6bQxtCroY5GPvIuJTjFtgFY4FJFIs6vMxZ0Xm6mQQxU0 t0h4IZ2uyAeLegE/toH63gAGo9pf1745vEdcTlbNddvKitNDjBrYjVSZSQPPwXXgEHf6 tEFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XpyNIdF2uhZAhQUKpx12L3Gpl72rWCRfsfzIB7HNnLk=; fh=YlaQJ3TP8tbT2RGJU1jM+MHAbXw6RYFhYgmjWx/ZxUI=; b=iXvSaiTk9n1PRiglbo7RvFtdE89stCgFUDhNefv0DMxJmuGUwa/kcI5JLp42hHAboO J/PI0E+wjOPyutypS6L4+I8+u0C8BDeSpdwJz0qMoVMZRGHnkXORhB8HKcexCDgiiu20 j2EOFLTlkHNzIhFLGFOxV+MLgKSUFVokt9GPgmzB557iD/phFqIKSbIv/mFORZej4UJH I4jbpB0NZxSNwVj4ugOfvsaQ6+m3fw/KiGqeOSKD3B1YZPhwkFQ4j5LcVTzoKFpSFaJs D74cGJzW9P7LJPfqA58KDVZbMtJiQKN53gXZAMofr++a1Ulq+EOPSzvGHTeZIDpSQTSj 8s6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=IJgqXLWr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b00563e904db63si1879020pgk.137.2023.07.27.16.08.50; Thu, 27 Jul 2023 16:09:04 -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; dkim=pass header.i=@me.com header.s=1a1hai header.b=IJgqXLWr; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232404AbjG0VxG (ORCPT + 99 others); Thu, 27 Jul 2023 17:53:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232528AbjG0Vwn (ORCPT ); Thu, 27 Jul 2023 17:52:43 -0400 Received: from qs51p00im-qukt01072301.me.com (qs51p00im-qukt01072301.me.com [17.57.155.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90A6C3A80 for ; Thu, 27 Jul 2023 14:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1690494755; bh=XpyNIdF2uhZAhQUKpx12L3Gpl72rWCRfsfzIB7HNnLk=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=IJgqXLWrQv7ZqRRd1SPCqOO7HHye4jaYz47x9dg7NbM6TIErBkVQ8MH8Sb4G42/9K 0sGo9iHeuh6jIbYsmJR1sWfGgmsoWbgCeytnx/ET2Z9lJAz2EPyShYcozxM/3Q8cOB +44mc6qbSaRy4uhU7cmVsUNzUIzFKt5f8YFGuwEl+lBlnvEw0/5L7oWUKaJSKKU5+1 QokDbvi81mb7olxqmjZhRzGUAVmRpzm7tIpCACV+c3rLS12DLSDEk/XliyB27m3GQO QzG6rvyI/oiZu7wNVOirzPt5vxETdjIZ72Mdd4W933Q9JVorr9vjC4uogefrmi9nlU WEzI3J3Jb1FEQ== Received: from localhost (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01072301.me.com (Postfix) with ESMTPSA id 8BF6225401AC; Thu, 27 Jul 2023 21:52:34 +0000 (UTC) From: Alain Volmat To: Alain Volmat , David Airlie , Daniel Vetter Cc: Alain Volmat , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/14] drm/sti: add support for stih418 in tvout Date: Thu, 27 Jul 2023 21:51:29 +0000 Message-Id: <20230727215141.53910-6-avolmat@me.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727215141.53910-1-avolmat@me.com> References: <20230727215141.53910-1-avolmat@me.com> MIME-Version: 1.0 X-Proofpoint-GUID: kRQ2cwLkVgPsl2ICV2Gw1qVI7RyokRPq X-Proofpoint-ORIG-GUID: kRQ2cwLkVgPsl2ICV2Gw1qVI7RyokRPq X-Proofpoint-Virus-Version: =?utf-8?q?vendor=3Dfsecure_engine=3D1=2E1=2E170-?= =?utf-8?q?22c6f66c430a71ce266a39bfe25bc2903e8d5c8f=3A6=2E0=2E138=2C18=2E0?= =?utf-8?q?=2E790=2C17=2E11=2E62=2E513=2E0000000_definitions=3D2022-01-12=5F?= =?utf-8?q?02=3A2020-02-14=5F02=2C2022-01-12=5F02=2C2021-12-02=5F01_signatur?= =?utf-8?q?es=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 spamscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2307270198 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1772617040132290123 X-GMAIL-MSGID: 1772617040132290123 The tvout for stih407 and stih418 differ in the connection with the vtg regarding to the hdmi output. In order to cop with that, introduce a new compatible st,stih418-tvout in order to have the hdmi_sync_id being part of the data attached to each compatible. Signed-off-by: Alain Volmat --- drivers/gpu/drm/sti/sti_tvout.c | 35 +++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c index 64615638b79a..685c0a4ba1be 100644 --- a/drivers/gpu/drm/sti/sti_tvout.c +++ b/drivers/gpu/drm/sti/sti_tvout.c @@ -118,6 +118,7 @@ struct sti_tvout { struct drm_encoder *hda; struct drm_encoder *dvo; bool debugfs_registered; + unsigned int hdmi_sync_id; }; struct sti_tvout_encoder { @@ -130,6 +131,10 @@ struct sti_tvout_encoder { #define to_sti_tvout(x) to_sti_tvout_encoder(x)->tvout +struct sti_tvout_data { + unsigned int hdmi_sync_id; +}; + /* preformatter conversion matrix */ static const u32 rgb_to_ycbcr_601[8] = { 0xF927082E, 0x04C9FEAB, 0x01D30964, 0xFA95FD3D, @@ -359,14 +364,14 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path) DRM_DEBUG_DRIVER("main vip for hdmi\n"); /* select the input sync for hdmi */ tvout_write(tvout, - TVO_SYNC_MAIN_VTG_SET_REF | VTG_SYNC_ID_HDMI, + TVO_SYNC_MAIN_VTG_SET_REF | tvout->hdmi_sync_id, TVO_HDMI_SYNC_SEL); tvo_in_vid_format = TVO_MAIN_IN_VID_FORMAT; } else { DRM_DEBUG_DRIVER("aux vip for hdmi\n"); /* select the input sync for hdmi */ tvout_write(tvout, - TVO_SYNC_AUX_VTG_SET_REF | VTG_SYNC_ID_HDMI, + TVO_SYNC_AUX_VTG_SET_REF | tvout->hdmi_sync_id, TVO_HDMI_SYNC_SEL); tvo_in_vid_format = TVO_AUX_IN_VID_FORMAT; } @@ -833,10 +838,26 @@ static const struct component_ops sti_tvout_ops = { .unbind = sti_tvout_unbind, }; +static const struct sti_tvout_data stih407_tvout_data = { + .hdmi_sync_id = 1, +}; + +static const struct sti_tvout_data stih418_tvout_data = { + .hdmi_sync_id = 5, +}; + +static const struct of_device_id tvout_of_match[] = { + { .compatible = "st,stih407-tvout", .data = &stih407_tvout_data, }, + { .compatible = "st,stih418-tvout", .data = &stih418_tvout_data, }, + { /* end node */ } +}; +MODULE_DEVICE_TABLE(of, tvout_of_match); + static int sti_tvout_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; + const struct sti_tvout_data *data; struct sti_tvout *tvout; struct resource *res; @@ -851,6 +872,10 @@ static int sti_tvout_probe(struct platform_device *pdev) tvout->dev = dev; + /* populate data structure depending on compatibility */ + data = of_match_node(tvout_of_match, node)->data; + tvout->hdmi_sync_id = data->hdmi_sync_id; + /* get memory resources */ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "tvout-reg"); if (!res) { @@ -877,12 +902,6 @@ static void sti_tvout_remove(struct platform_device *pdev) component_del(&pdev->dev, &sti_tvout_ops); } -static const struct of_device_id tvout_of_match[] = { - { .compatible = "st,stih407-tvout", }, - { /* end node */ } -}; -MODULE_DEVICE_TABLE(of, tvout_of_match); - struct platform_driver sti_tvout_driver = { .driver = { .name = "sti-tvout",