Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Enric Balletbo i Serra


On 6/3/20 13:03, Ondřej Jirman wrote:
> On Fri, Mar 06, 2020 at 09:46:51AM +0100, Enric Balletbo i Serra wrote:
>> Hi Ondrej,
>>
>> On 5/3/20 20:35, Ondřej Jirman wrote:
>>> Hi,
>>>
>>> On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
 On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
  wrote:
>
> Hi Vasily,

 CC: Icenowy and Ondrej
>
> Would you mind to check which firmware version is running the anx7688 in
> PinePhone, I think should be easy to check with i2c-tools.

 Icenowy, Ondrej, can you guys please check anx7688 firmware version?
>>>
>>> i2cget 0 0x28 0x00 w
>>> 0x
>>>
>>> i2cget 0 0x28 0x02 w
>>> 0x7688
>>>
>>> i2cget 0 0x28 0x80 w
>>> 0x
>>>
>>
>> Can you check the value for 0x81 too?
> 
> 'w' read checks both values at once, as you can see above.
> 

Oh right, sorry. The thing is that firmware version is at 0x2c, not 0x28, so
we're interested on see register 0x80 and 0x81 for 0x2c address.

Thanks,
 Enric

> regards,
>   o.
> 
>> Thanks,
>>  Enric
>>
>>
>>> regards,
>>> o.
>>>
> Thanks in advance,
>  Enric
>
> [snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Ondřej Jirman
On Fri, Mar 06, 2020 at 09:46:51AM +0100, Enric Balletbo i Serra wrote:
> Hi Ondrej,
> 
> On 5/3/20 20:35, Ondřej Jirman wrote:
> > Hi,
> > 
> > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> >> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> >>  wrote:
> >>>
> >>> Hi Vasily,
> >>
> >> CC: Icenowy and Ondrej
> >>>
> >>> Would you mind to check which firmware version is running the anx7688 in
> >>> PinePhone, I think should be easy to check with i2c-tools.
> >>
> >> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
> > 
> > i2cget 0 0x28 0x00 w
> > 0x
> > 
> > i2cget 0 0x28 0x02 w
> > 0x7688
> > 
> > i2cget 0 0x28 0x80 w
> > 0x
> > 
> 
> Can you check the value for 0x81 too?

'w' read checks both values at once, as you can see above.

regards,
o.

> Thanks,
>  Enric
> 
> 
> > regards,
> > o.
> > 
> >>> Thanks in advance,
> >>>  Enric
> >>>
> >>> [snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Ondřej Jirman
On Fri, Mar 06, 2020 at 04:53:46PM +0800, Icenowy Zheng wrote:
> 在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> > Hi Ondrej,
> > 
> > On 5/3/20 20:35, Ondřej Jirman wrote:
> > > Hi,
> > > 
> > > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > > >  wrote:
> > > > > Hi Vasily,
> > > > 
> > > > CC: Icenowy and Ondrej
> > > > > Would you mind to check which firmware version is running the
> > > > > anx7688 in
> > > > > PinePhone, I think should be easy to check with i2c-tools.
> > > > 
> > > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > > version?
> > > 
> > > i2cget 0 0x28 0x00 w
> > > 0x
> > > 
> > > i2cget 0 0x28 0x02 w
> > > 0x7688
> > > 
> > > i2cget 0 0x28 0x80 w
> > > 0x
> > > 
> > 
> > Can you check the value for 0x81 too?
> 
> root@ice-pinephone [ ~ ] # i2cdump 0 0x28
> No size specified (using byte-data access)
> WARNING! This program can confuse your I2C bus, cause data loss and
> worse!
> I will probe file /dev/i2c-0, address 0x28, mode byte
> Continue? [Y/n] 
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
> 00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05???v?.??
> 10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000...
> 20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00...$??..
> 30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01?@.??? ..?.?..??
> 40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0r?.?.@?..?.?
> 50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00...??.??.?q.
> 60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00???)-!..
> 70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07.\???8B?
> 80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00.t??D?u.
> 90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00???..0.Y?...
> a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02..??
> b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00..@.(D?.
> c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00?.?..?..
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01P??P.?.p..0?
> f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff.??.???..??.

My values for 0x28 address match this. ^

Interesting that it returns different register values for different
device addresses.

> root@ice-pinephone [ ~ ] # i2cdump 0 0x2c
> No size specified (using byte-data access)
> WARNING! This program can confuse your I2C bus, cause data loss and
> worse!
> I will probe file /dev/i2c-0, address 0x2c, mode byte
> Continue? [Y/n] 
>  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
> 00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00)??v.??.? ??
> 10: 03 00 ff 8f ff 7f 00 00 00 00 05 00 10 0a 0c 00?..?.??.???.
> 20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00???...?.
> 30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 40: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00?...
> 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 70: b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00?...
> 80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00?%..
> 90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00??..
> a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> > 
> > Thanks,
> >  Enric
> > 
> > 
> > > regards,
> > >   o.
> > > 
> > > > > Thanks in advance,
> > > > >  Enric
> > > > > 
> > > > > [snip]
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Icenowy Zheng
在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> Hi Ondrej,
> 
> On 5/3/20 20:35, Ondřej Jirman wrote:
> > Hi,
> > 
> > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > >  wrote:
> > > > Hi Vasily,
> > > 
> > > CC: Icenowy and Ondrej
> > > > Would you mind to check which firmware version is running the
> > > > anx7688 in
> > > > PinePhone, I think should be easy to check with i2c-tools.
> > > 
> > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > version?
> > 
> > i2cget 0 0x28 0x00 w
> > 0x
> > 
> > i2cget 0 0x28 0x02 w
> > 0x7688
> > 
> > i2cget 0 0x28 0x80 w
> > 0x
> > 
> 
> Can you check the value for 0x81 too?

root@ice-pinephone [ ~ ] # i2cdump 0 0x28
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will probe file /dev/i2c-0, address 0x28, mode byte
Continue? [Y/n] 
 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05???v?.??
10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000...
20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00...$??..
30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01?@.??? ..?.?..??
40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0r?.?.@?..?.?
50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00...??.??.?q.
60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00???)-!..
70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07.\???8B?
80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00.t??D?u.
90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00???..0.Y?...
a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02..??
b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00..@.(D?.
c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00?.?..?..
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01P??P.?.p..0?
f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff.??.???..??.
root@ice-pinephone [ ~ ] # i2cdump 0 0x2c
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will probe file /dev/i2c-0, address 0x2c, mode byte
Continue? [Y/n] 
 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00)??v.??.? ??
