From patchwork Sun Oct 2 06:45:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Trimarchi X-Patchwork-Id: 2416 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 82EDB3F331 for ; Sun, 2 Oct 2022 08:45:52 +0200 (CEST) Received: by mail-ed1-f72.google.com with SMTP id b16-20020a056402279000b0044f1102e6e2sf6763029ede.20 for ; Sat, 01 Oct 2022 23:45:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1664693152; cv=pass; d=google.com; s=arc-20160816; b=mGbmQpe2Y4nKCjo6lLUWq5URwAZp58NDrVDHb8c6nKw6TAaLKcG0rxwokGs+nR+VPn z0MfLJPg5wP+nrWZuvUluLguLTK/lLkDWlj9tz8qTm5+Cjgh1aNno3m+ftL0ZczhsNba dbciLpKhXd662i7kT+CkKhMTVxLJbFJ9HsoauqVrSvykMAWrxbBlvNjj6V2Ef27MrVfc ciFXiKdj4XAfGGrfkb02KfsSXLcCpK5MBadOUzyoE5v3/8HD9hmShR5yoxlZxjoMIg7e oB9K50FgzW/a6HokjS+2g5uLKHi6zTYd1McfnWLT8nT0dqPm0qmtV0CnRvdJ9o52yWOy LLYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=pNk0KmeAaPBBgH8rf2/myOUZMQfYE0ygligWws/SSIQ=; b=eYW8i6QLOjUdOAk+hFo0zuLBHNVpsSHhll8h1vZLUTHsuv6om/+s6P6NGNa066F8kr xfU3JXrItlOvtKIwVLCcHomL1DBcHJyrp7RFikbjBNUABEBOHlYc9WBFVDe6VD/4NEhs JtYYhZKEJt2P3B2s//c/FUQtuRs8QH41wmQM4ysVHcDKAZok6u76avRT499xnb159w3+ TQDpUX8Qj5VHEaUDaJz8ZPCIyG12m1k1RBU7pWkDtWEysXCA3KAo3srT73SNWi7efelf YrX/wl3vMPrnm/TPQPDMgk0+lOpUjCKQD3OiGKLGQugvI2n8eQStAdD1lpma5iYOgl1p yayg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=omdSgHFq; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date; bh=pNk0KmeAaPBBgH8rf2/myOUZMQfYE0ygligWws/SSIQ=; b=OdFACohoOJGvR5BzaX7htUxZNqPteXxGDrpspyCKE12aDPonToDBnfOJ6dWdvinC/i +ULsBe3R6FWRkUfW+wNXayXsHGlVosRe2ABdk23SCHY9Z6nPW7G464tVmfWuAZSkJJ0k sejyzGNzfinjDoMHwKpcYn7OwlJ6rj/6DJICs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date; bh=pNk0KmeAaPBBgH8rf2/myOUZMQfYE0ygligWws/SSIQ=; b=kYlJSUajhQ8hE4wPPYUomOqaVc/znEvfw2td69itiA90wWuTn4yqJD/a5WHU6zPsNa xLTKc0mKr3QbzCR95xgOSOoSvAlLFznbgohyLq20pNcGj/Y5HfVXps1xn8X6EViGXeHR JL6pT0lOwU2NrVF2VcEOQRphc9sempghNjQ9T/SgDDPjHxt4SgknPVSiFp5iwvBoy3zO sz+XMRNEO6DhhrLtw/2YmV7ijCXyNfbk0zjmHrkvHGbKYAKrRAjH8sLzjra9no25iXKj /n5lGAnhKX2cymEI+f8cvYfnIEocaX44MZsSexbIdJiEkzhEu35wAxsfnBGCX9diDXWn 77wg== X-Gm-Message-State: ACrzQf3pt5ngO5HV5StxI+N+q7xtnrWy9xGJsXKTVl2vHlWhf3nz3Dbn ExpvgFuIVoGsoN5Q6HTyqH7xW6hM X-Google-Smtp-Source: AMsMyM4SjfT7pVfuyJIgL2U0E/ixyyuIWGwFuI6yyDtPCprIXhw5X5D0TFvPHbj/cj6YYv4huxccFA== X-Received: by 2002:a05:6402:3806:b0:450:bad8:8cd5 with SMTP id es6-20020a056402380600b00450bad88cd5mr14305693edb.305.1664693152188; Sat, 01 Oct 2022 23:45:52 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:a10a:b0:77d:b590:5e60 with SMTP id t10-20020a170906a10a00b0077db5905e60ls4001841ejy.8.-pod-prod-gmail; Sat, 01 Oct 2022 23:45:51 -0700 (PDT) X-Received: by 2002:a17:907:2bd5:b0:76f:591c:466b with SMTP id gv21-20020a1709072bd500b0076f591c466bmr11041818ejc.504.1664693150836; Sat, 01 Oct 2022 23:45:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664693150; cv=none; d=google.com; s=arc-20160816; b=l+ePdkNnuExnrBJwn0u8jmGu2xbvPV8DmgTjwNwWiGtDGrMZvotUvYwSxGjXlYeahV uNUCq+lGmS57tnIJ5gIWwiqEWBfqJLmW/3Oq63QLnRS3kTIQ/jtyrwPOroc27SAMcAta 3nnVFUHPz5TOv5Z2l5o2akEL8X3F6Q+iHbkOXlJWlyt0tyXir/GNi4t3Y8ZjMFS6PC+9 umZmz0mpoX9dfJrEswOleAy6/xsqVO920vyCk5JU8TXJ5aCxlJB1Su6gjZphxBb56fVH w0/jpzyiRlVxOatM2iJRzQSFLF9WgM8r9UGgQGtwfbVnzA7HTtp9uny7NLGH3EJS+jWq r8Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gtEJxbrwC/UQVf48sJy2NN3O3k5LpfsDQAoSkyusABE=; b=FdNp+W0CSOfabtmmAnxwc39kMRbw7bvxeuUDmS78geoGAzBlBi+PP34n9FhE03qBIF AgF7zDvH5fM22uS34A94b8Jqq9juLqBFAmjeVTvYzw53u8JMQEO+FQQlc//osVNJ/dUj VuoSX1Fim8ug34r59Ca5hKNkqH+06jnlfbRZ3jJYZw5halIVnWn8pHk9blPDDgNuf3Jv XQPfQsSURrvzpsSVo9i8mhkz0GcEQ3ezAwq/7V2x7kM8b3Tidy9Af7ksnn8LXFkHioVP qxIG4JySHV+kdFZ/n1dw2DZK04jlDDDwjwyz40GrnDCygNJfX6vf9GxobWnAao5lHMmS b+9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=omdSgHFq; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id n19-20020a1709067b5300b0073dde87e10dsor2262593ejo.79.2022.10.01.23.45.50 for (Google Transport Security); Sat, 01 Oct 2022 23:45:50 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:3205:b0:770:8554:c4ee with SMTP id xg5-20020a170907320500b007708554c4eemr11785485ejb.39.1664693150522; Sat, 01 Oct 2022 23:45:50 -0700 (PDT) Received: from panicking.. ([109.52.206.103]) by smtp.gmail.com with ESMTPSA id 26-20020a170906329a00b0077f5e96129fsm3569894ejw.158.2022.10.01.23.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 23:45:50 -0700 (PDT) From: Michael Trimarchi To: Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , David Airlie , Daniel Vetter Cc: Kishon Vijay Abraham I , Vinod Koul , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-amarula@amarulasolutions.com Subject: [RFC PATCH 4/4] drm/rockchip: rgb: Add dphy connection to rgb output Date: Sun, 2 Oct 2022 08:45:40 +0200 Message-Id: <20221002064540.2500257-5-michael@amarulasolutions.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221002064540.2500257-1-michael@amarulasolutions.com> References: <20221002064540.2500257-1-michael@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: michael@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=omdSgHFq; spf=pass (google.com: domain of michael@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=michael@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Dispite the commit 1f0f015151727, the rgb output has an option to allow to sent the output pin using the dsi/lvds/ttl logic. The only way to do and stay on the same design is let the rockchip_rgb block to grab the handle if it is present and enable it. The present of this handle depends on dts configuration I have a full working example with an hardware with mixed lines on direct logic and using the phy, with the follow dts example: panel: panel { compatible = "panel-dpi"; ... panel-timing { clock-frequency = <30000000>; ... }; port { panel_rgb_in: endpoint { remote-endpoint = <&vopb_out_rgb>; }; }; }; &vopb_out { vopb_out_rgb: endpoint@2 { reg = <2>; remote-endpoint = <&panel_rgb_in>; }; }; &vopb { status = "okay"; pinctrl-names = "default", "sleep"; pinctrl-0 = <&lcdc_rgb_pins>; pinctrl-1 = <&lcdc_sleep_pins>; phys = <&dsi_dphy>; phy-names = "dphy"; }; Signed-off-by: Michael Trimarchi --- drivers/gpu/drm/rockchip/rockchip_rgb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index 75eb7cca3d82..c725774a0f40 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ struct rockchip_rgb { struct drm_bridge *bridge; struct drm_encoder encoder; struct drm_connector connector; + struct phy *dphy; int output_mode; }; @@ -168,6 +170,22 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, goto err_free_connector; } + /* PHY */ + rgb->dphy = devm_phy_get(dev, "dphy"); + if (!IS_ERR(rgb->dphy)) { + ret = phy_init(rgb->dphy); + if (ret) + return ERR_PTR(ret); + + ret = phy_set_mode(rgb->dphy, PHY_MODE_TTL); + if (ret) + return ERR_PTR(ret); + + ret = phy_power_on(rgb->dphy); + if (ret) + return ERR_PTR(ret); + } + return rgb; err_free_connector: