From nobody Wed Sep 10 02:49:35 2025 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 BE934EB64DD for ; Thu, 27 Jul 2023 21:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232458AbjG0VxH (ORCPT ); Thu, 27 Jul 2023 17:53:07 -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 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: kRQ2cwLkVgPsl2ICV2Gw1qVI7RyokRPq X-Proofpoint-ORIG-GUID: kRQ2cwLkVgPsl2ICV2Gw1qVI7RyokRPq X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.790,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-12=5F02:2020-02-14=5F02,2022-01-12=5F02,2021-12-02?= =?UTF-8?Q?=5F01_signatures=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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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_tvou= t.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; }; =20 struct sti_tvout_encoder { @@ -130,6 +131,10 @@ struct sti_tvout_encoder { =20 #define to_sti_tvout(x) to_sti_tvout_encoder(x)->tvout =20 +struct sti_tvout_data { + unsigned int hdmi_sync_id; +}; + /* preformatter conversion matrix */ static const u32 rgb_to_ycbcr_601[8] =3D { 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 =3D 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 =3D TVO_AUX_IN_VID_FORMAT; } @@ -833,10 +838,26 @@ static const struct component_ops sti_tvout_ops =3D { .unbind =3D sti_tvout_unbind, }; =20 +static const struct sti_tvout_data stih407_tvout_data =3D { + .hdmi_sync_id =3D 1, +}; + +static const struct sti_tvout_data stih418_tvout_data =3D { + .hdmi_sync_id =3D 5, +}; + +static const struct of_device_id tvout_of_match[] =3D { + { .compatible =3D "st,stih407-tvout", .data =3D &stih407_tvout_data, }, + { .compatible =3D "st,stih418-tvout", .data =3D &stih418_tvout_data, }, + { /* end node */ } +}; +MODULE_DEVICE_TABLE(of, tvout_of_match); + static int sti_tvout_probe(struct platform_device *pdev) { struct device *dev =3D &pdev->dev; struct device_node *node =3D dev->of_node; + const struct sti_tvout_data *data; struct sti_tvout *tvout; struct resource *res; =20 @@ -851,6 +872,10 @@ static int sti_tvout_probe(struct platform_device *pde= v) =20 tvout->dev =3D dev; =20 + /* populate data structure depending on compatibility */ + data =3D of_match_node(tvout_of_match, node)->data; + tvout->hdmi_sync_id =3D data->hdmi_sync_id; + /* get memory resources */ res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "tvout-reg"); if (!res) { @@ -877,12 +902,6 @@ static void sti_tvout_remove(struct platform_device *p= dev) component_del(&pdev->dev, &sti_tvout_ops); } =20 -static const struct of_device_id tvout_of_match[] =3D { - { .compatible =3D "st,stih407-tvout", }, - { /* end node */ } -}; -MODULE_DEVICE_TABLE(of, tvout_of_match); - struct platform_driver sti_tvout_driver =3D { .driver =3D { .name =3D "sti-tvout", --=20 2.34.1