This worked for me on a HP Pavilion 2 in 1, seems to disable the laptop switching into tablet mode when you turn it sideways or twist the screen back.
Go to Computer Management, Device Manager, and under System Devices, right click Intel Integrated Sensor Solution and click Disable.
If you're hoping to sometimes use it as a tablet only this may not be a great solution, but it works for my case where i hardly ever want the keyboard/touchpad disabled or portrait mode. It should be way easier to disable the keyboard with a separate software than trying to stop the automatic tablet mode from doing its thing when you don't want it to.
Found this on a reddit thread where folks were trying the reverse (enabling tablet mode)
https://www.reddit.com/r/Windows11/comments/pezxex/windows_11s_tablet_mode_removal_and_how_that/
However the backlighting doesn't work when you log back into the computer after hibernation, so I have added a batch file to run using Task Scheduler on logon to enable the device then disable it.
To List devices using command prompt (then use Find to find the right device)
pnputil /enum-devices
To disable device:
pnputil /disable-device "PCI\VEN_8086&DEV_A0FC&SUBSYS_88BC103C&REV_20\3&11583659&2&90"
To enable device:
pnputil /enable-device "PCI\VEN_8086&DEV_A0FC&SUBSYS_88BC103C&REV_20\3&11583659&2&90"
Note this is my device instance id in the quotes, you would have to enter your own.