[PATCH 3/3] usb: typec: altmodes/displayport: Notify drm subsys of hotplug events

Hans de Goede hdegoede at redhat.com
Mon Feb 25 16:19:23 UTC 2019


Hi,

On 25-02-19 15:06, Greg Kroah-Hartman wrote:
> On Mon, Feb 25, 2019 at 02:20:37PM +0100, Hans de Goede wrote:
>> Use the new drm_kms_call_oob_hotplug_notifier_chain() function to load

s/load/let/ fixed in my tree.

>> drm/kms drivers know about DisplayPort over Type-C hotplug events.
>>
>> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
>> ---
>>   drivers/usb/typec/altmodes/displayport.c | 34 ++++++++++++++++--------
>>   1 file changed, 23 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
>> index 35161594e368..87760ea252d6 100644
>> --- a/drivers/usb/typec/altmodes/displayport.c
>> +++ b/drivers/usb/typec/altmodes/displayport.c
>> @@ -13,6 +13,7 @@
>>   #include <linux/module.h>
>>   #include <linux/usb/pd_vdo.h>
>>   #include <linux/usb/typec_dp.h>
>> +#include <drm/drm_probe_helper.h>
>>   
>>   #define DP_HEADER(cmd)			(VDO(USB_TYPEC_DP_SID, 1, cmd) | \
>>   					 VDO_OPOS(USB_TYPEC_DP_MODE))
>> @@ -67,12 +68,23 @@ struct dp_altmode {
>>   	const struct typec_altmode *port;
>>   };
>>   
>> -static int dp_altmode_notify(struct dp_altmode *dp)
>> +static int dp_altmode_notify(struct dp_altmode *dp, unsigned long conf)
>> +{
>> +	int ret;
>> +
>> +	ret = typec_altmode_notify(dp->alt, conf, &dp->data);
>> +	if (ret)
>> +		return ret;
>> +
>> +	drm_kms_call_oob_hotplug_notifier_chain(DRM_OOB_HOTPLUG_TYPE_C_DP);
> 
> Is this causing a build/run-time dependancy of the USB code on DRM now?
> What about typec systems without DRM, is that a thing?

Good point, yes this adds a build/run-time dependancy on the drm-core
to the Type-C DisplayPort altmode driver (typec_displayport.ko). But
only to that driver, which can be enabled / disabled separately through
CONFIG_TYPEC_DP_ALTMODE and that specific Type-C altmode makes little
sense without having drm/kms support.

Your remark does make me realize that I have forgotten to add a Kconfig
dependency for this to the TYPEC_DP_ALTMODE Kconfig symbol, I will fix
this for v2.

Regards,

Hans


More information about the dri-devel mailing list