Re: [PATCH v5 7/9] drm/bridge: it6505: Register number of Type C switches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 22, 2022 at 05:34:36PM +0000, Prashant Malani wrote:
> From: Pin-Yen Lin <treapking@xxxxxxxxxxxx>
> 
> Parse the "switches" node, if available, and count and store the number
> of Type-C switches within it. The extcon registration is still
> supported, but we don't expect both extcon and typec-switch be
> registered at the same time.
> 
> This patch sets a foundation for the actual registering of Type-C
> switches with the Type-C connector class framework.
> 
> Signed-off-by: Pin-Yen Lin <treapking@xxxxxxxxxxxx>
> Signed-off-by: Prashant Malani <pmalani@xxxxxxxxxxxx>
> ---
> 
> v5 is the first version for this patch.
> 
>  drivers/gpu/drm/bridge/ite-it6505.c | 34 +++++++++++++++++++++++++----
>  1 file changed, 30 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 4b673c4792d7..b259f9f367f6 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -452,6 +452,7 @@ struct it6505 {
>  	struct delayed_work delayed_audio;
>  	struct it6505_audio_data audio;
>  	struct dentry *debugfs;
> +	int num_typec_switches;
>  
>  	/* it6505 driver hold option */
>  	bool enable_drv_hold;
> @@ -3229,13 +3230,28 @@ static void it6505_shutdown(struct i2c_client *client)
>  		it6505_lane_off(it6505);
>  }
>  
> +static int it6505_register_typec_switches(struct device *device, struct it6505 *it6505)
> +{
> +	struct device_node *of;
> +
> +	of = of_get_child_by_name(device->of_node, "switches");
> +	if (!of)
> +		return -ENODEV;
> +
> +	it6505->num_typec_switches = of_get_child_count(of);
> +	if (it6505->num_typec_switches <= 0)
> +		return -ENODEV;
> +
> +	return 0;
> +}

Not that I expect this to remain, but you have the same function in 2 
files. That's a clear sign this belongs in a helper.

Rob



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux