Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add suspend_mode attribute and associated logic #10

Merged
merged 2 commits into from
Apr 6, 2024

Conversation

SytheZN
Copy link
Contributor

@SytheZN SytheZN commented Mar 30, 2024

Implements switchable suspend logic for LEDs.

Behavior can be set with /sys/class/leds/multicolor:chassis/device/suspend_mode.

Supported behaviors:

  • oem: Default; release control of LEDs to the MCU during suspend.
  • keep: Retain the currently set values.
  • off: Turn the lights off.

Tested on AyaNeo Air Pro. Other devices should work, but not confirmed.

@@ -568,8 +699,14 @@ static int ayaneo_platform_probe(struct platform_device *pdev)
ret = PTR_ERR_OR_ZERO(match);
if (ret)
return ret;

ret = devm_device_add_groups(dev, ayaneo_led_mc_groups);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dev here adds the attribute to the platform device. During the init we have access to the led_mc dev via struct led_classdev *led_cdev = &ayaneo_led_mc.led_cdev;. If we use this instead, the attribute will be accessible through sys/class/leds/multicolor:chassis with all the other attributes instead of /sys/class/leds/multicolor:chassis/device with the platform attributes. As this is specifically related to the suspend mode of the led_mc I think it makes more sense to have it attached to the led device.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the attribute to the led device as suggested; definitely better that way.

@pastaq
Copy link
Contributor

pastaq commented Apr 1, 2024

This exposes some strange behavior on the air plus. I know you don't have a device to test it on so I won't hold up the PR for it, but I did find superfluous code while troubleshooting it. The write and the open at likes 390/393 are not necessary.

The bug is that in "off" mode only the right LED turns back on, and in "keep" mode the right LED turns off when resuming. If you have any insight here that would be appreciated.

@pastaq pastaq merged commit 2dbb95f into ShadowBlip:main Apr 6, 2024
@SytheZN SytheZN deleted the sythezn/suspend-mode branch April 6, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants