dt-bindings: pwm: mediatek: Add compatible string for MT7986
Subsystems (3)
PATCH 2/2 dt-bindings: pwm: mediatek: Add compatible string for MT7986
Add new compatible string for MT7986 PWM.
--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1 -0
@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC. - "mediatek,mt8183-pwm": found on mt8183 SoC. - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm": found on mt8195 SoC. - "mediatek,mt8365-pwm": found on mt8365 SoC.
Signature · 1 line
2.38.1
Rob Herring
maintainerQuoted 12 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.
This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 7 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0- "mediatek,mt8183-pwm": found on mt8183 SoC. - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm": found on mt8195 SoC. - "mediatek,mt8365-pwm": found on mt8365 SoC.Signature · 1 line
2.38.1
Quoted 8 lines · Rob Herring
Quoted 7 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)
Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Quoted 9 lines
Quoted 8 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0- "mediatek,mt8183-pwm": found on mt8183 SoC. - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm": found on mt8195 SoC. - "mediatek,mt8365-pwm": found on mt8365 SoC.Signature · 1 line
2.38.1
Quoted 22 lines · Daniel Golle
Quoted 8 lines · Rob Herring
Quoted 7 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
If so, they are compatible.
Best regards,
Krzysztof
Hi Krzysztof,
Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Daniel Golle
Quoted 20 lines · Rob Herring
Quoted 12 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 6 lines
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
Quoted 2 lines
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
I'm talking about
commit fe00faee8060402a3d85aed95775e16838a6dad2
commit 394b517585da9fbb2eea2f2103ff47d37321e976
Cheers
Daniel
Quoted 30 lines · Daniel Golle
Hi Krzysztof,
Quoted 27 lines · Krzysztof Kozlowski
Quoted 25 lines · Daniel Golle
Quoted 8 lines · Rob Herring
Quoted 7 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Quoted 7 lines
Quoted 2 lines
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Why on MT8183 there would be undocumented memory? Where is undocumented memory?
Quoted 4 lines
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
So why they are not made compatible?
Quoted 10 lines
Quoted 3 lines
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
I'm talking about
commitfe00faee8060402a3d85aed95775e16838a6dad2
commit394b517585da9fbb2eea2f2103ff47d37321e976
This is a pattern spreading in several Mediatek bindings and we already commented on new patches. I don't know why people working on Mediatek do not mark pieces compatible.
Best regards,
Krzysztof
Quoted 34 lines · Krzysztof Kozlowski
Quoted 33 lines · Daniel Golle
Hi Krzysztof,
Quoted 29 lines · Krzysztof Kozlowski
Quoted 22 lines · Daniel Golle
Quoted 8 lines · Rob Herring
Quoted 7 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Quoted 7 lines
Quoted 4 lines
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Why on MT8183 there would be undocumented memory? Where is undocumented memory?
So we were talking about using the MT8183 compatible for MT7986 SoC, as the PWM units are identical apart from the number of channels they offer:
MT7986 got 2 PWM channels. The MMIO registers used for those two channels start at offsets 0x10 (pwm0) and 0x50 (pwm1)
MT8183 got 4 PWM channels. The MMIO registers used for those four channels start of offsets 0x10 (pwm0), 0x50 (pwm1), 0x90 (pwm2) and 0xd0 (pwm3).
Hence, when using the MT8183 compatible with MT7986, the driver will access offsets 0x90 and 0xd0 in case the users enables the (bogus) outputs pwm2 and pwm3. These offsets, however, are not mentioned in the datasheet, so it has to be considered that writing things to these undocumented offsets could cause unknown behavior.
I hope it's more clear now what I mean.
Quoted 7 lines
Quoted 5 lines
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
So why they are not made compatible?
My guess is that it's for this very reason:
To correctly communicate the capabilities (in this case: number of channels) to the driver and not have bogus pwmX show up in the OS which then causes undocumented MMIO register access in case anyone tries to actually use them.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
Quoted 7 lines
Quoted 3 lines
I'm talking about
commitfe00faee8060402a3d85aed95775e16838a6dad2
commit394b517585da9fbb2eea2f2103ff47d37321e976This is a pattern spreading in several Mediatek bindings and we already commented on new patches. I don't know why people working on Mediatek do not mark pieces compatible.
Others will have to answer that for you.
To me this looks a bit like a structural shortcoming of the PWM controller
bindings: if there was a way to tell the driver "hey, this is like MT8183, but it got only two channels" that would solve it nicely.
This could either be done using child-nodes for each PWM channel or by simply adding a 'nr-pwms' property.
Cheers
Daniel
Quoted 40 lines · Daniel Golle
Quoted 39 lines · Krzysztof Kozlowski
Quoted 37 lines · Daniel Golle
Hi Krzysztof,
Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Daniel Golle
Quoted 20 lines · Rob Herring
Quoted 12 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 6 lines
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Quoted 6 lines
Quoted 2 lines
Why on MT8183 there would be undocumented memory? Where is undocumented memory?
So we were talking about using the MT8183 compatible for MT7986 SoC, as the PWM units are identical apart from the number of channels they offer:
No, we talk about MT8183 with mt7986-pwm compatible. Read again my message.
Quoted 8 lines
MT7986 got 2 PWM channels. The MMIO registers used for those two channels start at offsets
0x10(pwm0) and0x50(pwm1)MT8183 got 4 PWM channels. The MMIO registers used for those four channels start of offsets
0x10(pwm0),0x50(pwm1),0x90(pwm2) and0xd0(pwm3).
Quoted 7 lines
Hence, when using the MT8183 compatible with MT7986, the driver will access offsets
0x90and0xd0in case the users enables the (bogus) outputs pwm2 and pwm3. These offsets, however, are not mentioned in the datasheet, so it has to be considered that writing things to these undocumented offsets could cause unknown behavior.I hope it's more clear now what I mean.
But even your case is not correct. On MT7986 the device would still have 2 channels, how the heck he would get 4? Driver binds to ,t7986-pwm compatible, which defines 2 channels.
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
Quoted 7 lines
Quoted 1 line
So why they are not made compatible?
My guess is that it's for this very reason:
To correctly communicate the capabilities (in this case: number of channels) to the driver and not have bogus pwmX show up in the OS which then causes undocumented MMIO register access in case anyone tries to actually use them.
No, that's not correct reason. There would be no wrong MMIO access and capabilities would be still correctly communicated.
Quoted 17 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
Quoted 7 lines
Quoted 3 lines
I'm talking about
commitfe00faee8060402a3d85aed95775e16838a6dad2
commit394b517585da9fbb2eea2f2103ff47d37321e976This is a pattern spreading in several Mediatek bindings and we already commented on new patches. I don't know why people working on Mediatek do not mark pieces compatible.
Quoted 7 lines
Others will have to answer that for you.
To me this looks a bit like a structural shortcoming of the PWM controller
bindings: if there was a way to tell the driver "hey, this is like MT8183, but it got only two channels" that would solve it nicely.
This could either be done using child-nodes for each PWM channel or by simply adding a 'nr-pwms' property.
No, it's rather someone did not think about Devicetree compatibles or did not care to design the Mediatek bindings and just copy-paste existing pattern...
Best regards,
Krzysztof
Quoted 41 lines · Krzysztof Kozlowski
Quoted 40 lines · Daniel Golle
Quoted 39 lines · Krzysztof Kozlowski
Quoted 37 lines · Daniel Golle
Hi Krzysztof,
Quoted 23 lines · Krzysztof Kozlowski
Quoted 22 lines · Daniel Golle
Quoted 20 lines · Rob Herring
Quoted 12 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +0
-0Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 4 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 6 lines
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Why on MT8183 there would be undocumented memory? Where is undocumented memory?
So we were talking about using the MT8183 compatible for MT7986 SoC, as the PWM units are identical apart from the number of channels they offer:
No, we talk about MT8183 with mt7986-pwm compatible. Read again my message.
Ok, that was not clear to me. I understood the other way around, to use mediatek,mt8183-pwm on MT7986 (and not even introduce an additional compatible for MT7986 in the driver, but only list it as compatibly with existing MT8183 in binding docs).
So: The to-be newly introduced mediatek,mt7986-pwm should work on MT8183 as well, but in that case only two of the four channels would be accessible.
Quoted 15 lines
Quoted 15 lines
MT7986 got 2 PWM channels. The MMIO registers used for those two channels start at offsets
0x10(pwm0) and0x50(pwm1)MT8183 got 4 PWM channels. The MMIO registers used for those four channels start of offsets
0x10(pwm0),0x50(pwm1),0x90(pwm2) and0xd0(pwm3).Hence, when using the MT8183 compatible with MT7986, the driver will access offsets
0x90and0xd0in case the users enables the (bogus) outputs pwm2 and pwm3. These offsets, however, are not mentioned in the datasheet, so it has to be considered that writing things to these undocumented offsets could cause unknown behavior.
Quoted 5 lines
Quoted 1 line
I hope it's more clear now what I mean.
But even your case is not correct. On MT7986 the device would still have 2 channels, how the heck he would get 4? Driver binds to ,t7986-pwm compatible, which defines 2 channels.
If we do introduce that new compatible, then yes.
I understood you were suggesting to use mediatek,mt8183 on MT7986 hardware which would have resulted in such behavior.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 7 lines
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
So why they are not made compatible?
Quoted 8 lines
Quoted 5 lines
My guess is that it's for this very reason:
To correctly communicate the capabilities (in this case: number of channels) to the driver and not have bogus pwmX show up in the OS which then causes undocumented MMIO register access in case anyone tries to actually use them.No, that's not correct reason. There would be no wrong MMIO access and capabilities would be still correctly communicated.
So what exactly do you mean by "made compatible"?
In the driver? In DTS files? In DT-bindings?
Quoted 26 lines
Quoted 18 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
Quoted 7 lines
Quoted 3 lines
I'm talking about
commitfe00faee8060402a3d85aed95775e16838a6dad2
commit394b517585da9fbb2eea2f2103ff47d37321e976This is a pattern spreading in several Mediatek bindings and we already commented on new patches. I don't know why people working on Mediatek do not mark pieces compatible.
Quoted 7 lines
Others will have to answer that for you.
To me this looks a bit like a structural shortcoming of the PWM controller
bindings: if there was a way to tell the driver "hey, this is like MT8183, but it got only two channels" that would solve it nicely.
This could either be done using child-nodes for each PWM channel or by simply adding a 'nr-pwms' property.
Quoted 3 lines
No, it's rather someone did not think about Devicetree compatibles or did not care to design the Mediatek bindings and just copy-paste existing pattern...
So in that case, maybe those existing patterns should be cleaned up? Can you suggest a change? (even informal, I can wrap it up as patch).
To me, code is almost always better documentation than actual documentation, which is usually time consuming to read, hard to understand (compared to reading code or existing examples), and it's commonly full of errors. I hardly waste my time with it, if there is code or existing examples, I will always prefer do read and understand that.
Cheers
Daniel
Quoted 49 lines · Daniel Golle
Quoted 48 lines · Krzysztof Kozlowski
Quoted 46 lines · Daniel Golle
Quoted 34 lines · Krzysztof Kozlowski
Quoted 33 lines · Daniel Golle
Hi Krzysztof,
Quoted 29 lines · Krzysztof Kozlowski
Quoted 22 lines · Daniel Golle
Quoted 8 lines · Rob Herring
Quoted 7 lines · Daniel Golle
Add new compatible string for MT7986 PWM.
Signed-off-by Daniel Golle <[email protected]>--- Documentation/devicetree/bindings/pwm/pwm-mediatek.txt | 1 + 1 file changed, 1 insertion(+)Quoted 12 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 11
Quoted 9 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +1
-0@@ -8,6 +8,7 @@ Required properties: - "mediatek,mt7623-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC.This version of the PWM h/w is not compatible with any of the existing chips? If it is, it should have a fallback compatible.
Quoted 3 lines
No, it is unique because it comes with just 2 PWM channels. Otherwise the driver behaves just like for MT8183 (4 channels) or MT8365 (3 channels) which also got distinct compatible strings.
Then something would be here compatible. E.g. If you bound MT8183 with mt7986-pwm compatible, would you get working device with two channels?
Quoted 7 lines
Quoted 4 lines
Yes, but I'd see another 2 channels which do not work, accessing them may even cause problems (I haven't tried that) as it means accessing an undocumented memory range of the SoC which we in general we shouldn't be messing around with.
Why on MT8183 there would be undocumented memory? Where is undocumented memory?
So we were talking about using the MT8183 compatible for MT7986 SoC, as the PWM units are identical apart from the number of channels they offer:
Quoted 6 lines
Quoted 1 line
No, we talk about MT8183 with mt7986-pwm compatible. Read again my message.
Ok, that was not clear to me. I understood the other way around, to use
mediatek,mt8183-pwmon MT7986 (and not even introduce an additional compatible for MT7986 in the driver, but only list it as compatibly with existing MT8183 in binding docs).
You need dedicated compatible (which will be used by the driver) because these are two different devices.
Quoted 19 lines
So: The to-be newly introduced
mediatek,mt7986-pwmshould work on MT8183 as well, but in that case only two of the four channels would be accessible.Quoted 15 lines
Quoted 15 lines
MT7986 got 2 PWM channels. The MMIO registers used for those two channels start at offsets
0x10(pwm0) and0x50(pwm1)MT8183 got 4 PWM channels. The MMIO registers used for those four channels start of offsets
0x10(pwm0),0x50(pwm1),0x90(pwm2) and0xd0(pwm3).Hence, when using the MT8183 compatible with MT7986, the driver will access offsets
0x90and0xd0in case the users enables the (bogus) outputs pwm2 and pwm3. These offsets, however, are not mentioned in the datasheet, so it has to be considered that writing things to these undocumented offsets could cause unknown behavior.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
I hope it's more clear now what I mean.
But even your case is not correct. On MT7986 the device would still have 2 channels, how the heck he would get 4? Driver binds to ,t7986-pwm compatible, which defines 2 channels.
If we do introduce that new compatible, then yes.
No one here argued against introducing new compatible. The question was why these devices are not compatible with each other? Why new compatible is not made a part of family of existing compatibles.
Quoted 19 lines
I understood you were suggesting to use
mediatek,mt8183on MT7986 hardware which would have resulted in such behavior.Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Quoted 7 lines
Also note that this case is the same as MT8183 vs. MT8365, they got distinct compatible strings and also for those two the only difference is the number of channels.
So why they are not made compatible?
My guess is that it's for this very reason:
To correctly communicate the capabilities (in this case: number of channels) to the driver and not have bogus pwmX show up in the OS which then causes undocumented MMIO register access in case anyone tries to actually use them.
Quoted 5 lines
Quoted 2 lines
No, that's not correct reason. There would be no wrong MMIO access and capabilities would be still correctly communicated.
So what exactly do you mean by "made compatible"?
In the driver? In DTS files? In DT-bindings?
I review bindings, so by "devices being made compatible" I meant exactly what Devicetree specification asks:
"The property value consists of a concatenated list of null terminated strings, from most specific to most general. They allow a device to express its compatibility with a family of similar devices, potentially allowing a single device driver to match against several devices."
Which means that devices share some common characteristics, like programming model, and differ by some other pieces. For device drivers, usually this also means that a device can use any of the compatibles to bind and function properly, within the limits/features of that compatible.
Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
If so, they are compatible.
By that definition you should remove the additional compatible for MT8365 or rather, it should have been rejected for the same argument.
Quoted 7 lines
Quoted 3 lines
I'm talking about
commitfe00faee8060402a3d85aed95775e16838a6dad2
commit394b517585da9fbb2eea2f2103ff47d37321e976This is a pattern spreading in several Mediatek bindings and we already commented on new patches. I don't know why people working on Mediatek do not mark pieces compatible.
Others will have to answer that for you.
To me this looks a bit like a structural shortcoming of the PWM controller
bindings: if there was a way to tell the driver "hey, this is like MT8183, but it got only two channels" that would solve it nicely.
This could either be done using child-nodes for each PWM channel or by simply adding a 'nr-pwms' property.
Quoted 6 lines
Quoted 3 lines
No, it's rather someone did not think about Devicetree compatibles or did not care to design the Mediatek bindings and just copy-paste existing pattern...
So in that case, maybe those existing patterns should be cleaned up? Can you suggest a change? (even informal, I can wrap it up as patch).
Someone knowing the devices should reorganize compatibles to come up with family models, e.g. expressed in DT schema like:
oneOf:
- const: mediatek,mt7986-pwm
- items:
- enum:
- mediatek,mt8183-pwm
- const: mediatek,mt7986-pwm
and so on.
Quoted 6 lines
To me, code is almost always better documentation than actual documentation, which is usually time consuming to read, hard to understand (compared to reading code or existing examples), and it's commonly full of errors. I hardly waste my time with it, if there is code or existing examples, I will always prefer do read and understand that.
Example schema expresses it:
Best regards,
Krzysztof
PATCH v2 1/1 dt-bindings: pwm: mediatek: Add compatible for MT7986
Add new compatible string for MT7986 PWM and list compatible units for existing entries. Also make sure the number of pwm1-X clocks is listed for all supported units.
--- .../devicetree/bindings/pwm/pwm-mediatek.txt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +12 -8
@@ -2,14 +2,15 @@ MediaTek PWM controller Required properties: - compatible: should be "mediatek,<name>-pwm": - - "mediatek,mt2712-pwm": found on mt2712 SoC. + - "mediatek,mt2712-pwm", "mediatek,mt6795-pwm": found on mt2712 SoC. - "mediatek,mt6795-pwm": found on mt6795 SoC. - - "mediatek,mt7622-pwm": found on mt7622 SoC. - - "mediatek,mt7623-pwm": found on mt7623 SoC. + - "mediatek,mt7622-pwm", "mediatek,mt8195-pwm", "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt7622 SoC. + - "mediatek,mt7623-pwm", "mediatek,mt7628-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. - - "mediatek,mt8183-pwm": found on mt8183 SoC. - - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm": found on mt8195 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC. + - "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt8183 SoC. + - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt8195 SoC. - "mediatek,mt8365-pwm": found on mt8365 SoC. - "mediatek,mt8516-pwm": found on mt8516 SoC. - reg: physical base address and length of the controller's registers.
@@ -20,11 +21,14 @@ Required properties: has no clocks - "top": the top clock generator - "main": clock used by the PWM core + - "pwm1" : the PWM1 clock for mt7629 + - "pwm1-2": the two per PWM clocks for mt7986 - "pwm1-3": the three per PWM clocks for mt8365 - - "pwm1-8": the eight per PWM clocks for mt2712 + - "pwm1-4": the four per PWM clocks for mt7628 or mt8183 + - "pwm1-5": the five per PWM clocks for mt7623 or mt8516 - "pwm1-6": the six per PWM clocks for mt7622 - - "pwm1-5": the five per PWM clocks for mt7623 - - "pwm1" : the PWM1 clock for mt7629 + - "pwm1-7": the seven per PWM clocks for mt6795 + - "pwm1-8": the eight per PWM clocks for mt2712 - pinctrl-names: Must contain a "default" entry. - pinctrl-0: One property must exist for each entry in pinctrl-names. See pinctrl/pinctrl-bindings.txt for details of the property values.
Signature · 1 line
2.38.1
Re: [PATCH v2] dt-bindings: pwm: mediatek: Add compatible for MT7986
Quoted 42 lines · Daniel Golle
Add new compatible string for MT7986 PWM and list compatible units for existing entries. Also make sure the number of pwm1-X clocks is listed for all supported units.
Signed-off-by Daniel Golle <[email protected]>--- .../devicetree/bindings/pwm/pwm-mediatek.txt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +8
-6@@ -2,14 +2,15 @@ MediaTek PWM controller Required properties: - compatible: should be "mediatek,<name>-pwm": - - "mediatek,mt2712-pwm": found on mt2712 SoC. + - "mediatek,mt2712-pwm", "mediatek,mt6795-pwm": found on mt2712 SoC. - "mediatek,mt6795-pwm": found on mt6795 SoC. - - "mediatek,mt7622-pwm": found on mt7622 SoC. - - "mediatek,mt7623-pwm": found on mt7623 SoC. + - "mediatek,mt7622-pwm", "mediatek,mt8195-pwm", "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt7622 SoC. + - "mediatek,mt7623-pwm", "mediatek,mt7628-pwm": found on mt7623 SoC. - "mediatek,mt7628-pwm": found on mt7628 SoC. - "mediatek,mt7629-pwm": found on mt7629 SoC. - - "mediatek,mt8183-pwm": found on mt8183 SoC. - - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm": found on mt8195 SoC. + - "mediatek,mt7986-pwm": found on mt7986 SoC. + - "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt8183 SoC. + - "mediatek,mt8195-pwm", "mediatek,mt8183-pwm", "mediatek,mt7986-pwm": found on mt8195 SoC. - "mediatek,mt8365-pwm": found on mt8365 SoC. - "mediatek,mt8516-pwm": found on mt8516 SoC. - reg: physical base address and length of the controller's registers.@@ -20,11 +21,14 @@ Required properties: has no clocks - "top": the top clock generator - "main": clock used by the PWM core + - "pwm1" : the PWM1 clock for mt7629 + - "pwm1-2": the two per PWM clocks for mt7986 - "pwm1-3": the three per PWM clocks for mt8365 - - "pwm1-8": the eight per PWM clocks for mt2712
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt Required properties: · line 34
Quoted 10 lines
Documentation/devicetree/bindings/pwm/pwm-mediatek.txt +4
-2+ - "pwm1-4": the four per PWM clocks for mt7628 or mt8183 + - "pwm1-5": the five per PWM clocks for mt7623 or mt8516 - "pwm1-6": the six per PWM clocks for mt7622 - - "pwm1-5": the five per PWM clocks for mt7623 - - "pwm1" : the PWM1 clock for mt7629 + - "pwm1-7": the seven per PWM clocks for mt6795 + - "pwm1-8": the eight per PWM clocks for mt2712 - pinctrl-names: Must contain a "default" entry. - pinctrl-0: One property must exist for each entry in pinctrl-names. See pinctrl/pinctrl-bindings.txt for details of the property values.
I have no concerns. However converting that to yaml would be a nice thing. Also I didn't notice an effort to adapt the dts files accordingly. But that might be because I wasn't on Cc: for these (or I might have missed them despite the Cc: :-)
I'll mark this patch as handled-elsewhere in the PWM patchwork.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Re: [PATCH v2] dt-bindings: pwm: mediatek: Add compatible for MT7986
In reply to Daniel GolleQuoted 9 lines · Daniel Golle
Add new compatible string for MT7986 PWM and list compatible units for existing entries. Also make sure the number of pwm1-X clocks is listed for all supported units.
Signed-off-by Daniel Golle <[email protected]>--- .../devicetree/bindings/pwm/pwm-mediatek.txt | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
You managed to miss all folks from DT :/
Best regards,
Krzysztof