[BPI-R2 Pro] IR Receiver/PWM

Hi @sinovoip

I have a question about the IR Receiver:

According to the BSP dts the IR Receiver is connected to pwm7:

But according to the schematics it’s commected to pwm3:

image

while pwm7 is used for mPCIe_EN

As i got the correct pin is PWM3, but i want to make sure it’s a correct assumption.

@sinovoip please help.

Thanks a lot!

i wonder why it is connected to a pwm, as pwm is normally output (so IR-TX,not rx). wonder how this should work, but found no other board in mainline using pwm for IR as reference (independ of which pwm is used).

is this really a receiver like stated in schematics?

pwm7 has only same pins (GPIO0_C6) as PCIE30X2_PERSTn_M0 which is used as 4G_PWREN_H_GPIO0_C6 (so gpio-mode is not pwm, and so pwm3 seems right)

grafik

so bpi-dts seems wrong here, as there is no pwm7 because GPIO0_C6 is the only breakout for pwm7 and blocked by another function

Found this patch for another board:

https://lore.kernel.org/lkml/[email protected]/

Physically the sensor is also connected to GPIO0_C2/PWM3_IR, so it might work for R2 Pro as well.

I’m not sure what advantages has rockchip,remotectl-pwm over the gpio-ir-receiver

nice find :slight_smile:

last one seems mainline first one is imho rk downstream driver and not available in mainline linux.

gpio-ir-receiver seems to work not in pwm-mode (which is imho tx only), gpio can rx and tx

and yes, pin define seems same so it may work on r2pro too (including r2pro has external pullup too), just try it out and give me feedback…then i merge it in my new 6.1-main tree and maybe send to mainline

bpi-r2pro ~ # dmesg | grep receiver
[    1.879774] rc rc0: gpio_ir_recv as /devices/platform/ir-receiver/rc/rc0
[    1.880597] rc rc0: lirc_dev: driver gpio_ir_recv registered at minor = 0, raw IR receiver, no transmitter
[    1.881633] input: gpio_ir_recv as /devices/platform/ir-receiver/rc/rc0/input1

Interrupt count grows on remote action.

Every 2.0s: cat /proc/interrupts | grep gpio-ir-recv-irq                                                                                                                                        bpi-r2pro: Tue Dec 13 22:44:50 2022

 74:       1870          0          0          0  rockchip_gpio_irq  18 Edge      gpio-ir-recv-irq

No lirc or other software tested yet.

Additional config (likely not minimal):

 #IR_Driver
 CONFIG_RC_CORE=y
 CONFIG_LIRC=y
 CONFIG_RC_DEVICES=y
 CONFIG_IR_GPIO_CIR=y
 CONFIG_RC_MAP=y
 # Decoders (might be optional)
 CONFIG_RC_DECODERS=y
 CONFIG_IR_IMON_DECODER=y
 CONFIG_IR_JVC_DECODER=y
 CONFIG_IR_MCE_KBD_DECODER=y
 CONFIG_IR_NEC_DECODER=y
 CONFIG_IR_RC5_DECODER=y
 CONFIG_IR_RC6_DECODER=y
 CONFIG_IR_RCMM_DECODER=y
 CONFIG_IR_SANYO_DECODER=y
 CONFIG_IR_SHARP_DECODER=y
 CONFIG_IR_SONY_DECODER=y
 CONFIG_IR_XMP_DECODER=y

Some /dev/lirc0 input:

bpi-r2pro ~ # mode2 -d /dev/lirc0  
Using driver default on device /dev/lirc0
Trying device: /dev/lirc0
Using device: /dev/lirc0
Warning: Running as root.
pulse 8941
space 4560
pulse 577
space 570
pulse 593
space 573
pulse 614
space 1664
pulse 602
space 552
pulse 615
space 545
pulse 615
space 550

The dts update has been committed to my repo, for now - w/o defconfig update.

1 Like

@frank-w

Hey Frank,

I’ve tried to update the /home/alex/Src/BPI/BPI-R2/arch/arm64/configs/rk3568_bpi-r2p_defconfig

But my changes didn’t affected the .config after ./build.sh importconfig, any clues, please? :slight_smile:

➜  BPI-R2 git:(6.1-rc) ✗ ./build.sh importconfig
import a defconfig file
import quartz64_defconfig (arch/arm64/configs/quartz64_defconfig)
make[1]: Entering directory '/home/alex/Src/BPI/build'
  GEN     Makefile
#
# No change to .config
#
make[1]: Leaving directory '/home/alex/Src/BPI/build'

arch/arm64/configs/quartz64_defconfig :man_facepalming:

Ok, The right question is a half of an answer :slight_smile:

UPD: No change :frowning: the same after updating quartz64_defconfig, please advice.

I’ll try to update the default config and commit it tomorrow.

Change in quartz64_defconfig (yes i use this from peter which i have extended instead of my own one which had some problems in graphics part) should be right, maybe you miss any depency for your options?

Just search the first options in menuconfig after importing the modified defconfig…if they are not set,look on depends line which option is missing

1 Like

Ok, it works :slight_smile:

The config may have some redundancy, but it works :wink:

Created the pull-request, please check.

sent out Patch to Mailinglist: https://patchwork.kernel.org/project/linux-rockchip/patch/[email protected]/

1 Like