msm8953-mainline / linux

Linux mainline kernel with WIP patches for msm8953 devices
Other
111 stars 59 forks source link

leds: qcom-lpg: Add support for PMI8950 PWM #96

Closed M0Rf30 closed 7 months ago

M0Rf30 commented 1 year ago

… markw

Need to set:

CONFIG_RC_CORE=m CONFIG_RC_MAP=m CONFIG_LIRC=y CONFIG_LEDS_GPIO=m CONFIG_IR_GPIO_CIR=m CONFIG_IR_GPIO_TX=m CONFIG_IR_PWM_TX=m

M0Rf30 commented 1 year ago

@vipaoL @z3ntu @alikates

vipaoL commented 1 year ago

I can confirm it works on markw, I can turn the ir LED on by executing echo 1 > /sys/class/leds/irled/brightness

M0Rf30 commented 1 year ago

@kiciuk @marc0x1 can you give feedback for mido?

z3ntu commented 1 year ago

Is there no upstream driver for GPIO IR LED like with ir-spi-led? While I haven't looked into the ir-spi-led driver I doubt it's getting exposed as a simple LED device, I'm guessing there's some kernel API for IR that then user space uses?

M0Rf30 commented 1 year ago

Is there no upstream driver for GPIO IR LED like with ir-spi-led? While I haven't looked into the ir-spi-led driver I doubt it's getting exposed as a simple LED device, I'm guessing there's some kernel API for IR that then user space uses?

Yeah maybe I found gpio-ir-tx and pwm-ir-tx . I will give them a try

spazziale commented 1 year ago

@Kiciuk @marc0x1 can you give feedback for mido? Can you provide, if you have it, the compiled version?

barni2000 commented 1 year ago

I have tested on mido the driver is initialized and it creates /dev/lirc0. I try to use with ir-ctl but unfortunately it doesn't work for me.

barni2000 commented 1 year ago

As i see in the downstream source for mido we should use pwm-ir-tx

Downstream node:

pwm_ir {
    compatible = "pwm-ir";
    pwms = <&pmi8950_pwm 0 0>;
    reg-id = "vdd";
    vdd-supply = <&pm8953_l8>;
};
M0Rf30 commented 1 year ago

As i see in the downstream source for mido we should use pwm-ir-tx

Downstream node:

pwm_ir {
  compatible = "pwm-ir";
  pwms = <&pmi8950_pwm 0 0>;
  reg-id = "vdd";
  vdd-supply = <&pm8953_l8>;
};

Thanks for the suggestion. I will submit something for test today I think

M0Rf30 commented 1 year ago

@barni2000 @vipaoL I enabled the pwm generator for pmi8950 and use of pwm-ir-tx, I can't test it. let me know Judging from various dts the pwm node should live in pmic@3 node, has a reg = 0xb000 and one channel (chanid=0). So basically a msm8916-pwm with different .base. Some devices (sdm450) also enable a pm8950_pwm (not pmi), on pmic@1 and reg 0xbc00 (seems equivalent to msm8916-pwm)

Don't forget to enable required kernel modules

https://github.com/search?q=repo%3ASonicBSV%2Fandroid_kernel_xiaomi_markw-4.9%20pmi8950_pwm&type=code

barni2000 commented 1 year ago

@M0Rf30 I am going to check on mido, but i see you changed markw but it uses gpio-ir. The two device has different irled solution.

barni2000 commented 1 year ago

@barni2000 @vipaoL I enabled the pwm generator for pmi8950 and use of pwm-ir-tx, I can't test it. let me know Judging from various dts the pwm node should live in pmic@3 node, has a reg = 0xb000 and one channel (chanid=0). So basically a msm8916-pwm with different .base. Some devices (sdm450) also enable a pm8950_pwm (not pmi), on pmic@1 and reg 0xbc00 (seems equivalent to msm8916-pwm)

Don't forget to enable required kernel modules

https://github.com/search?q=repo%3ASonicBSV%2Fandroid_kernel_xiaomi_markw-4.9%20pmi8950_pwm&type=code

I have test but unfortunately it is not reacts for anything. The drivers are initialized i have /dev/lirc0 but the led is not working for me.

barni2000 commented 7 months ago

I have added pmi8950_gpio pinctrl for mido and it is working now.

barni2000 commented 7 months ago

@M0Rf30 will you send it to upstream?

M0Rf30 commented 7 months ago

I think to upstream this and posting a link here

M0Rf30 commented 5 months ago

In linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20240415&id=2573c25e2c482b53b6e1142ff3cd28f6de13e659

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20240415&id=fc3b23faa14371182ca8a3806854f0db827cb91f