You are not logged in.

#1 2021-01-04 07:07:10

amaro
Member
From: xfce
Registered: 2014-05-09
Posts: 367

udev rule for intel_reg write after suspend

Hello everybody!

First of all Happy New Year!

Wish you health and best of luck in your endeavours!

Now, here is the issue...

After reading the wiki https://wiki.archlinux.org/index.php/Ba … i915_only)
and https://devbraindom.blogspot.com/2013/0 … intel.html

I tried to write a rule to change PWM frequency after suspension.

Here is the rule I wrote (in '/etc/udev/rules.d/')

KERNEL=="intel_backlight"
SUBSYSTEM=="backlight"

ATTRS{vendor}=="8086"
ATTRS{device}=="0156"

ACTION=="change"
RUN+="systemctl start pwmfreq@0x07a109d0"

NAME=="pwmfreq"

Got the specifics (both results are truncated)

udevadm info --attribute-walk --path=/sys/class/backlight/intel_backlight | grep -i attr
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
ATTRS{device}=="0x0156"
ATTRS{vendor}=="0x8086"
udevadm info --attribute-walk --path=/sys/class/backlight/intel_backlight | grep -i backlight
  looking at device '/devices/pci0000:00/0000:00:02.0/drm/card0/card0-LVDS-1/intel_backlight':
    KERNEL=="intel_backlight"
    SUBSYSTEM=="backlight"

The 'pwmfreq@.service' file is in '/etc/systemd/system/'

[Unit]
Description=LED PWM frequency 

[Service]
Type=oneshot
ExecStart=/usr/bin/intel_reg write 0xc8254 %I

[Install]
WantedBy=graphical.target

I did

udevadm control --reload && udevadm trigger

But the rule is not working.

After suspension I always get '0x0d9c0000'

intel_reg dump | grep -i pwm
                   BLC_PWM_CPU_CTL2 (0x00048250): 0x80000000 (enable 1, pipe A)
                    BLC_PWM_CPU_CTL (0x00048254): 0x000007d8 (cycle 2008)
                   BLC_PWM_PCH_CTL1 (0x000c8250): 0x80000000 (enable 1, override 0, inverted polarity 0)
                   BLC_PWM_PCH_CTL2 (0x000c8254): 0x0d9c0000 (freq 3484, cycle 0)

Is something missing from this rule?

Any help is appreciated!

Thank you in advance!

Offline

Board footer

Powered by FluxBB