android_kernel_xiaomi_sm8450/drivers/clk/qcom/clk-rcg2.c
aseshu 136573f110 Merge keystone/android12-5.10-keystone-qcom-release.205+ (a31d98f) into msm-5.10
* refs/heads/tmp-a31d98f:
  ANDROID: userfaultfd: allow SPF for UFFD_FEATURE_SIGBUS on private+anon
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: add hooks into blk-mq-sched.c for customized I/O scheduler
  ANDROID: add hooks into blk-ma-tag.c for customized I/O scheduler
  ANDROID: add hooks into blk-flush.c for customized I/O scheduler
  ANDROID: add hooks into blk-core.c for customized I/O scheduler
  ANDROID: add hooks into blk-mq.c for customized I/O scheduler.
  ANDROID: add hooks into bio.c for customized I/O scheduler
  UPSTREAM: usb: dwc3: gadget: Handle EP0 request dequeuing properly
  UPSTREAM: usb: dwc3: gadget: Refactor EP0 forced stall/restart into a separate API
  ANDROID: GKI: Update symbols to symbol list
  ANDROID: add hooks into blk-mq-sched.c for customized I/O scheduler
  ANDROID: add hooks into blk-ma-tag.c for customized I/O scheduler
  ANDROID: add hooks into blk-flush.c for customized I/O scheduler
  ANDROID: add hooks into blk-core.c for customized I/O scheduler
  ANDROID: add hooks into blk-mq.c for customized I/O scheduler.
  ANDROID: add hooks into bio.c for customized I/O scheduler
  ANDROID: ABI: Update oplus symbol list
  ANDROID: binder: Add vendor hook to fix priority restore
  ANDROID: GKI: Update symbol list
  ANDROID: Add vendor hook for task exiting routine
  UPSTREAM: netfilter: nft_set_rbtree: skip end interval element from gc
  ANDROID: GKI: Update oplus symbol list
  UPSTREAM: usb: gadget: uvc: set v4l2_dev->dev in f_uvc
  ANDROID: mm: Fix VMA ref count after fast-mremap
  ANDROID: mm: Fix VMA ref count after fast-mremap
  ANDROID: GKI: fix ABI breakage in struct ipv6_devconf
  Reapply "net: release reference to inet6_dev pointer"
  Reapply "net: change accept_ra_min_rtr_lft to affect all RA lifetimes"
  Reapply "net: add sysctl accept_ra_min_rtr_lft"
  ANDROID: GKI: explicit include of stringify.h
  ANDROID: introduce a vendor hook to allow speculative swap pagefaults
  ANDROID: mm: allow limited speculative page faulting in do_swap_page()
  UPSTREAM: net: tls, update curr on splice as well
  ANDROID: GKI: Update oplus symbol list
  ANDROID: mm: Add vendor hooks for recording when kswapd finishing the reclaim job
  ANDROID: GKI: Update oplus symbol list
  ANDROID: vendor_hooks: Add hooks for adjusting alloc_flags
  Reapply "perf: Fix perf_event_validate_size()"
  UPSTREAM: ida: Fix crash in ida_free when the bitmap is empty
  UPSTREAM: netfilter: nf_tables: Reject tables of unsupported family
  UPSTREAM: net/rose: Fix Use-After-Free in rose_ioctl
  ANDROID: GKI: Update symbol list for mtk
  Reapply "perf: Disallow mis-matched inherited group reads"
  ANDROID: scsi: ufs: UFS HPB feature not working
  ANDROID: GKI: Update symbol list for mtk
  FROMGIT: usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart
  FROMGIT: BACKPORT: mm: update mark_victim tracepoints fields
  ANDROID: ABI: update allowed list for galaxy
  ANDROID: ABI: update allowed list for galaxy
  BACKPORT: exfat: reduce block requests when zeroing a cluster
  UPSTREAM: netfilter: nf_tables: skip set commit for deleted/destroyed sets
  ANDROID: GKI: fix crc issue in include/net/addrconf.h
  Revert "cred: switch to using atomic_long_t"
  Linux 5.10.205
  powerpc/ftrace: Fix stack teardown in ftrace_no_trace
  powerpc/ftrace: Create a dummy stackframe to fix stack unwind
  tty: n_gsm: add sanity check for gsm->receive in gsm_receive_buf()
  tty: n_gsm, remove duplicates of parameters
  tty: n_gsm: fix tty registration before control channel open
  USB: gadget: core: adjust uevent timing on gadget unbind
  ring-buffer: Fix a race in rb_time_cmpxchg() for 32 bit archs
  ring-buffer: Fix writing to the buffer with max_data_size
  ring-buffer: Have saved event hold the entire event
  tracing: Update snapshot buffer on resize if it is allocated
  ring-buffer: Fix memory leak of free page
  team: Fix use-after-free when an option instance allocation fails
  arm64: mm: Always make sw-dirty PTEs hw-dirty in pte_modify
  ext4: prevent the normalized size from exceeding EXT_MAX_BLOCKS
  soundwire: stream: fix NULL pointer dereference for multi_link
  perf: Fix perf_event_validate_size() lockdep splat
  HID: hid-asus: add const to read-only outgoing usb buffer
  net: usb: qmi_wwan: claim interface 4 for ZTE MF290
  asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation
  HID: multitouch: Add quirk for HONOR GLO-GXXX touchpad
  HID: hid-asus: reset the backlight brightness level on resume
  HID: add ALWAYS_POLL quirk for Apple kb
  HID: glorious: fix Glorious Model I HID report
  platform/x86: intel_telemetry: Fix kernel doc descriptions
  bcache: avoid NULL checking to c->root in run_cache_set()
  bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc()
  bcache: remove redundant assignment to variable cur_idx
  bcache: avoid oversize memory allocation by small stripe_size
  blk-throttle: fix lockdep warning of "cgroup_mutex or RCU read lock required!"
  usb: aqc111: check packet for fixup for true limit
  drm/mediatek: Add spinlock for setting vblank event in atomic_begin
  PCI: loongson: Limit MRRS to 256
  Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
  ALSA: hda/realtek: Apply mute LED quirk for HP15-db
  ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
  fuse: dax: set fc->dax to NULL in fuse_dax_conn_free()
  cred: switch to using atomic_long_t
  net: atlantic: fix double free in ring reinit logic
  appletalk: Fix Use-After-Free in atalk_ioctl
  net: stmmac: Handle disabled MDIO busses from devicetree
  net: stmmac: use dev_err_probe() for reporting mdio bus registration failure
  vsock/virtio: Fix unsigned integer wrap around in virtio_transport_has_space()
  sign-file: Fix incorrect return values check
  net: ena: Fix XDP redirection error
  net: ena: Destroy correct number of xdp queues upon failure
  net: Remove acked SYN flag from packet in the transmit queue correctly
  qed: Fix a potential use-after-free in qed_cxt_tables_alloc
  net/rose: Fix Use-After-Free in rose_ioctl
  atm: Fix Use-After-Free in do_vcc_ioctl
  net: fec: correct queue selection
  net: vlan: introduce skb_vlan_eth_hdr()
  atm: solos-pci: Fix potential deadlock on &tx_queue_lock
  atm: solos-pci: Fix potential deadlock on &cli_queue_lock
  qca_spi: Fix reset behavior
  qca_debug: Fix ethtool -G iface tx behavior
  qca_debug: Prevent crash on TX ring changes
  net: ipv6: support reporting otherwise unknown prefix flags in RTM_NEWPREFIX
  HID: lenovo: Restrict detection of patched firmware only to USB cptkbd
  afs: Fix refcount underflow from error handling race
  netfilter: nf_tables: fix 'exist' matching on bigendian arches
  Revert "psample: Require 'CAP_NET_ADMIN' when joining "packets" group"
  Revert "genetlink: add CAP_NET_ADMIN test for multicast bind"
  Revert "drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group"
  Revert "perf/core: Add a new read format to get a number of lost samples"
  Revert "perf: Fix perf_event_validate_size()"
  Revert "hrtimers: Push pending hrtimers away from outgoing CPU earlier"
  Linux 5.10.204
  r8169: fix rtl8125b PAUSE frames blasting when suspended
  devcoredump: Send uevent once devcd is ready
  devcoredump : Serialize devcd_del work
  smb: client: fix potential NULL deref in parse_dfs_referrals()
  cifs: Fix non-availability of dedup breaking generic/304
  Revert "btrfs: add dmesg output for first mount and last unmount of a filesystem"
  mmc: block: Be sure to wait while busy in CQE error recovery
  platform/x86: asus-wmi: Document the dgpu_disable sysfs attribute
  tools headers UAPI: Sync linux/perf_event.h with the kernel sources
  platform/x86: asus-wmi: Fix kbd_dock_devid tablet-switch reporting
  netfilter: nft_set_pipapo: skip inactive elements during set walk
  drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group
  psample: Require 'CAP_NET_ADMIN' when joining "packets" group
  genetlink: add CAP_NET_ADMIN test for multicast bind
  netlink: don't call ->netlink_bind with table lock held
  io_uring/af_unix: disable sending io_uring over sockets
  MIPS: Loongson64: Enable DMA noncoherent support
  MIPS: Loongson64: Reserve vgabios memory on boot
  KVM: s390/mm: Properly reset no-dat
  x86/CPU/AMD: Check vendor in the AMD microcode callback
  serial: 8250_omap: Add earlycon support for the AM654 UART controller
  serial: 8250: 8250_omap: Do not start RX DMA on THRI interrupt
  serial: 8250: 8250_omap: Clear UART_HAS_RHR_IT_DIS bit
  serial: sc16is7xx: address RX timeout interrupt errata
  ARM: PL011: Fix DMA support
  usb: typec: class: fix typec_altmode_put_partner to put plugs
  Revert "xhci: Loosen RPM as default policy to cover for AMD xHC 1.1"
  parport: Add support for Brainboxes IX/UC/PX parallel cards
  usb: gadget: f_hid: fix report descriptor allocation
  drm/amdgpu: correct the amdgpu runtime dereference usage count
  gpiolib: sysfs: Fix error handling on failed export
  perf: Fix perf_event_validate_size()
  perf/core: Add a new read format to get a number of lost samples
  tracing: Stop current tracer when resizing buffer
  tracing: Set actual size after ring buffer resize
  ring-buffer: Force absolute timestamp on discard of event
  misc: mei: client.c: fix problem of return '-EOVERFLOW' in mei_cl_write
  misc: mei: client.c: return negative error code in mei_cl_write
  arm64: dts: mediatek: mt8183: Fix unit address for scp reserved memory
  arm64: dts: mediatek: mt8173-evb: Fix regulator-fixed node names
  arm64: dts: mediatek: mt7622: fix memory node warning check
  packet: Move reference count in packet_sock to atomic_long_t
  tracing: Fix a possible race when disabling buffered events
  tracing: Fix incomplete locking when disabling buffered events
  tracing: Disable snapshot buffer when stopping instance tracers
  tracing: Always update snapshot buffer size
  checkstack: fix printed address
  nilfs2: prevent WARNING in nilfs_sufile_set_segment_usage()
  nilfs2: fix missing error check for sb_set_blocksize call
  ALSA: hda/realtek: Enable headset on Lenovo M90 Gen5
  ALSA: pcm: fix out-of-bounds in snd_pcm_state_names
  riscv: fix misaligned access handling of C.SWSP and C.SDSP
  ARM: dts: imx7: Declare timers compatible with fsl,imx6dl-gpt
  ARM: imx: Check return value of devm_kasprintf in imx_mmdc_perf_init
  scsi: be2iscsi: Fix a memleak in beiscsi_init_wrb_handle()
  tracing: Fix a warning when allocating buffered events fails
  ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populate
  hwmon: (acpi_power_meter) Fix 4.29 MW bug
  RDMA/bnxt_re: Correct module description string
  RDMA/rtrs-clt: Remove the warnings for req in_use check
  arm64: dts: rockchip: Expand reg size of vdec node for RK3399
  tee: optee: Fix supplicant based device enumeration
  bpf: sockmap, updating the sg structure should also update curr
  tcp: do not accept ACK of bytes we never sent
  netfilter: xt_owner: Fix for unsafe access of sk->sk_socket
  net: hns: fix fake link up on xge port
  ipv4: ip_gre: Avoid skb_pull() failure in ipgre_xmit()
  ionic: Fix dim work handling in split interrupt mode
  ionic: fix snprintf format length warning
  net: bnxt: fix a potential use-after-free in bnxt_init_tc
  i40e: Fix unexpected MFS warning message
  arcnet: restoring support for multiple Sohard Arcnet cards
  net: arcnet: com20020 fix error handling
  mlxbf-bootctl: correctly identify secure boot with development keys
  hv_netvsc: rndis_filter needs to select NLS
  octeontx2-pf: Add missing mutex lock in otx2_get_pauseparam
  ipv6: fix potential NULL deref in fib6_add()
  of: dynamic: Fix of_reconfig_get_state_change() return value documentation
  of: Add missing 'Return' section in kerneldoc comments
  of: Fix kerneldoc output formatting
  of: base: Fix some formatting issues and provide missing descriptions
  platform/x86: asus-wmi: Move i8042 filter install to shared asus-wmi code
  platform/x86: asus-wmi: Simplify tablet-mode-switch handling
  platform/x86: asus-wmi: Simplify tablet-mode-switch probing
  platform/x86: asus-wmi: Add support for ROG X13 tablet mode
  platform/x86: asus-wmi: Adjust tablet/lidflip handling to use enum
  asus-wmi: Add dgpu disable method
  platform/x86: asus-nb-wmi: Add tablet_mode_sw=lid-flip quirk for the TP200s
  platform/x86: asus-nb-wmi: Allow configuring SW_TABLET_MODE method with a module option
  platform/x86: asus-wmi: Add support for SW_TABLET_MODE on UX360
  drm/amdgpu: correct chunk_ptr to a pointer to chunk.
  kconfig: fix memory leak from range properties
  tg3: Increment tx_dropped in tg3_tso_bug()
  tg3: Move the [rt]x_dropped counters to tg3_napi
  netfilter: ipset: fix race condition between swap/destroy and kernel side add/del/test
  i2c: designware: Fix corrupted memory seen in the ISR
  hrtimers: Push pending hrtimers away from outgoing CPU earlier
  Revert "mmc: core: add helpers mmc_regulator_enable/disable_vqmmc"
  Revert "mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled"
  Revert "driver core: Move the "removable" attribute from USB to core"
  Revert "drm/amdgpu: don't use ATRM for external devices"
  Revert "HID: core: store the unique system identifier in hid_device"
  Revert "HID: fix HID device resource race between HID core and debugging support"
  Revert "wireguard: use DEV_STATS_INC()"
  ANDROID: Fix up ipvlan merge in 5.10.202
  Revert "ASoC: soc-card: Add storage for PCI SSID"
  Revert "tracing: Have trace_event_file have ref counters"
  UPSTREAM: interconnect: qcom: Add support for mask-based BCMs
  Revert "ipvlan: properly track tx_errors"
  Revert "inet: shrink struct flowi_common"
  Revert "arm64/arm: xen: enlighten: Fix KPTI checks"
  Revert "mfd: core: Un-constify mfd_cell.of_reg"
  Linux 5.10.203
  driver core: Release all resources during unbind before updating device links
  r8169: fix deadlock on RTL8125 in jumbo mtu mode
  r8169: disable ASPM in case of tx timeout
  mmc: sdhci-sprd: Fix vqmmc not shutting down after the card was pulled
  mmc: core: add helpers mmc_regulator_enable/disable_vqmmc
  mmc: block: Retry commands in CQE error recovery
  mmc: core: convert comma to semicolon
  mmc: cqhci: Fix task clearing in CQE error recovery
  mmc: cqhci: Warn of halt or task clear failure
  mmc: cqhci: Increase recovery halt timeout
  cpufreq: imx6q: Don't disable 792 Mhz OPP unnecessarily
  cpufreq: imx6q: don't warn for disabling a non-existing frequency
  scsi: qla2xxx: Fix system crash due to bad pointer access
  scsi: qla2xxx: Use scsi_cmd_to_rq() instead of scsi_cmnd.request
  scsi: core: Introduce the scsi_cmd_to_rq() function
  smb3: fix caching of ctime on setxattr
  fs: add ctime accessors infrastructure
  drm/amdgpu: don't use ATRM for external devices
  driver core: Move the "removable" attribute from USB to core
  ima: annotate iint mutex to avoid lockdep false positive warnings
  fbdev: stifb: Make the STI next font pointer a 32-bit signed offset
  misc: pci_endpoint_test: Add deviceID for J721S2 PCIe EP device support
  misc: pci_endpoint_test: Add deviceID for AM64 and J7200
  s390/cmma: fix detection of DAT pages
  s390/mm: fix phys vs virt confusion in mark_kernel_pXd() functions family
  ASoC: SOF: sof-pci-dev: Fix community key quirk detection
  ASoC: SOF: sof-pci-dev: don't use the community key on APL Chromebooks
  ASoC: SOF: sof-pci-dev: add parameter to override topology filename
  ASoC: SOF: sof-pci-dev: use community key on all Up boards
  ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
  smb3: fix touch -h of symlink
  net: ravb: Start TX queues after HW initialization succeeded
  net: ravb: Use pm_runtime_resume_and_get()
  ravb: Fix races between ravb_tx_timeout_work() and net related ops
  r8169: prevent potential deadlock in rtl8169_close
  Revert "workqueue: remove unused cancel_work()"
  octeontx2-pf: Fix adding mbox work queue entry when num_vfs > 64
  net: stmmac: xgmac: Disable FPE MMC interrupts
  selftests/net: mptcp: fix uninitialized variable warnings
  selftests/net: ipsec: fix constant out of range
  dpaa2-eth: increase the needed headroom to account for alignment
  ipv4: igmp: fix refcnt uaf issue when receiving igmp query packet
  usb: config: fix iteration issue in 'usb_get_bos_descriptor()'
  USB: core: Change configuration warnings to notices
  hv_netvsc: fix race of netvsc and VF register_netdevice
  Input: xpad - add HyperX Clutch Gladiate Support
  btrfs: make error messages more clear when getting a chunk map
  btrfs: send: ensure send_fd is writable
  btrfs: fix off-by-one when checking chunk map includes logical address
  btrfs: ref-verify: fix memory leaks in btrfs_ref_tree_mod()
  btrfs: add dmesg output for first mount and last unmount of a filesystem
  parisc: Drop the HP-UX ENOSYM and EREMOTERELEASE error codes
  powerpc: Don't clobber f0/vs0 during fp|altivec register save
  iommu/vt-d: Add MTL to quirk list to skip TE disabling
  bcache: revert replacing IS_ERR_OR_NULL with IS_ERR
  dm verity: don't perform FEC for failed readahead IO
  dm-verity: align struct dm_verity_fec_io properly
  ALSA: hda/realtek: Add supported ALC257 for ChromeOS
  ALSA: hda/realtek: Headset Mic VREF to 100%
  ALSA: hda: Disable power-save on KONTRON SinglePC
  mmc: block: Do not lose cache flush during CQE error recovery
  firewire: core: fix possible memory leak in create_units()
  pinctrl: avoid reload of p state in list iteration
  io_uring: fix off-by one bvec index
  USB: dwc3: qcom: fix wakeup after probe deferral
  usb: dwc3: set the dma max_seg_size
  usb: dwc3: Fix default mode initialization
  USB: dwc2: write HCINT with INTMASK applied
  USB: serial: option: don't claim interface 4 for ZTE MF290
  USB: serial: option: fix FM101R-GL defines
  USB: serial: option: add Fibocom L7xx modules
  bcache: fixup lock c->root error
  bcache: fixup init dirty data errors
  bcache: prevent potential division by zero error
  bcache: check return value from btree_node_alloc_replacement()
  dm-delay: fix a race between delay_presuspend and delay_bio
  hv_netvsc: Mark VF as slave before exposing it to user-mode
  hv_netvsc: Fix race of register_netdevice_notifier and VF register
  USB: serial: option: add Luat Air72*U series products
  s390/dasd: protect device queue against concurrent access
  bcache: fixup multi-threaded bch_sectors_dirty_init() wake-up race
  bcache: replace a mistaken IS_ERR() by IS_ERR_OR_NULL() in btree_gc_coalesce()
  swiotlb-xen: provide the "max_mapping_size" method
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CVA
  ASoC: simple-card: fixup asoc_simple_probe() error handling
  nfsd: lock_rename() needs both directories to live on the same fs
  ext4: make sure allocate pending entry not fail
  ext4: fix slab-use-after-free in ext4_es_insert_extent()
  ext4: using nofail preallocation in ext4_es_insert_extent()
  ext4: using nofail preallocation in ext4_es_insert_delayed_block()
  ext4: using nofail preallocation in ext4_es_remove_extent()
  ext4: use pre-allocated es in __es_remove_extent()
  ext4: use pre-allocated es in __es_insert_extent()
  ext4: factor out __es_alloc_extent() and __es_free_extent()
  ext4: add a new helper to check if es must be kept
  MIPS: KVM: Fix a build warning about variable set but not used
  media: ccs: Correctly initialise try compose rectangle
  lockdep: Fix block chain corruption
  USB: dwc3: qcom: fix ACPI platform device leak
  USB: dwc3: qcom: fix resource leaks on probe deferral
  nvmet: nul-terminate the NQNs passed in the connect command
  nvmet: remove unnecessary ctrl parameter
  afs: Fix file locking on R/O volumes to operate in local mode
  afs: Return ENOENT if no cell DNS record can be found
  net: axienet: Fix check for partial TX checksum
  amd-xgbe: propagate the correct speed and duplex status
  amd-xgbe: handle the corner-case during tx completion
  amd-xgbe: handle corner-case during sfp hotplug
  arm/xen: fix xen_vcpu_info allocation alignment
  net/smc: avoid data corruption caused by decline
  net: usb: ax88179_178a: fix failed operations during ax88179_reset
  ipv4: Correct/silence an endian warning in __ip_do_redirect
  HID: fix HID device resource race between HID core and debugging support
  HID: core: store the unique system identifier in hid_device
  drm/rockchip: vop: Fix color for RGB888/BGR888 format on VOP full
  ata: pata_isapnp: Add missing error check for devm_ioport_map()
  wireguard: use DEV_STATS_INC()
  drm/panel: simple: Fix Innolux G101ICE-L01 timings
  drm/panel: simple: Fix Innolux G101ICE-L01 bus flags
  drm/panel: auo,b101uan08.3: Fine tune the panel power sequence
  drm/panel: boe-tv101wum-nl6: Fine tune the panel power sequence
  afs: Make error on cell lookup failure consistent with OpenAFS
  afs: Fix afs_server_list to be cleaned up with RCU
  PCI: keystone: Drop __init from ks_pcie_add_pcie_{ep,port}()
  RDMA/irdma: Prevent zero-length STAG registration
  ANDROID: GKI: db845c: Update symbols list and ABI on rpmsg_register_device_override
  Linux 5.10.202
  interconnect: qcom: Add support for mask-based BCMs
  netfilter: nf_tables: disable toggling dormant table state more than once
  netfilter: nf_tables: fix table flag updates
  netfilter: nftables: update table flags from the commit phase
  tracing: Have trace_event_file have ref counters
  io_uring/fdinfo: lock SQ thread while retrieving thread cpu/pid
  drm/amd/display: Change the DMCUB mailbox memory location from FB to inbox
  drm/amdgpu: fix error handling in amdgpu_bo_list_get()
  drm/amd/pm: Handle non-terminated overdrive commands.
  ext4: remove gdb backup copy for meta bg in setup_new_flex_group_blocks
  ext4: correct the start block of counting reserved clusters
  ext4: correct return value of ext4_convert_meta_bg
  ext4: correct offset of gdb backup in non meta_bg group to update_backups
  ext4: apply umask if ACL support is disabled
  Revert "net: r8169: Disable multicast filter for RTL8168H and RTL8107E"
  media: qcom: camss: Fix vfe_get() error jump
  mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors
  nfsd: fix file memleak on client_opens_release
  media: venus: hfi: add checks to handle capabilities from firmware
  media: venus: hfi: fix the check to handle session buffer requirement
  media: venus: hfi_parser: Add check to keep the number of codecs within range
  media: sharp: fix sharp encoding
  media: lirc: drop trailing space from scancode transmit
  f2fs: avoid format-overflow warning
  i2c: i801: fix potential race in i801_block_transaction_byte_by_byte
  net: phylink: initialize carrier state at creation
  net: dsa: lan9303: consequently nested-lock physical MDIO
  i2c: designware: Disable TX_EMPTY irq while waiting for block length byte
  lsm: fix default return value for inode_getsecctx
  lsm: fix default return value for vm_enough_memory
  Revert ncsi: Propagate carrier gain/loss events to the NCSI controller
  arm64: dts: qcom: ipq6018: Fix tcsr_mutex register size
  arm64: dts: qcom: ipq6018: switch TCSR mutex to MMIO
  PCI: exynos: Don't discard .remove() callback
  Bluetooth: btusb: Add 0bda:b85b for Fn-Link RTL8852BE
  Bluetooth: btusb: Add RTW8852BE device 13d3:3570 to device tables
  bluetooth: Add device 13d3:3571 to device tables
  bluetooth: Add device 0bda:887b to device tables
  Bluetooth: btusb: Add Realtek RTL8852BE support ID 0x0cb8:0xc559
  cpufreq: stats: Fix buffer overflow detection in trans_stats()
  tty: serial: meson: fix hard LOCKUP on crtscts mode
  serial: meson: Use platform_get_irq() to get the interrupt
  tty: serial: meson: retrieve port FIFO size from DT
  serial: meson: remove redundant initialization of variable id
  ALSA: hda/realtek - Enable internal speaker of ASUS K6500ZC
  ALSA: hda/realtek - Add Dell ALC295 to pin fall back table
  ALSA: info: Fix potential deadlock at disconnection
  xhci: Enable RPM on controllers that support low-power states
  parisc/pgtable: Do not drop upper 5 address bits of physical address
  parisc: Prevent booting 64-bit kernels on PA1.x machines
  i3c: master: cdns: Fix reading status register
  mtd: cfi_cmdset_0001: Byte swap OTP info
  mm/memory_hotplug: use pfn math in place of direct struct page manipulation
  mm/cma: use nth_page() in place of direct struct page manipulation
  dmaengine: stm32-mdma: correct desc prep when channel running
  mcb: fix error handling for different scenarios when parsing
  i2c: core: Run atomic i2c xfer when !preemptible
  kernel/reboot: emergency_restart: Set correct system_state
  quota: explicitly forbid quota files from being encrypted
  jbd2: fix potential data lost in recovering journal raced with synchronizing fs bdev
  PCI: keystone: Don't discard .probe() callback
  PCI: keystone: Don't discard .remove() callback
  genirq/generic_chip: Make irq_remove_generic_chip() irqdomain aware
  mmc: meson-gx: Remove setting of CMD_CFG_ERROR
  wifi: ath11k: fix htt pktlog locking
  wifi: ath11k: fix dfs radar event locking
  wifi: ath11k: fix temperature event locking
  ima: detect changes to the backing overlay file
  firmware: qcom_scm: use 64-bit calling convention only when client is 64-bit
  btrfs: don't arbitrarily slow down delalloc if we're committing
  rcu: kmemleak: Ignore kmemleak false positives when RCU-freeing objects
  PM: hibernate: Clean up sync_read handling in snapshot_write_next()
  PM: hibernate: Use __get_safe_page() rather than touching the list
  arm64: dts: qcom: ipq6018: Fix hwlock index for SMEM
  PCI/ASPM: Fix L1 substate handling in aspm_attr_store_common()
  mmc: sdhci_am654: fix start loop index for TAP value parsing
  mmc: vub300: fix an error code
  clk: qcom: ipq6018: drop the CLK_SET_RATE_PARENT flag from PLL clocks
  clk: qcom: ipq8074: drop the CLK_SET_RATE_PARENT flag from PLL clocks
  parisc/pdc: Add width field to struct pdc_model
  arm64: Restrict CPU_BIG_ENDIAN to GNU as or LLVM IAS 15.x or newer
  ACPI: resource: Do IRQ override on TongFang GMxXGxx
  watchdog: move softlockup_panic back to early_param
  PCI/sysfs: Protect driver's D3cold preference from user space
  hvc/xen: fix error path in xen_hvc_init() to always register frontend driver
  hvc/xen: fix console unplug
  tty/sysrq: replace smp_processor_id() with get_cpu()
  audit: don't WARN_ON_ONCE(!current->mm) in audit_exe_compare()
  audit: don't take task_lock() in audit_exe_compare() code path
  KVM: x86: Ignore MSR_AMD64_TW_CFG access
  KVM: x86: hyper-v: Don't auto-enable stimer on write from user-space
  x86/cpu/hygon: Fix the CPU topology evaluation for real
  scsi: megaraid_sas: Increase register read retry rount from 3 to 30 for selected registers
  scsi: mpt3sas: Fix loop logic
  bpf: Fix precision tracking for BPF_ALU | BPF_TO_BE | BPF_END
  bpf: Fix check_stack_write_fixed_off() to correctly spill imm
  randstruct: Fix gcc-plugin performance mode to stay in group
  powerpc/perf: Fix disabling BHRB and instruction sampling
  media: venus: hfi: add checks to perform sanity on queue pointers
  cifs: fix check of rc in function generate_smb3signingkey
  cifs: spnego: add ';' in HOST_KEY_LEN
  tools/power/turbostat: Fix a knl bug
  macvlan: Don't propagate promisc change to lower dev in passthru
  net/mlx5e: Check return value of snprintf writing to fw_version buffer for representors
  net/mlx5_core: Clean driver version and name
  net/mlx5e: fix double free of encap_header
  net: stmmac: fix rx budget limit check
  netfilter: nf_conntrack_bridge: initialize err to 0
  net: ethernet: cortina: Fix MTU max setting
  net: ethernet: cortina: Handle large frames
  net: ethernet: cortina: Fix max RX frame define
  bonding: stop the device in bond_setup_by_slave()
  ptp: annotate data-race around q->head and q->tail
  xen/events: fix delayed eoi list handling
  ppp: limit MRU to 64K
  tipc: Fix kernel-infoleak due to uninitialized TLV value
  net: hns3: fix VF reset fail issue
  net: hns3: fix variable may not initialized problem in hns3_init_mac_addr()
  tty: Fix uninit-value access in ppp_sync_receive()
  ipvlan: add ipvlan_route_v6_outbound() helper
  gfs2: Silence "suspicious RCU usage in gfs2_permission" warning
  SUNRPC: Fix RPC client cleaned up the freed pipefs dentries
  NFSv4.1: fix SP4_MACH_CRED protection for pnfs IO
  SUNRPC: Add an IS_ERR() check back to where it was
  SUNRPC: ECONNRESET might require a rebind
  xhci: turn cancelled td cleanup to its own function
  wifi: iwlwifi: Use FW rate for non-data frames
  pwm: Fix double shift bug
  drm/amdgpu: fix software pci_unplug on some chips
  ASoC: ti: omap-mcbsp: Fix runtime PM underflow warnings
  kgdb: Flush console before entering kgdb on panic
  drm/amd/display: Avoid NULL dereference of timing generator
  media: imon: fix access to invalid resource for the second interface
  media: cobalt: Use FIELD_GET() to extract Link Width
  gfs2: fix an oops in gfs2_permission
  gfs2: ignore negated quota changes
  media: vivid: avoid integer overflow
  media: gspca: cpia1: shift-out-of-bounds in set_flicker
  i2c: sun6i-p2wi: Prevent potential division by zero
  9p/trans_fd: Annotate data-racy writes to file::f_flags
  usb: gadget: f_ncm: Always set current gadget in ncm_bind()
  tty: vcc: Add check for kstrdup() in vcc_probe()
  exfat: support handle zero-size directory
  HID: Add quirk for Dell Pro Wireless Keyboard and Mouse KM5221W
  misc: pci_endpoint_test: Add Device ID for R-Car S4-8 PCIe controller
  scsi: libfc: Fix potential NULL pointer dereference in fc_lport_ptp_setup()
  atm: iphase: Do PCI error checks on own line
  PCI: tegra194: Use FIELD_GET()/FIELD_PREP() with Link Width fields
  ALSA: hda: Fix possible null-ptr-deref when assigning a stream
  ARM: 9320/1: fix stack depot IRQ stack filter
  HID: lenovo: Detect quirk-free fw on cptkbd and stop applying workaround
  jfs: fix array-index-out-of-bounds in diAlloc
  jfs: fix array-index-out-of-bounds in dbFindLeaf
  fs/jfs: Add validity check for db_maxag and db_agpref
  fs/jfs: Add check for negative db_l2nbperpage
  RDMA/hfi1: Use FIELD_GET() to extract Link Width
  crypto: pcrypt - Fix hungtask for PADATA_RESET
  ASoC: soc-card: Add storage for PCI SSID
  selftests/efivarfs: create-read: fix a resource leak
  drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
  drm/panel: st7703: Pick different reset sequence
  drm/panel/panel-tpo-tpg110: fix a possible null pointer dereference
  drm/panel: fix a possible null pointer dereference
  drm/amdgpu: Fix potential null pointer derefernce
  drm/amd: Fix UBSAN array-index-out-of-bounds for Polaris and Tonga
  drm/amd: Fix UBSAN array-index-out-of-bounds for SMU7
  drm/msm/dp: skip validity check for DP CTS EDID checksum
  drm/komeda: drop all currently held locks if deadlock happens
  platform/x86: thinkpad_acpi: Add battery quirk for Thinkpad X120e
  Bluetooth: Fix double free in hci_conn_cleanup
  Bluetooth: btusb: Add date->evt_skb is NULL check
  wifi: ath10k: Don't touch the CE interrupt registers after power up
  net: annotate data-races around sk->sk_dst_pending_confirm
  net: annotate data-races around sk->sk_tx_queue_mapping
  wifi: ath10k: fix clang-specific fortify warning
  wifi: ath9k: fix clang-specific fortify warnings
  bpf: Detect IP == ksym.end as part of BPF program
  wifi: mac80211: don't return unset power in ieee80211_get_tx_power()
  wifi: mac80211_hwsim: fix clang-specific fortify warning
  x86/mm: Drop the 4 MB restriction on minimal NUMA node memory size
  clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
  clocksource/drivers/timer-imx-gpt: Fix potential memory leak
  perf/core: Bail out early if the request AUX area is out of bound
  locking/ww_mutex/test: Fix potential workqueue corruption
  ANDROID: fix up rpmsg_device ABI break
  ANDROID: fix up platform_device ABI break
  Revert "kasan: print the original fault addr when access invalid shadow"
  Linux 5.10.201
  btrfs: use u64 for buffer sizes in the tree search ioctls
  Revert "mmc: core: Capture correct oemid-bits for eMMC cards"
  tracing/kprobes: Fix the order of argument descriptions
  fbdev: fsl-diu-fb: mark wr_reg_wa() static
  fbdev: imsttfb: fix a resource leak in probe
  fbdev: imsttfb: Fix error path of imsttfb_probe()
  spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies
  drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE
  x86/sev-es: Allow copy_from_kernel_nofault() in earlier boot
  x86: Share definition of __is_canonical_address()
  netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
  netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs
  netfilter: xt_recent: fix (increase) ipv6 literal buffer length
  r8169: respect userspace disabling IFF_MULTICAST
  tg3: power down device only on SYSTEM_POWER_OFF
  net/smc: put sk reference if close work was canceled
  net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc
  net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
  net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
  Fix termination state for idr_for_each_entry_ul()
  net: r8169: Disable multicast filter for RTL8168H and RTL8107E
  dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
  dccp: Call security_inet_conn_request() after setting IPv4 addresses.
  inet: shrink struct flowi_common
  tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
  hsr: Prevent use after free in prp_create_tagged_frame()
  llc: verify mac len before reading mac header
  Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
  pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
  pwm: sti: Reduce number of allocations and drop usage of chip_data
  pwm: sti: Avoid conditional gotos
  regmap: prevent noinc writes from clobbering cache
  media: dvb-usb-v2: af9035: fix missing unlock
  media: cedrus: Fix clock/reset sequence
  media: vidtv: mux: Add check and kfree for kstrdup
  media: vidtv: psi: Add check for kstrdup
  media: s3c-camif: Avoid inappropriate kfree()
  media: bttv: fix use after free error due to btv->timeout timer
  media: i2c: max9286: Fix some redundant of_node_put() calls
  pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
  pcmcia: ds: fix refcount leak in pcmcia_device_add()
  pcmcia: cs: fix possible hung task and memory leak pccardd()
  rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
  i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
  perf hist: Add missing puts to hist__account_cycles
  perf machine: Avoid out of bounds LBR memory read
  usb: host: xhci-plat: fix possible kernel oops while resuming
  xhci: Loosen RPM as default policy to cover for AMD xHC 1.1
  powerpc/pseries: fix potential memory leak in init_cpu_associativity()
  powerpc/imc-pmu: Use the correct spinlock initializer.
  powerpc/xive: Fix endian conversion size
  powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro
  modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host
  interconnect: qcom: sc7180: Set ACV enable_mask
  interconnect: qcom: sc7180: Retire DEFINE_QBCM
  f2fs: fix to initialize map.m_pblk in f2fs_precache_extents()
  dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc()
  USB: usbip: fix stub_dev hub disconnect
  tools: iio: iio_generic_buffer ensure alignment
  tools: iio: iio_generic_buffer: Fix some integer type and calculation
  tools: iio: privatize globals and functions in iio_generic_buffer.c file
  misc: st_core: Do not call kfree_skb() under spin_lock_irqsave()
  dmaengine: ti: edma: handle irq_of_parse_and_map() errors
  usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency
  livepatch: Fix missing newline character in klp_resolve_symbols()
  tty: tty_jobctrl: fix pid memleak in disassociate_ctty()
  leds: trigger: ledtrig-cpu:: Fix 'output may be truncated' issue for 'cpu'
  leds: pwm: Don't disable the PWM when the LED should be off
  mfd: dln2: Fix double put in dln2_probe
  mfd: core: Ensure disabled devices are skipped without aborting
  mfd: core: Un-constify mfd_cell.of_reg
  ASoC: ams-delta.c: use component after check
  padata: Fix refcnt handling in padata_free_shell()
  padata: Convert from atomic_t to refcount_t on parallel_data->refcnt
  ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails
  HID: logitech-hidpp: Move get_wireless_feature_index() check to hidpp_connect_event()
  HID: logitech-hidpp: Revert "Don't restart communication if not necessary"
  HID: logitech-hidpp: Don't restart IO, instead defer hid_connect() only
  HID: logitech-hidpp: Remove HIDPP_QUIRK_NO_HIDINPUT quirk
  Revert "HID: logitech-hidpp: add a module parameter to keep firmware gestures"
  sh: bios: Revive earlyprintk support
  hid: cp2112: Fix IRQ shutdown stopping polling for all IRQs on chip
  RDMA/hfi1: Workaround truncation compilation error
  scsi: ufs: core: Leave space for '\0' in utf8 desc string
  ASoC: fsl: Fix PM disable depth imbalance in fsl_easrc_probe
  RDMA/hns: Fix signed-unsigned mixed comparisons
  RDMA/hns: Fix uninitialized ucmd in hns_roce_create_qp_common()
  IB/mlx5: Fix rdma counter binding for RAW QP
  ASoC: fsl: mpc5200_dma.c: Fix warning of Function parameter or member not described
  ext4: move 'ix' sanity check to corrent position
  ARM: 9321/1: memset: cast the constant byte to unsigned char
  hid: cp2112: Fix duplicate workqueue initialization
  crypto: qat - increase size of buffers
  crypto: qat - mask device capabilities with soft straps
  crypto: caam/jr - fix Chacha20 + Poly1305 self test failure
  crypto: caam/qi2 - fix Chacha20 + Poly1305 self test failure
  nd_btt: Make BTT lanes preemptible
  libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value
  hwrng: geode - fix accessing registers
  crypto: hisilicon/hpre - Fix a erroneous check after snprintf()
  selftests/resctrl: Ensure the benchmark commands fits to its array
  selftests/pidfd: Fix ksft print formats
  clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped
  firmware: ti_sci: Mark driver as non removable
  soc: qcom: llcc: Handle a second device without data corruption
  ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator
  arm64: dts: qcom: sdm845-mtp: fix WiFi configuration
  arm64: dts: qcom: msm8916: Fix iommu local address range
  xen-pciback: Consider INTx disabled when MSI/MSI-X is enabled
  drm/rockchip: Fix type promotion bug in rockchip_gem_iommu_map()
  arm64/arm: xen: enlighten: Fix KPTI checks
  drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
  drm/mediatek: Fix iommu fault during crtc enabling
  drm/bridge: tc358768: Fix bit updates
  drm/bridge: tc358768: Disable non-continuous clock mode
  drm/bridge: tc358768: Fix use of uninitialized variable
  drm/radeon: possible buffer overflow
  drm/rockchip: vop: Fix call to crtc reset helper
  drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs
  hwmon: (coretemp) Fix potentially truncated sysfs attribute name
  hwmon: (axi-fan-control) Fix possible NULL pointer dereference
  hwmon: (axi-fan-control) Support temperature vs pwm points
  platform/x86: wmi: Fix opening of char device
  platform/x86: wmi: remove unnecessary initializations
  platform/x86: wmi: Fix probe failure when failing to register WMI devices
  clk: qcom: config IPQ_APSS_6018 should depend on QCOM_SMEM
  clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt7629: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt7629-eth: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6779: Add check for mtk_alloc_clk_data
  clk: mediatek: clk-mt6765: Add check for mtk_alloc_clk_data
  clk: npcm7xx: Fix incorrect kfree
  clk: ti: fix double free in of_ti_divider_clk_setup()
  clk: ti: change ti_clk_register[_omap_hw]() API
  clk: ti: Update component clocks to use ti_dt_clk_name()
  clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name()
  clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
  clk: keystone: pll: fix a couple NULL vs IS_ERR() checks
  spi: nxp-fspi: use the correct ioremap function
  clk: linux/clk-provider.h: fix kernel-doc warnings and typos
  clk: asm9260: use parent index to link the reference clock
  clk: imx: imx8mq: correct error handling path
  clk: imx: Select MXC_CLK for CLK_IMX8QXP
  clk: qcom: gcc-sm8150: Fix gcc_sdcc2_apps_clk_src
  clk: qcom: gcc-sm8150: use ARRAY_SIZE instead of specifying num_parents
  clk: qcom: mmcc-msm8998: Fix the SMMU GDSC
  clk: qcom: mmcc-msm8998: Set bimc_smmu_gdsc always on
  clk: qcom: mmcc-msm8998: Don't check halt bit on some branch clks
  clk: qcom: mmcc-msm8998: Add hardware clockgating registers to some clks
  clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies
  regmap: debugfs: Fix a erroneous check after snprintf()
  ipvlan: properly track tx_errors
  net: add DEV_STATS_READ() helper
  ipv6: avoid atomic fragment on GSO packets
  ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias()
  tcp: fix cookie_init_timestamp() overflows
  chtls: fix tp->rcv_tstamp initialization
  r8169: fix rare issue with broken rx after link-down on RTL8125
  r8169: use tp_to_dev instead of open code
  thermal: core: prevent potential string overflow
  PM / devfreq: rockchip-dfi: Make pmu regmap mandatory
  can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on()
  can: dev: can_restart(): don't crash kernel if carrier is OK
  wifi: rtlwifi: fix EDCA limit set by BT coexistence
  tcp_metrics: do not create an entry from tcp_init_metrics()
  tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics()
  tcp_metrics: add missing barriers on delete
  wifi: mt76: mt7603: rework/fix rx pse hang check
  wifi: rtw88: debug: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
  net: spider_net: Use size_add() in call to struct_size()
  tipc: Use size_add() in calls to struct_size()
  mlxsw: Use size_mul() in call to struct_size()
  gve: Use size_add() in call to struct_size()
  overflow: Implement size_t saturating arithmetic helpers
  tcp: call tcp_try_undo_recovery when an RTOd TFO SYNACK is ACKed
  udp: add missing WRITE_ONCE() around up->encap_rcv
  i40e: fix potential memory leaks in i40e_remove()
  genirq/matrix: Exclude managed interrupts in irq_matrix_allocated()
  pstore/platform: Add check for kstrdup
  x86/boot: Fix incorrect startup_gdt_descr.size
  futex: Don't include process MM in futex key on no-MMU
  x86/srso: Fix SBPB enablement for (possible) future fixed HW
  vfs: fix readahead(2) on block devices
  sched/uclamp: Ignore (util == 0) optimization in feec() when p_util_max = 0
  iov_iter, x86: Be consistent about the __user tag on copy_mc_to_user()
  Linux 5.10.200
  ALSA: hda: intel-dsp-config: Fix JSL Chromebook quirk detection
  tty: 8250: Add support for Intashield IS-100
  tty: 8250: Add support for Brainboxes UP cards
  tty: 8250: Add support for additional Brainboxes UC cards
  tty: 8250: Remove UC-257 and UC-431
  usb: raw-gadget: properly handle interrupted requests
  usb: storage: set 1.50 as the lower bcdDevice for older "Super Top" compatibility
  PCI: Prevent xHCI driver from claiming AMD VanGogh USB3 DRD device
  can: isotp: isotp_sendmsg(): fix TX state detection and wait behavior
  can: isotp: isotp_bind(): do not validate unused address information
  can: isotp: add local echo tx processing and tx without FC
  can: isotp: handle wait_event_interruptible() return values
  can: isotp: check CAN address family in isotp_bind()
  can: isotp: isotp_bind(): return -EINVAL on incorrect CAN ID formatting
  can: isotp: set max PDU size to 64 kByte
  can: isotp: Add error message if txqueuelen is too small
  can: isotp: add symbolic error message to isotp_module_init()
  can: isotp: change error format from decimal to symbolic error names
  powerpc/mm: Fix boot crash with FLATMEM
  net: chelsio: cxgb4: add an error code check in t4_load_phy_fw
  platform/mellanox: mlxbf-tmfifo: Fix a warning message
  scsi: mpt3sas: Fix in error path
  fbdev: uvesafb: Call cn_del_callback() at the end of uvesafb_exit()
  ASoC: rt5650: fix the wrong result of key button
  netfilter: nfnetlink_log: silence bogus compiler warning
  spi: npcm-fiu: Fix UMA reads when dummy.nbytes == 0
  fbdev: atyfb: only use ioremap_uc() on i386 and ia64
  Input: synaptics-rmi4 - handle reset delay when using SMBus trsnsport
  dmaengine: ste_dma40: Fix PM disable depth imbalance in d40_probe
  irqchip/stm32-exti: add missing DT IRQ flag translation
  net: sched: cls_u32: Fix allocation size in u32_init()
  x86: Fix .brk attribute in linker script
  rpmsg: Fix possible refcount leak in rpmsg_register_device_override()
  rpmsg: glink: Release driver_override
  rpmsg: Fix calling device_lock() on non-initialized device
  rpmsg: Fix kfree() of static memory on setting driver_override
  rpmsg: Constify local variable in field store macro
  driver: platform: Add helper for safer setting of driver_override
  objtool/x86: add missing embedded_insn check
  ext4: avoid overlapping preallocations due to overflow
  ext4: fix BUG in ext4_mb_new_inode_pa() due to overflow
  ext4: add two helper functions extent_logical_end() and pa_logical_end()
  x86/mm: Fix RESERVE_BRK() for older binutils
  x86/mm: Simplify RESERVE_BRK()
  f2fs: fix to do sanity check on inode type during garbage collection
  smbdirect: missing rc checks while waiting for rdma events
  kobject: Fix slab-out-of-bounds in fill_kobj_path()
  x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
  iio: adc: xilinx-xadc: Don't clobber preset voltage/temperature thresholds
  iio: adc: xilinx: use more devres helpers and remove remove()
  iio: adc: xilinx: use devm_krealloc() instead of kfree() + kcalloc()
  iio: adc: xilinx: use helper variable for &pdev->dev
  clk: Sanitize possible_parent_show to Handle Return Value of of_clk_get_parent_name
  sparc32: fix a braino in fault handling in csum_and_copy_..._user()
  perf/core: Fix potential NULL deref
  nvmem: imx: correct nregs for i.MX6UL
  nvmem: imx: correct nregs for i.MX6SLL
  nvmem: imx: correct nregs for i.MX6ULL
  misc: fastrpc: Clean buffers on remote invocation failures
  tracing/kprobes: Fix the description of variable length arguments
  i2c: aspeed: Fix i2c bus hang in slave read
  i2c: stm32f7: Fix PEC handling in case of SMBUS transfers
  i2c: muxes: i2c-demux-pinctrl: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-gpmux: Use of_get_i2c_adapter_by_node()
  i2c: muxes: i2c-mux-pinctrl: Use of_get_i2c_adapter_by_node()
  iio: exynos-adc: request second interupt only when touchscreen mode is used
  kasan: print the original fault addr when access invalid shadow
  i40e: Fix wrong check for I40E_TXR_FLAGS_WB_ON_ITR
  gtp: fix fragmentation needed check with gso
  gtp: uapi: fix GTPA_MAX
  tcp: fix wrong RTO timeout when received SACK reneging
  r8152: Release firmware if we have an error in probe
  r8152: Cancel hw_phy_work if we have an error in probe
  r8152: Run the unload routine if we have errors during probe
  r8152: Increase USB control msg timeout to 5000ms as per spec
  net: usb: smsc95xx: Fix uninit-value access in smsc95xx_read_reg
  net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show()
  igc: Fix ambiguity in the ethtool advertising
  neighbour: fix various data-races
  igb: Fix potential memory leak in igb_add_ethtool_nfc_entry
  treewide: Spelling fix in comment
  r8169: fix the KCSAN reported data race in rtl_rx while reading desc->opts1
  r8169: fix the KCSAN reported data-race in rtl_tx while reading TxDescArray[entry].opts1
  drm/dp_mst: Fix NULL deref in get_mst_branch_device_by_guid_helper()
  mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL
  mm/page_alloc: correct start page when guard page debug is enabled
  virtio-mmio: fix memory leak of vm_dev
  virtio_balloon: Fix endless deflation and inflation on arm64
  mcb-lpc: Reallocate memory region to avoid memory overlapping
  mcb: Return actual parsed size when reading chameleon table
  selftests/ftrace: Add new test case which checks non unique symbol
  Revert "usb: core: Track SuperSpeed Plus GenXxY"
  Revert "drm/connector: Add a fwnode pointer to drm_connector and register with ACPI (v2)"
  Revert "drm/connector: Add drm_connector_find_by_fwnode() function (v3)"
  Revert "drm/connector: Add support for out-of-band hotplug notification (v3)"
  Revert "usb: typec: altmodes/displayport: Notify drm subsys of hotplug events"
  Revert "usb: typec: altmodes/displayport: Signal hpd low when exiting mode"
  Revert "ipv4/fib: send notify when delete source address routes"
  Revert "net: add sysctl accept_ra_min_rtr_lft"
  Revert "net: change accept_ra_min_rtr_lft to affect all RA lifetimes"
  Revert "net: release reference to inet6_dev pointer"
  Revert "xfrm: fix a data-race in xfrm_gen_index()"
  Revert "perf: Disallow mis-matched inherited group reads"
  Revert "Bluetooth: hci_core: Fix build warnings"
  Revert "xfrm: interface: use DEV_STATS_INC()"
  ANDROID: GKI: arm64: drop CONFIG_DEBUG_PREEMPT forced disable
  Linux 5.10.199
  xfrm6: fix inet6_dev refcount underflow problem
  Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name
  Bluetooth: hci_sock: fix slab oob read in create_monitor_event
  phy: mapphone-mdm6600: Fix pinctrl_pm handling for sleep pins
  phy: mapphone-mdm6600: Fix runtime PM for remove
  phy: mapphone-mdm6600: Fix runtime disable on probe
  ASoC: pxa: fix a memory leak in probe()
  gpio: vf610: set value before the direction to avoid a glitch
  platform/x86: asus-wmi: Map 0x2a code, Ignore 0x2b and 0x2c events
  platform/x86: asus-wmi: Change ASUS_WMI_BRN_DOWN code from 0x20 to 0x2e
  s390/pci: fix iommu bitmap allocation
  perf: Disallow mis-matched inherited group reads
  USB: serial: option: add Fibocom to DELL custom modem FM101R-GL
  USB: serial: option: add entry for Sierra EM9191 with new firmware
  USB: serial: option: add Telit LE910C4-WWX 0x1035 composition
  nvme-rdma: do not try to stop unallocated queues
  nvme-pci: add BOGUS_NID for Intel 0a54 device
  ACPI: irq: Fix incorrect return value in acpi_register_gsi()
  pNFS: Fix a hang in nfs4_evict_inode()
  Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()"
  mmc: core: Capture correct oemid-bits for eMMC cards
  mmc: core: sdio: hold retuning if sdio in 1-bit mode
  mtd: physmap-core: Restore map_rom fallback
  mtd: spinand: micron: correct bitmask for ecc status
  mtd: rawnand: arasan: Ensure program page operations are successful
  mtd: rawnand: marvell: Ensure program page operations are successful
  mtd: rawnand: qcom: Unmap the right resource upon probe failure
  Bluetooth: hci_event: Fix using memcmp when comparing keys
  net/mlx5: Handle fw tracer change ownership event based on MTRC
  platform/x86: touchscreen_dmi: Add info for the Positivo C4128B
  HID: multitouch: Add required quirk for Synaptics 0xcd7e device
  btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c
  drm: panel-orientation-quirks: Add quirk for One Mix 2S
  ipv4/fib: send notify when delete source address routes
  sky2: Make sure there is at least one frag_addr available
  regulator/core: Revert "fix kobject release warning and memory leak in regulator_register()"
  wifi: cfg80211: avoid leaking stack data into trace
  wifi: mac80211: allow transmitting EAPOL frames with tainted key
  wifi: cfg80211: Fix 6GHz scan configuration
  Bluetooth: hci_core: Fix build warnings
  Bluetooth: Avoid redundant authentication
  HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event
  tracing: relax trace_event_eval_update() execution with cond_resched()
  ata: libata-eh: Fix compilation warning in ata_eh_link_report()
  gpio: timberdale: Fix potential deadlock on &tgpio->lock
  overlayfs: set ctime when setting mtime and atime
  i2c: mux: Avoid potential false error message in i2c_mux_add_adapter
  btrfs: initialize start_slot in btrfs_log_prealloc_extents
  btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1
  ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone
  usb: typec: altmodes/displayport: Signal hpd low when exiting mode
  usb: typec: altmodes/displayport: Notify drm subsys of hotplug events
  drm/connector: Add support for out-of-band hotplug notification (v3)
  drm/connector: Add drm_connector_find_by_fwnode() function (v3)
  drm/connector: Add a fwnode pointer to drm_connector and register with ACPI (v2)
  drm/connector: Give connector sysfs devices there own device_type
  drm/amd/display: Don't set dpms_off for seamless boot
  drm/amd/display: only check available pipe to disable vbios mode.
  serial: 8250_omap: Fix errors with no_console_suspend
  serial: 8250: omap: Fix imprecise external abort for omap_8250_pm()
  xhci: track port suspend state correctly in unsuccessful resume cases
  xhci: decouple usb2 port resume and get_port_status request handling
  xhci: clear usb2 resume related variables in one place.
  xhci: rename resume_done to resume_timestamp
  xhci: move port specific items such as state completions to port structure
  xhci: cleanup xhci_hub_control port references
  usb: core: Track SuperSpeed Plus GenXxY
  selftests/mm: fix awk usage in charge_reserved_hugetlb.sh and hugetlb_reparenting_test.sh that may cause error
  selftests/vm: make charge_reserved_hugetlb.sh work with existing cgroup setting
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1402CBA
  ACPI: resource: Skip IRQ override on ASUS ExpertBook B1502CBA
  ACPI: resource: Skip IRQ override on Asus Expertbook B2402CBA
  ACPI: resource: Add Asus ExpertBook B2502 to Asus quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook S5602ZA
  ACPI: resource: Add ASUS model S5402ZA to quirks
  ACPI: resource: Skip IRQ override on Asus Vivobook K3402ZA/K3502ZA
  ACPI: resources: Add DMI-based legacy IRQ override quirk
  ACPI: Drop acpi_dev_irqresource_disabled()
  resource: Add irqresource_disabled()
  thunderbolt: Workaround an IOMMU fault on certain systems with Intel Maple Ridge
  net: pktgen: Fix interface flags printing
  netfilter: nft_set_rbtree: .deactivate fails if element has expired
  neighbor: tracing: Move pin6 inside CONFIG_IPV6=y section
  net/sched: sch_hfsc: upgrade 'rt' to 'sc' when it becomes a inner curve
  net: dsa: bcm_sf2: Fix possible memory leak in bcm_sf2_mdio_register()
  i40e: prevent crash on probe if hw registers have invalid values
  net: usb: smsc95xx: Fix an error code in smsc95xx_reset()
  ipv4: fib: annotate races around nh->nh_saddr_genid and nh->nh_saddr
  tun: prevent negative ifindex
  tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb
  tcp: fix excessive TLP and RACK timeouts from HZ rounding
  net: rfkill: gpio: prevent value glitch during probe
  net: ipv6: fix return value check in esp_remove_trailer
  net: ipv4: fix return value check in esp_remove_trailer
  xfrm: interface: use DEV_STATS_INC()
  xfrm: fix a data-race in xfrm_gen_index()
  qed: fix LL2 RX buffer allocation
  drm/i915: Retry gtt fault when out of fence registers
  nvmet-tcp: Fix a possible UAF in queue intialization setup
  netfilter: nft_payload: fix wrong mac header matching
  tcp: check mptcp-level constraints for backlog coalescing
  x86/sev: Check for user-space IOIO pointing to kernel space
  x86/sev: Check IOBM for IOIO exceptions from user-space
  x86/sev: Disable MMIO emulation from user mode
  KVM: x86: Mask LVTPC when handling a PMI
  regmap: fix NULL deref on lookup
  nfc: nci: fix possible NULL pointer dereference in send_acknowledge()
  ice: reset first in crash dump kernels
  ice: fix over-shifted variable
  Bluetooth: avoid memcmp() out of bounds warning
  Bluetooth: hci_event: Fix coding style
  Bluetooth: vhci: Fix race when opening vhci device
  Bluetooth: Fix a refcnt underflow problem for hci_conn
  Bluetooth: Reject connection with the device which has same BD_ADDR
  Bluetooth: hci_event: Ignore NULL link key
  usb: hub: Guard against accesses to uninitialized BOS descriptors
  Documentation: sysctl: align cells in second content column
  mm/memory_hotplug: rate limit page migration warnings
  lib/Kconfig.debug: do not enable DEBUG_PREEMPT by default
  dev_forward_skb: do not scrub skb mark within the same name space
  ravb: Fix use-after-free issue in ravb_tx_timeout_work()
  RDMA/srp: Fix srp_abort()
  RDMA/srp: Set scmnd->result only when scmnd is not NULL
  arm64: armv8_deprecated: fix unused-function error
  arm64: armv8_deprecated: rework deprected instruction handling
  arm64: armv8_deprecated: move aarch32 helper earlier
  arm64: armv8_deprecated move emulation functions
  arm64: armv8_deprecated: fold ops into insn_emulation
  arm64: rework EL0 MRS emulation
  arm64: factor insn read out of call_undef_hook()
  arm64: factor out EL1 SSBS emulation hook
  arm64: split EL0/EL1 UNDEF handlers
  arm64: allow kprobes on EL0 handlers
  arm64: rework BTI exception handling
  arm64: rework FPAC exception handling
  arm64: consistently pass ESR_ELx to die()
  arm64: die(): pass 'err' as long
  arm64: report EL1 UNDEFs better
  x86/alternatives: Disable KASAN in apply_alternatives()
  powerpc/64e: Fix wrong test in __ptep_test_and_clear_young()
  powerpc/8xx: Fix pte_access_permitted() for PAGE_NONE
  dmaengine: mediatek: Fix deadlock caused by synchronize_irq()
  usb: gadget: ncm: Handle decoding of multiple NTB's in unwrap call
  usb: gadget: udc-xilinx: replace memcpy with memcpy_toio
  counter: microchip-tcb-capture: Fix the use of internal GCLK logic
  pinctrl: avoid unsafe code pattern in find_pinctrl()
  cgroup: Remove duplicates in cgroup v1 tasks file
  tee: amdtee: fix use-after-free vulnerability in amdtee_close_session
  Input: goodix - ensure int GPIO is in input for gpio_count == 1 && gpio_int_idx == 0 case
  Input: i8042 - add Fujitsu Lifebook E5411 to i8042 quirk table
  Input: xpad - add PXN V900 support
  Input: psmouse - fix fast_reconnect function for PS/2 mode
  Input: powermate - fix use-after-free in powermate_config_complete
  ceph: fix type promotion bug on 32bit systems
  ceph: fix incorrect revoked caps assert in ceph_fill_file_size()
  libceph: use kernel_connect()
  thunderbolt: Check that lane 1 is in CL0 before enabling lane bonding
  mcb: remove is_added flag from mcb_device struct
  x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs
  iio: pressure: ms5611: ms5611_prom_is_valid false negative bug
  iio: pressure: dps310: Adjust Timeout Settings
  iio: pressure: bmp280: Fix NULL pointer exception
  usb: musb: Modify the "HWVers" register address
  usb: musb: Get the musb_qh poniter after musb_giveback
  usb: dwc3: Soft reset phy on probe for host
  net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read
  usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer
  dmaengine: stm32-mdma: abort resume if no ongoing transfer
  media: mtk-jpeg: Fix use after free bug due to uncanceled work
  net: release reference to inet6_dev pointer
  net: change accept_ra_min_rtr_lft to affect all RA lifetimes
  net: add sysctl accept_ra_min_rtr_lft
  Revert "spi: spi-zynqmp-gqspi: Fix runtime PM imbalance in zynqmp_qspi_probe"
  Revert "spi: zynqmp-gqspi: fix clock imbalance on probe failure"
  workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask()
  nfc: nci: assert requested protocol is valid
  pinctrl: renesas: rzn1: Enable missing PINMUX
  net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn()
  ixgbe: fix crash with empty VF macvlan list
  net: phy: mscc: macsec: reject PN update requests
  net: macsec: indicate next pn update when offloading
  drm/vmwgfx: fix typo of sizeof argument
  riscv, bpf: Sign-extend return values
  riscv, bpf: Factor out emit_call for kernel and bpf context
  xen-netback: use default TX queue size for vifs
  mlxsw: fix mlxsw_sp2_nve_vxlan_learning_set() return type
  ieee802154: ca8210: Fix a potential UAF in ca8210_probe
  ravb: Fix up dma_free_coherent() call in ravb_remove()
  drm/msm/dpu: change _dpu_plane_calc_bw() to use u64 to avoid overflow
  drm/msm/dsi: skip the wait for video mode done if not applicable
  drm/msm/dp: do not reinitialize phy unless retry during link training
  net: prevent address rewrite in kernel_bind()
  quota: Fix slow quotaoff
  HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect
  lib/test_meminit: fix off-by-one error in test_pages()
  perf/arm-cmn: Fix the unhandled overflow status of counter 4 to 7
  RDMA/cxgb4: Check skb value for failure to allocate
  RDMA/srp: Do not call scsi_done() from srp_abort()
  RDMA/srp: Make struct scsi_cmnd and struct srp_request adjacent

 Conflicts:
	drivers/interconnect/qcom/bcm-voter.c
	drivers/interconnect/qcom/icc-rpmh.h
	drivers/media/platform/qcom/venus/hfi_parser.c

