[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <400476ec-4b81-6a3d-651a-dbfa8eb5717e@189.cn>
Date: Tue, 22 Feb 2022 21:53:45 +0800
From: Sui Jingfeng <15330273260@....cn>
To: Maxime Ripard <maxime@...no.tech>
Cc: Thomas Zimmermann <tzimmermann@...e.de>,
Roland Scheidegger <sroland@...are.com>,
Zack Rusin <zackr@...are.com>,
Christian Gmeiner <christian.gmeiner@...il.com>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Dan Carpenter <dan.carpenter@...cle.com>,
Krzysztof Kozlowski <krzk@...nel.org>,
Andrey Zhizhikin <andrey.zhizhikin@...ca-geosystems.com>,
Sam Ravnborg <sam@...nborg.org>,
"David S . Miller" <davem@...emloft.net>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
Lucas Stach <l.stach@...gutronix.de>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Ilia Mirkin <imirkin@...m.mit.edu>,
Qing Zhang <zhangqing@...ngson.cn>,
suijingfeng <suijingfeng@...ngson.cn>,
linux-mips@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, dri-devel@...ts.freedesktop.org,
Randy Dunlap <rdunlap@...radead.org>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v10 3/4] drm/lsdc: add drm driver for loongson display
controller
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.
Powered by blists - more mailing lists