[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFXsbZqQAd0eG1tTqC-tiYRe_GT8jGuB5dzmxuJeRjG-O9-UNg@mail.gmail.com>
Date: Sun, 17 May 2020 17:23:14 -0700
From: Chris Healy <cphealy@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Michal Kubecek <mkubecek@...e.cz>
Subject: Re: [PATCH net-next 4/7] net: phy: marvell: Add support for amplitude graph
On Sun, May 17, 2020 at 1:51 PM Andrew Lunn <andrew@...n.ch> wrote:
>
> > > +static int marvell_vct5_amplitude_distance(struct phy_device *phydev,
> > > + int meters)
> > > +{
> > > + int mV_pair0, mV_pair1, mV_pair2, mV_pair3;
> > > + int distance;
> > > + u16 reg;
> > > + int err;
> > > +
> > > + distance = meters * 1000 / 805;
> >
> > With this integer based meters representation, it seems to me that we
> > are artificially reducing the resolution of the distance sampling.
> > For a 100 meter cable, the Marvell implementation looks to support 124
> > sample points. This could result in incorrect data reporting as two
> > adjacent meter numbers would resolve to the same disatance value
> > entered into the register. (eg - 2 meters = 2 distance 3 meters = 2
> > distance)
> >
> > Is there a better way of doing this which would allow for userspace to
> > use the full resolution of the hardware?
>
> Hi Chris
>
> I don't see a simple solution to this.
>
> PHYs/vendors seem to disagree about the ratio. Atheros use
> 824. Marvell use 805. I've no idea what Broadcom, aQuantia uses. We
> would need to limit the choice of step to multiples of whatever the
> vendor picks as its ratio. If the user picks a step of 2m, the driver
> needs to return an error and say sorry, please try 2.488 meter steps
> for Marvell, 2.427 meter steps on Atheros, and who knows what for
> Broadcom. And when the user requests data just for 1-25 meters, the
> driver needs to say sorry, try again with 0.824-24.62, or maybe
> 0.805-24.955. That is not a nice user experience.
>
> It is easy for you to disable this conversion. Do you see a noticeable
> difference in the quality of the results?
>
Could this be resolved by changing the interface slightly such that
the user specifies the range only (in meters or maybe centimetres) and
the driver figures out what to do with it and returns all the data
within that range in a centimetre format?
For example, if we were to provide a range of 10 to 20 meters with the
Marvell PHY, the driver would set the first offset to a register value
of 10/0.805 rounded down to the next lower integer value then
increment through the register values one by one until hitting
20/0.805 rounded up to the next integer value and return the results
for each of these 26 sets of values. With each of these 26 sets of
values, the distance could be returned in a centimetre format thus
providing the data requested in the resolution of the PHY.
Powered by blists - more mailing lists