Change-Id: I3dd63e23b279d1f3dc6f726d18b73a965098b403
Signed-off-by: aseshu <quic_aseshu@quicinc.com>
2024-04-05 17:33:21 +05:30

1715 lines
42 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2013, 2016-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/bug.h>
#include <linux/export.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/rational.h>
#include <linux/regmap.h>
#include <linux/rational.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <asm/div64.h>
#include "clk-rcg.h"
#include "common.h"
#include "clk-debug.h"
#define CMD_REG 0x0
#define CMD_UPDATE BIT(0)
#define CMD_ROOT_EN BIT(1)
#define CMD_DIRTY_CFG BIT(4)
#define CMD_DIRTY_N BIT(5)
#define CMD_DIRTY_M BIT(6)
#define CMD_DIRTY_D BIT(7)
#define CMD_ROOT_OFF BIT(31)
#define CFG_REG 0x4
#define CFG_SRC_DIV_SHIFT 0
#define CFG_SRC_SEL_SHIFT 8
#define CFG_SRC_SEL_MASK (0x7 << CFG_SRC_SEL_SHIFT)
#define CFG_MODE_SHIFT 12
#define CFG_MODE_MASK (0x3 << CFG_MODE_SHIFT)
#define CFG_MODE_DUAL_EDGE (0x2 << CFG_MODE_SHIFT)
#define CFG_HW_CLK_CTRL_MASK BIT(20)
#define M_REG 0x8
#define N_REG 0xc
#define D_REG 0x10
#define RCG_CFG_OFFSET(rcg) ((rcg)->cmd_rcgr + (rcg)->cfg_off + CFG_REG)
#define RCG_M_OFFSET(rcg) ((rcg)->cmd_rcgr + (rcg)->cfg_off + M_REG)
#define RCG_N_OFFSET(rcg) ((rcg)->cmd_rcgr + (rcg)->cfg_off + N_REG)
#define RCG_D_OFFSET(rcg) ((rcg)->cmd_rcgr + (rcg)->cfg_off + D_REG)
/* Dynamic Frequency Scaling */
#define MAX_PERF_LEVEL 8
#define SE_CMD_DFSR_OFFSET 0x14
#define SE_CMD_DFS_EN BIT(0)
#define SE_PERF_DFSR(level) (0x1c + 0x4 * (level))
#define SE_PERF_M_DFSR(level) (0x5c + 0x4 * (level))
#define SE_PERF_N_DFSR(level) (0x9c + 0x4 * (level))
enum freq_policy {
FLOOR,
CEIL,
};
static struct freq_tbl cxo_f = {
.freq = 19200000,
.src = 0,
.pre_div = 1,
.m = 0,
.n = 0,
};
static int clk_rcg2_is_enabled(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
u32 cmd;
int ret;
ret = regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG, &cmd);
if (ret)
return ret;
return (cmd & CMD_ROOT_OFF) == 0;
}
static u8 clk_rcg2_get_parent(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int num_parents = clk_hw_get_num_parents(hw);
u32 cfg;
int i, ret;
ret = regmap_read(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), &cfg);
if (ret)
goto err;
cfg &= CFG_SRC_SEL_MASK;
cfg >>= CFG_SRC_SEL_SHIFT;
for (i = 0; i < num_parents; i++)
if (cfg == rcg->parent_map[i].cfg)
return i;
err:
pr_debug("%s: Clock %s has invalid parent, using default.\n",
__func__, clk_hw_get_name(hw));
return 0;
}
static int update_config(struct clk_rcg2 *rcg)
{
int count, ret;
u32 cmd;
struct clk_hw *hw = &rcg->clkr.hw;
ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG,
CMD_UPDATE, CMD_UPDATE);
if (ret)
return ret;
/* Wait for update to take effect */
for (count = 500; count > 0; count--) {
ret = regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG, &cmd);
if (ret)
return ret;
if (!(cmd & CMD_UPDATE))
return 0;
udelay(1);
}
WARN_CLK(hw, 1, "rcg didn't update its configuration.");
return -EBUSY;
}
static int clk_rcg2_set_parent(struct clk_hw *hw, u8 index)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret;
u32 cfg = rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT;
ret = regmap_update_bits(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg),
CFG_SRC_SEL_MASK, cfg);
if (ret)
return ret;
return update_config(rcg);
}
static int clk_rcg2_set_force_enable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret = 0, count = 500;
ret = regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG,
CMD_ROOT_EN, CMD_ROOT_EN);
if (ret)
return ret;
for (; count > 0; count--) {
if (clk_rcg2_is_enabled(hw))
return ret;
/* Delay for 1usec and retry polling the status bit */
udelay(1);
}
WARN_CLK(hw, 1, "rcg didn't turn on.");
return ret;
}
static int clk_rcg2_clear_force_enable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
return regmap_update_bits(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG,
CMD_ROOT_EN, 0);
}
static bool clk_rcg2_is_force_enabled(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
u32 val = 0;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CMD_REG, &val);
return val & CMD_ROOT_EN;
}
static int prepare_enable_rcg_srcs(struct clk *curr, struct clk *new)
{
int rc = 0;
rc = clk_prepare(curr);
if (rc)
return rc;
rc = clk_prepare(new);
if (rc)
goto err_new_src_prepare;
rc = clk_enable(curr);
if (rc)
goto err_curr_src_enable;
rc = clk_enable(new);
if (rc)
goto err_new_src_enable;
return rc;
err_new_src_enable:
clk_disable(curr);
err_curr_src_enable:
clk_unprepare(new);
err_new_src_prepare:
clk_unprepare(curr);
return rc;
}
static void disable_unprepare_rcg_srcs(struct clk *curr, struct clk *new)
{
clk_disable(new);
clk_disable(curr);
clk_unprepare(new);
clk_unprepare(curr);
}
/*
* Calculate m/n:d rate
*
* parent_rate m
* rate = ----------- x ---
* hid_div n
*/
static unsigned long
calc_rate(unsigned long rate, u32 m, u32 n, u32 mode, u32 hid_div)
{
if (hid_div)
rate = mult_frac(rate, 2, hid_div + 1);
if (mode)
rate = mult_frac(rate, m, n);
return rate;
}
static unsigned long
clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f_curr;
u32 cfg, src, hid_div, m = 0, n = 0, mode = 0, mask;
unsigned long rrate = 0;
regmap_read(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), &cfg);
src = cfg;
src &= CFG_SRC_SEL_MASK;
src >>= CFG_SRC_SEL_SHIFT;
if (rcg->enable_safe_config && (!clk_hw_is_prepared(hw)
|| !clk_hw_is_enabled(hw)) && !src) {
if (!rcg->current_freq)
rcg->current_freq = cxo_f.freq;
if (!(clk_hw_get_flags(hw) & CLK_GET_RATE_NOCACHE))
return rcg->current_freq;
}
if (rcg->mnd_width) {
mask = BIT(rcg->mnd_width) - 1;
regmap_read(rcg->clkr.regmap, RCG_M_OFFSET(rcg), &m);
m &= mask;
regmap_read(rcg->clkr.regmap, RCG_N_OFFSET(rcg), &n);
n = ~n;
n &= mask;
n += m;
mode = cfg & CFG_MODE_MASK;
mode >>= CFG_MODE_SHIFT;
}
if (rcg->enable_safe_config && !src) {
f_curr = qcom_find_freq(rcg->freq_tbl, rcg->current_freq);
if (!f_curr)
return -EINVAL;
hid_div = f_curr->pre_div;
} else {
mask = BIT(rcg->hid_width) - 1;
hid_div = cfg >> CFG_SRC_DIV_SHIFT;
hid_div &= mask;
}
rrate = calc_rate(parent_rate, m, n, mode, hid_div);
/*
* Check to cover the case when the RCG has been initialized to a
* non-CXO frequency before the clock driver has taken control of it.
*/
if (rcg->enable_safe_config && !rcg->current_freq)
rcg->current_freq = rrate;
return rrate;
}
static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
struct clk_rate_request *req,
enum freq_policy policy)
{
unsigned long clk_flags, rate = req->rate;
struct clk_rate_request parent_req = { };
struct clk_hw *p;
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int index, ret = 0;
switch (policy) {
case FLOOR:
f = qcom_find_freq_floor(f, rate);
break;
case CEIL:
f = qcom_find_freq(f, rate);
break;
default:
return -EINVAL;
}
if (!f)
return -EINVAL;
index = qcom_find_src_index(hw, rcg->parent_map, f->src);
if (index < 0)
return index;
clk_flags = clk_hw_get_flags(hw);
p = clk_hw_get_parent_by_index(hw, index);
if (!p)
return -EINVAL;
if (clk_flags & CLK_SET_RATE_PARENT) {
rate = f->freq;
if (f->pre_div) {
if (!rate)
rate = req->rate;
rate /= 2;
rate *= f->pre_div + 1;
}
if (f->n) {
u64 tmp = rate;
tmp = tmp * f->n;
do_div(tmp, f->m);
rate = tmp;
}
} else {
rate = clk_hw_get_rate(p);
}
req->best_parent_hw = p;
req->best_parent_rate = clk_hw_round_rate(p, rate);
req->rate = f->freq;
if (f->src_freq != FIXED_FREQ_SRC) {
rate = parent_req.rate = f->src_freq;
parent_req.best_parent_hw = p;
ret = __clk_determine_rate(p, &parent_req);
if (ret)
return ret;
ret = clk_set_rate(p->clk, parent_req.rate);
if (ret) {
pr_err("Failed set rate(%lu) on parent for non-fixed source\n",
parent_req.rate);
return ret;
}
}
return 0;
}
static int clk_rcg2_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
return _freq_tbl_determine_rate(hw, rcg->freq_tbl, req, CEIL);
}
static int clk_rcg2_determine_floor_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
return _freq_tbl_determine_rate(hw, rcg->freq_tbl, req, FLOOR);
}
static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
{
u32 cfg, mask, d_val, not2d_val, n_minus_m;
struct clk_hw *hw = &rcg->clkr.hw;
int ret, index = qcom_find_src_index(hw, rcg->parent_map, f->src);
if (index < 0)
return index;
if (rcg->mnd_width && f->n) {
mask = BIT(rcg->mnd_width) - 1;
ret = regmap_update_bits(rcg->clkr.regmap,
RCG_M_OFFSET(rcg), mask, f->m);
if (ret)
return ret;
ret = regmap_update_bits(rcg->clkr.regmap,
RCG_N_OFFSET(rcg), mask, ~(f->n - f->m));
if (ret)
return ret;
/* Calculate 2d value */
d_val = f->n;
n_minus_m = f->n - f->m;
n_minus_m *= 2;
d_val = clamp_t(u32, d_val, f->m, n_minus_m);
not2d_val = ~d_val & mask;
ret = regmap_update_bits(rcg->clkr.regmap,
RCG_D_OFFSET(rcg), mask, not2d_val);
if (ret)
return ret;
}
mask = BIT(rcg->hid_width) - 1;
mask |= CFG_SRC_SEL_MASK | CFG_MODE_MASK | CFG_HW_CLK_CTRL_MASK;
cfg = f->pre_div << CFG_SRC_DIV_SHIFT;
cfg |= rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT;
if (rcg->mnd_width && f->n && (f->m != f->n))
cfg |= CFG_MODE_DUAL_EDGE;
if (rcg->flags & HW_CLK_CTRL_MODE)
cfg |= CFG_HW_CLK_CTRL_MASK;
return regmap_update_bits(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg),
mask, cfg);
}
static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)
{
int ret;
ret = __clk_rcg2_configure(rcg, f);
if (ret)
return ret;
return update_config(rcg);
}
static void clk_rcg2_list_registers(struct seq_file *f, struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
static struct clk_register_data *data;
int i, val;
static struct clk_register_data data1[] = {
{"CMD_RCGR", 0x0},
{"CFG_RCGR", 0x4},
{ },
};
static struct clk_register_data data2[] = {
{"CMD_RCGR", 0x0},
{"CFG_RCGR", 0x4},
{"M_VAL", 0x8},
{"N_VAL", 0xC},
{"D_VAL", 0x10},
{ },
};
static struct clk_register_data data3[] = {
{"CMD_RCGR", 0x0},
{"CFG_RCGR", 0x4},
{"M_VAL", 0x8},
{"N_VAL", 0xC},
{"D_VAL", 0x10},
{"CMD_DFSR", 0x14},
{ },
};
if (rcg->flags & DFS_SUPPORT)
data = data3;
else if (rcg->mnd_width)
data = data2;
else
data = data1;
for (i = 0; data[i].name != NULL; i++) {
regmap_read(rcg->clkr.regmap, (rcg->cmd_rcgr +
data[i].offset), &val);
clock_debug_output(f, "%20s: 0x%.8x\n", data[i].name, val);
}
}
/* Return the nth supported frequency for a given clock. */
static long clk_rcg2_list_rate(struct clk_hw *hw, unsigned int n,
unsigned long fmax)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f = rcg->freq_tbl;
size_t freq_tbl_size = 0;
if (!f)
return -ENXIO;
for (; f->freq; f++)
freq_tbl_size++;
if (n > freq_tbl_size - 1)
return -EINVAL;
return (rcg->freq_tbl + n)->freq;
}
static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
enum freq_policy policy)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f, *f_curr;
int ret, curr_src_index, new_src_index;
struct clk_hw *curr_src = NULL, *new_src = NULL;
bool force_enabled = false;
switch (policy) {
case FLOOR:
f = qcom_find_freq_floor(rcg->freq_tbl, rate);
break;
case CEIL:
f = qcom_find_freq(rcg->freq_tbl, rate);
break;
default:
return -EINVAL;
}
if (!f)
return -EINVAL;
/*
* Return if the RCG is currently disabled. This configuration update
* will happen as part of the RCG enable sequence.
*/
if (rcg->enable_safe_config && !clk_hw_is_prepared(hw)) {
rcg->current_freq = rate;
return 0;
}
if (rcg->flags & FORCE_ENABLE_RCG) {
rcg->current_freq = DIV_ROUND_CLOSEST_ULL(
clk_get_rate(hw->clk), 1000) * 1000;
if (rcg->current_freq == cxo_f.freq)
curr_src_index = 0;
else {
f_curr = qcom_find_freq(rcg->freq_tbl,
rcg->current_freq);
if (!f_curr)
return -EINVAL;
curr_src_index = qcom_find_src_index(hw,
rcg->parent_map, f_curr->src);
}
new_src_index = qcom_find_src_index(hw, rcg->parent_map,
f->src);
curr_src = clk_hw_get_parent_by_index(hw, curr_src_index);
if (!curr_src)
return -EINVAL;
new_src = clk_hw_get_parent_by_index(hw, new_src_index);
if (!new_src)
return -EINVAL;
/* The RCG could currently be disabled. Enable its parents. */
ret = prepare_enable_rcg_srcs(curr_src->clk, new_src->clk);
if (ret)
return ret;
force_enabled = clk_rcg2_is_force_enabled(hw);
if (!force_enabled)
clk_rcg2_set_force_enable(hw);
}
ret = clk_rcg2_configure(rcg, f);
if (ret)
return ret;
if (rcg->flags & FORCE_ENABLE_RCG) {
if (!force_enabled)
clk_rcg2_clear_force_enable(hw);
disable_unprepare_rcg_srcs(curr_src->clk, new_src->clk);
}
/* Update current frequency with the requested frequency. */
rcg->current_freq = rate;
return ret;
}
static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
return __clk_rcg2_set_rate(hw, rate, CEIL);
}
static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
return __clk_rcg2_set_rate(hw, rate, FLOOR);
}
static int clk_rcg2_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
return __clk_rcg2_set_rate(hw, rate, CEIL);
}
static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
return __clk_rcg2_set_rate(hw, rate, FLOOR);
}
static int clk_rcg2_enable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
unsigned long rate;
const struct freq_tbl *f;
int ret;
if (rcg->flags & FORCE_ENABLE_RCG)
clk_rcg2_set_force_enable(hw);
if (!rcg->enable_safe_config)
return 0;
/*
* Switch from CXO to the stashed mux selection. Force enable and
* disable the RCG while configuring it to safeguard against any update
* signal coming from the downstream clock. The current parent has
* already been prepared and enabled at this point, and the CXO source
* is always on while APPS is online. Therefore, the RCG can safely be
* switched.
*/
rate = rcg->current_freq;
f = qcom_find_freq(rcg->freq_tbl, rate);
if (!f)
return -EINVAL;
/*
* If CXO is not listed as a supported frequency in the frequency
* table, the above API would return the lowest supported frequency
* instead. This will lead to incorrect configuration of the RCG.
* Check if the RCG rate is CXO and configure it accordingly.
*/
if (rate == cxo_f.freq)
f = &cxo_f;
if (!(rcg->flags & FORCE_ENABLE_RCG))
clk_rcg2_set_force_enable(hw);
ret = clk_rcg2_configure(rcg, f);
if (!(rcg->flags & FORCE_ENABLE_RCG))
clk_rcg2_clear_force_enable(hw);
return ret;
}
static void clk_rcg2_disable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret;
if (!rcg->enable_safe_config) {
if (rcg->flags & FORCE_ENABLE_RCG)
clk_rcg2_clear_force_enable(hw);
return;
}
/*
* Park the RCG at a safe configuration - sourced off the CXO. This is
* needed for 2 reasons: In the case of RCGs sourcing PSCBCs, due to a
* default HW behavior, the RCG will turn on when its corresponding
* GDSC is enabled. We might also have cases when the RCG might be left
* enabled without the overlying SW knowing about it. This results from
* hard to track cases of downstream clocks being left enabled. In both
* these cases, scaling the RCG will fail since it's enabled but with
* its sources cut off.
*
* Save mux select and switch to CXO. Force enable and disable the RCG
* while configuring it to safeguard against any update signal coming
* from the downstream clock. The current parent is still prepared and
* enabled at this point, and the CXO source is always on while APPS is
* online. Therefore, the RCG can safely be switched.
*/
clk_rcg2_set_force_enable(hw);
ret = clk_rcg2_configure(rcg, &cxo_f);
if (ret)
pr_err("%s: CXO configuration failed\n", clk_hw_get_name(hw));
clk_rcg2_clear_force_enable(hw);
}
static struct clk_regmap_ops clk_rcg2_regmap_ops = {
.list_rate = clk_rcg2_list_rate,
.list_registers = clk_rcg2_list_registers,
};
static int clk_rcg2_init(struct clk_hw *hw)
{
struct clk_regmap *rclk = to_clk_regmap(hw);
if (!rclk->ops)
rclk->ops = &clk_rcg2_regmap_ops;
return 0;
}
const struct clk_ops clk_rcg2_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.enable = clk_rcg2_enable,
.disable = clk_rcg2_disable,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.determine_rate = clk_rcg2_determine_rate,
.set_rate = clk_rcg2_set_rate,
.set_rate_and_parent = clk_rcg2_set_rate_and_parent,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_rcg2_ops);
const struct clk_ops clk_rcg2_floor_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.determine_rate = clk_rcg2_determine_floor_rate,
.set_rate = clk_rcg2_set_floor_rate,
.set_rate_and_parent = clk_rcg2_set_floor_rate_and_parent,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_rcg2_floor_ops);
struct frac_entry {
int num;
int den;
};
static const struct frac_entry frac_table_675m[] = { /* link rate of 270M */
{ 52, 295 }, /* 119 M */
{ 11, 57 }, /* 130.25 M */
{ 63, 307 }, /* 138.50 M */
{ 11, 50 }, /* 148.50 M */
{ 47, 206 }, /* 154 M */
{ 31, 100 }, /* 205.25 M */
{ 107, 269 }, /* 268.50 M */
{ },
};
static struct frac_entry frac_table_810m[] = { /* Link rate of 162M */
{ 31, 211 }, /* 119 M */
{ 32, 199 }, /* 130.25 M */
{ 63, 307 }, /* 138.50 M */
{ 11, 60 }, /* 148.50 M */
{ 50, 263 }, /* 154 M */
{ 31, 120 }, /* 205.25 M */
{ 119, 359 }, /* 268.50 M */
{ },
};
static int clk_edp_pixel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct freq_tbl f = *rcg->freq_tbl;
const struct frac_entry *frac;
int delta = 100000;
s64 src_rate = parent_rate;
s64 request;
u32 mask = BIT(rcg->hid_width) - 1;
u32 hid_div;
if (src_rate == 810000000)
frac = frac_table_810m;
else
frac = frac_table_675m;
for (; frac->num; frac++) {
request = rate;
request *= frac->den;
request = div_s64(request, frac->num);
if ((src_rate < (request - delta)) ||
(src_rate > (request + delta)))
continue;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
&hid_div);
f.pre_div = hid_div;
f.pre_div >>= CFG_SRC_DIV_SHIFT;
f.pre_div &= mask;
f.m = frac->num;
f.n = frac->den;
return clk_rcg2_configure(rcg, &f);
}
return -EINVAL;
}
static int clk_edp_pixel_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
/* Parent index is set statically in frequency table */
return clk_edp_pixel_set_rate(hw, rate, parent_rate);
}
static int clk_edp_pixel_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f = rcg->freq_tbl;
const struct frac_entry *frac;
int delta = 100000;
s64 request;
u32 mask = BIT(rcg->hid_width) - 1;
u32 hid_div;
int index = qcom_find_src_index(hw, rcg->parent_map, f->src);
/* Force the correct parent */
req->best_parent_hw = clk_hw_get_parent_by_index(hw, index);
if (!req->best_parent_hw)
return -EINVAL;
req->best_parent_rate = clk_hw_get_rate(req->best_parent_hw);
if (req->best_parent_rate == 810000000)
frac = frac_table_810m;
else
frac = frac_table_675m;
for (; frac->num; frac++) {
request = req->rate;
request *= frac->den;
request = div_s64(request, frac->num);
if ((req->best_parent_rate < (request - delta)) ||
(req->best_parent_rate > (request + delta)))
continue;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
&hid_div);
hid_div >>= CFG_SRC_DIV_SHIFT;
hid_div &= mask;
req->rate = calc_rate(req->best_parent_rate,
frac->num, frac->den,
!!frac->den, hid_div);
return 0;
}
return -EINVAL;
}
const struct clk_ops clk_edp_pixel_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_edp_pixel_set_rate,
.set_rate_and_parent = clk_edp_pixel_set_rate_and_parent,
.determine_rate = clk_edp_pixel_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_edp_pixel_ops);
static int clk_byte_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f = rcg->freq_tbl;
int index = qcom_find_src_index(hw, rcg->parent_map, f->src);
unsigned long parent_rate, div;
u32 mask = BIT(rcg->hid_width) - 1;
struct clk_hw *p;
if (req->rate == 0)
return -EINVAL;
req->best_parent_hw = p = clk_hw_get_parent_by_index(hw, index);
if (!p)
return -EINVAL;
req->best_parent_rate = parent_rate = clk_hw_round_rate(p, req->rate);
div = DIV_ROUND_UP((2 * parent_rate), req->rate) - 1;
div = min_t(u32, div, mask);
req->rate = calc_rate(parent_rate, 0, 0, 0, div);
return 0;
}
static int clk_byte_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct freq_tbl f = *rcg->freq_tbl;
unsigned long div;
u32 mask = BIT(rcg->hid_width) - 1;
div = DIV_ROUND_UP((2 * parent_rate), rate) - 1;
div = min_t(u32, div, mask);
f.pre_div = div;
return clk_rcg2_configure(rcg, &f);
}
static int clk_byte_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
/* Parent index is set statically in frequency table */
return clk_byte_set_rate(hw, rate, parent_rate);
}
const struct clk_ops clk_byte_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_byte_set_rate,
.set_rate_and_parent = clk_byte_set_rate_and_parent,
.determine_rate = clk_byte_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_byte_ops);
static int clk_byte2_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
unsigned long parent_rate, div;
u32 mask = BIT(rcg->hid_width) - 1;
struct clk_hw *p;
unsigned long rate = req->rate;
p = req->best_parent_hw;
if (!p || rate == 0)
return -EINVAL;
req->best_parent_rate = parent_rate = clk_hw_round_rate(p, rate);
div = DIV_ROUND_UP((2 * parent_rate), rate) - 1;
div = min_t(u32, div, mask);
req->rate = calc_rate(parent_rate, 0, 0, 0, div);
return 0;
}
static int clk_byte2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct freq_tbl f = { 0 };
unsigned long div;
int i, num_parents = clk_hw_get_num_parents(hw);
u32 mask = BIT(rcg->hid_width) - 1;
u32 cfg;
div = DIV_ROUND_UP((2 * parent_rate), rate) - 1;
div = min_t(u32, div, mask);
f.pre_div = div;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
cfg &= CFG_SRC_SEL_MASK;
cfg >>= CFG_SRC_SEL_SHIFT;
for (i = 0; i < num_parents; i++) {
if (cfg == rcg->parent_map[i].cfg) {
f.src = rcg->parent_map[i].src;
return clk_rcg2_configure(rcg, &f);
}
}
return -EINVAL;
}
static int clk_byte2_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
/* Read the hardware to determine parent during set_rate */
return clk_byte2_set_rate(hw, rate, parent_rate);
}
const struct clk_ops clk_byte2_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_byte2_set_rate,
.set_rate_and_parent = clk_byte2_set_rate_and_parent,
.determine_rate = clk_byte2_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_byte2_ops);
static const struct frac_entry frac_table_pixel[] = {
{ 3, 8 },
{ 2, 9 },
{ 4, 9 },
{ 1, 1 },
{ 2, 3 },
{ }
};
static int clk_pixel_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
unsigned long request, src_rate;
int delta = 100000;
const struct frac_entry *frac = frac_table_pixel;
if (!req->best_parent_hw)
return -EINVAL;
for (; frac->num; frac++) {
request = (req->rate * frac->den) / frac->num;
src_rate = clk_hw_round_rate(req->best_parent_hw, request);
if ((src_rate < (request - delta)) ||
(src_rate > (request + delta)))
continue;
req->best_parent_rate = src_rate;
req->rate = (src_rate * frac->num) / frac->den;
return 0;
}
return -EINVAL;
}
static int clk_pixel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct freq_tbl f = { 0 };
const struct frac_entry *frac = frac_table_pixel;
unsigned long request;
int delta = 100000;
u32 mask = BIT(rcg->hid_width) - 1;
u32 hid_div, cfg;
int i, num_parents = clk_hw_get_num_parents(hw);
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
cfg &= CFG_SRC_SEL_MASK;
cfg >>= CFG_SRC_SEL_SHIFT;
for (i = 0; i < num_parents; i++)
if (cfg == rcg->parent_map[i].cfg) {
f.src = rcg->parent_map[i].src;
break;
}
for (; frac->num; frac++) {
request = (rate * frac->den) / frac->num;
if ((parent_rate < (request - delta)) ||
(parent_rate > (request + delta)))
continue;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
&hid_div);
f.pre_div = hid_div;
f.pre_div >>= CFG_SRC_DIV_SHIFT;
f.pre_div &= mask;
f.m = frac->num;
f.n = frac->den;
return clk_rcg2_configure(rcg, &f);
}
return -EINVAL;
}
static int clk_pixel_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate, u8 index)
{
return clk_pixel_set_rate(hw, rate, parent_rate);
}
const struct clk_ops clk_pixel_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_pixel_set_rate,
.set_rate_and_parent = clk_pixel_set_rate_and_parent,
.determine_rate = clk_pixel_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_pixel_ops);
static int clk_dp_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct clk_hw *parent = clk_hw_get_parent(hw);
struct freq_tbl f = { 0 };
unsigned long src_rate;
unsigned long num, den;
u32 mask = BIT(rcg->hid_width) - 1;
u32 hid_div, cfg;
int i, num_parents = clk_hw_get_num_parents(hw);
if (!parent)
return -EINVAL;
src_rate = clk_get_rate(parent->clk);
if (src_rate <= 0) {
pr_err("Invalid RCG parent rate\n");
return -EINVAL;
}
rational_best_approximation(src_rate, rate,
(unsigned long)(1 << 16) - 1,
(unsigned long)(1 << 16) - 1, &den, &num);
if (!num || !den) {
pr_err("Invalid MN values derived for requested rate %lu\n",
rate);
return -EINVAL;
}
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
hid_div = cfg;
cfg &= CFG_SRC_SEL_MASK;
cfg >>= CFG_SRC_SEL_SHIFT;
for (i = 0; i < num_parents; i++)
if (cfg == rcg->parent_map[i].cfg) {
f.src = rcg->parent_map[i].src;
break;
}
f.pre_div = hid_div;
f.pre_div >>= CFG_SRC_DIV_SHIFT;
f.pre_div &= mask;
if (num == den) {
f.m = 0;
f.n = 0;
} else {
f.m = num;
f.n = den;
}
return clk_rcg2_configure(rcg, &f);
}
static int clk_dp_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate, u8 index)
{
return clk_dp_set_rate(hw, rate, parent_rate);
}
static int clk_dp_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
if (!req->best_parent_hw)
return -EINVAL;
req->best_parent_rate = clk_hw_round_rate(req->best_parent_hw,
req->best_parent_rate);
return 0;
}
const struct clk_ops clk_dp_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_dp_set_rate,
.set_rate_and_parent = clk_dp_set_rate_and_parent,
.determine_rate = clk_dp_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL(clk_dp_ops);
static int clk_gfx3d_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rate_request parent_req = { };
struct clk_hw *p2, *p8, *p9, *xo;
unsigned long p9_rate;
int ret;
xo = clk_hw_get_parent_by_index(hw, 0);
if (!xo)
return -EINVAL;
if (req->rate == clk_hw_get_rate(xo)) {
req->best_parent_hw = xo;
return 0;
}
p9 = clk_hw_get_parent_by_index(hw, 2);
p2 = clk_hw_get_parent_by_index(hw, 3);
p8 = clk_hw_get_parent_by_index(hw, 4);
if (!p9 || !p2 || !p8)
return -EINVAL;
/* PLL9 is a fixed rate PLL */
p9_rate = clk_hw_get_rate(p9);
parent_req.rate = req->rate = min(req->rate, p9_rate);
if (req->rate == p9_rate) {
req->rate = req->best_parent_rate = p9_rate;
req->best_parent_hw = p9;
return 0;
}
if (req->best_parent_hw == p9) {
/* Are we going back to a previously used rate? */
if (clk_hw_get_rate(p8) == req->rate)
req->best_parent_hw = p8;
else
req->best_parent_hw = p2;
} else if (req->best_parent_hw == p8) {
req->best_parent_hw = p2;
} else {
req->best_parent_hw = p8;
}
ret = __clk_determine_rate(req->best_parent_hw, &parent_req);
if (ret)
return ret;
req->rate = req->best_parent_rate = parent_req.rate;
return 0;
}
static int clk_gfx3d_set_rate_and_parent(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate, u8 index)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
u32 cfg;
int ret;
/* Just mux it, we don't use the division or m/n hardware */
cfg = rcg->parent_map[index].cfg << CFG_SRC_SEL_SHIFT;
ret = regmap_write(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, cfg);
if (ret)
return ret;
return update_config(rcg);
}
static int clk_gfx3d_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
/*
* We should never get here; clk_gfx3d_determine_rate() should always
* make us use a different parent than what we're currently using, so
* clk_gfx3d_set_rate_and_parent() should always be called.
*/
return 0;
}
const struct clk_ops clk_gfx3d_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_gfx3d_set_rate,
.set_rate_and_parent = clk_gfx3d_set_rate_and_parent,
.determine_rate = clk_gfx3d_determine_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_gfx3d_ops);
static int
clk_rcg2_shared_force_enable_clear(struct clk_hw *hw, const struct freq_tbl *f)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret;
ret = clk_rcg2_set_force_enable(hw);
if (ret)
return ret;
ret = clk_rcg2_configure(rcg, f);
if (ret)
return ret;
return clk_rcg2_clear_force_enable(hw);
}
static int clk_rcg2_shared_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
const struct freq_tbl *f;
f = qcom_find_freq(rcg->freq_tbl, rate);
if (!f)
return -EINVAL;
/*
* In case clock is disabled, update the CFG, M, N and D registers
* and don't hit the update bit of CMD register.
*/
if (!__clk_is_enabled(hw->clk))
return __clk_rcg2_configure(rcg, f);
return clk_rcg2_shared_force_enable_clear(hw, f);
}
static int clk_rcg2_shared_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
return clk_rcg2_shared_set_rate(hw, rate, parent_rate);
}
static int clk_rcg2_shared_enable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret;
/*
* Set the update bit because required configuration has already
* been written in clk_rcg2_shared_set_rate()
*/
ret = clk_rcg2_set_force_enable(hw);
if (ret)
return ret;
ret = update_config(rcg);
if (ret)
return ret;
return clk_rcg2_clear_force_enable(hw);
}
static void clk_rcg2_shared_disable(struct clk_hw *hw)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
u32 cfg;
/*
* Store current configuration as switching to safe source would clear
* the SRC and DIV of CFG register
*/
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
/*
* Park the RCG at a safe configuration - sourced off of safe source.
* Force enable and disable the RCG while configuring it to safeguard
* against any update signal coming from the downstream clock.
* The current parent is still prepared and enabled at this point, and
* the safe source is always on while application processor subsystem
* is online. Therefore, the RCG can safely switch its parent.
*/
clk_rcg2_set_force_enable(hw);
regmap_write(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG,
rcg->safe_src_index << CFG_SRC_SEL_SHIFT);
update_config(rcg);
clk_rcg2_clear_force_enable(hw);
/* Write back the stored configuration corresponding to current rate */
regmap_write(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, cfg);
}
const struct clk_ops clk_rcg2_shared_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.enable = clk_rcg2_shared_enable,
.disable = clk_rcg2_shared_disable,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.determine_rate = clk_rcg2_determine_rate,
.set_rate = clk_rcg2_shared_set_rate,
.set_rate_and_parent = clk_rcg2_shared_set_rate_and_parent,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
EXPORT_SYMBOL_GPL(clk_rcg2_shared_ops);
/* Common APIs to be used for DFS based RCGR */
static int clk_rcg2_dfs_populate_freq(struct clk_hw *hw, unsigned int l,
struct freq_tbl *f)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct clk_hw *p;
unsigned long prate = 0;
u32 val, mask, cfg, mode, src;
int i, num_parents;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + SE_PERF_DFSR(l), &cfg);
mask = BIT(rcg->hid_width) - 1;
f->pre_div = 1;
if (cfg & mask)
f->pre_div = cfg & mask;
src = cfg & CFG_SRC_SEL_MASK;
src >>= CFG_SRC_SEL_SHIFT;
num_parents = clk_hw_get_num_parents(hw);
for (i = 0; i < num_parents; i++) {
if (src == rcg->parent_map[i].cfg) {
f->src = rcg->parent_map[i].src;
p = clk_hw_get_parent_by_index(&rcg->clkr.hw, i);
if (!p)
return -EINVAL;
prate = clk_hw_get_rate(p);
}
}
mode = cfg & CFG_MODE_MASK;
mode >>= CFG_MODE_SHIFT;
if (mode) {
mask = BIT(rcg->mnd_width) - 1;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + SE_PERF_M_DFSR(l),
&val);
val &= mask;
f->m = val;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + SE_PERF_N_DFSR(l),
&val);
val = ~val;
val &= mask;
val += f->m;
f->n = val;
}
f->freq = calc_rate(prate, f->m, f->n, mode, f->pre_div);
return 0;
}
static int clk_rcg2_dfs_populate_freq_table(struct clk_rcg2 *rcg)
{
struct freq_tbl *freq_tbl;
int i, ret;
/* Allocate space for 1 extra since table is NULL terminated */
freq_tbl = kcalloc(MAX_PERF_LEVEL + 1, sizeof(*freq_tbl), GFP_KERNEL);
if (!freq_tbl)
return -ENOMEM;
rcg->freq_tbl = freq_tbl;
for (i = 0; i < MAX_PERF_LEVEL; i++) {
ret =
clk_rcg2_dfs_populate_freq(&rcg->clkr.hw, i, freq_tbl + i);
if (ret)
return ret;
}
return ret;
}
static int clk_rcg2_dfs_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
int ret;
if (!rcg->freq_tbl) {
ret = clk_rcg2_dfs_populate_freq_table(rcg);
if (ret) {
pr_err("Failed to update DFS tables for %s\n",
clk_hw_get_name(hw));
return ret;
}
}
return clk_rcg2_determine_rate(hw, req);
}
static unsigned long
clk_rcg2_dfs_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
u32 level, mask, cfg, m = 0, n = 0, mode, pre_div;
regmap_read(rcg->clkr.regmap,
rcg->cmd_rcgr + SE_CMD_DFSR_OFFSET, &level);
level &= GENMASK(4, 1);
level >>= 1;
if (rcg->freq_tbl)
return rcg->freq_tbl[level].freq;
/*
* Assume that parent_rate is actually the parent because
* we can't do any better at figuring it out when the table
* hasn't been populated yet. We only populate the table
* in determine_rate because we can't guarantee the parents
* will be registered with the framework until then.
*/
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + SE_PERF_DFSR(level),
&cfg);
mask = BIT(rcg->hid_width) - 1;
pre_div = 1;
if (cfg & mask)
pre_div = cfg & mask;
mode = cfg & CFG_MODE_MASK;
mode >>= CFG_MODE_SHIFT;
if (mode) {
mask = BIT(rcg->mnd_width) - 1;
regmap_read(rcg->clkr.regmap,
rcg->cmd_rcgr + SE_PERF_M_DFSR(level), &m);
m &= mask;
regmap_read(rcg->clkr.regmap,
rcg->cmd_rcgr + SE_PERF_N_DFSR(level), &n);
n = ~n;
n &= mask;
n += m;
}
return calc_rate(parent_rate, m, n, mode, pre_div);
}
static const struct clk_ops clk_rcg2_dfs_ops = {
.prepare = clk_prepare_regmap,
.unprepare = clk_unprepare_regmap,
.pre_rate_change = clk_pre_change_regmap,
.post_rate_change = clk_post_change_regmap,
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.determine_rate = clk_rcg2_dfs_determine_rate,
.recalc_rate = clk_rcg2_dfs_recalc_rate,
.init = clk_rcg2_init,
.debug_init = clk_common_debug_init,
};
static int clk_rcg2_enable_dfs(const struct clk_rcg_dfs_data *data,
struct regmap *regmap)
{
struct clk_rcg2 *rcg = data->rcg;
struct clk_init_data *init = data->init;
u32 val;
int ret;
rcg->flags |= DFS_SUPPORT;
ret = regmap_read(regmap, rcg->cmd_rcgr + SE_CMD_DFSR_OFFSET, &val);
if (ret)
return -EINVAL;
if (!(val & SE_CMD_DFS_EN))
return 0;
/*
* Rate changes with consumer writing a register in
* their own I/O region
*/
init->flags |= CLK_GET_RATE_NOCACHE;
init->ops = &clk_rcg2_dfs_ops;
rcg->freq_tbl = NULL;
return 0;
}
int qcom_cc_register_rcg_dfs(struct regmap *regmap,
const struct clk_rcg_dfs_data *rcgs, size_t len)
{
int i, ret;
for (i = 0; i < len; i++) {
ret = clk_rcg2_enable_dfs(&rcgs[i], regmap);
if (ret)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_cc_register_rcg_dfs);
#if 0
static int clk_rcg2_dp_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
struct freq_tbl f = { 0 };
u32 mask = BIT(rcg->hid_width) - 1;
u32 hid_div, cfg;
int i, num_parents = clk_hw_get_num_parents(hw);
unsigned long num, den;
rational_best_approximation(parent_rate, rate,
GENMASK(rcg->mnd_width - 1, 0),
GENMASK(rcg->mnd_width - 1, 0), &den, &num);
if (!num || !den)
return -EINVAL;
regmap_read(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, &cfg);
hid_div = cfg;
cfg &= CFG_SRC_SEL_MASK;
cfg >>= CFG_SRC_SEL_SHIFT;
for (i = 0; i < num_parents; i++) {
if (cfg == rcg->parent_map[i].cfg) {
f.src = rcg->parent_map[i].src;
break;
}
}
f.pre_div = hid_div;
f.pre_div >>= CFG_SRC_DIV_SHIFT;
f.pre_div &= mask;
if (num != den) {
f.m = num;
f.n = den;
} else {
f.m = 0;
f.n = 0;
}
return clk_rcg2_configure(rcg, &f);
}
static int clk_rcg2_dp_set_rate_and_parent(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate, u8 index)
{
return clk_rcg2_dp_set_rate(hw, rate, parent_rate);
}
static int clk_rcg2_dp_determine_rate(struct clk_hw *hw,
struct clk_rate_request *req)
{
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
unsigned long num, den;
u64 tmp;
/* Parent rate is a fixed phy link rate */
rational_best_approximation(req->best_parent_rate, req->rate,
GENMASK(rcg->mnd_width - 1, 0),
GENMASK(rcg->mnd_width - 1, 0), &den, &num);
if (!num || !den)
return -EINVAL;
tmp = req->best_parent_rate * num;
do_div(tmp, den);
req->rate = tmp;
return 0;
}
const struct clk_ops clk_dp_ops = {
.is_enabled = clk_rcg2_is_enabled,
.get_parent = clk_rcg2_get_parent,
.set_parent = clk_rcg2_set_parent,
.recalc_rate = clk_rcg2_recalc_rate,
.set_rate = clk_rcg2_dp_set_rate,
.set_rate_and_parent = clk_rcg2_dp_set_rate_and_parent,
.determine_rate = clk_rcg2_dp_determine_rate,
};
EXPORT_SYMBOL_GPL(clk_dp_ops);
#endif