[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZBrgD61p/p17IOJL@smile.fi.intel.com>
Date: Wed, 22 Mar 2023 13:01:35 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Pin-yen Lin <treapking@...omium.org>
Cc: Andrzej Hajda <andrzej.hajda@...el.com>,
Neil Armstrong <neil.armstrong@...aro.org>,
Robert Foss <rfoss@...nel.org>,
Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
Jonas Karlman <jonas@...boo.se>,
Jernej Skrabec <jernej.skrabec@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Daniel Scally <djrscally@...il.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Prashant Malani <pmalani@...omium.org>,
Benson Leung <bleung@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
Xin Ji <xji@...logixsemi.com>, linux-kernel@...r.kernel.org,
Thomas Zimmermann <tzimmermann@...e.de>,
linux-acpi@...r.kernel.org,
Javier Martinez Canillas <javierm@...hat.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Lyude Paul <lyude@...hat.com>,
NĂcolas F . R . A . Prado
<nfraprado@...labora.com>, Allen Chen <allen.chen@....com.tw>,
dri-devel@...ts.freedesktop.org, Marek Vasut <marex@...x.de>,
Stephen Boyd <swboyd@...omium.org>,
chrome-platform@...ts.linux.dev, devicetree@...r.kernel.org,
Andi Shyti <andi.shyti@...ux.intel.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Douglas Anderson <dianders@...omium.org>,
Imre Deak <imre.deak@...el.com>,
Jani Nikula <jani.nikula@...el.com>,
Linus Walleij <linus.walleij@...aro.org>,
YueHaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH v14 03/10] drm/display: Add Type-C switch helpers
On Wed, Mar 22, 2023 at 06:46:32PM +0800, Pin-yen Lin wrote:
> Add helpers to register and unregister Type-C "switches" for bridges
> capable of switching their output between two downstream devices.
>
> The helper registers USB Type-C mode switches when the "mode-switch"
> and the "reg" properties are available in Device Tree.
...
> +config DRM_DISPLAY_DP_TYPEC_HELPER
> + bool
> + default y
def_bool y
> + depends on DRM_DISPLAY_HELPER
> + depends on DRM_DISPLAY_HELPER=TYPEC || TYPEC=y
> + help
> + DRM display helpers for USB Type-C Displayport Alternate mode.
Hmm... Dunno if this help is enough.
...
> + snprintf(name, sizeof(name), "%pfwP-%u", fwnode, port_num);
Would it be possible to have a dup in name and would it be a problem if so?
...
> +/**
> + * drm_dp_register_typec_switches() - register Type-C switches
> + * @dev: Device that registers Type-C switches
> + * @port: Device node for the switch
> + * @switch_desc: A Type-C switch descriptor
> + * @data: Private data for the switches
> + * @mux_set: Callback function for typec_mux_set
> + *
> + * This function registers USB Type-C switches for DP bridges that can switch
> + * the output signal between their output pins. This function uses devm_kcalloc
> + * to allocate memory, so it is expected to only call this in the driver probe
> + * functions.
> + *
> + * Currently only mode switches are implemented, and the function assumes the
> + * given @port device node has endpoints with "mode-switch" property.
> + * The port number is determined by the "reg" property of the endpoint.
`kernel-doc -v ...` should complain on absence of "Return" section.
> + */
...
> + switch_desc->typec_ports = devm_kcalloc(dev, switch_desc->num_typec_switches,
> + sizeof(struct drm_dp_typec_port_data),
sizeof(*switch_desc_typec_ports),
?
> + GFP_KERNEL);
> + if (!switch_desc->typec_ports)
> + return -ENOMEM;
...
> +#ifdef CONFIG_DRM_DISPLAY_DP_TYPEC_HELPER
Ah, maybe this should use IS_REACHABLE() ?
> +void drm_dp_unregister_typec_switches(struct drm_dp_typec_switch_desc *switch_desc);
> +int drm_dp_register_typec_switches(struct device *dev, struct fwnode_handle *port,
> + struct drm_dp_typec_switch_desc *switch_desc,
> + void *data, typec_mux_set_fn_t mux_set);
> +#else
> +static inline void drm_dp_unregister_typec_switches(struct drm_dp_typec_switch_desc *switch_desc)
> +{
> +}
> +static inline int drm_dp_register_typec_switches(
> + struct device *dev, struct fwnode_handle *port,
> + struct drm_dp_typec_switch_desc *switch_desc, void *data,
> + typec_mux_set_fn_t mux_set)
> +{
> + return -EOPNOTSUPP;
> +}
> +#endif
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists