RE: [PATCH 2/2 v7] typec: tcpm: Only request matching pdos

From: Adam Thomson
Date: Tue Nov 28 2017 - 04:24:08 EST


On 28 November 2017 01:38, Badhri Jagan Sridharan wrote:

> > examples in the kernel where this happens. Where are these functions likely to
> > be called from, as wherever that is it will need a reference to the port?
> > Actually should we be adding DT bindings to set supported src/snk PDOs from FW,
> > if you're taking this approach to PDO selection?
> >
> > This patch also seemingly leaves 'max_snk_mv', 'max_snk_ma' and 'max_snk_mv'
> > redundant, although those values can be configured from a PD controller driver
> > (e.g. fusb302 actually supports DT bindings which allow these to be set through
> > FW). Now these DT bindings are basically made redundant by your change as they
> > have no impact. Are we expecting these to be used again in the future, or should
>
> Yes, I think 'max_snk_mv', 'max_snk_ma' and 'max_snk_mw' etc should be
> removed.
> The problem here is that maintaining these values implies that tcpm is
> not going to
> request pdo based on the sink_caps that are published. All these
> values can be derived from
> the sink_pdo objects that were declared, hence, they are redundant,
> I will update the patch to remove this.

I have no problem really with this approach, other than right now with your
patch there's no way to actually set the PDOs other than the 2 functions to
update source and sink capabilities. Previously you had the option, at least
through the fusb302 driver, to configure the max_snk_* values from DT, but your
patch obviously changes this behaviour. I think we need a FW based method of
configuring these at startup at least, as with your current patch the values
being used are hard coded. As this is generic for TCPM I would guess DT bindings
(and maybe equivalent ACPI properties as well I guess) would be a sensible
approach.

> > these be removed? FYI, as part of my PPS patch set I have been using them as
> > part of the PPS APDO selection criteria, based on TCPM code prior to your
> > modifications, as for PPS we're interested in a wide range of voltages and
> > currents but want to stay within the platforms limits.
>
> Arent you defining a new PDO type similar to PDO_FIXED, PDO_VARIABLE etc ?
> If so values such as " 'max_snk_mv', 'max_snk_ma' and
> 'max_snk_mw' " should be part of the APDO object right ? So why would
> you still need
> 'max_snk_mv', 'max_snk_ma' and 'max_snk_mw' ?

My initial implementation was based on the approach before your changes, and
actually for PPS this to me made sense, at least from the sink side. We are
dealing with a range of voltages and currents so the important points are the
maximum values. However, if we're now making decisions based on sink PDOs then
I can look at adapting.