ChanServ changed the topic of #linux-sunxi to: Allwinner/sunxi development - Did you try looking at our wiki? https://linux-sunxi.org - Don't ask to ask. Just ask and wait for an answer! - This channel is logged at https://oftc.irclog.whitequark.org/linux-sunxi
smaeul_ has joined #linux-sunxi
radxanaoki has quit [Quit: radxanaoki]
smaeul has quit [Ping timeout: 480 seconds]
ftg has quit [Read error: Connection reset by peer]
Daanct12 has joined #linux-sunxi
cnxsoft has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
Schimsalabim has quit [Read error: Connection reset by peer]
Schimsalabim has joined #linux-sunxi
<tokyovigilante> jernej: the IOMMU patch looks like it works well, can successfully enable the display engine with the IOMMU now
junari has joined #linux-sunxi
<junari> jernej: There are errors in the log with your latest patch https://paste.c-net.org/FiletRubber
junari has quit [Remote host closed the connection]
junari has joined #linux-sunxi
cnxsoft has quit [Ping timeout: 480 seconds]
hexdump01 has joined #linux-sunxi
hexdump0815 has quit [Ping timeout: 480 seconds]
vagrantc has quit [Quit: leaving]
JohnDoe_71Rus has joined #linux-sunxi
cnxsoft has joined #linux-sunxi
bauen1 has joined #linux-sunxi
bauen1 has quit [Ping timeout: 480 seconds]
junari has quit [Ping timeout: 480 seconds]
<jernej> junari: is it only a warning message or it doesn't work at all?
apritzel has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
tokyovigilante has quit [Remote host closed the connection]
tokyovigilante has joined #linux-sunxi
hazardchem has quit [Read error: Connection reset by peer]
hazardchem has joined #linux-sunxi
tokyovigilante has quit [Remote host closed the connection]
tokyovigilante has joined #linux-sunxi
Schimsalabim has quit [Ping timeout: 480 seconds]
Schimsalabim has joined #linux-sunxi
Robot_ has joined #linux-sunxi
Robot_ has quit []
Schimsalabim has quit [Ping timeout: 480 seconds]
ungeskriptet has quit [Remote host closed the connection]
ungeskriptet has joined #linux-sunxi
Schimsalabim has joined #linux-sunxi
Schimsalabim has quit [Ping timeout: 480 seconds]
Schimsalabim has joined #linux-sunxi
radxanaoki has joined #linux-sunxi
radxanaoki has quit []
bauen1 has joined #linux-sunxi
Schimsalabim has quit [Ping timeout: 480 seconds]
Schimsalabim has joined #linux-sunxi
radxanaoki has joined #linux-sunxi
Schimsalabim has quit [Read error: Connection reset by peer]
Schimsalabim has joined #linux-sunxi
radxanaoki has quit [Quit: radxanaoki]
Schimsalabim has quit [Read error: No route to host]
Schimsalabim has joined #linux-sunxi
Daanct12 has quit [Quit: WeeChat 4.5.1]
JohnDoe_71Rus has quit [Ping timeout: 480 seconds]
JohnDoe_71Rus has joined #linux-sunxi
apritzel has joined #linux-sunxi
<apritzel> I guess this check needs to be changed as well, as now the addresses don't match anymore, with bit 32 differing
<jernej> yeah, that's why I asking if it works otherwise
cnxsoft has quit [Ping timeout: 480 seconds]
apritzel has quit [Ping timeout: 480 seconds]
Schimsalabim has quit [Ping timeout: 480 seconds]
ftg has joined #linux-sunxi
Schimsalabim has joined #linux-sunxi
apritzel has joined #linux-sunxi
Schimsalabim has quit [Ping timeout: 480 seconds]
Schimsalabim has joined #linux-sunxi
apritzel has quit [Ping timeout: 480 seconds]
<kuba2k2> does anyone know what determines the assignment of clocks to peripherals on sunxi? I mean, for example the CLK_SRC_SEL bits in TVE_CLK_REG or TCONTV_CLK_REG
<kuba2k2> for example, why is it assigned to PLL_VIDEO0_1X and not PLL_VIDEO1_4X for instance
psydroid has quit []
psydroid has joined #linux-sunxi
apritzel has joined #linux-sunxi
<apritzel> kuba2k2: that's done by the Common Clock Framework (CCF) in Linux, so generic clock code
<apritzel> it gets the layout of the clock tree, encoded in the hardware clock drivers, and some parts in the DT, then picks the "best suitable" parent, depending on the rate requested
<kuba2k2> when I try to enable the TVE (and the TCON TV) on a T113, the same clock source is used for both
<apritzel> I *think* if it can reach the frequency with the currently selected parent, it keeps it that way, otherwise it tries the other parents
<apritzel> I think that's part of the strategy: to reuse existing clock sources
<kuba2k2> that would make sense; however, in my case, both the LCD and TV TCONs try to use the same parent
<apritzel> is that a problem?
<kuba2k2> yeah, because first the LCD tcon sets it to 65 MHz (at least that's what is passed to clk_set_rate(), somehow it becomes 450 MHz in the end)
<kuba2k2> and then the TV tcon sets it to 13 MHz...
<kuba2k2> which, logically, changes the clock rate that LCD tcon wanted to have
<apritzel> that sounds odd, the CCF should not do that: if there are conflicting clock rates, it would reconfigure or pick another parent
<apritzel> so are you sure that the clock tree is described correctly?
<apritzel> keep in mind that most mod clock have a divider, so you can have a higher clock parent, shared by multiple mod clocks, with different dividers
<kuba2k2> all I can see is ccu-sun20i-d1.c, and it *seems* correct
<apritzel> kuba2k2: are you using both TCONs at the same time?
<kuba2k2> well I'm trying to, unless it's impossible by design
<kuba2k2> ultimately I want to get the TVE to work alone, at least
<apritzel> there was a patch lately, which forces parents for some video clocks, in the DT, let me find it
<kuba2k2> I see, I'll try that method
<kuba2k2> do you happen to know why does the clk_set_rate() call with 65MHz set the clock to 450 MHz? (sun4i_tcon0_mode_set_lvds)
<apritzel> clk_set_rate() on which clock, exactly?
bauen1 has quit [Ping timeout: 480 seconds]
<apritzel> on CLK_TCON_LCD0 (or CLK_TCON_TV?
<kuba2k2> this ends up setting the TCONLCD_CLK to 450 MHz
<kuba2k2> and mode->crtc_clock is 65000 here
<apritzel> those clocks are divider clocks, and have CLK_SET_RATE_PARENT set, so the request is handed up to the (currently selected) PLL
<apritzel> which has a minimum frequency of 252MHz, so the algorithm should start searching there for a combination of factor and dividers that express the requested rate as close as possible
<apritzel> so I guess it's PLL_VIDEO0 that gets 450 MHz, and then gets divided down, say by 7, to get to the 65 MHz?
<kuba2k2> PLL_VIDEO gets 450 MHz, but it's not divided, TCONLCD_CLK_REG has N=1 and M=0
<kuba2k2> so unless there's another divider that I'm not seeing, TCONLCD gets 450 MHz
<kuba2k2> which makes sense - 65 mhz is the pixel clock, obviously the tcon must run faster than that - what I don't get is where does the 450 come from if 65 is (seemingly) requested
<kuba2k2> I want to understand that for the TCON TV case, which requests 13.5 MHz and that exactly is set - which makes both TCONs clocked way too slowly
<apritzel> kuba2k2: try to play that through in drivers/clk/sunxi-ng/ccu_mp.c:ccu_mp_find_best_with_parent_adj(), that should be the function in charge, IIUC
<kuba2k2> ok, thanks, I'll try that
IlikeTech has quit [Read error: Connection reset by peer]
dsimic is now known as Guest9771
dsimic has joined #linux-sunxi
<jernej> apritzel, kuba2k2: sunxi-ng clk driver usually botches clock setting when there are two video output active at the same time without some pointers in DT.
Guest9771 has quit [Ping timeout: 480 seconds]
IlikeTech has joined #linux-sunxi
<jernej> there was hope that some purely algoritmic solution will be implemented, but nobody figured it out yet
<kuba2k2> I assume the BSP just hardcodes everything
<apritzel> jernej: right, so I was wondering how it handles those conflicts? It seems like clk_set_rate() goes straight to the hw clk driver, there is no CCF logic involved?
<jernej> older BSP clock drivers work differently, more manually, like device drivers usually select parent and clock
<apritzel> I mean the obvious algorithm would be: check if parent is already used: then try to find a divider with that fixed parent rate. If not, try another parent (we typically have a choice)
<jernej> apritzel: main issue is that clock rates aren't lock in place. so if you set one clock rate for one core, let's say TCON, next one, for example, HDMI PHY may use same parent, but thus change it and thus influence TCON clock.
hexdump01 has quit []
<apritzel> yes, but that seems like an obvious and generic problem, isn't it?
hexdump0815 has joined #linux-sunxi
<jernej> of course
<apritzel> something that the CCF should take care of, not necessarily the sunxi-ng drivers?
<apritzel> but it any case: it doesn't sound too complicated to implement, which makes me wonder why nobody has done this before?
hexdump0815 has quit []
<apritzel> because rarely anyone uses two video outputs at the same time?
hexdump0815 has joined #linux-sunxi
<jernej> apritzel: be my guest :)
<jernej> there is clk_set_rate_exclusive() but if I'm not mistaken, it also locks parent rate
<kuba2k2> iirc it won't be a problem then if I use assigned-clock-parents = <> in the DT?
<jernej> oh, BSP also set parents to fixed rate, for example, PLL_VIDEO 297 MHz, which can be easily divided to pixel clocks for standard resolutions. But that also means that all weird screen sizes many have don't work.
<jernej> kuba2k2: that's possible solution but I would like to avoid it, if possible. IIRC it's also more of a suggestion and driver can change parent later.
<kuba2k2> well, for now all I get on the CVBS output is a green screen anyway :)
<kuba2k2> (the colorbar works though, but anything coming from the TCON TV to TVE doesn't)
<jernej> apritzel: I don't remember which use case shows the issue. Probably some A64 board with LCD and HDMI, like pinebook.
<jernej> kuba2k2: colorbar in TCON?
<apritzel> jernej: yes, that Pinebook patch lately, but I thought that the parent choice also influenced some other mux?
<kuba2k2> jernej: no, colorbar in TVE. setting TV_SRC_SEL in TCON doesn't make a difference (i.e. to see the RGB color gradient test)
<apritzel> jernej: anyway, interesting, I always thought that the CCF would take care of that, given that it knows the number of users per clock, for instance, and those generic flags
<jernej> kuba2k2: oh, I wasn't aware that TVE also has colorbar setting, I only know TCON one
<kuba2k2> yeah it has a separate one. solid color bars, white/yellow/cyan/lime/magenta/red/blue/black, i.e. the 8 basic colors
<jernej> apritzel: I think issue is in sunxi-ng driver. When clock is asked to find closest rate to the requested, it first check current parent. If there is perfect match, that's it. If it's not, it finds first perfect or best match with other parent, regardless if it already supports some other active clock.
<jernej> but take that with grain of salt, it's been years since I worked on clock driver
<jernej> kuba2k2: which clocks are you using? I want to check something.
<kuba2k2> to get the green screen? same as the BSP, PLL_VIDEO1_4X for TCON TV0, and PLL_VIDEO0_4X for TVE
<kuba2k2> but I just found the register map for TCON TOP, and noticed there are also clock gates and source select bits there.. so I'm trying to set it up now too
<jernej> ah yes, that's also needed :)
<kuba2k2> right, I see text now :) though it's very much squished vertically and I don't think colors work... but it's something :)
<apritzel> jernej: makes sense, that's what I also got from skimming over the code
<kuba2k2> jernej: and the green screen is still there. But it's probably related to https://groups.google.com/g/linux-sunxi/c/HxDBpY5HbbQ/m/mX2O2OYlCwAJ - I also get the green tint on screen, but only sometimes.
<jernej> kuba2k2: have you colorbar pattern enabled? if not, it's likely that you don't have mixer properly set up.
<kuba2k2> I didn't touch the mixer configuration. The TVE colorbar displays fine. The TCON color gradient doesn't it's all green-ish
<kuba2k2> but the green tint is also (sometimes) present on LVDS or DSI
<kuba2k2> it is set this way by default
<kuba2k2> (which is odd now that I think about it, the code clearly disables all the bits)
<kuba2k2> or maybe not, sun8i_tcon_top_de_config() will probably set this bit if mixer is 1
<jernej> actually, if you have both mixer1 active, it should be reconfigured after init, so this is good
<kuba2k2> hmm, the patch says "makes sure both DEs never share the same output", maybe they can't *ever* be set to the same output, even before the init completes?
<kuba2k2> I'll try the patch then
<jernej> kuba2k2: do you have TCON_TOP register 0 configured? Bit 8 and possibly bit 0 set?
<jernej> and bit 20 in register 0x20?
<kuba2k2> register 0 bit 0 (TV0_CLK_SRC) is set, others cleared
<kuba2k2> register 0x20 bit 20 (TV0_CLK_GATE) is set, others cleared
<jernej> try also enabling TCON_TV0_OUTSEL
<kuba2k2> nothing changed
<kuba2k2> the tcon top patch didn't help either
<kuba2k2> this is how it looks now: https://pasteboard.co/NyouJgqoelPZ.png
<jernej> kuba2k2: that looks to me like missing color conversion from RGB to YUV
<kuba2k2> let me guess.. sunxi_engine_apply_color_correction() ? :D
<jernej> correct :)
<jernej> specifically, mixer code
<kuba2k2> right, I've seen this patch before, but now it makes more sense to me :) I'll try
<jernej> although now that I think about it, this can only work on DE2 and as such, patch would need some rework to be acceptable for mainline
<kuba2k2> the rgb2yuv part in mixer, you mean?
<kuba2k2> the DT changes seems unnecessary for the D1s/T113, at least
<kuba2k2> (as it's already defined in DT, and the D1 has a tcon top, whereas the H3 doesn't)
<jernej> correct
<kuba2k2> the quirks->calibration part in sun4i_tv is not applicable to D1 too, as the entire TVE driver is totally different than on H3/A10
<jernej> correct, I just put it for reference for color conversion part
<kuba2k2> and that is specific to de2? isn't sun8i-mixer only for de2 anyway?
<kuba2k2> mm, the green tint is still there
<kuba2k2> but it is also there when displaying the TCON color gradient. Is that coming through the mixer too? https://pasteboard.co/NOhcsYISWL0h.png
JohnDoe_71Rus has quit [Quit: KVIrc 5.2.6 Quasar http://www.kvirc.net/]
<jernej> that code is specific to DE2, yes. With every generation of DE, CSC units get moved a bit
<jernej> kuba2k2: no, but I'm not sure if it outputs in RGB or YUV
<kuba2k2> well whatever it outputs in, it works on BSP - and if the mixer isn't in play here (with the color gradient), then it shouldn't need the color conversion for that anyway
<jernej> do you have working BSP? check if TCON CEU registers are set
<jernej> that's basically CSC unit too
<kuba2k2> CEU_EN = 0
<kuba2k2> but the coef's are set (Rr, Gg, Bb) and the ranges
<kuba2k2> I have a working BSP, and I saved all the registers when it was configured in TVE mode. So I'm setting most of them to the same values on mainline
<kuba2k2> oh? I removed mixer1 completely, just like the patch in the google group (https://paste.xogium.me/pn.txt), and the colors are now perfectly fine
Topi has joined #linux-sunxi
Topi has quit []
<jernej> but you don't have TVE output now, right?
<kuba2k2> I do
<kuba2k2> still needs the color correction patch, but with mixer1 gone the TVE works. Don't know if LVDS will work simultaneously
<jernej> oh, so that patch you linked is not yours
<kuba2k2> no, it's from the google group I sent before (https://groups.google.com/g/linux-sunxi/c/HxDBpY5HbbQ/m/mX2O2OYlCwAJ)
<jernej> no, TVE most likely uses mixer0 now, so LVDS won't work
<kuba2k2> correct, LVDS is all yellow now (why yellow? idk)
<kuba2k2> so it seems like the color correction doesn't apply correctly to both mixers, and if only one is present then it does and TVE can use it
<jernej> TVE is YUV, LVDS is RGB, so you can run both with the same colorspace
<jernej> *can't
<kuba2k2> so the mixer should take care of that, right? at least, one of the mixers
<kuba2k2> and TVE should then use that output, right?
<jernej> yes
<jernej> kuba2k2: is there BSP for D1/T113 on the net?
<kuba2k2> yes, the tina linux 5.4 kernel
<kuba2k2> this one https://github.com/ixgbe/linux-5.4 since the original repo is gone
<jernej> tnx
<kuba2k2> but it's very tricky to get working without the BSP u-boot (it expects PSCI, for instance)
<jernej> I'm just interested in sources, to check configuration related to mixer1, since that seems to cause the issue
<kuba2k2> right. I couldn't find the mixer1 driver yet
<jernej> BSP has organized things a bit differently. Low level bits related to DE are here: https://github.com/ixgbe/linux-5.4/tree/master/drivers/video/fbdev/sunxi/disp2/disp/de/lowlevel_v2x
<jernej> mixer driver would be de_rtmx
<kuba2k2> yep, found that, but it's just so different from mainline that it's hard to read exactly which registers do what
<jernej> it's always good to check clock and feat modules too
<jernej> it takes some practice :) btw, there is DE2 documentation on wiki, if you're interested
<kuba2k2> oh.. I totally missed the PDF
<kuba2k2> thanks for the help so far. I'll see tomorrow if I can get anywhere with this
smaeul_ has quit []
smaeul has joined #linux-sunxi
<smaeul> 02:30 <loki666> tokyovigilante: pwm patch is not for h616 yet, marcromorgan is waiting for D1 to be merged first
<smaeul> merging D1 PWM support first would mean that the fallback compatible string is not the original SoC containing the hardware, which isn't ideal, but isn't so much of a problem either
<jernej> kuba2k2: mixer1 on D1 has distinction that's the only supported mixer without UI planes and only one VI. It's possible that init routine doesn't work properly for it. Can you check these registers on BSP and compare to mainline? https://elixir.bootlin.com/linux/v6.13.3/source/drivers/gpu/drm/sun4i/sun8i_mixer.c#L568-L591
evgeny_boger has joined #linux-sunxi
<Jookia> i full a full t113 bsp and allwinner documentation. not sure about the d1