PaddleStroke

Members
  • Content Count

    51
  • Joined

  • Last visited

 Content Type 

Forums

Member Map

Store

Crowdfunding

Raffles

Applications

Everything posted by PaddleStroke

  1. If you're using mainline kernel the HDMI audio is not supported on A20.
  2. Hey guys, I see the HDMI audio is not supported in the status matrix. Do you know what is missing exactly? I read it predepends on DRM driver, do you know which part is missing? I read in #linux-sunxi IRC history that there are some patches for HDMI audio for H3 H6 H64. What about A20 ? Is there any patches available?
  3. Regarding the uboot error I discussed before. Actually the kernel driver is doing exactly the same thing : https://github.com/torvalds/linux/blob/master/drivers/mfd/axp20x.c static void axp20x_power_off(void) { if (axp20x_pm_power_off->variant == AXP288_ID) return; regmap_write(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, AXP20X_OFF); /* Give capacitors etc. time to drain to avoid kernel panic msg. */ msleep(500); } AXP20X_OFF = bit(7) So it does the same thing. On shutdown it writes bit(7) on reg32. The problem is when you boot after on PEK press, the AXP regs are not reset. So the reg32 is not set back to default value but keep instead bit(7). Which makes that battery detection is disabled. Should be replaced by static void axp20x_power_off(void) { if (axp20x_pm_power_off->variant == AXP288_ID) return; regmap_update_bits(axp20x_pm_power_off->regmap, AXP20X_OFF_CTRL, AXP20X_OFF, AXP20X_OFF); /* Give capacitors etc. time to drain to avoid kernel panic msg. */ msleep(500); } What do you think?
  4. I tried to write to u-boot-patches@bugs.denx.de but got a automatic reply saying address is NOK.
  5. Yes you are right. I'll finish to understand everything before adding anything though. Btw do you know how to make a bug report to u-boot?
  6. Also the uboot driver has a problem I think : int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { pmic_bus_write(AXP209_SHUTDOWN, AXP209_POWEROFF); /* infinite loop during shutdown */ while (1) {} /* not reached */ return 0; } #define AXP209_POWEROFF BIT(7) AXP209_SHUTDOWN = 0x32 So actually on every power off, uboot write BIT(7) to REG 32. Now I understand why at boot the kernel AXP20x driver triggers to set battery detection ON as it's also on REG32. It does not use mask to write only bit 7, so I guess it writes 1000 0000 to the REG... I think it should use "pmic_bus_setbits" instead of "pmic_bus_write" what do you think? If someone can confirm this.
  7. I found the reason why IRQ REG show 00 and why GPIO keep reseting... It's the u-boot driver for AXP209: https://gitlab.denx.de/u-boot/u-boot/blob/master/drivers/power/axp209.c https://gitlab.denx.de/u-boot/u-boot/blob/master/include/axp209.h This files is giving me 2/3 of my troubles : /* Mask all interrupts */ for (i = AXP209_IRQ_ENABLE1; i <= AXP209_IRQ_ENABLE5; i++) { rc = pmic_bus_write(i, 0); if (rc) return rc; } This is why REG 40 is 00... /* * Turn off LDOIO regulators / tri-state GPIO pins, when rebooting * from android these are sometimes on. */ rc = pmic_bus_write(AXP_GPIO0_CTRL, AXP_GPIO_CTRL_INPUT); if (rc) return rc; rc = pmic_bus_write(AXP_GPIO1_CTRL, AXP_GPIO_CTRL_INPUT); if (rc) return rc; rc = pmic_bus_write(AXP_GPIO2_CTRL, AXP_GPIO_CTRL_INPUT); if (rc) return rc; Reset the 3 GPIO status... Only the battery voltage error does not come from this. I think it probably comes from : https://github.com/torvalds/linux/blob/master/drivers/power/supply/axp20x_battery.c However I am not sure how the driver is getting executed. What is the calling sequence of it.
  8. GPIO-AXP209.c Ok there's a page in bindings about this driver : https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/gpio/gpio-axp209.txt There's even a armbian patch about this driver binding text : https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/0104-dt-bindings-gpio-gpio-axp209-add-AXP803-GPIO-binding.patch but the driver itself cannot be found on github... maybe it's name changed to this one : https://github.com/torvalds/linux/blob/master/drivers/pinctrl/pinctrl-axp209.c if so why is there still a gpio-axp209.txt and a patch for this.
  9. After few more test I can say that reg 33 (the one for max voltage) get reset when you boot on AC connection. Not when you boot on PEK pressed. Why? No ideas yet. Dmesg don't give any hint.
  10. I found a problem with either armbian patch for AXP20X.c driver or with i2Cset too. Running : sudo i2cset -y -f 0 0x34 0x33 0xe9 #0x33 is AXP20X_CHRG_CTRL1. Value read with i2cget before is 0xc9 sudo i2cset -y -f 0 0x34 0x90 0x04 #0x90 is AXP20X_GPIO0_CTRL. Value read with i2cget before is is 0x02 sudo i2cset -y -f 0 0x34 0x92 0x04 #0x92 is AXP20X_GPIO1_CTRL. Value read with i2cget before is is 0x02 Change the register values correctly. Then on reboot we have : sudo i2cget -y -f 0 0x34 0x33 0xe9 sudo i2cget -y -f 0 0x34 0x90 0x02 sudo i2cget -y -f 0 0x34 0x92 0x02 0x90 and 0x92 reseted (0x33 reset only when booting when AC-plugged in power. Not when PEK pressed...). I check Dmesg and find one difference compared to normal boot without modifications: axp20x-i2c 0-0034: Battery detection is disabled, enabling So I check the armbian patch of AXP20X.c and find this error message in this part of the code : + /* Enable battery detection */ + ret = regmap_read(axp->regmap, AXP20X_OFF_CTRL, &res); + if (ret == 0) { + if ((res & 0x40) != 0x40) { + dev_info(axp->dev, "Battery detection is disabled, enabling"); + ret = regmap_update_bits(axp->regmap, AXP20X_OFF_CTRL, 0x40, 0x40); + if (ret) + dev_warn(axp->dev, "Unable to enable battery detection: %d", ret); + } + } else + dev_warn(axp->dev, "Unable to read register AXP20X_OFF_CTRL: %d", ret); interestingly the error is triggered after reading AXP20X_OFF_CTRL ( Reg 0x32)... Which is not one that I have been modifying?? I am not sure to understand what is going on there: - Either the i2Cset/I2Cget tool is not working properly. - Either something is wrong in the patch. But it looks correct as it uses AXP20X_OFF_CTRL which is 0x32 and change only bit 6 to 1. - Either something is wrong with regmap?
  11. What is the difference between TCON, framebuffer, pipeline, front end, display ? I found that it seems that linux framebuffers have been replaced by DRM on mainline. But can't find much information about this. https://www.kernel.org/doc/Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt Anyone familiar with framebuffers/display/... can give me the big picture on how this is organized ?
  12. I found several files about AXP on the torvalds github. Note: Megeous github (torvalds fork which is used for Armbian build if I am not mistaken) files are slightly different... So the main driver seems to be this one: https://github.com/torvalds/linux/blob/master/drivers/mfd/axp20x.c https://github.com/torvalds/linux/blob/master/include/linux/mfd/axp20x.h https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/mfd/axp20x.txt Then there are several complementary-drivers : https://github.com/torvalds/linux/blob/master/drivers/input/misc/axp20x-pek.c https://github.com/torvalds/linux/blob/master/drivers/mfd/axp20x-i2c.c https://github.com/torvalds/linux/blob/master/drivers/regulator/axp20x-regulator.c https://github.com/torvalds/linux/blob/master/drivers/iio/adc/axp20x_adc.c https://github.com/torvalds/linux/blob/master/drivers/power/supply/axp20x_battery.c https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt https://github.com/torvalds/linux/blob/master/drivers/pinctrl/pinctrl-axp209.c https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/gpio/gpio-axp209.txt Not 100% sure if these last c and txt files are related as there is no gpio-axp209.c nor pinctrl-axp209.txt so I think it's just naming issue. Then on top of that you have a armbian patch of the main axp20X.c : https://github.com/armbian/build/blob/master/patch/kernel/sunxi-next/general-axp20x-sysfs-interface.patch Or this one seems related but not sure it's included: https://github.com/QSchulz/linux/commit/aa13f8990a2482e951f72d5c70c2f4cedf2684c6#diff-dfdc0dfa3d0d84a7e9a84c9baa75b869
  13. I have been trying to do my own scrip to read/write directly reg values with i2C. But changing parameters with i2Cset are overwriten after reboot, probably by the current driver... i2cset -y -f 0 0x34 0x33 0xE9 This should change to 4.36V. This setting get reseted to 0xC9 but only when the unit boot on AC connection. Booting on PEK press does not reset it. Very strange. i2cset -y -f 0 0x34 0x83 0x8C This setting does not get reset! i2cset -y -f 0 0x34 0x90 0x04 i2cset -y -f 0 0x34 0x92 0x04 Those two should set the GPIO 0 and 1 functions as ADC. Those don't work they keep reseting to 0x02 after any reboot (AC plugged in boot or PEK press boot)... i2cget -y -f 0 0x34 0x40 This REG 40 should be a list of IRQ enabled. Someone suggested bit 6 to be the boot when AC plugged-in parameter. But very strangely the reg40 reads 0x00 instead of normal default value of 0xD8... Same for other IRQ REGs 41 and 42. So this means the AXP209 driver is messing things up for us..!
  14. Is anyone know how to set HDMI and LCD simultaneously on mainline kernel? We use a 3.5" LCD for which we made a patch (see enclosed). Now I'd like to have both HDMI and LCD showing the same framebuffer. Currently HDMI is only showing the console while signal is OK on LCD. Any hint would be appreciated. u-boot-sunxi-next.patch kernel-sunxi-next.patch
  15. Hey guys, It seems that some graphics card (probably the one integrated in the a20 processor) are able to manage multiple memory buffer and thus several layers for one display. Is it possible to declare two framebuffers for the main display: like fb0 - layer1 / fb1 - layer2 with alpha channel? So it would be easier to implement overlay display for information about the battery or the brightness level of the screen.
  16. I found relatively little information concerning AXP209 support on mainline. My targets : - set the battery as 4.35V instead of 4.2V. Datasheet say it's set in REG 33H. Defaut value for register : 0xCX, X being the charge current. if 1200mAh then default value is 0xC9. To change from 4.2 to 4.35V, use EXh (so E9h if you'r using 1200mA) 11001001 to 11101001.) - Remove boot when AC plugged in and boot only when PEK is pressed. Datasheet say it's possible is not clear about how to do it. It may be reg40 bit6. I could not test yet as REG40 strangely reads 0x00 with i2cget. - Set GPIO0 and GPIO1 as ADC. GPIO0 function is REG 90H (see page 40 datasheet). GPIO1 function is REG 92H. Defaut value for both registers : 0x07 (=0000 0111 bin) where bit 0-2 (111) are the function. We need replace with 100 bin for ADC function so 04h Also need to enable GPIO ADC in REG 83H bit 2-3 too ! Default value 80H 1000 0000 replace with 8C 1000 1100. First look : There are several topics about AXP209 management. However there are different different things and some look deprecated... - Some people have been changing the REG values directly with i2Cset. - A Sysfs interface have been developped. But it's not clear whether it's deprecated or not. - Apparantly there are "proper drivers" that have been added. But no mention of them anywhere. Nor how to use them to change things or get battery% or anything. In this topic for example : Where @zador.blood.stained you say : Are you talking about this patch ? (Which is the one from your github? https://github.com/zador-blood-stained/axp209-sysfs-interface ) If so this patch is deprecated right? If yes then where are the proper drivers you are talking about and how to use them to get current battery voltage, capacity%...? Thanks
  17. Bananapi boards are using AP6212 wifi+bt module. Maybe it's easier to use this module as it seem it already works on armbian. In your experience, is this module working correctly? Thanks!
  18. hey guys, Using legacy kernel I have trouble having dual output on LCD and HDMI. I tried to have a cloned dual output (same framebuffer for both) : [disp_init] disp_init_enable = 1 disp_mode = 4 screen0_output_type = 1 screen0_output_mode = 6 screen1_output_type = 3 screen1_output_mode = 4 fb0_width = 0 fb0_height = 0 fb0_framebuffer_num = 2 fb0_format = 10 fb0_pixel_sequence = 0 fb0_scaler_mode_enable = 0 fb1_width = 1024 fb1_height = 600 fb1_framebuffer_num = 2 fb1_format = 10 fb1_pixel_sequence = 0 fb1_scaler_mode_enable = 0 ... Also tried with 2 framebuffers : [disp_init] disp_init_enable = 1 disp_mode = 2 screen0_output_type = 1 screen0_output_mode = 6 screen1_output_type = 3 screen1_output_mode = 4 fb0_width = 0 fb0_height = 0 fb0_framebuffer_num = 2 fb0_format = 10 fb0_pixel_sequence = 0 fb0_scaler_mode_enable = 0 fb1_width = 0 fb1_height = 0 fb1_framebuffer_num = 2 fb1_format = 10 fb1_pixel_sequence = 0 fb1_scaler_mode_enable = 0 ... On both case when booting the signal is first on HDMI until kernel starts. Then the signal goes to LCD and HDMI turns off. Any hint? Full fex below :
  19. Hey guys, What is in your opinion the best solution to add WIFI/BT capability to a A20 board? Currently I tried to add ESP8266 connected with SDIO. (without much success so far). Then in order to add BT too I am thinking about ESP32 (with ESP-WROOM-32 module). Do you know if there are references of using this ESP32 solution to provide wifi and bt to a allwinner board/armbian ? Also this module have a lot of different interfaces available, which should be prefered? Or alternatively, do you know other armbian supported solution for wifi/bt? Best would be a solution that does not use USB ports as I need them. Thanks!
  20. Hey guys, Using a A20 board with AXP209, using mainline, I am trying to add a battery indicator as an overlay on video signal so that user can see remaining battery %. Something similar to smartphone battery indicator. Any idea how to do this? This shows how to get battery % but how to add an overlay? This sounds like something that probably have already been done. Do you know any existing reference ?
  21. Hi Tido, Thanks for your feedback. Finally the FJ035CI54-R40 could work on legacy. Without even timing values. So it seems timing values are not critical to get picture... The error was probably somewhere else, I still need to do some test to find out more precisely. Here's the fex that works with legacy and FJ035CI54-R40 for reference.
  22. Hey guys, Some questions about LCD interfacing. I have a A20 board and 2 LCD, one 640*480 3.5" (FJ035CI54-R40), one 320*240 3.5" (LQ035NC111, same as bananapi LCD). Both LCD have the same pinout, formfactor and ribbon so should be hardware compatible. 1 - LQ035NC111 I could get the LQ035NC111 to work on legacy kernel with the following script.fex (for reference) But can't get it to work with mainline. With mainline I get a white rectangle flashing on the left side of the screen. Interestingly I can reproduce the exact same bug with legacy by changing all the pin configurations from : lcdd0 = port:PD00<2><0><3><default> lcdd1... to lcdd0 = port:PD00<2><0><default><default> lcdd1... Looking at fex guide I see that the third parameter is "<drive capability> defines the output drive in mA, values are 0-3 corresponding to 10mA, 20mA, 30mA and 40mA." As the visual issue is exactly the same on mainline I guess the problem must come from this but I can't figure out how to change this drive capability in mainline. Any guess? 2 - FJ035CI54-R40 So for this LCD I can't get over a black screen (Backlight is working). The tricky part is that the datasheet (enclosed) is not clear for me. Also supplier gave me additional data which seem different than datasheet. #define HT 680 //Horizontal total period = (HT + 1) pixels #define HPS 2 //Horizontal Sync Pulse Start Position = (HPS + 1) pixels #define LPS 20 //Horizontal Display Period Start Position = LPS pixels #define HPW 20 //Horizontal Sync Pulse Width = (HPW + 1) pixels #define VT 550 //Vertical Total = (VT + 1) lines #define VPS 2 //Vertical Sync Pulse Start Position = VPS lines #define FPS 6 //Vertical Display Period Start Position = FPS lines #define VPW 12 //Vertical Sync Pulse Width = (VPW + 1) lines #define HSPW 2 #define HBPD 20 #define HFPD 20 #define VSPW 2 #define VBPD 6 #define VFPD 12 //DCLK=20MHZ On page 6 of datasheet the timing data looks different, but it may just be a misunderstanding from me. For instance datasheet say PCLK = 63.61MHz, but the file above say DCLK = 20MHZ (even if commented out). Do you know what is the difference between PCLK and DLCK? (The inconsistancy between LCD datasheets parameter names and symbols is killing me.) Also the datasheet say "The RGB only support the DE mode: HSYNC,VSYNC,DCLK and DE pin ." It seems from fex guide that mode can be set by "lcd_if" value. However there is no DE mode. Only : So I am unsure what to select. I can't find much documentation about those modes on internet. Also I can't understand what is this and how it should be set : "lcd_io_cfg0 = 268435456" I made several attemps with either datasheet or above code timing values but without luck so far. Only a black screen. Anyone has some experience with LCD interfacing on armbian could help me writing this fex? It would really really really be appreciated. Above is my last attempt of fex : FJ035CI54-R40.pdf
  23. Hi there, I am trying to download the lime2 legacy image : https://www.armbian.com/olimex-lime-2/#kernels-archive But the link is dead (error 404). Any chance to get this back up? Or can I use another legacy image and just change the script.bin or is there other things to modify? Thanks Edit : I just found the image on olimex website : ftp://staging.olimex.com/Allwinner_Images/A20-OLinuXino/2.legacy_images_kernel_3.4.x/
  24. Thanks for feedback! In chinese, do you mean that those commands are hardware coded in the allwinner chip? It's not something that is coded in armbian? I can handle chinese documentation if you have any. Or if you confirm allwinner could help I'll ask them, but I am not sure what to ask them right now as I thought it was a armbian feature.
  25. Thanks for feedback, anyway I found a way to hardware rotate LCD now. It was just for curiosity. What about the dispdbg commands? Do you know where I can find documentation about that? Or the source code of these commands? Any idea how to disable disp1 and enable disp0 ? I think perhaps it's not working because the switch command only changes the screen_output_type and mode but is not actually enabling/disabling screen0/screen1 I tried to enable both disp in my script.bin with : [disp_init] disp_init_enable = 1 disp_mode = 2 # dual head screen0_output_type = 0 # 0 should be NONE screen0_output_mode = 5 screen1_output_type = 2 screen1_output_mode = 14 But then I have not any signal on either screen. Maybe disp_mode= 4 (clone(screen0, screen1, fb0) (2 screens, one standard framebuffer) ) would work? Also I am not sure how to enable HDMI after disable TV (as I don't have screen anymore...). So I tried to make a bash file but not sure the syntax is correct. Can you tell me if something is wrong in the syntax? #!/bin/bash cd /sys/kernel/debug/dispdbg/ echo "switch" > command echo "disp1" > name echo "0 14" > param echo "1" > start sleep 2 cd /sys/kernel/debug/dispdbg/ echo "switch" > command echo "disp0" > name echo "4 5" > param echo "1" > start