dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-usb@vger.kernel.org,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	intel-gfx <intel-gfx@lists.freedesktop.org>,
	David Airlie <airlied@linux.ie>,
	Sean Paul <seanpaul@chromium.org>,
	dri-devel@lists.freedesktop.org,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 0/3] Propagate DP-over-Type-C hotplug events from Type-C subsys to drm-drivers
Date: Tue, 5 Mar 2019 08:45:29 +0100	[thread overview]
Message-ID: <8c2bfdf8-6d2e-f369-ede1-f9b499e2868d@redhat.com> (raw)
In-Reply-To: <20190304151704.GA8238@kuha.fi.intel.com>

Hi,

On 04-03-19 16:17, Heikki Krogerus wrote:
> Hi Hans,
> 
> On Thu, Feb 28, 2019 at 05:54:21PM +0100, Hans de Goede wrote:
>> Hi Heikki,
>>
>> On 28-02-19 15:47, Heikki Krogerus wrote:
>>> Hi Hans,
>>>
>>> On Thu, Feb 28, 2019 at 12:24:25PM +0100, Hans de Goede wrote:
>>>> Hi,
>>>>
>>>> On 28-02-19 10:15, Heikki Krogerus wrote:
>>
>> <snip>
>>
>>>>> I've been thinking about this... Do we actually need to link the
>>>>> correct drm_connector to the Type-C connector? Perhaps we can make
>>>>> this work by just linking the GFX device to the Type-C connector.
>>>>
>>>> What use is it to the kms driver if it gets an event there is a DP
>>>> hotplug with x lanes and orientation foo, if we are not telling it
>>>> on which DP port it is ? kms devices already have multiple DP ports
>>>> and more then one could be hooked-up to type-c connectors.
>>>
>>> I was looking at this series. You walk trough every DP port in the
>>> system when the DP alt mode driver broadcasts the event, but maybe
>>> that's different. Never mind.
>>
>> Right, my "simple / naive" solution simply tells the kms driver to
>> check all DP ports for connection state changes, similar to how
>> running "xrandr" under Xorg causes the kms driver to re-check the
>> connection status of all ports. Actually running xrandr under Xorg
>> after plugging in the cable, is how I did my initial DP over Type-C
>> testing on the GPD win.
>>
>> But once we start passing extra-info, I believe the kms driver needs
>> to know to which connector that info belongs.
>>
>> <snip>
>>
>>>>> Well, I don't think we can deny the GPU driver (in this case) the
>>>>> information that we have and that is relevant to it, just because it
>>>>> seems difficult to deliver that information to the right location.
>>>>
>>>> Right, but this does not require a tight-coupling. My original
>>>> proposal can do this if we pass a data struct with an identifier
>>>> for the DP port for which the event is to the notifier. I suggest using
>>>> a string for identifier, something like: "0000:00:02.0/DP-1" this
>>>> event struct could then also contain all the info we want to pass.
>>>
>>> I do agree that we should not tie the objects (device entries)
>>> representing these components in kernel together, but I assume that we
>>> agree now that the connection between the two - the USB Type-C
>>> connector and the DisplayPort - must be described somewhere, either in
>>> firmware or build-in? So I guess we are talking implementation details
>>> here, right?
>>
>> Right.
>>
>>> If that is the case...
>>>
>>> That string identifier you proposed would basically provide the
>>> details about the connection, so if we know those details, we might as
>>> well use "normal" ways to describe the connection and just extract
>>> them in runtime in the function that our DP alt mode driver calls. I
>>> think the connection has to be defined in i915 on CHT in any case.
>>
>> Interesting, I think the connection should be described in the fwnode
>> for the fusb302 device for the CHT/GPD win case. Specifically I think
>> this fits well as a property of the dp altmode.
> 
> OK, you are correct. I was stupidly still thinking about the driver
> loading order, but the order does not matter.
> 
>>> The DP alt mode driver should definitely not need to pass anything
>>> else to the notifier other than handle to itself (actually, handle
>>> straight to the port device would be better) as an identifier. The
>>> notifier function needs to be the one that determines the actual
>>> connection using that handle. Even if the target DP is described using
>>> a string like you propose, then that string has to come from
>>> somewhere, most likely from a device property. The notifier function
>>> can just as well extract it, we don't need to pass it separately.
>>>
>>> Here's my suggestion for function prototype:
>>>
>>> int drm_typec_dp_notification(struct device *typec_port_dev,
>>>                                 struct typec_displayport_data *data);
>>
>> How about instead of the port_dev we pass in the altmode object and
>> we have a method to get the fwnode for the altmode? Then the
>> drm_typec_dp_notification() function can get info from that fwnode
>> to implement the connection finding you describe below:
> 
> We can pass the altmode object, np, but let's not decide which fwnode
> we'll ultimately use. I'm still leaning towards the connector node.
> 
>>> So that function finds the connection between typec_port_dev and the
>>> correct DP in runtime, possibly by letting i915 (or what ever GPU
>>> driver) to do that. Once the function is done, it decrements any ref
>>> counts that it incremented before returning.
>>>
>>> That struct typec_displayport_data has all the information we have -
>>> the current pin assignment from the Configure VDO, HPD IRQ from the
>>> last Status Update, etc. - so it needs to be passed as payload to the
>>> notifier.
>>
>> Ack.
>>
>> So I believe that this discussion ties into the discussion from the:
>> "[PATCH 0/2] platform/x86: intel_cht_int33fe: Start using software nodes"
>>
>> Mail thread. As discussed there I agree that adding a usb_connector
>> child fwnode to the fwnode for the fusb302 to describe things like
>> sink- and source-pdos is a good idea.
>>
>> Our last few mails were discussing describing supported alt-modes on
>> the connector by adding altmode child-nodes to the usb_connector node.
>>
>> I think it is best to continue that discussion here, as the 2 discussions
>> tie into one another.
>>
>> So my last proposal in that thread was adding the following to:
>>
>> Documentation/devicetree/bindings/connector/usb-connector.txt:
>>
>> """
>> Optionally an "usb-c-connector" can have child nodes, describing
>> supported alt-modes.
>>
>> Required properties for usb-c-connector altmode child-nodes:
>> compatible:        "usb-type-c-altmode"
>> svid:              integer, Standard or Vendor ID for the altmode (u16 stored in an u32) property and an u32
>> vdo:               integer, Vendor Data Object, VDO describing the altmode capabilies, SVID specific
>> """
>>
>> Since we now want to have the kernel know which DP connector belongs to
>> the usb_connector being in DP altmode I suggest additionally adding
>> the following:
>>
>> """
>> Optional properties for DisplayPort (svid==0xff01) altmode child-nodes.
>>
>> linux,dp-connector String in the form of "device-name/connector-name" describing the
>>                     DisplayPort connector on the GPU which is used when the usb-c-connector
>>                     is in DisplayPort altmode, e.g. "0000:00:02.0/DP-1"
>> """
>>
>> This to me feels like it is the most logical place to store the connection info,
>> at least for the CHT/GPD win case.  For other cases we may very-well need something
>> different. Since on the CHT/GPD win case both the producer and consumer of this
>> property will be in kernel, I think it is best to just go with this for now.
>> If we then later get a different solution for other cases and that solution turns
>> out to be generic enough that it will also work on the GPD win we can always move
>> the GPD win (and pocket) over to the new solution. Just like we are moving it
>> over to the usb_connector fwnode now.
> 
> I don't have a problem with your proposal of using a string like that
> at this point, but don't document it. I want to at least see if it's
> possible to use real reference instead of a string. I'm also still
> not sure should that be placed under the altmode node or should go
> under the connector node.
> 
> So please don't add it to the usb-connector.txt at this point, even as
> an optional property.

