From patchwork Sun Sep 3 21:41:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720381 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 4D4EFCA0FE9 for ; Sun, 3 Sep 2023 21:41:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348946AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348909AbjICVl5 (ORCPT ); Sun, 3 Sep 2023 17:41:57 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EB13E7 for ; Sun, 3 Sep 2023 14:41:53 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-500c6ff99acso2066271e87.1 for ; Sun, 03 Sep 2023 14:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777312; x=1694382112; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GmanXIAkjDsl+T2r62TPHvRC1u8K+rB0oi8RTwEBesA=; b=xJaeyPxHFUdk6qhXVl9pcYwGIj6ry212IshkgrOmUj8Bpt76gTqX0EVkMPzv92CxBS /IhjvH5xnYEh/XXSKV58i57VQ5FmNCr3kkNkaJze34nn/Bzwwlgn2FaOYXzuZA/nZM1i G5ntCFOlvmedXZ/pM5Zwdq9lKeImg+wpNUQrLDN/HQ8WBL9Q1quW+/3Uh6ldZFo7kQie DhjPGSx0zL3hKimS08w0KfGPgdLvG6TbWS+f3oJz7BusF2FJq0UMNmYA98k6HMNe8MAl J9b5wxVt7bccJM1U4RmlhuVPBvpTgujRq82kTQ7kXcykveAYquERpExSxMtiGOQNQTGX mEsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777312; x=1694382112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GmanXIAkjDsl+T2r62TPHvRC1u8K+rB0oi8RTwEBesA=; b=g/VVTjakMUdiiTx08ysqQaL6Gag5kyXFYRYtrp7fDQlNixE8Mv1H2TjpRpA3M/pEce mNLqCIaes2/teyVNr3q0jgMKU/k86ZjhIRz+1miRiPYm5m4xHglGKSxxUf/pri8hgSLK 4halmZr/RmNH1YgBSArrHQ8T9bY1Lgbc0QWNyMIzE6WkfGk+C/cIvGv8fZERs/5qcayK GnrH3xjiYlFsvCmL5xLeos7hwg+jFZTghWCfKxcTBIPlkoN0QCCuw33h6BCGt7hN3we2 Ui+2xUC/zWTUcwdoVifmJ+HBUWr2VVMz3OmXmxGqxtzZVn6nDpdCVHiPC4w07XOKWG5E p14w== X-Gm-Message-State: AOJu0YzkEfQCNp1TPpVEqpdIzbID46x7aXaEnjaromPtA6h1S6D4MCt4 G1+HwSWIrO+mURFBHJRWWkA4EA== X-Google-Smtp-Source: AGHT+IEGo/yjWy7nXfptqRFFQBffjwaXXQ9l9Ri/i3/adG+D2/r7RCm9m7rFgxFD5xaJpRnQWqoXxw== X-Received: by 2002:a05:6512:2215:b0:500:bf44:b2b3 with SMTP id h21-20020a056512221500b00500bf44b2b3mr2690899lfu.21.1693777311904; Sun, 03 Sep 2023 14:41:51 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:51 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org, Won Chung Subject: [RFC PATCH v1 01/12] Revert "drm/sysfs: Link DRM connectors to corresponding Type-C connectors" Date: Mon, 4 Sep 2023 00:41:39 +0300 Message-Id: <20230903214150.2877023-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org The kdev->fwnode pointer is never set in drm_sysfs_connector_add(), so dev_fwnode() checks never succeed, making the respective commit NOP. And if drm_sysfs_connector_add() is modified to set kdev->fwnode, it breaks drivers already using components (as it was pointed at [1]), resulting in a deadlock. Lockdep trace is provided below. Granted these two issues, it seems impractical to fix this commit in any sane way. Revert it instead. [1] https://lore.kernel.org/dri-devel/Y24bcYJKGy%2Fgd5fV@phenom.ffwll.local/ ============================================ WARNING: possible recursive locking detected 6.5.0-rc6-next-20230816-10542-g090e2ca9feae-dirty #713 Tainted: G W -------------------------------------------- kworker/u16:0/11 is trying to acquire lock: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 but task is already holding lock: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(component_mutex); lock(component_mutex); *** DEADLOCK *** May be due to missing lock nesting notation 6 locks held by kworker/u16:0/11: #0: ffff5b7680008d38 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x14c/0x51c #1: ffff8000800abde0 (deferred_probe_work){+.+.}-{0:0}, at: process_one_work+0x14c/0x51c #2: ffff5b76837a2908 (&dev->mutex){....}-{3:3}, at: __device_attach+0x38/0x188 #3: ffffce0f54bea490 (component_mutex){+.+.}-{3:3}, at: __component_add+0x64/0x170 #4: ffffce0f54bdeb40 (drm_connector_list_iter){.+.+}-{0:0}, at: drm_modeset_register_all+0x80/0x9c #5: ffff5b76866ad0d0 (&connector->mutex){+.+.}-{3:3}, at: drm_connector_register.part.0+0x28/0x104 stack backtrace: CPU: 6 PID: 11 Comm: kworker/u16:0 Tainted: G W 6.5.0-rc6-next-20230816-10542-g090e2ca9feae-dirty #713 Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT) Workqueue: events_unbound deferred_probe_work_func Call trace: dump_backtrace+0x98/0xf0 show_stack+0x18/0x24 dump_stack_lvl+0x60/0xac dump_stack+0x18/0x24 print_deadlock_bug+0x254/0x340 __lock_acquire+0x105c/0x1ebc lock_acquire+0x1ec/0x314 __lock_acquire+0x105c/0x1ebc lock_acquire+0x1ec/0x314 __mutex_lock+0xa0/0x77c mutex_lock_nested+0x24/0x30 __component_add+0x64/0x170 component_add+0x14/0x20 drm_sysfs_connector_add+0x144/0x1a0 drm_connector_register.part.0+0x5c/0x104 drm_connector_register_all+0x84/0x160 drm_modeset_register_all+0x80/0x9c drm_dev_register+0x120/0x238 msm_drm_bind+0x550/0x6e0 try_to_bring_up_aggregate_device+0x164/0x1d0 __component_add+0xa8/0x170 component_add+0x14/0x20 dsi_dev_attach+0x20/0x2c dsi_host_attach+0x9c/0x144 devm_mipi_dsi_attach+0x34/0xb4 lt9611uxc_attach_dsi.isra.0+0x84/0xfc lt9611uxc_probe+0x5ac/0x66c i2c_device_probe+0x148/0x290 really_probe+0x148/0x2ac __driver_probe_device+0x78/0x12c driver_probe_device+0x3c/0x160 __device_attach_driver+0xb8/0x138 bus_for_each_drv+0x80/0xdc __device_attach+0x9c/0x188 device_initial_probe+0x14/0x20 bus_probe_device+0xac/0xb0 deferred_probe_work_func+0x8c/0xc8 process_one_work+0x1ec/0x51c worker_thread+0x1ec/0x3e4 kthread+0x120/0x124 ret_from_fork+0x10/0x20 Fixes: c5c51b242062 ("drm/sysfs: Link DRM connectors to corresponding Type-C connectors") Cc: Won Chung Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_sysfs.c | 40 ------------------------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index b169b3e44a92..06662cc8d3f4 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -11,14 +11,12 @@ */ #include -#include #include #include #include #include #include #include -#include #include #include @@ -98,34 +96,6 @@ static char *drm_devnode(const struct device *dev, umode_t *mode) return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); } -static int typec_connector_bind(struct device *dev, - struct device *typec_connector, void *data) -{ - int ret; - - ret = sysfs_create_link(&dev->kobj, &typec_connector->kobj, "typec_connector"); - if (ret) - return ret; - - ret = sysfs_create_link(&typec_connector->kobj, &dev->kobj, "drm_connector"); - if (ret) - sysfs_remove_link(&dev->kobj, "typec_connector"); - - return ret; -} - -static void typec_connector_unbind(struct device *dev, - struct device *typec_connector, void *data) -{ - sysfs_remove_link(&typec_connector->kobj, "drm_connector"); - sysfs_remove_link(&dev->kobj, "typec_connector"); -} - -static const struct component_ops typec_connector_ops = { - .bind = typec_connector_bind, - .unbind = typec_connector_unbind, -}; - static CLASS_ATTR_STRING(version, S_IRUGO, "drm 1.1.0 20060810"); /** @@ -394,16 +364,9 @@ int drm_sysfs_connector_add(struct drm_connector *connector) connector->kdev = kdev; - if (dev_fwnode(kdev)) { - r = component_add(kdev, &typec_connector_ops); - if (r) - drm_err(dev, "failed to add component to create link to typec connector\n"); - } - if (connector->ddc) return sysfs_create_link(&connector->kdev->kobj, &connector->ddc->dev.kobj, "ddc"); - return 0; err_free: @@ -419,9 +382,6 @@ void drm_sysfs_connector_remove(struct drm_connector *connector) if (connector->ddc) sysfs_remove_link(&connector->kdev->kobj, "ddc"); - if (dev_fwnode(connector->kdev)) - component_del(connector->kdev, &typec_connector_ops); - DRM_DEBUG("removing \"%s\" from sysfs\n", connector->name); From patchwork Sun Sep 3 21:41:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719954 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 46CA6C88CB2 for ; Sun, 3 Sep 2023 21:42:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349028AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348918AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BF9ACD for ; Sun, 3 Sep 2023 14:41:54 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5007616b756so1449250e87.3 for ; Sun, 03 Sep 2023 14:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777313; x=1694382113; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ma99b4LHGq53HSGcZQ6vjRnRZEGnePGsfNP3DlvaRh0=; b=MYOlbi+JGeJYtrISEHYVNAZ7NpZm2f81saVxar4AyapqsYeo9BDcG1/09r2DRXNEwr mbf6atiwzL2s0ypbJJ/s/IfiyvbdNhMmfBynyy9zq4Rf7vF/UKwNGdUfTRKiv76gxCL4 mE9f/P4GWaSqWgWg8Blc4HJR9dojKiw2um+uyr3Q+NCLydXKm/qP+nrucUF+8gcc0LUa //eAsXd+bWEEnLFNEWZPuifwc6Em2sPC2YYH2qyga5l+JI3cHzbKS9tuyVzYtX/3wrA1 q6UYZNGQK1DVXTysf21XRs667gV4bf/tno9hwUtOQSBCWQKZUkQZU+7gjOhnFIxAnByJ oXJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777313; x=1694382113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ma99b4LHGq53HSGcZQ6vjRnRZEGnePGsfNP3DlvaRh0=; b=L0PCELn/Mx4DSNX1KuZe7EJGm2NQidneAFAydyWqwUnkFmlTA9xHl7Jwz78toQg9aD mVgkGMZfqw4WmPBTPdE0FwjnZdw3cuaoVVOwcy3Kmk0ODcVCj+roc2K/e8P5kqVYOJhm ujAcxNhInmTw3eywAI+H8IxUlyCQMkfVoZeZ4Q6ehkVXwpRsjoQ/KD1ibs9gAIhMLZuw qQ54dgltN+SLadzAlV+Q9aIGZPBk0lUrRBf77N4Eazt7J41+0gxnjBqPENFF2nvvy51p x/LQ+bPjLNswCeA8uSXrL3ux1W1TjYtfTnbzR/WzdYbUMbnazBaShNXyigEQyZ9CQzmg Thiw== X-Gm-Message-State: AOJu0YyaVzrFCwTgoh5AD3M0+pphVaoduEX8Yr7l8oSxB7y2HpzOrVQH gCpJMqU5RO/XXDDHl1UbFlH9AQ== X-Google-Smtp-Source: AGHT+IHJVW1SRXqtDqVwoMB9XSCNYSPZYNLw0l5nqazh953B3y2RWKaTYGlv3/IkcL42Y/AtV9dO0g== X-Received: by 2002:a05:6512:44c:b0:4fd:d517:fbcd with SMTP id y12-20020a056512044c00b004fdd517fbcdmr4553861lfk.6.1693777312712; Sun, 03 Sep 2023 14:41:52 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:52 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 02/12] drm/sysfs: link DRM connector device to the connector's fw nodes Date: Mon, 4 Sep 2023 00:41:40 +0300 Message-Id: <20230903214150.2877023-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Setup the of_node and fwnode fields for the DRM connector device, making respective links to appear in /sys. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 06662cc8d3f4..cb926d95ef0e 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c @@ -345,6 +345,8 @@ int drm_sysfs_connector_add(struct drm_connector *connector) kdev->class = drm_class; kdev->type = &drm_sysfs_device_connector; kdev->parent = dev->primary->kdev; + kdev->of_node = to_of_node(connector->fwnode); + kdev->fwnode = connector->fwnode; kdev->groups = connector_dev_groups; kdev->release = drm_sysfs_release; dev_set_drvdata(kdev, connector); From patchwork Sun Sep 3 21:41:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719953 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 2978FC88CB2 for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349188AbjICVmF (ORCPT ); Sun, 3 Sep 2023 17:42:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348737AbjICVl6 (ORCPT ); Sun, 3 Sep 2023 17:41:58 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3501CF2 for ; Sun, 3 Sep 2023 14:41:55 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4ff8f2630e3so1429639e87.1 for ; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777313; x=1694382113; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f4CGlwIh3CaiNYfDE8T4/N3NKVw9L1KuLHleXxMGA8k=; b=sL37z1nSxapwX1ACyQwJD5J17vIMjGOlYzI20UASAIey8kqRxI4mjpOLunNTr0u6KK jvpNqVkjoqjPTMONMwLwlzQKkafFdk3xRAB7v7F2C71kjfWv3RZAq0uwdXFBRgW5Ablu 5qEtusCHwgTRJX0jw35/YtTrrnm483NhEudimhX/Y9mY6b1ypxLsOGIV2NXg1locgBn2 GT8LylBHFPlCJAw9wBeuHQ564qtXwoDgreruE+BCcep2hASO7HKsC8zNooFIvAMa6b7z 9wXUeRsY+cFjE1kA3IgrV4pnlZhjm+i9W7t1RIK5ziozF2te0A0ydoVmTyp2VCrfh/M7 rszA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777313; x=1694382113; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f4CGlwIh3CaiNYfDE8T4/N3NKVw9L1KuLHleXxMGA8k=; b=gGVGCDm3F0LHZ3mnv5ogvZAZF529x5GoP4RJGZ9bvMOMm1fylz3kmOzU0hepAc1zzL VG+NGuR4Q1JnqxS+N6jrXQGAgB44cgdn9Ve+1i9hid1qRNxmhwzABp1BqlMaPMnzyOn7 yLG066fXQIEOrTF4FFZEaT2xD/GI/1JdkOyoLdtmAmsh0La5Sy8Jfhw8SeE7Rtmjegf7 paOpEpWeYZ+dLxdpCGNXRD6FzM0K1kts0ytt0JdqMsXh8fSiUuYjdKeMT5BLjCZGNVnq StdyQcGK/LYnGc01sGXApWXbErp60pXJmdJxU4iz2Bzu+fUn5EBD7hzK9+P81GXWZ/BO Ylpg== X-Gm-Message-State: AOJu0YzKHMRlzRF6RcazAM9nkMq2bHVCiykmKfM28y6Aha4BpxhoYanm T4fD2uIkr4oW7DTnBNrSoegGhw== X-Google-Smtp-Source: AGHT+IHZcZHwPmZz/G9GJYrJdaFt/yh7kFkMispc1XECmMNIp6Mo7eyJQIJfgGNG8gZdXS8BoslEpA== X-Received: by 2002:a05:6512:3444:b0:4fb:911b:4e19 with SMTP id j4-20020a056512344400b004fb911b4e19mr3890157lfr.35.1693777313473; Sun, 03 Sep 2023 14:41:53 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:53 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 03/12] drm/connector: extend PATH property to covert Type-C case Date: Mon, 4 Sep 2023 00:41:41 +0300 Message-Id: <20230903214150.2877023-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Userspace needs to identify whether the DisplayPort connector is a native one or it is wrapped into the USB-C port. Moreover the userspace might need to point user to the exact location of this Type-C port on the laptop case. Existing USB-C altmode implementations (i915, amdgpu) have used the DRM_MODE_CONNECTOR_DisplayPort even for such ports. To keep backwards compatibility we can not change this to DRM_MODE_CONNECTOR_USB. Therefore the kernel needs some other way to represent this information. To facilitate this, reuse the 'PATH' property, which was used to describe the DP port in the DP MST configuration. Use either 'typec:portN' to point out to the Type-C port class device, or just 'typec:' if the corresponding port can not be identified. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_connector.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 05fc29a54801..a326782e936e 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1185,10 +1185,14 @@ static const u32 dp_colorspaces = * never read back the value of "DPMS" because it can be incorrect. * PATH: * Connector path property to identify how this sink is physically - * connected. Used by DP MST. This should be set by calling - * drm_connector_set_path_property(), in the case of DP MST with the - * path property the MST manager created. Userspace cannot change this + * connected. This should be set by calling + * drm_connector_set_path_property(). Userspace cannot change this * property. + * In the case of DP MST this is equal to the path property the MST + * manager created. It is equal to 'mst:baseID-port-port...'. + * In the case of DP USB-C connector this is equal to the 'typec:portN', + * pointing to the corresponding Type-C port device or just 'typec' if the + * corresponding Type-C port can not be identified. * TILE: * Connector tile group property to indicate how a set of DRM connector * compose together into one logical screen. This is used by both high-res From patchwork Sun Sep 3 21:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719952 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 9FEC7CA0FFB for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349280AbjICVmG (ORCPT ); Sun, 3 Sep 2023 17:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348913AbjICVmD (ORCPT ); Sun, 3 Sep 2023 17:42:03 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4065E5 for ; Sun, 3 Sep 2023 14:41:55 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-50087d47d4dso1455496e87.1 for ; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777314; x=1694382114; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rp5vM1gl9RU86RuI50kxi2LQD61SiuVQj5J5+OGEdj8=; b=LzKuaU5Io7ERItKEqZSokMqcg2iAa7++TcfdkS0yu+CR7wFonJYS7+ZdKr9DSYx/yi 86mmet212rmoU5Dw9VVnk7lhIeLnn0zaNTGymvSvzYzWAA4XOeWgPSdV/z/2Kqak2aZ9 NbOyn1woZTbkezEHcfieOJxq2Cc1qlXvrJrNNQ1QNB+y0G+02m8O98romojdQ6SNA6yY tezO6y6hXQA986TSsp4iXyKAA+FVwWGyTFqhhqUKreX1L/XTG2Ke8yAaZWsJU9r08Kve 3ygwAjaBFUJBequ0/hBMcHsCJmbBviNfoNfReeogrLaEqJQxJit6I+6BT/IGngECh0g0 t9ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777314; x=1694382114; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rp5vM1gl9RU86RuI50kxi2LQD61SiuVQj5J5+OGEdj8=; b=d+QYLqPy+Gl48N51JWXpVOfmurNM/Yygv+oP7Ix43Ip6ob7WJsdwpKG7Xz0elW50Bv AgKl0Y7/YFO/QzJ/GxYA7/RN92uGalzWG+rGaPZIZJUBmdyceCVQ/jncQYkh7vjY/0Kv S+mu0pHUluqCsz9kdMDPrTTlYjOmjVAzRYNMVeZKTNuzFOJnewi1+92ovCFT1zznktk2 ctWeLXLn2Q50zkLtY5P3aKgL7eytusCmXKmAiW2Ua7xcyRpDejnqs6UKJCPFL3YZupGN w7aJaAW1mQVvagZx+nXdESO8ipiXjp8g0s5N++QHGL4Cv0/XNSMTNGO0eFAMHpyPU4MV QdQA== X-Gm-Message-State: AOJu0YxfrzitXAoLzDwb6QTcabY3r4Oz+3NDkmvF7SKPEnnaazZvKmND VdSBNAFwHgT4A2v2w6Nexm9P7Q== X-Google-Smtp-Source: AGHT+IGDQQbfVXjBOtsl8V14iEcrDkjhs9AHs4yCZXqJ/byBpZFqNkhX6ECkcKXY9MxCWwyt+uunZA== X-Received: by 2002:a05:6512:711:b0:4fe:5860:7abf with SMTP id b17-20020a056512071100b004fe58607abfmr4579227lfs.13.1693777314266; Sun, 03 Sep 2023 14:41:54 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:53 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 04/12] drm/bridge-connector: set the PATH property for the connector Date: Mon, 4 Sep 2023 00:41:42 +0300 Message-Id: <20230903214150.2877023-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In order to properly identify connectors (in particular, DisplayPort connectors wrapped into USB-C) allow bridge drivers to specify the value to be used for connector's PATH property. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_bridge_connector.c | 12 ++++++++++++ include/drm/drm_bridge.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index bf73960c2c2a..008d730e1c2f 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -331,6 +331,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, struct drm_connector *connector; struct i2c_adapter *ddc = NULL; struct drm_bridge *bridge, *panel_bridge = NULL; + const char *path = NULL; int connector_type; int ret; @@ -377,6 +378,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); #endif + if (bridge->path) + path = bridge->path; + if (bridge->ddc) ddc = bridge->ddc; @@ -405,6 +409,14 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; + if (path) { + drm_object_attach_property(&connector->base, + drm->mode_config.path_property, + 0); + + drm_connector_set_path_property(connector, path); + } + if (panel_bridge) drm_panel_bridge_set_orientation(connector, panel_bridge); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index c339fc85fd07..98e9d76474f4 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -753,6 +753,13 @@ struct drm_bridge { * before the peripheral. */ bool pre_enable_prev_first; + /** + * @path: the 'path' of the bridge. For bridges at the end of this + * chain this is used to set the 'PATH' property of the connector. + * This string is not freed manually, so one either should use a static + * string here or a devres-allocated one. + */ + const char *path; /** * @ddc: Associated I2C adapter for DDC access, if any. */ From patchwork Sun Sep 3 21:41:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720378 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 10FB6CA0FE3 for ; Sun, 3 Sep 2023 21:42:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349452AbjICVmJ (ORCPT ); Sun, 3 Sep 2023 17:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349004AbjICVmD (ORCPT ); Sun, 3 Sep 2023 17:42:03 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95DE5E7 for ; Sun, 3 Sep 2023 14:41:56 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-500cfb168c6so1451527e87.2 for ; Sun, 03 Sep 2023 14:41:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777315; x=1694382115; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xxzYLYfsMsF6kZIITXju1taC/sMkbxWNFfavaK+QQhU=; b=ol2cmF1Ocr6XjMIqA//EXbkHdrd4tbITPgQ9dfba3zCGi4O/YeaSmYsvRpLvXvbew0 CaJTC2FwS5lXnQkMTf0uNTAI2CZJ7ZrC38V2ZqxxC2DYN6DakeUYsAGoZZzH0LcHTQOq i0HCP32Xn4Yf8+AlwQraR/f1hPjJ9yRz4sueO2Pa/HETpcJYWOnN0wTENILYyYgWWcDR /OKTfsZs/GTZK3EhuFZxpRKx61Jog+I9Duyr3lKsNynpwQB86pRIdyaZn94yq9Z+X7H9 Uk0VnJdkGBThj7gVbDQb2WtTX7Yift/0qgnXnpDtoNyq6qTG7ZgzsYQ/s5vVhWgAEA7C tjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777315; x=1694382115; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xxzYLYfsMsF6kZIITXju1taC/sMkbxWNFfavaK+QQhU=; b=d4h4lxSOS0Oepavd2M1CSm1uZw3hst0o7Mn6cAI4XTUv5sy7Ql7U6VC5PPc6h5xGlt fKSjZ0uR8rqc8oP8PcdofCxseVr0Y1k0GiiNe86PqJZuXSg49rZFF5U/bhRvcUXeLFrN yZj9Q5Gv8Fp859RFRc0o/Ixm19wPJjnTDZDM4wA+pJXzZhdu2Mshy4vF1x85t3VMmrwE +1WvAlJ2/pgYlH1ijnDOWrp9iIbGcVRxtXGaZps4cLDeT9PPkIoBqaj4D3Keb+4DWXr6 JIUQbiOK5tJD64tJsUJmUi/p7YwxmgO2KKZ1TAzkANCOydkmUYCY64ER5Y46X/PjyfKG 2hrg== X-Gm-Message-State: AOJu0YzizEfQYd5NkCFSiYpidyPF8W9WMZ9Zdxyhjp6jhKxNiwuljwAg 0CLwFDuRzH8XMrRG1wTkfW3/FQ== X-Google-Smtp-Source: AGHT+IHkhutnflS0UUIMoJstZXZDY/ceuTUjBBh2pmrIlmKpCCqxCMZjLAzGe9MmdoJHda/q0FEUHw== X-Received: by 2002:a19:4f4f:0:b0:500:a1e4:fc44 with SMTP id a15-20020a194f4f000000b00500a1e4fc44mr4968258lfk.61.1693777315009; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:54 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 05/12] drm/bridge: remove conditionals around devicetree pointers Date: Mon, 4 Sep 2023 00:41:43 +0300 Message-Id: <20230903214150.2877023-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Remove ifdef CONFIG_OF around the drm_bridge::of_node field. This follow the correponding change to struct device we had since 2.6.39. Having conditional around the of_node pointers turns out to make driver code use ugly #ifdef blocks. Drop the conditionals and remove the #ifdef blocks from the affected drivers. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/panel.c | 2 -- drivers/gpu/drm/drm_bridge_connector.c | 2 -- include/drm/drm_bridge.h | 2 -- 3 files changed, 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 9316384b4474..7f41525f7a6e 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -302,9 +302,7 @@ struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, panel_bridge->panel = panel; panel_bridge->bridge.funcs = &panel_bridge_bridge_funcs; -#ifdef CONFIG_OF panel_bridge->bridge.of_node = panel->dev->of_node; -#endif panel_bridge->bridge.ops = DRM_BRIDGE_OP_MODES; panel_bridge->bridge.type = connector_type; diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 008d730e1c2f..ca255609fb08 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -372,11 +372,9 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (!drm_bridge_get_next_bridge(bridge)) connector_type = bridge->type; -#ifdef CONFIG_OF if (!drm_bridge_get_next_bridge(bridge) && bridge->of_node) connector->fwnode = fwnode_handle_get(of_fwnode_handle(bridge->of_node)); -#endif if (bridge->path) path = bridge->path; diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 98e9d76474f4..afa1de791075 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -716,10 +716,8 @@ struct drm_bridge { struct drm_encoder *encoder; /** @chain_node: used to form a bridge chain */ struct list_head chain_node; -#ifdef CONFIG_OF /** @of_node: device node pointer to the bridge */ struct device_node *of_node; -#endif /** @list: to keep track of all added bridges */ struct list_head list; /** From patchwork Sun Sep 3 21:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720380 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 19E45CA0FE3 for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349423AbjICVmI (ORCPT ); Sun, 3 Sep 2023 17:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349029AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8297810C for ; Sun, 3 Sep 2023 14:41:57 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-500aed06ffcso1304711e87.0 for ; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777315; x=1694382115; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=OQcAPcnsh/PX6lyiVXrbFZsnqyLcpAkILp56uQTeTQw=; b=UjTEXxmFUGnIujn1SJgYcThCVEVbqbKDQ9fn5cOi3aS41aGLUt/77MYmqIvuDVPy9I eg6aEROrqc61eZttTIdT8Duii6Ft9LiS0027egPMOibMVg8FbUkU6yG4ZDAXj/NgIji+ Hrta5vkPm711oqUtlMm+zPSuP7MwLY1kTZflViuLGduARZRS/94ulKaC5/VHbZUtxro1 Itx3HNTB+9IwuvFO9sVY/MhO07CEnrXax8l51OxudEfjvNdcq4/in6LpVBN+aavs39xj E2rPwzk2bOi5/iYDeVCkaYOd1kmRW9xIgkPDA7OcOHAzYGmYO7ERRkJYo8oTrSxhX2LX Ib1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777315; x=1694382115; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OQcAPcnsh/PX6lyiVXrbFZsnqyLcpAkILp56uQTeTQw=; b=VzbIdIrbCM/bJQJVQqbN/YuT1terascc4dhx81up9kSiv2ywUOdiyaa+AI7FKWcRS2 e9MZ7nMTsXy8rtEFhdb6C+Vse74h7NeRrJD1hVUMICZduPlX1smCpv9VhRv2RyOK1YWi y1OdduBgYnPCedAaew8KpkhWZ01M7ieaNdBS+14IsTe8890jlMHOoTRc5/TJRRtSRn3h FJvR3kUWuE9kTeV+Cnn5VrUC3FFS6Smp7ZTDZjLoXIM+21x2RikJJSGlOBpo5eqh1y1Q quE74XcGvMqD8JTgLWTXSn2MHfRHexwU68gFp+XDqxCDdAlJS9MaHEpRh0FDLc85Fnx4 8/dg== X-Gm-Message-State: AOJu0Yws5AoonAAeZlVHmyQrIkZR0+XtP8qiGm6vFZ1EF/G4ELgB5w/j N3cmLjsGIUmbiczKYcUrZby2lg== X-Google-Smtp-Source: AGHT+IFpEl+oUE18/qsarFYaU8IntNTWUpC/nioDioEjFcJUMzzHif7+zO1awGEwu6H7kQPHIzxz/g== X-Received: by 2002:a05:6512:2814:b0:4f8:62a6:8b2 with SMTP id cf20-20020a056512281400b004f862a608b2mr6629124lfb.46.1693777315799; Sun, 03 Sep 2023 14:41:55 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:55 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 06/12] soc: qcom: pmic_glink_altmode: fix DRM connector type Date: Mon, 4 Sep 2023 00:41:44 +0300 Message-Id: <20230903214150.2877023-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org During discussions regarding USB-C vs native DisplayPort it was pointed out that other implementations (i915, AMD) are using DRM_MODE_CONNECTOR_DisplayPort for both native and USB-C-wrapped DP output. Follow this example and make the pmic_glink_altmode driver also report DipslayPort connector rather than the USB one. Cc: Simon Ser --- drivers/soc/qcom/pmic_glink_altmode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index d05e0d6edf49..974c14d1e0bf 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -465,7 +465,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, alt_port->bridge.funcs = &pmic_glink_altmode_bridge_funcs; alt_port->bridge.of_node = to_of_node(fwnode); alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; - alt_port->bridge.type = DRM_MODE_CONNECTOR_USB; + alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; ret = devm_drm_bridge_add(dev, &alt_port->bridge); if (ret) From patchwork Sun Sep 3 21:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720379 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 90680CA0FF7 for ; Sun, 3 Sep 2023 21:42:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349407AbjICVmG (ORCPT ); Sun, 3 Sep 2023 17:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349046AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A8F010D for ; Sun, 3 Sep 2023 14:41:58 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-50087d47d4dso1455524e87.1 for ; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777316; x=1694382116; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mQu1z4f66ZLko+rKDaNEqwlYcOO6KOPqUNdRGmTYflk=; b=yoQftoDDcczedWpEq5MPT7EbuHO3OQRoQ0GhNSJBMxufi3KntbCaG03nOnSCAaxDB8 r84VlqXhzFLTwgbI599qxvakCtQgkp/aL9EnSMQFsdqLkmoNaNvGcO2t9SIU7OSZDUQs uyj1C6+RlHWcBHaSv4P2bz7jD6YSSDRSUo6bZnvPX/oVRYOyI3jobnRqgwwShuKLNJhU iSJnfHkg8z8NT2m1nwPybfNwNLaY566Bybvu/PCjtwqwHot5UCABnqYKa0bHw01ByAVL Xj41PUI77GyELjwHISUDLoltehhd94u/kBv5JHRmc/3m/IKMBCFjDBCiLobVNy7rsc5y Sj8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777316; x=1694382116; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mQu1z4f66ZLko+rKDaNEqwlYcOO6KOPqUNdRGmTYflk=; b=YOwz6gaOsQPuhtriBtT+joYEusRcPh/Eba2cP7W0jGjj9b4C1Z5K0rtXP8QD1tufNa H3Q1FhY+c/xUJiMolA0+MCKTkntT/NrW00VQCDQpvordiClfb2NUyhZBCl+26AfBGkpY 8ePnqanjLbCcNQcPY6zAuX8R8+iYvScA6K0629D8ME41de2Plkyx6OtilLRkdQta9cig CimebGEHrlrwb2z4HNsKEfSbI0dVCsyHIVU+CuE/2mybh/guLRWGsSCM6hKHTCEpGwCM IPKpXVlNB3XzQkjWFRTx3j5V4w1oZYDYqYQETofyJjOVyQzhJkh8JIdL8TUiexNrlUW1 3GyQ== X-Gm-Message-State: AOJu0Yx+WiAT04cwii0DDH3iiL6/dQwvBJnt1Bs4X6RxB2ECJyze49Pw +GJZWTe5lwsCRc5mutmehTb+Gw== X-Google-Smtp-Source: AGHT+IExVQuQX3Gj81jbZ+R6ySGMUAgWZnxuPMcXW9RME/R1Qx0IzJskMS/e3HZRFl9o1BgsPXmohw== X-Received: by 2002:a05:6512:34d0:b0:4fe:85c:aeba with SMTP id w16-20020a05651234d000b004fe085caebamr5162568lfr.21.1693777316523; Sun, 03 Sep 2023 14:41:56 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:56 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 07/12] soc: qcom: pmic_glink_altmode: report that this is a Type-C connector Date: Mon, 4 Sep 2023 00:41:45 +0300 Message-Id: <20230903214150.2877023-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Set the bridge's path property to point out that this connector is wrapped into the Type-C port. We can not really identify the exact Type-C port because it is registered separately, by another driver, which is not mandatory and the corresponding device is not even present on some of platforms, like sc8180x or sm8350. Thus we use the shortened version of the PATH, which includes just the 'typec:' part. Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/pmic_glink_altmode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/pmic_glink_altmode.c b/drivers/soc/qcom/pmic_glink_altmode.c index 974c14d1e0bf..a5b72046caaa 100644 --- a/drivers/soc/qcom/pmic_glink_altmode.c +++ b/drivers/soc/qcom/pmic_glink_altmode.c @@ -466,6 +466,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, alt_port->bridge.of_node = to_of_node(fwnode); alt_port->bridge.ops = DRM_BRIDGE_OP_HPD; alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + alt_port->bridge.path = "typec:"; ret = devm_drm_bridge_add(dev, &alt_port->bridge); if (ret) From patchwork Sun Sep 3 21:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719949 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 A07B8CA0FFF for ; Sun, 3 Sep 2023 21:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234657AbjICVmU (ORCPT ); Sun, 3 Sep 2023 17:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349070AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8096115 for ; Sun, 3 Sep 2023 14:41:58 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-500b0f06136so1542360e87.0 for ; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777317; x=1694382117; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SWHSZWaKhvE1MjysmoYq2syAfT9CG/PqkkscIEqVNT4=; b=OFGjRw15uVSbGAp4yu9zzgtzGPg8+T2glIgwMKBNEypXFfvXXOMCnXcBGmXfmdDOzO 846sonlFk704L2Ont7y+SWa0ldpFMcmfi1KaqGgBo9Ys5Sb0WiaOqIM+x+DpTMldQ47Q XX1CO0+/O3bNgKf7pOJv//hNpwgjyxsV0k69x+awp/1KtBj+SBhnl1l7LoUGoab88l4L XsOuZkzMTTWzgLk0fgjlPPC66W9V7bQi1pM2e8nwJKYSeFf+tDEveGjtCDi94zRlcFBw OfPz+/YXry+rIC48tGl97KlcSfbSrzjxOuszKPovZvpEr1vzMtnNAicxd1dCPj7jTYM7 y9wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777317; x=1694382117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SWHSZWaKhvE1MjysmoYq2syAfT9CG/PqkkscIEqVNT4=; b=EM+je7lwZ2XrNrxwgDxHH3oOxZ9qBnH2BFwmAw987mWr9RzKOx25d92X4SHzx0TyMA 0gL1JLkG6UIs3CFiU5OlVrwlDohDIjZLFw3fxNOAzsorEr6QW52R6CbUvbB0XCEl+sni K2xhvzpw++WdUtz3gRfZ/R3KHp11Fy079HKQ4OVSBIorFZGwHN0s3gE3qDuoDM3TzBzv 2m9XodVeKK35r01D0IVf/UWs/oxtnXdUgfNCUHC2IophFgMf5K8wUeD/vd/wfXE3k6U5 VKaNdRaaN76Itft3RO+miY0xhIKVrLwCLCfAxVGJE/8Fp0dXCpXs6vwGQwx8CLQokZTL c2eQ== X-Gm-Message-State: AOJu0Yzxblo5etSLXInRCfgXVouqwpk1roFSSqqHVGJuKQz/sA6SYp0l 1AXFIYAQ/vZThXRKckLJXTYeWg== X-Google-Smtp-Source: AGHT+IHdP+cCSWTvD+87l9JrZmPVTmSpURuy7YzU/9ihGfD9uR1Aa2DcxlQZlNBD7Tvco0iNQQ5Pmw== X-Received: by 2002:a05:6512:2247:b0:500:7dcc:621 with SMTP id i7-20020a056512224700b005007dcc0621mr6544464lfu.31.1693777317228; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:56 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 08/12] usb: typec: support generating Type-C port names for userspace Date: Mon, 4 Sep 2023 00:41:46 +0300 Message-Id: <20230903214150.2877023-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We need a way to generate and return the Type-C port device names. For example, it is going to be used by the DRM to provide PATH property for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/class.c | 14 ++++++++++++++ include/linux/usb/typec.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 9c1dbf3c00e0..7394a2ecef6f 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -2327,6 +2327,20 @@ void typec_unregister_port(struct typec_port *port) } EXPORT_SYMBOL_GPL(typec_unregister_port); +/** + * typec_port_get_name - Get USB Type-C Port name + * @port: The port to describe + * + * Returns a name of the passed USB Type-C port on success or NULL when the + * port has not been enumerated yet. The resulting string should be freed by + * the caller. + */ +char *typec_port_get_name(struct typec_port *port) +{ + return kasprintf(GFP_KERNEL, "typec:%s", dev_name(&port->dev)); +} +EXPORT_SYMBOL_GPL(typec_port_get_name); + static int __init typec_init(void) { int ret; diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 8fa781207970..4aa9c9378383 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -303,6 +303,8 @@ struct typec_plug *typec_register_plug(struct typec_cable *cable, struct typec_plug_desc *desc); void typec_unregister_plug(struct typec_plug *plug); +char *typec_port_get_name(struct typec_port *port); + void typec_set_data_role(struct typec_port *port, enum typec_data_role role); void typec_set_pwr_role(struct typec_port *port, enum typec_role role); void typec_set_vconn_role(struct typec_port *port, enum typec_role role); From patchwork Sun Sep 3 21:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719950 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 D913CCA0FF8 for ; Sun, 3 Sep 2023 21:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349595AbjICVmS (ORCPT ); Sun, 3 Sep 2023 17:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349132AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9221711A for ; Sun, 3 Sep 2023 14:41:59 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b962c226ceso13269541fa.3 for ; Sun, 03 Sep 2023 14:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777318; x=1694382118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=UHecZlFu28oyM1EdwF5xu4mbh3c2hb9MD1AU+tQzl8OtnJ90IX3AnYpsaXP5H/9n+K 7RSSHsOk6xIOwWDE4bzOUWVpuwqj4GACfNrd9MPwiQGsouwn9HIoabmEZiv31jSd1KrL uH23NUO7LadsBKSRoVYdeINOieKFf8Bho2p5Vo7JqZ3cT5Ev0sLvodGS/LF7wv5huys8 xPfGsgB9scNjYQbe3XUeXoj51Oh2/YtvW2bmycHFSM6JDAfHrhk2JqaNa2ftxlwZdEOY q255uEOuw3G3ki2y9VodbHLknRoerdOIWj9YaEAZaymp4DGlP7RHW0bVu2DXodZvkzvx nbsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777318; x=1694382118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k1gyG4EA+KF88AUvqDVJpMyc5ibJn0KvVHVwRSeTDTM=; b=ETijjxnvpD4ArWHKNGLQyaLpz5ZAmoj5YaSd0O9TCAzGyhzi4stBJtLkAUri/8f7rh 9dIZK2YfTB9gw2U3Lby8aIfNj70bXUZRF6Dvb96pcy7PgnxCrlzFfdeqVBvVwUZ5FjsQ JmWbTWqRAyLiKcS/yIJbpasLi+R07nklQ/IU6zxAcgjhxgphf1HJmqUz7f4f70cas5Ct dCbYU1/61pYVapafSI8ASPEfe88jk4J6dpwXQFD9nILKUYSL60nm0W8VvowmP57zx85P A1PhQmiG0iZOIBObOeLHpeSxkypcb8KjV/7/bOq+dJwT21/VRnE1VeUwvZgk0TLm7xxS 0dJg== X-Gm-Message-State: AOJu0YyyjOzd0AHRxkXePLPPa1WlyJhLmL4wkJfICoHJI8SdsJ090m4Y j8xTtX0dAsO0SwLN5AXRQTQo4g== X-Google-Smtp-Source: AGHT+IFeimZforUo3xm2aTW6r+gvYdhOH4RX08O1w99CKPaCyS3lubUtNJ5cXMhhp/mnVE4/u6CHlg== X-Received: by 2002:a05:6512:3b8a:b0:4f8:7055:6f7e with SMTP id g10-20020a0565123b8a00b004f870556f7emr6244283lfv.44.1693777317966; Sun, 03 Sep 2023 14:41:57 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:57 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 09/12] usb: typec: tcpm: support generating Type-C port names for userspace Date: Mon, 4 Sep 2023 00:41:47 +0300 Message-Id: <20230903214150.2877023-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org We need a way to generate and return the Type-C port device names. For example, it is going to be used by the DRM to provide PATH property for DisplayPort connectors. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/tcpm.c | 14 ++++++++++++++ include/linux/usb/tcpm.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index d962f67c95ae..9709b56a3046 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5539,6 +5539,20 @@ bool tcpm_port_is_toggling(struct tcpm_port *port) } EXPORT_SYMBOL_GPL(tcpm_port_is_toggling); +/** + * tcpm_port_get_name - get the name of the corresponding USB Type-C port + * @port: TCPM port instance + * + * Returns a name of the USB Type-C port correponding to the passed TCPM port + * instance on success or NULL when the port has not been enumerated yet. The + * resulting string should be freed by the caller. + */ +char *tcpm_port_get_name(struct tcpm_port *port) +{ + return typec_port_get_name(port->typec_port); +} +EXPORT_SYMBOL_GPL(tcpm_port_get_name); + static void tcpm_enable_frs_work(struct kthread_work *work) { struct tcpm_port *port = container_of(work, struct tcpm_port, enable_frs); diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index ab7ca872950b..623c34788680 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -161,6 +161,8 @@ struct tcpm_port; struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc); void tcpm_unregister_port(struct tcpm_port *port); +char *tcpm_port_get_name(struct tcpm_port *port); + void tcpm_vbus_change(struct tcpm_port *port); void tcpm_cc_change(struct tcpm_port *port); void tcpm_sink_frs(struct tcpm_port *port); From patchwork Sun Sep 3 21:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720376 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 6E187CA0FE3 for ; Sun, 3 Sep 2023 21:42:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349620AbjICVmT (ORCPT ); Sun, 3 Sep 2023 17:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349120AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60EA8127 for ; Sun, 3 Sep 2023 14:42:00 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5008d16cc36so1418845e87.2 for ; Sun, 03 Sep 2023 14:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777318; x=1694382118; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Fl8gZia3d8uGRSMrCOuo+xZGwzdrHyhk9K+cL7FZyc=; b=WTpHh5M9kY04howTyEB8GN/GLm/GKC1zwGchyEUCNR7tihUUiXkVO83OSwPoA89lbE WlpYyvcDBWvWB6vsQlANHsA8Enpx+lSFlswXgAT9BAOY9oeMeDOn6z+NMZM23+S4XkPU YOOPgUg2ZMC8dl6oEVqE0lqbXCNtD8D6KPmpjYDJNyGOrXayYg9o8hJgD5xLkS64qCf8 sEIkZNXYcS9Irzhb/k/Sv+AYigXMFbdLBbzIP5ZT4y3x8KUqxW6SFhgA9eDLK2vJBfw/ C7taRXEotxCJt5eBv/IYqro7O6fODj1/nNKu161429SNm0BkFuViFeKxtKKbEdhEBCrY uAuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777318; x=1694382118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Fl8gZia3d8uGRSMrCOuo+xZGwzdrHyhk9K+cL7FZyc=; b=AAf0XkIfE3yjK5gEHKZ+6uKkzNCqJIRFRq01OX6llhPVtyHt+ujw78D7CbuDYk+sNq WIe9LF65LCPr9tWHdQfI6JX3WqyVtQb2Vt1GljWybPWDsdtAYnQnPvKgCSsuKFaLEqnc K6zqtTo30IkTh8SuB9Nvy8F9u4wccOXibmF/3lMs0Wv6HHT1KinsD2ADGYtVdBNl2fTq UYPcYgerqKBXNhbjTnKyYaV2EFA1pKH+KwsKN82uohr7uYKFTCZsyJqrbetOid7e9rN3 2Qw6fV7cSnyI6zB2AFe8woNJ7gzyLlh9m0fadc4cnmXpzGOw301b7B3cxwEtXSirN/gc TVpA== X-Gm-Message-State: AOJu0Yy/tOl0JDTzYiOiCtlkbo7CUahUj/5AnN3BwMUPcvZQaLxym87R VTXdfZKbrSz9m/GgzdIZIRFl0Q== X-Google-Smtp-Source: AGHT+IFB7g1NLcGbFTo55gFtReAERXtRLC3wSNcCmU3/Hx6wGeI5ha18iUymtWlOuu8WNDnb4g6j1g== X-Received: by 2002:a05:6512:446:b0:500:9bbf:da17 with SMTP id y6-20020a056512044600b005009bbfda17mr4134008lfk.51.1693777318743; Sun, 03 Sep 2023 14:41:58 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:58 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 10/12] usb: typec: qcom: implement proper error path in probe() Date: Mon, 4 Sep 2023 00:41:48 +0300 Message-Id: <20230903214150.2877023-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Implement proper error path in the qcom_pmic_typec_probe(). This makes sure that we properly disable hardware blocks and do not leak memory. Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index 581199d37b49..ceda594a8d56 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -258,15 +258,22 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto tcpm_unregister_port; ret = qcom_pmic_typec_pdphy_start(tcpm->pmic_typec_pdphy, tcpm->tcpm_port); if (ret) - goto fwnode_remove; + goto typec_stop; return 0; + +typec_stop: + qcom_pmic_typec_port_stop(tcpm->pmic_typec_port); + +tcpm_unregister_port: + tcpm_unregister_port(tcpm->tcpm_port); + fwnode_remove: fwnode_remove_software_node(tcpm->tcpc.fwnode); From patchwork Sun Sep 3 21:41:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720377 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 80C38CA0FF3 for ; Sun, 3 Sep 2023 21:42:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349612AbjICVmR (ORCPT ); Sun, 3 Sep 2023 17:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349179AbjICVmE (ORCPT ); Sun, 3 Sep 2023 17:42:04 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F32133 for ; Sun, 3 Sep 2023 14:42:01 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-500bb392ab7so1457697e87.1 for ; Sun, 03 Sep 2023 14:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777319; x=1694382119; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6Z9KfdzRz+e1f0Dn+tIMZYjzQ2uNwluev0VEi7a5dtY=; b=bLiNoc2xYPP7AyRYDhGdrqngyBpzEC0olw884TRdE1gasT/b2exvR9K4qCWnr5YBtF 6MIXCjqUqo2JQ1i3JdI4YHxA47N1EEtd+084xcuIFWZ7tDNlkeyTnolh84j1PO5waMDq NhvmZQ4lJ5YFo50avGCVH25BTBJv5TkopOHljmsTkpi6dunjR/FADyOG5H5qvMF5Cppr EcoY7lYQMM8vpMFnHIR56G8H8SKp69NNZ5RVhYFrO7sGaTkataeHWNx6CApbmdTT7qYR 4T9lMCOh4CoUBVtiJL+k89UnTiPWyZ7EO4bL7/lSr/7W5aQO6ueBUsYZXL6AD98la6BZ 5z/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777319; x=1694382119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6Z9KfdzRz+e1f0Dn+tIMZYjzQ2uNwluev0VEi7a5dtY=; b=WE+VGbszigt+CO3IL/jK8nLRJuWc7SJYFaSxW08CTsqRMgWiZYvtE2f03H8c3eNWJb SjHbFSwtwFZimhVOqD2JbEZxfguPUvlHuO/X2iaxtyULSN/BydQmzVZ9X33NC0klJ6Lo 9pe1n6/M7IKxqhEgdho3qC6oeOn+96W6qxR9CR7/DMWZVqjYv9j89IUQs5CzWbccKzqp NtHjJSTDV791e8xYAA1rU3HHCvQ1cakYQLuGpZeBJeK94OiilgKsGwlvDKS3gf1Nguij yvyJXhsdDVeaNX/iwHCsaH6KHwTElXOu5VFSXFZ+ksfWMzGVDoKedMSh3zNSgZIAOcpb rUUA== X-Gm-Message-State: AOJu0Yw4U6G/S7gDHfVuy0N5pJT0iovawx+m0VhbDASk666VhQZKX2cD C6kLqlb90zQmHsZ43UR8Ls/4XH1QJKj/sPy8JLg= X-Google-Smtp-Source: AGHT+IEMobz+Krc+0cqSQPSTTEZbkkDAuHF3uHKlCMRtDr3G2ANxRagameLnEyWRzywcqzd4HevbIQ== X-Received: by 2002:a05:6512:ac3:b0:4f9:5a87:1028 with SMTP id n3-20020a0565120ac300b004f95a871028mr6541101lfu.30.1693777319560; Sun, 03 Sep 2023 14:41:59 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:59 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 11/12] usb: typec: qcom: extract DRM bridge functionality to separate file Date: Mon, 4 Sep 2023 00:41:49 +0300 Message-Id: <20230903214150.2877023-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In order to simplify source code and to reduce the amount of ifdefs in the C files, extract the DRM bridge functionality to the separate file. Suggested-by: Heikki Krogerus Suggested-by: Bryan O'Donoghue Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/Makefile | 4 ++ drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 40 +++---------------- .../usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c | 38 ++++++++++++++++++ .../usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h | 20 ++++++++++ 4 files changed, 67 insertions(+), 35 deletions(-) create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h diff --git a/drivers/usb/typec/tcpm/qcom/Makefile b/drivers/usb/typec/tcpm/qcom/Makefile index dc1e8832e197..6d01ec97c9fd 100644 --- a/drivers/usb/typec/tcpm/qcom/Makefile +++ b/drivers/usb/typec/tcpm/qcom/Makefile @@ -4,3 +4,7 @@ obj-$(CONFIG_TYPEC_QCOM_PMIC) += qcom_pmic_tcpm.o qcom_pmic_tcpm-y += qcom_pmic_typec.o \ qcom_pmic_typec_port.o \ qcom_pmic_typec_pdphy.o + +ifneq ($(CONFIG_DRM),) + qcom_pmic_tcpm-y += qcom_pmic_typec_drm.o +endif diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index ceda594a8d56..b9d4856101c7 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -18,8 +18,7 @@ #include #include -#include - +#include "qcom_pmic_typec_drm.h" #include "qcom_pmic_typec_pdphy.h" #include "qcom_pmic_typec_port.h" @@ -34,9 +33,9 @@ struct pmic_typec { struct tcpc_dev tcpc; struct pmic_typec_pdphy *pmic_typec_pdphy; struct pmic_typec_port *pmic_typec_port; + struct pmic_typec_drm *pmic_typec_drm; bool vbus_enabled; struct mutex lock; /* VBUS state serialization */ - struct drm_bridge bridge; }; #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc) @@ -150,35 +149,6 @@ static int qcom_pmic_typec_init(struct tcpc_dev *tcpc) return 0; } -#if IS_ENABLED(CONFIG_DRM) -static int qcom_pmic_typec_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) -{ - return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; -} - -static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { - .attach = qcom_pmic_typec_attach, -}; - -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - tcpm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; -#ifdef CONFIG_OF - tcpm->bridge.of_node = of_get_child_by_name(tcpm->dev->of_node, "connector"); -#endif - tcpm->bridge.ops = DRM_BRIDGE_OP_HPD; - tcpm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; - - return devm_drm_bridge_add(tcpm->dev, &tcpm->bridge); -} -#else -static int qcom_pmic_typec_init_drm(struct pmic_typec *tcpm) -{ - return 0; -} -#endif - static int qcom_pmic_typec_probe(struct platform_device *pdev) { struct pmic_typec *tcpm; @@ -241,9 +211,9 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); - ret = qcom_pmic_typec_init_drm(tcpm); - if (ret) - return ret; + tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev); + if (IS_ERR(tcpm->pmic_typec_drm)) + return PTR_ERR(tcpm->pmic_typec_drm); tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c new file mode 100644 index 000000000000..e202eb7b52db --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#include + +#include + +struct pmic_typec_drm { + struct drm_bridge bridge; +}; + +static int qcom_pmic_typec_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; +} + +static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { + .attach = qcom_pmic_typec_attach, +}; + +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +{ + struct pmic_typec_drm *tcpm_drm; + + tcpm_drm = devm_kzalloc(dev, sizeof(*tcpm_drm), GFP_KERNEL); + if (!tcpm_drm) + return ERR_PTR(-ENOMEM); + + tcpm_drm->bridge.funcs = &qcom_pmic_typec_bridge_funcs; + tcpm_drm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector"); + tcpm_drm->bridge.ops = DRM_BRIDGE_OP_HPD; + tcpm_drm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + + return ERR_PTR(devm_drm_bridge_add(dev, &tcpm_drm->bridge)); +} diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h new file mode 100644 index 000000000000..01f4bb71346b --- /dev/null +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023, Linaro Ltd. All rights reserved. + */ + +#ifndef __QCOM_PMIC_DRM_H__ +#define __QCOM_PMIC_DRM_H__ + +struct pmic_typec_drm; + +#if IS_ENABLED(CONFIG_DRM) +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev); +#else +static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +{ + return NULL; +} +#endif + +#endif /* __QCOM_PMIC_DRM_H__ */ From patchwork Sun Sep 3 21:41:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 719951 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 51CC6CA0FFF for ; Sun, 3 Sep 2023 21:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349586AbjICVmK (ORCPT ); Sun, 3 Sep 2023 17:42:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349291AbjICVmG (ORCPT ); Sun, 3 Sep 2023 17:42:06 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A776D9 for ; Sun, 3 Sep 2023 14:42:01 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5009969be25so1321457e87.3 for ; Sun, 03 Sep 2023 14:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693777320; x=1694382120; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VRU3YcmHhtMgrEwiKr0jiCPmTZjWFsu5C3QySeLjrFk=; b=THFkBtld5ZsUEWb6H7JLFiGSPRQ+dD2nTuY9ZyosTxdnMQYrFpMp996995G4SsnEOz mxkG6hcuNZC1NM94capcIUbsN2NWauNTEZQn56ShrcMvd2rsWkuct8PwtmO7xnVJQ3xN J6zAH3jpoNu/dPEW6LYdWUQ5JqOHYXDRjyN1T0P/Oi3IxUDOTPsdnpEzJb3mAImzsHAZ vOMzaxYVA0fAD+52jn5f+yfeoIeKkGm6XTgbuPPdUZIctJCOhKszdt+MeE23/o4hezBT BXJLu2R+Vn4wtKxbgD22lxYH18rs7QX2uJpSFk6sf6t14Yr85rS9e7bE9ltN5Vf5X2n8 yLCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693777320; x=1694382120; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VRU3YcmHhtMgrEwiKr0jiCPmTZjWFsu5C3QySeLjrFk=; b=PJ21ygkDmCpwYeVzr2GcGqIHU+gqXuhS9FdxEpBxNBgPrz0rVXZHWOtA+tKKy9NOa9 XvBXgKE05zDuWfhAdvMBQnKzvF8zCVGBbMODZeTPuSXwbfQoFATRcj+VfHM63Uk3GXSy gyOZ7YtQWKAwdXOp7kZXkx7y0+7Bqnt9cA9P1CCzCw4WZooe9m7RtKGIDVJ5lB3aXIqc eUR+lvs8C5k47n1agucShD6D8Q+PwynOCqRN8p0FV6g1CttYp9+nshhWbBvKQ77D9mY2 T5r8r/vY+JgDlWGx6pyTF/Y2q1GFm+G8eqthe1pSjeh7rW9ic6SUmh2UUeLjoVzHBM/x 8Frg== X-Gm-Message-State: AOJu0YxrekWqE8YAowhC9nzbmYZ+oBcigaVaWwNpxYFeZpjNOeJ26YTq jHx61HG7LuKdq/PZURgj5ULQbA== X-Google-Smtp-Source: AGHT+IFsqgNhsNbkZVa3cNm+AdNIgulADr18z4rrsHYsJZU44KXFgwMqPl+5UxHTsBskue63qdvb8w== X-Received: by 2002:a05:6512:3b26:b0:4fb:caed:95c3 with SMTP id f38-20020a0565123b2600b004fbcaed95c3mr5991678lfv.53.1693777320290; Sun, 03 Sep 2023 14:42:00 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id x17-20020ac25dd1000000b004f8555f7aa1sm1422506lfq.52.2023.09.03.14.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 14:41:59 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , "Bryan O'Donoghue" , Guenter Roeck , Heikki Krogerus , Janne Grunau , Simon Ser , Andy Gross , Bjorn Andersson , Konrad Dybcio , Greg Kroah-Hartman Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [RFC PATCH v1 12/12] usb: typec: qcom: define the bridge's path Date: Mon, 4 Sep 2023 00:41:50 +0300 Message-Id: <20230903214150.2877023-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> References: <20230903214150.2877023-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org In order to notify the userspace about the DRM connector's USB-C port, export the corresponding port's name as the bridge's path field. Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 11 +++++++---- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c | 4 +++- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h | 6 ++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c index b9d4856101c7..452dc6437861 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c @@ -156,6 +156,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; const struct pmic_typec_resources *res; struct regmap *regmap; + char *tcpm_name; u32 base[2]; int ret; @@ -211,10 +212,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) mutex_init(&tcpm->lock); platform_set_drvdata(pdev, tcpm); - tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev); - if (IS_ERR(tcpm->pmic_typec_drm)) - return PTR_ERR(tcpm->pmic_typec_drm); - tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector"); if (!tcpm->tcpc.fwnode) return -EINVAL; @@ -225,6 +222,12 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev) goto fwnode_remove; } + tcpm_name = tcpm_port_get_name(tcpm->tcpm_port); + tcpm->pmic_typec_drm = qcom_pmic_typec_init_drm(dev, tcpm_name); + kfree(tcpm_name); + if (IS_ERR(tcpm->pmic_typec_drm)) + return PTR_ERR(tcpm->pmic_typec_drm); + ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port, tcpm->tcpm_port); if (ret) diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c index e202eb7b52db..7bd7f4bf3539 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.c @@ -21,7 +21,8 @@ static const struct drm_bridge_funcs qcom_pmic_typec_bridge_funcs = { .attach = qcom_pmic_typec_attach, }; -struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path) { struct pmic_typec_drm *tcpm_drm; @@ -33,6 +34,7 @@ struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) tcpm_drm->bridge.of_node = of_get_child_by_name(dev->of_node, "connector"); tcpm_drm->bridge.ops = DRM_BRIDGE_OP_HPD; tcpm_drm->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; + tcpm_drm->bridge.path = devm_kstrdup(dev, path, GFP_KERNEL); return ERR_PTR(devm_drm_bridge_add(dev, &tcpm_drm->bridge)); } diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h index 01f4bb71346b..259c047265f7 100644 --- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h +++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_drm.h @@ -9,9 +9,11 @@ struct pmic_typec_drm; #if IS_ENABLED(CONFIG_DRM) -struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev); +struct pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path); #else -static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev) +static inline pmic_typec_drm *qcom_pmic_typec_init_drm(struct device *dev, + const char *path) { return NULL; }