All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arthur LAMBERT <lambertarthur22@gmail.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Handle pwm with sysfs with recent kernel
Date: Tue, 8 Jan 2019 11:07:39 +0100	[thread overview]
Message-ID: <20190108100739.GA9046@arthur-bzh> (raw)

I am trying to update my kernel bsp from v4.1.X to v4.19.8 but I have some regressions
when I try to use pwm through sysfs from userspace. I have three pwm declared as
follow in my device tree :

	leds {
	     compatible = "pwm-leds";
	     ledred {
		pwms = <&pwm1>;
		label = "red";
		linux,default-trigger = "none";
		default-state = "on";
	     };

	     ledblue {
	     	pwms = <&pwm5>;
		label = "blue";
		linux,default-trigger = "none";
		default-state = "on";
	     };

	     ledgreen {
	     	pwms = <&pwm6>;
		label = "green";
		linux,default-trigger = "none";
		default-state = "on";
	     };
	};

First I have an issue with duplicate name :
sysfs: cannot create duplicate filename '/class/pwm/pwm0'
CPU: 0 PID: 653 Comm: XXXX
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
[<8010dda8>] (unwind_backtrace) from [<8010b468>] (show_stack+0x10/0x14)
[<8010b468>] (show_stack) from [<8025ef0c>] (sysfs_warn_dup+0x58/0x64)
[<8025ef0c>] (sysfs_warn_dup) from [<8025f200>] (sysfs_do_create_link_sd+0xd4/0xd8)
[<8025f200>] (sysfs_do_create_link_sd) from [<80458d6c>] (device_add+0x1ec/0x5d4)
[<80458d6c>] (device_add) from [<8040b5a8>] (export_store+0xfc/0x17c)
[<8040b5a8>] (export_store) from [<80456904>] (dev_attr_store+0x18/0x24)
[<80456904>] (dev_attr_store) from [<8025e604>] (sysfs_kf_write+0x44/0x48)
[<8025e604>] (sysfs_kf_write) from [<8025dcb0>] (kernfs_fop_write+0xe8/0x1d0)
[<8025dcb0>] (kernfs_fop_write) from [<801eaaf8>] (__vfs_write+0x28/0x144)
[<801eaaf8>] (__vfs_write) from [<801ead88>] (vfs_write+0xa4/0x164)
[<801ead88>] (vfs_write) from [<801eaf54>] (ksys_write+0x40/0x94)
[<801eaf54>] (ksys_write) from [<80101000>] (ret_fast_syscall+0x0

I was able to fix it by revert a patch : https://patchwork.kernel.org/patch/9971821/
It is normal that this revert patch is not currently apply on last 4.19.X tag (last one
seems to be 4.19.13)

Then I have another issue when I try to enable my pwm :

# ls /sys/class/pwm/
pwmchip0  pwmchip2  pwmchip4  pwmchip6
pwmchip1  pwmchip3  pwmchip5  pwmchip7
# echo 0 > /sys/class/pwm/pwmchip0/export
# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
-sh: write error: Invalid argument

Is there a new way to handle pwm in recent kernel ? My old process is now deprecated or something ?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-01-08 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08 10:07 Arthur LAMBERT [this message]
2019-01-08 22:21 ` Handle pwm with sysfs with recent kernel Uwe Kleine-König
2019-01-08 22:21   ` Uwe Kleine-König
2019-01-09  8:25   ` Lothar Waßmann
2019-01-09  9:20     ` Uwe Kleine-König
2019-01-09  9:20       ` Uwe Kleine-König
2019-01-09  9:26       ` Arthur LAMBERT
2019-01-09  9:26         ` Arthur LAMBERT

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190108100739.GA9046@arthur-bzh \
    --to=lambertarthur22@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.