Here is a workaround that seems to be working so far for the kernel 5.3 and 5.4.
Small Obs: During the tests, dimming the lcd backlight up and down for one hour worked without issues. I let the board idle for 6 hrs, worked 5 min on other things and had a crash. I could not recover the log to investigate it, but does not seem to be related to the issue. BR @lex On Friday, January 10, 2020 at 12:02:44 PM UTC-3, @lex wrote: > > Hi Clément, > > [image: backligth.png] > I can confirm that the patch fixed the issue (just need to run for a day > to make it does not break something else). MIPI-DSI worked out-of-the-box, > i just noticed the refresh rate seems to be a bit wrong, maybe i tested it > during the night and now it is possible to note this in daylight. > Any chance we see a back-port on this soon? > > Thank you! > > BR > @lex > > > > On Friday, January 10, 2020 at 10:22:20 AM UTC-3, @lex wrote: >> >> Hi Clément, >> >> I can still see some diff from what i have working in 5.4.8. Maybe this >> is redundant and not necessary. Anyway, I will test it soon. >> >> BR, >> @lex >> >> --- /arm/ubuntu/nanopi-a64-linux-next/linux-next/drivers/gpu/drm/sun4i/ >> sun6i_mipi_dsi.h >> +++ /arm/ubuntu/nanopi-a64-linux-next/linux-5.4.8/drivers/gpu/drm/sun4i/ >> sun6i_mipi_dsi.h >> @@ -13,7 +13,11 @@ >> #include <drm/drm_encoder.h> >> #include <drm/drm_mipi_dsi.h> >> -#define SUN6I_DSI_TCON_DIV 4 >> +#include <linux/regulator/consumer.h> >> + >> +struct sun6i_dsi_variant { >> + bool has_mod_clk; >> +}; >> struct sun6i_dsi { >> struct drm_connector connector; >> @@ -29,8 +33,10 @@ >> struct device *dev; >> struct sun4i_drv *drv; >> + struct sun4i_tcon *tcon; >> struct mipi_dsi_device *device; >> struct drm_panel *panel; >> + const struct sun6i_dsi_variant *variant; >> }; >> static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host * >> host) >> >> >> On Friday, January 10, 2020 at 4:50:35 AM UTC-3, Clément Péron wrote: >>> >>> Hi Alex >>> >>> Le ven. 10 janv. 2020 à 01:03, @lex <alex....@gmail.com> a écrit : >>> >>>> Hi Clément, >>>> >>>> Sure, i will try to apply the MIPI-DSI patch to linux-next, but i see >>>> there are a lot of changes to be made and this can take some time. >>>> >>> >>> MIPI DSI is already applied in Linux-next for a64. >>> >>> >>> >>>> I will report back when i get the results. >>>> >>> Thanks >>> Clement >>> >>> >>> Thanks, >>>> >>> @lex >>>> >>>> On Thursday, January 9, 2020 at 8:33:13 PM UTC-3, Clément Péron wrote: >>>>> >>>>> Hi Alex, >>>>> >>>>> On Thu, 9 Jan 2020 at 22:51, @lex <alex....@gmail.com> wrote: >>>>> > >>>>> > Clément, >>>>> > >>>>> > It usually crashes while changing the LCD backlight. >>>>> > Not sure it is related, but some time later the board enters in a >>>>> sleep mode and shutdown itself (don't resume from that). Screen saver and >>>>> power savings are disabled. >>>>> >>>>> Yes totally makes sense, >>>>> >>>>> Could you test with this patch on top of linux-next ? >>>>> https://patchwork.kernel.org/patch/11326439/ >>>>> >>>>> Thanks >>>>> Clément >>>>> >>>>> >>>>> > >>>>> > BR, >>>>> > @lex >>>>> > >>>>> > >>>>> > >>>>> > On Thursday, January 9, 2020 at 4:59:39 PM UTC-3, Clément Péron >>>>> wrote: >>>>> >> >>>>> >> Hi, >>>>> >> >>>>> >> On Thu, 9 Jan 2020 at 20:39, @lex <alex....@gmail.com> wrote: >>>>> >> > >>>>> >> > Hi Clément, >>>>> >> > >>>>> >> > Looks like Kernel 5.5 will be affected too. >>>>> >> Yes but if a fix is sent it will be backported to all the kernels >>>>> >> affected still maintained. >>>>> >> >>>>> >> What command do you do to reproduce this? >>>>> >> >>>>> >> Thanks, >>>>> >> Clément >>>>> >> >>>>> >> > >>>>> >> > Thank you. >>>>> >> > >>>>> >> > BR, >>>>> >> > @lex >>>>> >> > >>>>> >> > >>>>> >> > On Thursday, January 9, 2020 at 2:03:43 PM UTC-3, Clément Péron >>>>> wrote: >>>>> >> >> >>>>> >> >> Hi @lex, >>>>> >> >> >>>>> >> >> On Thu, 9 Jan 2020 at 16:51, @lex <alex....@gmail.com> wrote: >>>>> >> >> > >>>>> >> >> > Just adding some info, 5.3.y has the same issue. >>>>> >> >> >>>>> >> >> Yes the bug is not fix mainline. >>>>> >> >> >>>>> >> >> I will open a discussion with the PWM maintainer >>>>> >> >> >>>>> >> >> Regards, >>>>> >> >> Clement >>>>> >> >> >>>>> >> >> > >>>>> >> >> > On Thursday, January 9, 2020 at 9:55:54 AM UTC-3, @lex wrote: >>>>> >> >> >> >>>>> >> >> >> I asked this because i have not touched the pwm-sun4i driver >>>>> code, Only the MIPI-DSI on top of 5.4.8. >>>>> >> >> >> >>>>> >> >> >> On Thursday, January 9, 2020 at 9:25:11 AM UTC-3, @lex wrote: >>>>> >> >> >>> >>>>> >> >> >>> Thank you Vasily for the explanation. >>>>> >> >> >>> >>>>> >> >> >>> Is this a known bug or i have possibly introduced it while >>>>> patching the kernel? >>>>> >> >> >>> >>>>> >> >> >>> On Wednesday, January 8, 2020 at 9:51:03 PM UTC-3, Vasily >>>>> Khoruzhick wrote: >>>>> >> >> >>>> >>>>> >> >> >>>> The issue is that sun4i_pwm_apply() calls >>>>> sun4i_pwm_calculate() which >>>>> >> >> >>>> calls clk_get_rate() while holding a spinlock and >>>>> clk_get_rate() may >>>>> >> >> >>>> sleep. >>>>> >> >> >>>> >>>>> >> >> >>>> It's a bug in pwm-sun4i driver. >>>>> >> >> >>>> >>>>> >> >> >>>> On Wed, Jan 8, 2020 at 4:19 PM @lex <alex....@gmail.com> >>>>> wrote: >>>>> >> >> >>>> > >>>>> >> >> >>>> > I am doing some experiments with LCD7" with the kernel >>>>> 5.4.8 and occasionally i get this crash. >>>>> >> >> >>>> > Can someone explain or give some directions on how to >>>>> find the offending error based on the crash log? Any idea what could be >>>>> causing this? >>>>> >> >> >>>> > >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.681388] BUG: >>>>> scheduling while atomic: gsd-backlight-h/3978/0x00000002 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688221] >>>>> Modules linked in: fuse rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec >>>>> panel_feiyang_fy07024di26a30d sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce >>>>> sun8i_drm_hdmi videobuf2_dma_contig snd_soc_spdif_tx dw_hdmi >>>>> videobuf2_memops axp20x_adc cec videobuf2_v4l2 snd_soc_simple_card >>>>> sunxi_cir axp20x_usb_power axp20x_ac_power snd_soc_simple_card_utils >>>>> pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy rc_core >>>>> videobuf2_common >>>>> mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev sun8i_adda_pr_regmap >>>>> crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm sun4i_frontend >>>>> sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables x_tables ipv6 >>>>> nf_defrag_ipv6 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688331] CPU: 3 >>>>> PID: 3978 Comm: gsd-backlight-h Tainted: G C O 5.4.8 #1 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688334] >>>>> Hardware name: Pine64+ (DT) >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688339] Call >>>>> trace: >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688357] >>>>> dump_backtrace+0x0/0x150 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688364] >>>>> show_stack+0x14/0x20 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688374] >>>>> dump_stack+0xb4/0xd8 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688384] >>>>> __schedule_bug+0x50/0x70 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688392] >>>>> __schedule+0x4bc/0x510 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688397] >>>>> schedule+0x40/0xd0 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688403] >>>>> schedule_preempt_disabled+0x20/0x38 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688410] >>>>> __mutex_lock.isra.10+0x150/0x568 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688416] >>>>> __mutex_lock_slowpath+0x10/0x18 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688422] >>>>> mutex_lock+0x38/0x40 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688430] >>>>> clk_prepare_lock+0x40/0xa0 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688437] >>>>> clk_get_rate+0x1c/0x70 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688446] >>>>> sun4i_pwm_apply+0xb4/0x450 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688453] >>>>> pwm_apply_state+0x64/0x1e8 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688464] >>>>> pwm_backlight_update_status+0xb8/0x198 [pwm_bl] >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688473] >>>>> backlight_device_set_brightness+0x64/0xb8 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688480] >>>>> brightness_store+0x78/0x90 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688488] >>>>> dev_attr_store+0x14/0x28 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688496] >>>>> sysfs_kf_write+0x3c/0x50 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688501] >>>>> kernfs_fop_write+0x144/0x230 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688511] >>>>> __vfs_write+0x18/0x38 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688517] >>>>> vfs_write+0xb4/0x1e0 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688524] >>>>> ksys_write+0x68/0xf8 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688530] >>>>> __arm64_sys_write+0x18/0x20 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688540] >>>>> el0_svc_common.constprop.2+0x64/0x160 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688547] >>>>> el0_svc_handler+0x20/0x80 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688552] >>>>> el0_svc+0x8/0xc >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.688694] BUG: >>>>> scheduling while atomic: gsd-backlight-h/3978/0x00000000 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695480] >>>>> Modules linked in: fuse rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec >>>>> panel_feiyang_fy07024di26a30d sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce >>>>> sun8i_drm_hdmi videobuf2_dma_contig snd_soc_spdif_tx dw_hdmi >>>>> videobuf2_memops axp20x_adc cec videobuf2_v4l2 snd_soc_simple_card >>>>> sunxi_cir axp20x_usb_power axp20x_ac_power snd_soc_simple_card_utils >>>>> pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy rc_core >>>>> videobuf2_common >>>>> mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev sun8i_adda_pr_regmap >>>>> crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm sun4i_frontend >>>>> sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables x_tables ipv6 >>>>> nf_defrag_ipv6 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695558] CPU: 3 >>>>> PID: 3978 Comm: gsd-backlight-h Tainted: G WC O 5.4.8 #1 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695561] >>>>> Hardware name: Pine64+ (DT) >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695564] Call >>>>> trace: >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695579] >>>>> dump_backtrace+0x0/0x150 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695583] >>>>> show_stack+0x14/0x20 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695591] >>>>> dump_stack+0xb4/0xd8 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695600] >>>>> __schedule_bug+0x50/0x70 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695605] >>>>> __schedule+0x4bc/0x510 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695610] >>>>> schedule+0x40/0xd0 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695615] >>>>> do_notify_resume+0x1e0/0x398 >>>>> >> >> >>>> > Jan 8 23:49:43 pine64-plus kernel: [ 5144.695620] >>>>> work_pending+0x8/0x10 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.894318] BUG: >>>>> scheduling while atomic: gsd-backlight-h/3987/0x00000002 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901147] >>>>> Modules linked in: fuse rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec >>>>> panel_feiyang_fy07024di26a30d sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce >>>>> sun8i_drm_hdmi videobuf2_dma_contig snd_soc_spdif_tx dw_hdmi >>>>> videobuf2_memops axp20x_adc cec videobuf2_v4l2 snd_soc_simple_card >>>>> sunxi_cir axp20x_usb_power axp20x_ac_power snd_soc_simple_card_utils >>>>> pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy rc_core >>>>> videobuf2_common >>>>> mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev sun8i_adda_pr_regmap >>>>> crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm sun4i_frontend >>>>> sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables x_tables ipv6 >>>>> nf_defrag_ipv6 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901246] CPU: 0 >>>>> PID: 3987 Comm: gsd-backlight-h Tainted: G WC O 5.4.8 #1 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901250] >>>>> Hardware name: Pine64+ (DT) >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901254] Call >>>>> trace: >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901271] >>>>> dump_backtrace+0x0/0x150 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901277] >>>>> show_stack+0x14/0x20 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901286] >>>>> dump_stack+0xb4/0xd8 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901296] >>>>> __schedule_bug+0x50/0x70 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901303] >>>>> __schedule+0x4bc/0x510 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901307] >>>>> schedule+0x40/0xd0 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901313] >>>>> schedule_preempt_disabled+0x20/0x38 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901319] >>>>> __mutex_lock.isra.10+0x150/0x568 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901324] >>>>> __mutex_lock_slowpath+0x10/0x18 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901330] >>>>> mutex_lock+0x38/0x40 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901337] >>>>> clk_prepare_lock+0x40/0xa0 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901343] >>>>> clk_get_rate+0x1c/0x70 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901352] >>>>> sun4i_pwm_apply+0xb4/0x450 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901357] >>>>> pwm_apply_state+0x64/0x1e8 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901368] >>>>> pwm_backlight_update_status+0xb8/0x198 [pwm_bl] >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901375] >>>>> backlight_device_set_brightness+0x64/0xb8 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901381] >>>>> brightness_store+0x78/0x90 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901389] >>>>> dev_attr_store+0x14/0x28 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901396] >>>>> sysfs_kf_write+0x3c/0x50 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901401] >>>>> kernfs_fop_write+0x144/0x230 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901409] >>>>> __vfs_write+0x18/0x38 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901415] >>>>> vfs_write+0xb4/0x1e0 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901421] >>>>> ksys_write+0x68/0xf8 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901427] >>>>> __arm64_sys_write+0x18/0x20 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901435] >>>>> el0_svc_common.constprop.2+0x64/0x160 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901441] >>>>> el0_svc_handler+0x20/0x80 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901446] >>>>> el0_svc+0x8/0xc >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.901612] BUG: >>>>> scheduling while atomic: gsd-backlight-h/3987/0x00000000 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908388] >>>>> Modules linked in: fuse rfkill dw_hdmi_i2s_audio snd_soc_hdmi_codec >>>>> panel_feiyang_fy07024di26a30d sunxi_cedrus(C) v4l2_mem2mem crct10dif_ce >>>>> sun8i_drm_hdmi videobuf2_dma_contig snd_soc_spdif_tx dw_hdmi >>>>> videobuf2_memops axp20x_adc cec videobuf2_v4l2 snd_soc_simple_card >>>>> sunxi_cir axp20x_usb_power axp20x_ac_power snd_soc_simple_card_utils >>>>> pinctrl_axp209 axp20x_battery phy_sun6i_mipi_dphy rc_core >>>>> videobuf2_common >>>>> mali(O) sun6i_mipi_dsi sun50i_codec_analog videodev sun8i_adda_pr_regmap >>>>> crc_ccitt goodix sun8i_codec sun4i_i2s mc sun4i_drm sun4i_frontend >>>>> sun4i_tcon sun8i_mixer sun8i_tcon_top pwm_bl ip_tables x_tables ipv6 >>>>> nf_defrag_ipv6 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908479] CPU: 0 >>>>> PID: 3987 Comm: gsd-backlight-h Tainted: G WC O 5.4.8 #1 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908482] >>>>> Hardware name: Pine64+ (DT) >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908486] Call >>>>> trace: >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908500] >>>>> dump_backtrace+0x0/0x150 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908507] >>>>> show_stack+0x14/0x20 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908517] >>>>> dump_stack+0xb4/0xd8 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908526] >>>>> __schedule_bug+0x50/0x70 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908533] >>>>> __schedule+0x4bc/0x510 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908538] >>>>> schedule+0x40/0xd0 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908545] >>>>> do_notify_resume+0x1e0/0x398 >>>>> >> >> >>>> > Jan 8 23:49:45 pine64-plus kernel: [ 5146.908551] >>>>> work_pending+0x8/0x10 >>>>> >> >> >>>> > >>>>> >> >> >>>> > >>>>> >> >> >>>> > >>>>> >> >> >>>> > B.R >>>>> >> >> >>>> > >>>>> >> >> >>>> > -- >>>>> >> >> >>>> > You received this message because you are subscribed to >>>>> the Google Groups "linux-sunxi" group. >>>>> >> >> >>>> > To unsubscribe from this group and stop receiving emails >>>>> from it, send an email to linux...@googlegroups.com. >>>>> >> >> >>>> > To view this discussion on the web, visit >>>>> https://groups.google.com/d/msgid/linux-sunxi/91a0725f-5ce3-4244-ba98-88c1ea7e7574%40googlegroups.com. >>>>> >>>>> >>>>> >> >> > >>>>> >> >> > -- >>>>> >> >> > You received this message because you are subscribed to the >>>>> Google Groups "linux-sunxi" group. >>>>> >> >> > To unsubscribe from this group and stop receiving emails from >>>>> it, send an email to linux...@googlegroups.com. >>>>> >> >> > To view this discussion on the web, visit >>>>> https://groups.google.com/d/msgid/linux-sunxi/a6a5a51d-1fe5-4eef-bbd1-c285260f8fd4%40googlegroups.com. >>>>> >>>>> >>>>> >> > >>>>> >> > -- >>>>> >> > You received this message because you are subscribed to the >>>>> Google Groups "linux-sunxi" group. >>>>> >> > To unsubscribe from this group and stop receiving emails from it, >>>>> send an email to linux...@googlegroups.com. >>>>> >> > To view this discussion on the web, visit >>>>> https://groups.google.com/d/msgid/linux-sunxi/ed19d20b-9436-48bc-8e7e-5a6dd1593af3%40googlegroups.com. >>>>> >>>>> >>>>> > >>>>> > -- >>>>> > You received this message because you are subscribed to the Google >>>>> Groups "linux-sunxi" group. >>>>> > To unsubscribe from this group and stop receiving emails from it, >>>>> send an email to linux...@googlegroups.com. >>>>> > To view this discussion on the web, visit >>>>> https://groups.google.com/d/msgid/linux-sunxi/8d9b3d8a-7cb7-4837-96dc-0883d25a1b3a%40googlegroups.com. >>>>> >>>>> >>>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "linux-sunxi" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to linux...@googlegroups.com. >>>> To view this discussion on the web, visit >>>> https://groups.google.com/d/msgid/linux-sunxi/64b161cf-1af2-4a19-bddf-17a749fb8820%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/linux-sunxi/64b161cf-1af2-4a19-bddf-17a749fb8820%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. To view this discussion on the web, visit https://groups.google.com/d/msgid/linux-sunxi/96676ab2-c7e8-476f-8340-f8c619ea538c%40googlegroups.com.
--- a/drivers/pwm/pwm-sun4i.c +++ b/drivers/pwm/pwm-sun4i.c @@ -215,9 +215,6 @@ } } - spin_lock(&sun4i_pwm->ctrl_lock); - ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG); - if ((cstate.period != state->period) || (cstate.duty_cycle != state->duty_cycle)) { u32 period, duty, val; @@ -227,11 +224,13 @@ &duty, &period, &prescaler); if (ret) { dev_err(chip->dev, "period exceeds the maximum value\n"); - spin_unlock(&sun4i_pwm->ctrl_lock); if (!cstate.enabled) clk_disable_unprepare(sun4i_pwm->clk); return ret; } + + spin_lock(&sun4i_pwm->ctrl_lock); + ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG); if (PWM_REG_PRESCAL(ctrl, pwm->hwpwm) != prescaler) { /* Prescaler changed, the clock has to be gated */ @@ -247,6 +246,9 @@ sun4i_pwm->next_period[pwm->hwpwm] = jiffies + usecs_to_jiffies(cstate.period / 1000 + 1); sun4i_pwm->needs_delay[pwm->hwpwm] = true; + } else { + spin_lock(&sun4i_pwm->ctrl_lock); + ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG); } if (state->polarity != PWM_POLARITY_NORMAL)