Ok, I will give the discussed approach a try and then post a new version of
the patchset. I hope to get around to this this weekend (as you know this is a side /
spare-time project for me).

Regards,

Hans
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2019-03-05  7:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 13:20 [PATCH 0/3] Propagate DP-over-Type-C hotplug events from Type-C subsys to drm-drivers Hans de Goede
2019-02-25 13:20 ` [PATCH 1/3] drm: Add support for out-of-band hotplug notification Hans de Goede
2019-02-25 13:20 ` [PATCH 2/3] i915: Add support for out-of-bound hotplug events Hans de Goede
2019-02-25 13:20 ` [PATCH 3/3] usb: typec: altmodes/displayport: Notify drm subsys of " Hans de Goede
2019-02-25 14:06   ` Greg Kroah-Hartman
2019-02-25 16:19     ` Hans de Goede
2019-02-26  7:40   ` kbuild test robot
2019-02-26 16:04   ` kbuild test robot
2019-02-27  9:44   ` Heikki Krogerus
2019-02-27 15:51     ` Hans de Goede
2019-02-27 10:55 ` [PATCH 0/3] Propagate DP-over-Type-C hotplug events from Type-C subsys to drm-drivers Heikki Krogerus
2019-02-27 11:16   ` Jani Nikula
2019-02-27 11:49     ` Heikki Krogerus
2019-02-27 15:45     ` Hans de Goede
2019-02-28  9:15       ` Heikki Krogerus
2019-02-28 11:24         ` Hans de Goede
2019-02-28 14:47           ` Heikki Krogerus
2019-02-28 16:54             ` Hans de Goede
2019-03-04 15:17               ` Heikki Krogerus
2019-03-05  7:45                 ` Hans de Goede [this message]

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=8c2bfdf8-6d2e-f369-ede1-f9b499e2868d@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maxime.ripard@bootlin.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=seanpaul@chromium.org \
    /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).