devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sui Jingfeng <15330273260@189.cn>
To: Maxime Ripard <maxime@cerno.tech>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
	Roland Scheidegger <sroland@vmware.com>,
	Zack Rusin <zackr@vmware.com>,
	Christian Gmeiner <christian.gmeiner@gmail.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Rob Herring <robh+dt@kernel.org>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Andrey Zhizhikin <andrey.zhizhikin@leica-geosystems.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	"David S . Miller" <davem@davemloft.net>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Ilia Mirkin <imirkin@alum.mit.edu>,
	Qing Zhang <zhangqing@loongson.cn>,
	suijingfeng <suijingfeng@loongson.cn>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Randy Dunlap <rdunlap@infradead.org>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v10 3/4] drm/lsdc: add drm driver for loongson display controller
Date: Tue, 22 Feb 2022 21:53:45 +0800	[thread overview]
Message-ID: <400476ec-4b81-6a3d-651a-dbfa8eb5717e@189.cn> (raw)
In-Reply-To: <20220222082747.66otrkc4zwvhem7w@houat>


On 2022/2/22 16:27, Maxime Ripard wrote:
> Hi,
>
> On Sun, Feb 20, 2022 at 10:55:53PM +0800, Sui Jingfeng wrote:
>> +/* lsdc_get_display_timings_from_dtb - Get display timings from the device tree
>> + *
>> + * @np: point to the device node contain the display timings
>> + * @pptim: point to where the pointer of struct display_timings is store to
>> + */
>> +static void lsdc_get_display_timings_from_dtb(struct device_node *np,
>> +					      struct display_timings **pptim)
>> +{
>> +	struct display_timings *timings;
>> +
>> +	if (!np)
>> +		return;
>> +
>> +	timings = of_get_display_timings(np);
>> +	if (timings)
>> +		*pptim = timings;
>> +}
> This is not documented in your binding.
>
>> +static int lsdc_get_connector_type(struct drm_device *ddev,
>> +				   struct device_node *output,
>> +				   unsigned int index)
>> +{
>> +	const char *name;
>> +	int ret;
>> +
>> +	ret = of_property_read_string(output, "connector", &name);
>> +	if (ret < 0)
>> +		return DRM_MODE_CONNECTOR_Unknown;
>> +
>> +	if (strncmp(name, "vga-connector", 13) == 0) {
>> +		ret = DRM_MODE_CONNECTOR_VGA;
>> +		drm_info(ddev, "connector%d is VGA\n", index);
>> +	} else if (strncmp(name, "dvi-connector", 13) == 0) {
>> +		bool analog, digital;
>> +
>> +		analog = of_property_read_bool(output, "analog");
>> +		digital = of_property_read_bool(output, "digital");
>> +
>> +		if (analog && !digital)
>> +			ret = DRM_MODE_CONNECTOR_DVIA;
>> +		else if (analog && digital)
>> +			ret = DRM_MODE_CONNECTOR_DVII;
>> +		else
>> +			ret = DRM_MODE_CONNECTOR_DVID;
>> +
>> +		drm_info(ddev, "connector%d is DVI\n", index);
>> +	} else if (strncmp(name, "virtual-connector", 17) == 0) {
>> +		ret = DRM_MODE_CONNECTOR_VIRTUAL;
>> +		drm_info(ddev, "connector%d is virtual\n", index);
>> +	} else if (strncmp(name, "dpi-connector", 13) == 0) {
>> +		ret = DRM_MODE_CONNECTOR_DPI;
>> +		drm_info(ddev, "connector%d is DPI\n", index);
>> +	} else if (strncmp(name, "hdmi-connector", 14) == 0) {
>> +		int res;
>> +		const char *hdmi_type;
>> +
>> +		ret = DRM_MODE_CONNECTOR_HDMIA;
>> +
>> +		res = of_property_read_string(output, "type", &hdmi_type);
>> +		if (res == 0 && !strcmp(hdmi_type, "b"))
>> +			ret = DRM_MODE_CONNECTOR_HDMIB;
>> +
>> +		drm_info(ddev, "connector%d is HDMI, type is %s\n", index, hdmi_type);
>> +	} else {
>> +		ret = DRM_MODE_CONNECTOR_Unknown;
>> +		drm_info(ddev, "The type of connector%d is unknown\n", index);
>> +	}
>> +
>> +	return ret;
>> +}
> Your ports and that you're using the connectors bindings either.
>
>> +struct lsdc_connector *lsdc_connector_init(struct lsdc_device *ldev, unsigned int index)
>> +{
>> +	struct drm_device *ddev = &ldev->drm;
>> +	struct device_node *np = ddev->dev->of_node;
>> +	struct device_node *output = NULL;
>> +	unsigned int connector_type = DRM_MODE_CONNECTOR_Unknown;
>> +	struct device_node *disp_tims_np;
>> +	struct lsdc_connector *lconn;
>> +	struct drm_connector *connector;
>> +	int ret;
>> +
>> +	lconn = devm_kzalloc(ddev->dev, sizeof(*lconn), GFP_KERNEL);
>> +	if (!lconn)
>> +		return ERR_PTR(-ENOMEM);
>> +
>> +	lconn->index = index;
>> +	lconn->has_disp_tim = false;
>> +	lconn->ddc = NULL;
>> +
>> +	output = of_parse_phandle(np, "output-ports", index);
>> +	if (!output) {
>> +		drm_warn(ddev, "no output-ports property, please update dtb\n");
>> +		/*
>> +		 * Providing a blindly support even though no output-ports
>> +		 * property is provided in the dtb.
>> +		 */
>> +		goto DT_SKIPED;
>> +	}
> output-ports is not documented either.
Thanks for you take time review my patch, i will try to document it at 
next version.

  reply	other threads:[~2022-02-22 13:53 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-20 14:55 [PATCH v10 0/4] drm/lsdc: add drm driver for loongson display controller Sui Jingfeng
2022-02-20 14:55 ` [PATCH v10 1/4] MIPS: Loongson64: dts: update the display controller device node Sui Jingfeng
2022-02-20 18:18   ` Jiaxun Yang
2022-02-21  1:27     ` Sui Jingfeng
2022-02-21  9:19   ` Sergei Shtylyov
2022-02-21 10:01     ` Krzysztof Kozlowski
2022-02-21 13:57       ` Sui Jingfeng
2022-02-21 13:53     ` Sui Jingfeng
2022-02-20 14:55 ` [PATCH v10 2/4] Documentation/dt: Add descriptions for loongson display controller Sui Jingfeng
2022-02-20 18:22   ` Jiaxun Yang
2022-02-21  7:31     ` Krzysztof Kozlowski
2022-02-22 23:02   ` Rob Herring
2022-02-23 13:56     ` 隋景峰
2022-02-23 15:35       ` Sui Jingfeng
2022-02-23 15:44         ` Krzysztof Kozlowski
2022-02-23 15:40       ` Krzysztof Kozlowski
2022-02-20 14:55 ` [PATCH v10 3/4] drm/lsdc: add drm driver " Sui Jingfeng
2022-02-22  8:27   ` Maxime Ripard
2022-02-22 13:53     ` Sui Jingfeng [this message]
2022-02-22 14:46     ` Sui Jingfeng
2022-02-23 14:39       ` Maxime Ripard
2022-02-23 15:14         ` Sui Jingfeng
2022-02-23 15:41           ` Maxime Ripard
2022-02-23 15:45         ` Sui Jingfeng
2022-02-23 12:47   ` kernel test robot
2022-02-20 14:55 ` [PATCH v10 4/4] MAINTAINERS: add maintainers for DRM LSDC driver Sui Jingfeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=400476ec-4b81-6a3d-651a-dbfa8eb5717e@189.cn \
    --to=15330273260@189.cn \
    --cc=airlied@linux.ie \
    --cc=andrey.zhizhikin@leica-geosystems.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imirkin@alum.mit.edu \
    --cc=jiaxun.yang@flygoat.com \
    --cc=krzk@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maxime@cerno.tech \
    --cc=rdunlap@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=sroland@vmware.com \
    --cc=suijingfeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    --cc=tzimmermann@suse.de \
    --cc=zackr@vmware.com \
    --cc=zhangqing@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).