10: 03 00 ff 8f ff 7f 00 00 00 00 05 00 10 0a 0c 00?..?.??.???.
20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00???...?.
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40: 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00?...
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: b8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00?...
80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00?%..
90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00??..
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

> 
> Thanks,
>  Enric
> 
> 
> > regards,
> > o.
> > 
> > > > Thanks in advance,
> > > >  Enric
> > > > 
> > > > [snip]

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


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Enric Balletbo i Serra
Hi Ondrej,

On 5/3/20 20:35, Ondřej Jirman wrote:
> Hi,
> 
> On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
>> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>>  wrote:
>>>
>>> Hi Vasily,
>>
>> CC: Icenowy and Ondrej
>>>
>>> Would you mind to check which firmware version is running the anx7688 in
>>> PinePhone, I think should be easy to check with i2c-tools.
>>
>> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
> 
> i2cget 0 0x28 0x00 w
> 0x
> 
> i2cget 0 0x28 0x02 w
> 0x7688
> 
> i2cget 0 0x28 0x80 w
> 0x
> 

Can you check the value for 0x81 too?

Thanks,
 Enric


> regards,
>   o.
> 
>>> Thanks in advance,
>>>  Enric
>>>
>>> [snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Ondřej Jirman
On Fri, Mar 06, 2020 at 08:11:07PM +0800, Nicolas Boichat wrote:
> On Fri, Mar 6, 2020 at 8:07 PM Ondřej Jirman  wrote:
> 
> What about the values at 0x2c?

i2cdump 0 0x28

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 80 05 05???v????
10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000...
20: 00 00 00 00 00 00 00 00 00 00 00 34 f2 e4 ff 00...4??..
30: 04 40 00 04 94 11 20 ff ff 03 00 ff ff ff 00 01?@.??? ..?.?
40: 78 a4 00 09 00 08 05 84 10 60 17 00 00 0a 00 b0x?.?.`?..?.?
50: 00 00 00 0a 00 00 e0 df ff ff 00 00 00 10 71 00...?..??.?q.
60: 10 10 04 29 2d 21 10 01 09 03 00 03 e8 13 88 00???)-!..
70: 00 19 18 83 06 5a 11 00 ff 00 00 0d 04 38 42 07.Z???8B?
80: 00 00 00 00 00 74 1b 19 40 08 75 00 00 00 00 00.t??@?u.
90: 00 00 00 00 00 00 03 00 ff 30 00 59 01 00 00 00..?..0.Y?...
a0: 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 0a 10 18 00 00 ff 00 00???.
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 50 10 08 50 00 02 00 70 00 00 30 10 11 02 1c 01P??P.?.p..0?
f0: 00 11 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff.??.???..??.

i2cdump 0 0x2c

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
00: 29 1f 88 76 00 ac 11 00 11 20 10 10 00 00 00 00)??v.??.? ??
10: 03 00 ff 8f ff 7f 00 00 00 00 0a 00 10 11 0c 00?..?.??.???.
20: 00 00 00 00 99 06 c0 00 00 00 00 00 00 00 02 00???...?.
30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
70: b4 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00?...
80: 01 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00?%..
90: 0f 0f 00 00 00 00 00 00 00 00 00 00 00 00 00 00??..
a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


regards,
o.

> 
> Thanks,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-07 Thread Enric Balletbo i Serra
Hi Icenowy,

On 5/3/20 19:35, Icenowy Zheng wrote:
> 
> 
> 于 2020年3月6日 GMT+08:00 上午2:29:33, Vasily Khoruzhick  写到:
>> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>>  wrote:
>>>
>>> Hi Vasily,
>>
>> CC: Icenowy and Ondrej
>>>
>>> Would you mind to check which firmware version is running the anx7688
>> in
>>> PinePhone, I think should be easy to check with i2c-tools.
>>
>> Icenowy, Ondrej, can you guys please check anx7688 firmware version?
> 
> At 0x2c, 0x80 is 0x01, 0x81 is 0x25
> 
> 01.25, right?
> 

Yes, thanks.

>>
>>> Thanks in advance,
>>>  Enric
>>>
>>> [snip]
> 
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-06 Thread Nicolas Boichat
On Fri, Mar 6, 2020 at 8:07 PM Ondřej Jirman  wrote:
>
> On Fri, Mar 06, 2020 at 04:53:46PM +0800, Icenowy Zheng wrote:
> > 在 2020-03-06星期五的 09:46 +0100,Enric Balletbo i Serra写道:
> > > Hi Ondrej,
> > >
> > > On 5/3/20 20:35, Ondřej Jirman wrote:
> > > > Hi,
> > > >
> > > > On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> > > > > On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> > > > >  wrote:
> > > > > > Hi Vasily,
> > > > >
> > > > > CC: Icenowy and Ondrej
> > > > > > Would you mind to check which firmware version is running the
> > > > > > anx7688 in
> > > > > > PinePhone, I think should be easy to check with i2c-tools.
> > > > >
> > > > > Icenowy, Ondrej, can you guys please check anx7688 firmware
> > > > > version?
> > > >
> > > > i2cget 0 0x28 0x00 w
> > > > 0x
> > > >
> > > > i2cget 0 0x28 0x02 w
> > > > 0x7688
> > > >
> > > > i2cget 0 0x28 0x80 w
> > > > 0x
> > > >
> > >
> > > Can you check the value for 0x81 too?
> >
> > root@ice-pinephone [ ~ ] # i2cdump 0 0x28
> > No size specified (using byte-data access)
> > WARNING! This program can confuse your I2C bus, cause data loss and
> > worse!
> > I will probe file /dev/i2c-0, address 0x28, mode byte
> > Continue? [Y/n]
> >  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f0123456789abcdef
> > 00: aa aa 88 76 ac 00 00 00 00 00 00 00 00 00 05 05???v?.??
> > 10: 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 000...
> > 20: 00 00 00 00 00 00 00 00 00 00 00 24 f2 e4 ff 00...$??..
> > 30: 06 40 00 04 94 11 20 ff ff 03 00 bf ff ff 10 01?@.??? ..?.?..??
> > 40: 72 a4 00 09 00 08 05 84 15 40 17 00 00 0a 00 e0r?.?.@?..?.?
> > 50: 00 00 00 0a 10 00 e0 df ff ff 00 00 00 10 71 00...??.??.?q.
> > 60: 10 10 04 29 2d 21 10 01 09 13 00 03 e8 13 88 00???)-!..
> > 70: 00 19 18 83 16 5c 11 00 ff 00 00 0d 04 38 42 07.\???8B?
> > 80: 00 00 00 00 00 74 1b 19 44 08 75 00 00 00 00 00.t??D?u.
> > 90: 01 02 00 00 00 00 03 00 ff 30 00 59 01 00 00 00???..0.Y?...
> > a0: 00 ff fe ff ff 00 00 00 00 00 00 00 00 00 00 02..??
> > b0: 00 00 00 00 00 00 40 00 28 00 00 00 00 44 08 00..@.(D?.
> > c0: 00 00 00 00 80 00 10 01 0a 10 18 00 00 fd 00 00?.?..?..
> > d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> > e0: 50 10 08 50 00 02 00 70 00 00 30 10 0b 02 1c 01P??P.?.p..0?
> > f0: 00 0b 07 00 94 11 7f 00 00 00 00 00 00 01 0e ff.??.???..??.
>
> My values for 0x28 address match this. ^

What about the values at 0x2c?

> Interesting that it returns different register values for different
> device addresses.

Yes the registers have different meanings for the 2 addresses.

Thanks,
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-06 Thread Ondřej Jirman
Hi,

On Thu, Mar 05, 2020 at 10:29:33AM -0800, Vasily Khoruzhick wrote:
> On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
>  wrote:
> >
> > Hi Vasily,
> 
> CC: Icenowy and Ondrej
> >
> > Would you mind to check which firmware version is running the anx7688 in
> > PinePhone, I think should be easy to check with i2c-tools.
> 
> Icenowy, Ondrej, can you guys please check anx7688 firmware version?

i2cget 0 0x28 0x00 w
0x

i2cget 0 0x28 0x02 w
0x7688

i2cget 0 0x28 0x80 w
0x

regards,
o.

> > Thanks in advance,
> >  Enric
> >
> > [snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-06 Thread Enric Balletbo i Serra
Hi Vasily,

On 14/2/20 23:22, Vasily Khoruzhick wrote:
> On Fri, Feb 14, 2020 at 2:20 PM Enric Balletbo Serra
>  wrote:
>>
>> Hi Vasily,
>>
>> Missatge de Vasily Khoruzhick  del dia dv., 14 de
>> febr. 2020 a les 23:17:
>>>
>>> On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
>>>  wrote:

 Hi Vasily,

 Missatge de Vasily Khoruzhick  del dia dv., 14 de
 febr. 2020 a les 22:36:
>
> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
>  wrote:
>>
>> From: Nicolas Boichat 
>>
>> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
>> that has an internal microcontroller.
>>
>> The only reason a Linux kernel driver is necessary is to reject
>> resolutions that require more bandwidth than what is available on
>> the DP side. DP bandwidth and lane count are reported by the bridge
>> via 2 registers on I2C.
>
> It is true only for your particular platform where usb-c part is
> managed by firmware. Pinephone has the same anx7688 but linux will
> need a driver that manages usb-c in addition to DP.
>
> I'd suggest making it MFD driver from the beginning, or at least make
> proper bindings so we don't have to rework it and introduce binding
> incompatibilities in future.
>

 Do you have example code on how the ANX7866 is used in pinephone?
 There is a repo somewhere?
>>>
>>> I don't think it's implemented yet. I've CCed Icenowy in case if she
>>> has anything.
>>>
>>
>> It would be good to join the effort. Just because I am curious, there
>> are public schematics for the pinephone that is using that bridge?
> 
> Schematics is available here:
> https://wiki.pine64.org/index.php/PinePhone_v1.1_-_Braveheart#Schematic
> 

Would you mind to check which firmware version is running the anx7688 in
PinePhone, I think should be easy to check with i2c-tools.

Thanks in advance,
 Enric

[snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-06 Thread Icenowy Zheng


于 2020年3月6日 GMT+08:00 上午2:29:33, Vasily Khoruzhick  写到:
>On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
> wrote:
>>
>> Hi Vasily,
>
>CC: Icenowy and Ondrej
>>
>> Would you mind to check which firmware version is running the anx7688
>in
>> PinePhone, I think should be easy to check with i2c-tools.
>
>Icenowy, Ondrej, can you guys please check anx7688 firmware version?

At 0x2c, 0x80 is 0x01, 0x81 is 0x25

01.25, right?

>
>> Thanks in advance,
>>  Enric
>>
>> [snip]

-- 
使用 K-9 Mail 发送自我的Android设备。
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-03-05 Thread Vasily Khoruzhick
On Thu, Mar 5, 2020 at 7:28 AM Enric Balletbo i Serra
 wrote:
>
> Hi Vasily,

CC: Icenowy and Ondrej
>
> Would you mind to check which firmware version is running the anx7688 in
> PinePhone, I think should be easy to check with i2c-tools.

Icenowy, Ondrej, can you guys please check anx7688 firmware version?

> Thanks in advance,
>  Enric
>
> [snip]
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Nicolas Boichat
On Sat, Feb 15, 2020 at 5:36 AM Vasily Khoruzhick  wrote:
>
> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
>  wrote:
> >
> > From: Nicolas Boichat 
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
>
> It is true only for your particular platform where usb-c part is
> managed by firmware. Pinephone has the same anx7688 but linux will
> need a driver that manages usb-c in addition to DP.
>
> I'd suggest making it MFD driver from the beginning, or at least make
> proper bindings so we don't have to rework it and introduce binding
> incompatibilities in future.

If that helps for the binding, ANX7688 is indeed a MFD (TCPC, HDMI to
DP converter, USB-C mux between USB 3.0 lanes and the DP output of the
embedded converter), with 2 I2C addresses:
- 0x2c is the TCPC/mux, used by the Embedded Controller [1] on Chrome
OS, and the code in this patch (my understanding is that lane count/BW
registers in the kernel driver below may only be available to FW on
Chromebooks).
- 0x28:
- Used to update the embedded FW in the anx7688 (on Chrome OS we
do this in depthcharge [2]). This is a EEPROM-based FW (so even
without implementing this, it'll usually "just work").
- Used to workaround some TCPC issues (see [1] again).

[1] EC driver: 
https://chromium.googlesource.com/chromiumos/platform/ec/+/refs/heads/master/driver/tcpm/anx7688.c
[2] depthcharge driver to update ANX7688 FW:
https://chromium.googlesource.com/chromiumos/platform/depthcharge/+/master/src/drivers/ec/anx7688/anx7688.c
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Nicolas Boichat
On Fri, Feb 14, 2020 at 8:18 PM Andrzej Hajda  wrote:
>
> On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> > From: Nicolas Boichat 
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
> >
> > Signed-off-by: Nicolas Boichat 
> > Signed-off-by: Hsin-Yi Wang 
> > Signed-off-by: Enric Balletbo i Serra 
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> >  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
> >  3 files changed, 201 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > ANX6345 transforms the LVTTL RGB output of an
> > application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > + tristate "Analogix ANX7688 bridge"
> > + depends on OF
> > + select DRM_KMS_HELPER
> > + select REGMAP_I2C
> > + help
> > +   ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > +   mobile HD transmitter designed for portable devices. The
> > +   ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > +   including an intelligent crosspoint switch to support
> > +   USB Type-C.
> > +
> >  config DRM_ANALOGIX_ANX78XX
> >   tristate "Analogix ANX78XX bridge"
> >   select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > analogix-i2c-dptx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index ..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > + struct drm_bridge bridge;
> > + struct i2c_client *client;
> > + struct regmap *regmap;
> > +
> > + bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > + return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > +   const struct drm_display_mode *mode,
> > +   struct drm_display_mode *adjusted_mode)
> > +{
> > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > + int totalbw, requiredbw;
> > + u8 dpbw, lanecount;
> > + u8 regs[2];
> > + int ret;
> > +
> > + if (!anx7688->filter)
> > + return true;
> > +
> > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > + if (ret < 0) {
> > + dev_err(&anx7688->client->dev,
> > + "Failed to read bandwidth/lane count\n");
> > + return false;
> > + }
> > + dpbw = regs[0];
> > + lanecount = regs[1];
>
>
> Are these values hw invariant? Or they are result of cable probe/training?
>
> I

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Vasily Khoruzhick
On Fri, Feb 14, 2020 at 2:20 PM Enric Balletbo Serra
 wrote:
>
> Hi Vasily,
>
> Missatge de Vasily Khoruzhick  del dia dv., 14 de
> febr. 2020 a les 23:17:
> >
> > On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
> >  wrote:
> > >
> > > Hi Vasily,
> > >
> > > Missatge de Vasily Khoruzhick  del dia dv., 14 de
> > > febr. 2020 a les 22:36:
> > > >
> > > > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> > > >  wrote:
> > > > >
> > > > > From: Nicolas Boichat 
> > > > >
> > > > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > > > that has an internal microcontroller.
> > > > >
> > > > > The only reason a Linux kernel driver is necessary is to reject
> > > > > resolutions that require more bandwidth than what is available on
> > > > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > > > via 2 registers on I2C.
> > > >
> > > > It is true only for your particular platform where usb-c part is
> > > > managed by firmware. Pinephone has the same anx7688 but linux will
> > > > need a driver that manages usb-c in addition to DP.
> > > >
> > > > I'd suggest making it MFD driver from the beginning, or at least make
> > > > proper bindings so we don't have to rework it and introduce binding
> > > > incompatibilities in future.
> > > >
> > >
> > > Do you have example code on how the ANX7866 is used in pinephone?
> > > There is a repo somewhere?
> >
> > I don't think it's implemented yet. I've CCed Icenowy in case if she
> > has anything.
> >
>
> It would be good to join the effort. Just because I am curious, there
> are public schematics for the pinephone that is using that bridge?

Schematics is available here:
https://wiki.pine64.org/index.php/PinePhone_v1.1_-_Braveheart#Schematic

> > > Thanks,
> > >  Enric
> > >
> > > > > Signed-off-by: Nicolas Boichat 
> > > > > Signed-off-by: Hsin-Yi Wang 
> > > > > Signed-off-by: Enric Balletbo i Serra 
> > > > > ---
> > > > >
> > > > > Changes in v2:
> > > > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > > > - Make the driver OF only so we can reduce the ifdefs.
> > > > > - Update the Copyright to 2020.
> > > > > - Use probe_new so we can get rid of the i2c_device_id table.
> > > > >
> > > > >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> > > > >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> > > > >  .../drm/bridge/analogix/analogix-anx7688.c| 188 
> > > > > ++
> > > > >  3 files changed, 201 insertions(+)
> > > > >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > >
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > > > > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > index e1fa7d820373..af7c2939403c 100644
> > > > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > > > >   ANX6345 transforms the LVTTL RGB output of an
> > > > >   application processor to eDP or DisplayPort.
> > > > >
> > > > > +config DRM_ANALOGIX_ANX7688
> > > > > +   tristate "Analogix ANX7688 bridge"
> > > > > +   depends on OF
> > > > > +   select DRM_KMS_HELPER
> > > > > +   select REGMAP_I2C
> > > > > +   help
> > > > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > > > + mobile HD transmitter designed for portable devices. The
> > > > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > > > + including an intelligent crosspoint switch to support
> > > > > + USB Type-C.
> > > > > +
> > > > >  config DRM_ANALOGIX_ANX78XX
> > > > > tristate "Analogix ANX78XX bridge"
> > > > > select DRM_ANALOGIX_DP
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > > > > b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > index 97669b374098..27cd73635c8c 100644
> > > > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > > @@ -1,5 +1,6 @@
> > > > >  # SPDX-License-Identifier: GPL-2.0-only
> > > > >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > > > > analogix-i2c-dptx.o
> > > > >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > > > >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > > > >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > > > > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > > new file mode 100644
> > > > > index ..10a7cd0f9126
> > > > > --- /dev/null
> > > > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > > @@ -0,0 +1,188 @@
> > > > > +// SPDX-License-Identifier: GPL-2.0-only
> > > > > +/*
> > > > > + * ANX7688 HDMI->DP bridge driver
> > > > > + *
> > > > > + * Copyright 2020 Google LLC
> > > > > + */
> > 

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Enric Balletbo Serra
Hi Vasily,

Missatge de Vasily Khoruzhick  del dia dv., 14 de
febr. 2020 a les 23:17:
>
> On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
>  wrote:
> >
> > Hi Vasily,
> >
> > Missatge de Vasily Khoruzhick  del dia dv., 14 de
> > febr. 2020 a les 22:36:
> > >
> > > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> > >  wrote:
> > > >
> > > > From: Nicolas Boichat 
> > > >
> > > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > > that has an internal microcontroller.
> > > >
> > > > The only reason a Linux kernel driver is necessary is to reject
> > > > resolutions that require more bandwidth than what is available on
> > > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > > via 2 registers on I2C.
> > >
> > > It is true only for your particular platform where usb-c part is
> > > managed by firmware. Pinephone has the same anx7688 but linux will
> > > need a driver that manages usb-c in addition to DP.
> > >
> > > I'd suggest making it MFD driver from the beginning, or at least make
> > > proper bindings so we don't have to rework it and introduce binding
> > > incompatibilities in future.
> > >
> >
> > Do you have example code on how the ANX7866 is used in pinephone?
> > There is a repo somewhere?
>
> I don't think it's implemented yet. I've CCed Icenowy in case if she
> has anything.
>

It would be good to join the effort. Just because I am curious, there
are public schematics for the pinephone that is using that bridge?

> > Thanks,
> >  Enric
> >
> > > > Signed-off-by: Nicolas Boichat 
> > > > Signed-off-by: Hsin-Yi Wang 
> > > > Signed-off-by: Enric Balletbo i Serra 
> > > > ---
> > > >
> > > > Changes in v2:
> > > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > > - Make the driver OF only so we can reduce the ifdefs.
> > > > - Update the Copyright to 2020.
> > > > - Use probe_new so we can get rid of the i2c_device_id table.
> > > >
> > > >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> > > >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> > > >  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
> > > >  3 files changed, 201 insertions(+)
> > > >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > >
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > > > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > index e1fa7d820373..af7c2939403c 100644
> > > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > > >   ANX6345 transforms the LVTTL RGB output of an
> > > >   application processor to eDP or DisplayPort.
> > > >
> > > > +config DRM_ANALOGIX_ANX7688
> > > > +   tristate "Analogix ANX7688 bridge"
> > > > +   depends on OF
> > > > +   select DRM_KMS_HELPER
> > > > +   select REGMAP_I2C
> > > > +   help
> > > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > > + mobile HD transmitter designed for portable devices. The
> > > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > > + including an intelligent crosspoint switch to support
> > > > + USB Type-C.
> > > > +
> > > >  config DRM_ANALOGIX_ANX78XX
> > > > tristate "Analogix ANX78XX bridge"
> > > > select DRM_ANALOGIX_DP
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > > > b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > index 97669b374098..27cd73635c8c 100644
> > > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > > @@ -1,5 +1,6 @@
> > > >  # SPDX-License-Identifier: GPL-2.0-only
> > > >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > > > analogix-i2c-dptx.o
> > > >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > > >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > > >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > > > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > new file mode 100644
> > > > index ..10a7cd0f9126
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > > @@ -0,0 +1,188 @@
> > > > +// SPDX-License-Identifier: GPL-2.0-only
> > > > +/*
> > > > + * ANX7688 HDMI->DP bridge driver
> > > > + *
> > > > + * Copyright 2020 Google LLC
> > > > + */
> > > > +
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +#include 
> > > > +
> > > > +/* Register addresses */
> > > > +#define VENDOR_ID_REG 0x00
> > > > +#define DEVICE_ID_REG 0x02
> > > > +
> > > > +#define FW_VERSION_REG 0x80
> > > > +
> > > > +#define DP_BANDWIDTH_REG 0x85
> > > > +#define DP_LANE_COUNT_REG 0x86
> > > > +
> > > > +#define VENDOR_ID 0x1f29
> > > > +#define DEVICE_I

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Vasily Khoruzhick
On Fri, Feb 14, 2020 at 1:53 PM Enric Balletbo Serra
 wrote:
>
> Hi Vasily,
>
> Missatge de Vasily Khoruzhick  del dia dv., 14 de
> febr. 2020 a les 22:36:
> >
> > On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
> >  wrote:
> > >
> > > From: Nicolas Boichat 
> > >
> > > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > > that has an internal microcontroller.
> > >
> > > The only reason a Linux kernel driver is necessary is to reject
> > > resolutions that require more bandwidth than what is available on
> > > the DP side. DP bandwidth and lane count are reported by the bridge
> > > via 2 registers on I2C.
> >
> > It is true only for your particular platform where usb-c part is
> > managed by firmware. Pinephone has the same anx7688 but linux will
> > need a driver that manages usb-c in addition to DP.
> >
> > I'd suggest making it MFD driver from the beginning, or at least make
> > proper bindings so we don't have to rework it and introduce binding
> > incompatibilities in future.
> >
>
> Do you have example code on how the ANX7866 is used in pinephone?
> There is a repo somewhere?

I don't think it's implemented yet. I've CCed Icenowy in case if she
has anything.

> Thanks,
>  Enric
>
> > > Signed-off-by: Nicolas Boichat 
> > > Signed-off-by: Hsin-Yi Wang 
> > > Signed-off-by: Enric Balletbo i Serra 
> > > ---
> > >
> > > Changes in v2:
> > > - Move driver to drivers/gpu/drm/bridge/analogix.
> > > - Make the driver OF only so we can reduce the ifdefs.
> > > - Update the Copyright to 2020.
> > > - Use probe_new so we can get rid of the i2c_device_id table.
> > >
> > >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> > >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> > >  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
> > >  3 files changed, 201 insertions(+)
> > >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > >
> > > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > index e1fa7d820373..af7c2939403c 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > >   ANX6345 transforms the LVTTL RGB output of an
> > >   application processor to eDP or DisplayPort.
> > >
> > > +config DRM_ANALOGIX_ANX7688
> > > +   tristate "Analogix ANX7688 bridge"
> > > +   depends on OF
> > > +   select DRM_KMS_HELPER
> > > +   select REGMAP_I2C
> > > +   help
> > > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > > + mobile HD transmitter designed for portable devices. The
> > > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > > + including an intelligent crosspoint switch to support
> > > + USB Type-C.
> > > +
> > >  config DRM_ANALOGIX_ANX78XX
> > > tristate "Analogix ANX78XX bridge"
> > > select DRM_ANALOGIX_DP
> > > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > > b/drivers/gpu/drm/bridge/analogix/Makefile
> > > index 97669b374098..27cd73635c8c 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > > @@ -1,5 +1,6 @@
> > >  # SPDX-License-Identifier: GPL-2.0-only
> > >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > > analogix-i2c-dptx.o
> > >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> > >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> > >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > new file mode 100644
> > > index ..10a7cd0f9126
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > > @@ -0,0 +1,188 @@
> > > +// SPDX-License-Identifier: GPL-2.0-only
> > > +/*
> > > + * ANX7688 HDMI->DP bridge driver
> > > + *
> > > + * Copyright 2020 Google LLC
> > > + */
> > > +
> > > +#include 
> > > +#include 
> > > +#include 
> > > +#include 
> > > +
> > > +/* Register addresses */
> > > +#define VENDOR_ID_REG 0x00
> > > +#define DEVICE_ID_REG 0x02
> > > +
> > > +#define FW_VERSION_REG 0x80
> > > +
> > > +#define DP_BANDWIDTH_REG 0x85
> > > +#define DP_LANE_COUNT_REG 0x86
> > > +
> > > +#define VENDOR_ID 0x1f29
> > > +#define DEVICE_ID 0x7688
> > > +
> > > +/* First supported firmware version (0.85) */
> > > +#define MINIMUM_FW_VERSION 0x0085
> > > +
> > > +struct anx7688 {
> > > +   struct drm_bridge bridge;
> > > +   struct i2c_client *client;
> > > +   struct regmap *regmap;
> > > +
> > > +   bool filter;
> > > +};
> > > +
> > > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge 
> > > *bridge)
> > > +{
> > > +   return container_of(bridge, struct anx7688, b

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Enric Balletbo Serra
Hi Vasily,

Missatge de Vasily Khoruzhick  del dia dv., 14 de
febr. 2020 a les 22:36:
>
> On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
>  wrote:
> >
> > From: Nicolas Boichat 
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
>
> It is true only for your particular platform where usb-c part is
> managed by firmware. Pinephone has the same anx7688 but linux will
> need a driver that manages usb-c in addition to DP.
>
> I'd suggest making it MFD driver from the beginning, or at least make
> proper bindings so we don't have to rework it and introduce binding
> incompatibilities in future.
>

Do you have example code on how the ANX7866 is used in pinephone?
There is a repo somewhere?

Thanks,
 Enric

> > Signed-off-by: Nicolas Boichat 
> > Signed-off-by: Hsin-Yi Wang 
> > Signed-off-by: Enric Balletbo i Serra 
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> >  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
> >  3 files changed, 201 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> >   ANX6345 transforms the LVTTL RGB output of an
> >   application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > +   tristate "Analogix ANX7688 bridge"
> > +   depends on OF
> > +   select DRM_KMS_HELPER
> > +   select REGMAP_I2C
> > +   help
> > + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > + mobile HD transmitter designed for portable devices. The
> > + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > + including an intelligent crosspoint switch to support
> > + USB Type-C.
> > +
> >  config DRM_ANALOGIX_ANX78XX
> > tristate "Analogix ANX78XX bridge"
> > select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > analogix-i2c-dptx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index ..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > +   struct drm_bridge bridge;
> > +   struct i2c_client *client;
> > +   struct regmap *regmap;
> > +
> > +   bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > +   return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > + const struct drm_display_mode *mode,
> > + struct drm_display_mode 
> > *adjusted_mode)
> > +{
> > +   struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > +   int totalbw, requiredbw;
> > +   u8 dpbw, lanecount;
> > +   u8 

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Vasily Khoruzhick
On Thu, Feb 13, 2020 at 6:54 AM Enric Balletbo i Serra
 wrote:
>
> From: Nicolas Boichat 
>
> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> that has an internal microcontroller.
>
> The only reason a Linux kernel driver is necessary is to reject
> resolutions that require more bandwidth than what is available on
> the DP side. DP bandwidth and lane count are reported by the bridge
> via 2 registers on I2C.

It is true only for your particular platform where usb-c part is
managed by firmware. Pinephone has the same anx7688 but linux will
need a driver that manages usb-c in addition to DP.

I'd suggest making it MFD driver from the beginning, or at least make
proper bindings so we don't have to rework it and introduce binding
incompatibilities in future.

> Signed-off-by: Nicolas Boichat 
> Signed-off-by: Hsin-Yi Wang 
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v2:
> - Move driver to drivers/gpu/drm/bridge/analogix.
> - Make the driver OF only so we can reduce the ifdefs.
> - Update the Copyright to 2020.
> - Use probe_new so we can get rid of the i2c_device_id table.
>
>  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
>  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
>  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
>  3 files changed, 201 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
>
> diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> b/drivers/gpu/drm/bridge/analogix/Kconfig
> index e1fa7d820373..af7c2939403c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
>   ANX6345 transforms the LVTTL RGB output of an
>   application processor to eDP or DisplayPort.
>
> +config DRM_ANALOGIX_ANX7688
> +   tristate "Analogix ANX7688 bridge"
> +   depends on OF
> +   select DRM_KMS_HELPER
> +   select REGMAP_I2C
> +   help
> + ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> + mobile HD transmitter designed for portable devices. The
> + ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> + including an intelligent crosspoint switch to support
> + USB Type-C.
> +
>  config DRM_ANALOGIX_ANX78XX
> tristate "Analogix ANX78XX bridge"
> select DRM_ANALOGIX_DP
> diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> b/drivers/gpu/drm/bridge/analogix/Makefile
> index 97669b374098..27cd73635c8c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Makefile
> +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
>  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
>  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
>  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> new file mode 100644
> index ..10a7cd0f9126
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> @@ -0,0 +1,188 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * ANX7688 HDMI->DP bridge driver
> + *
> + * Copyright 2020 Google LLC
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* Register addresses */
> +#define VENDOR_ID_REG 0x00
> +#define DEVICE_ID_REG 0x02
> +
> +#define FW_VERSION_REG 0x80
> +
> +#define DP_BANDWIDTH_REG 0x85
> +#define DP_LANE_COUNT_REG 0x86
> +
> +#define VENDOR_ID 0x1f29
> +#define DEVICE_ID 0x7688
> +
> +/* First supported firmware version (0.85) */
> +#define MINIMUM_FW_VERSION 0x0085
> +
> +struct anx7688 {
> +   struct drm_bridge bridge;
> +   struct i2c_client *client;
> +   struct regmap *regmap;
> +
> +   bool filter;
> +};
> +
> +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> +{
> +   return container_of(bridge, struct anx7688, bridge);
> +}
> +
> +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> + const struct drm_display_mode *mode,
> + struct drm_display_mode *adjusted_mode)
> +{
> +   struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> +   int totalbw, requiredbw;
> +   u8 dpbw, lanecount;
> +   u8 regs[2];
> +   int ret;
> +
> +   if (!anx7688->filter)
> +   return true;
> +
> +   /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> +   ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> +   if (ret < 0) {
> +   dev_err(&anx7688->client->dev,
> +   "Failed to read bandwidth/lane count\n");
> +   return false;
> +   }
> +   dpbw = regs[0];
> + 

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Nicolas Boichat
On Fri, Feb 14, 2020 at 8:18 PM Andrzej Hajda  wrote:
>
> On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> > From: Nicolas Boichat 
> >
> > ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> > that has an internal microcontroller.
> >
> > The only reason a Linux kernel driver is necessary is to reject
> > resolutions that require more bandwidth than what is available on
> > the DP side. DP bandwidth and lane count are reported by the bridge
> > via 2 registers on I2C.
> >
> > Signed-off-by: Nicolas Boichat 
> > Signed-off-by: Hsin-Yi Wang 
> > Signed-off-by: Enric Balletbo i Serra 
> > ---
> >
> > Changes in v2:
> > - Move driver to drivers/gpu/drm/bridge/analogix.
> > - Make the driver OF only so we can reduce the ifdefs.
> > - Update the Copyright to 2020.
> > - Use probe_new so we can get rid of the i2c_device_id table.
> >
> >  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
> >  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
> >  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
> >  3 files changed, 201 insertions(+)
> >  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> > b/drivers/gpu/drm/bridge/analogix/Kconfig
> > index e1fa7d820373..af7c2939403c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> > +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> > @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> > ANX6345 transforms the LVTTL RGB output of an
> > application processor to eDP or DisplayPort.
> >
> > +config DRM_ANALOGIX_ANX7688
> > + tristate "Analogix ANX7688 bridge"
> > + depends on OF
> > + select DRM_KMS_HELPER
> > + select REGMAP_I2C
> > + help
> > +   ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> > +   mobile HD transmitter designed for portable devices. The
> > +   ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> > +   including an intelligent crosspoint switch to support
> > +   USB Type-C.
> > +
> >  config DRM_ANALOGIX_ANX78XX
> >   tristate "Analogix ANX78XX bridge"
> >   select DRM_ANALOGIX_DP
> > diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> > b/drivers/gpu/drm/bridge/analogix/Makefile
> > index 97669b374098..27cd73635c8c 100644
> > --- a/drivers/gpu/drm/bridge/analogix/Makefile
> > +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> > @@ -1,5 +1,6 @@
> >  # SPDX-License-Identifier: GPL-2.0-only
> >  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o 
> > analogix-i2c-dptx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> > +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
> >  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
> >  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> > diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> > b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > new file mode 100644
> > index ..10a7cd0f9126
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> > @@ -0,0 +1,188 @@
> > +// SPDX-License-Identifier: GPL-2.0-only
> > +/*
> > + * ANX7688 HDMI->DP bridge driver
> > + *
> > + * Copyright 2020 Google LLC
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +/* Register addresses */
> > +#define VENDOR_ID_REG 0x00
> > +#define DEVICE_ID_REG 0x02
> > +
> > +#define FW_VERSION_REG 0x80
> > +
> > +#define DP_BANDWIDTH_REG 0x85
> > +#define DP_LANE_COUNT_REG 0x86
> > +
> > +#define VENDOR_ID 0x1f29
> > +#define DEVICE_ID 0x7688
> > +
> > +/* First supported firmware version (0.85) */
> > +#define MINIMUM_FW_VERSION 0x0085
> > +
> > +struct anx7688 {
> > + struct drm_bridge bridge;
> > + struct i2c_client *client;
> > + struct regmap *regmap;
> > +
> > + bool filter;
> > +};
> > +
> > +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> > +{
> > + return container_of(bridge, struct anx7688, bridge);
> > +}
> > +
> > +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> > +   const struct drm_display_mode *mode,
> > +   struct drm_display_mode *adjusted_mode)
> > +{
> > + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> > + int totalbw, requiredbw;
> > + u8 dpbw, lanecount;
> > + u8 regs[2];
> > + int ret;
> > +
> > + if (!anx7688->filter)
> > + return true;
> > +
> > + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> > + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> > + if (ret < 0) {
> > + dev_err(&anx7688->client->dev,
> > + "Failed to read bandwidth/lane count\n");
> > + return false;
> > + }
> > + dpbw = regs[0];
> > + lanecount = regs[1];
>
>
> Are these values hw invariant? Or they are result of cable probe/training?
>
> I

Re: [PATCH v2 2/2] drm/bridge: anx7688: Add anx7688 bridge driver support

2020-02-14 Thread Andrzej Hajda
On 13.02.2020 15:54, Enric Balletbo i Serra wrote:
> From: Nicolas Boichat 
>
> ANX7688 is a HDMI to DP converter (as well as USB-C port controller),
> that has an internal microcontroller.
>
> The only reason a Linux kernel driver is necessary is to reject
> resolutions that require more bandwidth than what is available on
> the DP side. DP bandwidth and lane count are reported by the bridge
> via 2 registers on I2C.
>
> Signed-off-by: Nicolas Boichat 
> Signed-off-by: Hsin-Yi Wang 
> Signed-off-by: Enric Balletbo i Serra 
> ---
>
> Changes in v2:
> - Move driver to drivers/gpu/drm/bridge/analogix.
> - Make the driver OF only so we can reduce the ifdefs.
> - Update the Copyright to 2020.
> - Use probe_new so we can get rid of the i2c_device_id table.
>
>  drivers/gpu/drm/bridge/analogix/Kconfig   |  12 ++
>  drivers/gpu/drm/bridge/analogix/Makefile  |   1 +
>  .../drm/bridge/analogix/analogix-anx7688.c| 188 ++
>  3 files changed, 201 insertions(+)
>  create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
>
> diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig 
> b/drivers/gpu/drm/bridge/analogix/Kconfig
> index e1fa7d820373..af7c2939403c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Kconfig
> +++ b/drivers/gpu/drm/bridge/analogix/Kconfig
> @@ -11,6 +11,18 @@ config DRM_ANALOGIX_ANX6345
> ANX6345 transforms the LVTTL RGB output of an
> application processor to eDP or DisplayPort.
>  
> +config DRM_ANALOGIX_ANX7688
> + tristate "Analogix ANX7688 bridge"
> + depends on OF
> + select DRM_KMS_HELPER
> + select REGMAP_I2C
> + help
> +   ANX7688 is an ultra-low power 4k Ultra-HD (4096x2160p60)
> +   mobile HD transmitter designed for portable devices. The
> +   ANX7688 converts HDMI 2.0 to DisplayPort 1.3 Ultra-HD
> +   including an intelligent crosspoint switch to support
> +   USB Type-C.
> +
>  config DRM_ANALOGIX_ANX78XX
>   tristate "Analogix ANX78XX bridge"
>   select DRM_ANALOGIX_DP
> diff --git a/drivers/gpu/drm/bridge/analogix/Makefile 
> b/drivers/gpu/drm/bridge/analogix/Makefile
> index 97669b374098..27cd73635c8c 100644
> --- a/drivers/gpu/drm/bridge/analogix/Makefile
> +++ b/drivers/gpu/drm/bridge/analogix/Makefile
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0-only
>  analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
>  obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
> +obj-$(CONFIG_DRM_ANALOGIX_ANX7688) += analogix-anx7688.o
>  obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
>  obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c 
> b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> new file mode 100644
> index ..10a7cd0f9126
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/analogix/analogix-anx7688.c
> @@ -0,0 +1,188 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * ANX7688 HDMI->DP bridge driver
> + *
> + * Copyright 2020 Google LLC
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* Register addresses */
> +#define VENDOR_ID_REG 0x00
> +#define DEVICE_ID_REG 0x02
> +
> +#define FW_VERSION_REG 0x80
> +
> +#define DP_BANDWIDTH_REG 0x85
> +#define DP_LANE_COUNT_REG 0x86
> +
> +#define VENDOR_ID 0x1f29
> +#define DEVICE_ID 0x7688
> +
> +/* First supported firmware version (0.85) */
> +#define MINIMUM_FW_VERSION 0x0085
> +
> +struct anx7688 {
> + struct drm_bridge bridge;
> + struct i2c_client *client;
> + struct regmap *regmap;
> +
> + bool filter;
> +};
> +
> +static inline struct anx7688 *bridge_to_anx7688(struct drm_bridge *bridge)
> +{
> + return container_of(bridge, struct anx7688, bridge);
> +}
> +
> +static bool anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
> +   const struct drm_display_mode *mode,
> +   struct drm_display_mode *adjusted_mode)
> +{
> + struct anx7688 *anx7688 = bridge_to_anx7688(bridge);
> + int totalbw, requiredbw;
> + u8 dpbw, lanecount;
> + u8 regs[2];
> + int ret;
> +
> + if (!anx7688->filter)
> + return true;
> +
> + /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
> + ret = regmap_bulk_read(anx7688->regmap, DP_BANDWIDTH_REG, regs, 2);
> + if (ret < 0) {
> + dev_err(&anx7688->client->dev,
> + "Failed to read bandwidth/lane count\n");
> + return false;
> + }
> + dpbw = regs[0];
> + lanecount = regs[1];


Are these values hw invariant? Or they are result of cable probe/training?

In 1st case this code should go rather to mode_valid.


> +
> + /* Maximum 0x19 bandwidth (6.75 Gbps Turbo mode), 2 lanes */
> + if (dpbw > 0x19 || lanecount > 2) {
> + dev_err(&anx7688->client->dev,
> + "Invalid bandwidth/lane count (%02x/%d)\n",
> + dpbw, lanecount);
> +