You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kernel_samsung_sm7125/drivers/clk/qcom/clk-regmap-divider.c

75 lines
2.2 KiB

/*
* Copyright (c) 2014, 2017, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/regmap.h>
#include <linux/export.h>
#include "clk-regmap-divider.h"
static inline struct clk_regmap_div *to_clk_regmap_div(struct clk_hw *hw)
{
return container_of(to_clk_regmap(hw), struct clk_regmap_div, clkr);
}
static long div_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
struct clk_regmap_div *divider = to_clk_regmap_div(hw);
return divider_round_rate(hw, rate, prate, divider->table,
divider->width,
CLK_DIVIDER_ROUND_CLOSEST |
divider->flags);
}
static int div_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
struct clk_regmap_div *divider = to_clk_regmap_div(hw);
struct clk_regmap *clkr = &divider->clkr;
u32 div;
div = divider_get_val(rate, parent_rate, divider->table,
divider->width, CLK_DIVIDER_ROUND_CLOSEST |
divider->flags);
return regmap_update_bits(clkr->regmap, divider->reg,
(BIT(divider->width) - 1) << divider->shift,
div << divider->shift);
}
static unsigned long div_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_regmap_div *divider = to_clk_regmap_div(hw);
struct clk_regmap *clkr = &divider->clkr;
u32 div;
regmap_read(clkr->regmap, divider->reg, &div);
div >>= divider->shift;
div &= BIT(divider->width) - 1;
return divider_recalc_rate(hw, parent_rate, div, divider->table,
Merge remote-tracking branch 'remotes/origin/tmp-7e76ead' into msm-4.14 * remotes/origin/tmp-7e76ead: Linux 4.14.34 net/mlx4_core: Fix memory leak while delete slave's resources vhost_net: add missing lock nesting notation team: move dev_mc_sync after master_upper_dev_link in team_port_add route: check sysctl_fib_multipath_use_neigh earlier than hash vhost: validate log when IOTLB is enabled net/mlx5e: Fix traffic being dropped on VF representor net/mlx4_en: Fix mixed PFC and Global pause user control requests strparser: Fix sign of err codes net/sched: fix NULL dereference on the error path of tcf_skbmod_init() net/sched: fix NULL dereference in the error path of tunnel_key_init() net/mlx5e: Sync netdev vxlan ports at open net/mlx5e: Don't override vport admin link state in switchdev mode ipv6: sr: fix seg6 encap performances with TSO enabled nfp: use full 40 bits of the NSP buffer address net/mlx5e: Fix memory usage issues in offloading TC flows net/mlx5e: Avoid using the ipv6 stub in the TC offload neigh update path vti6: better validate user provided tunnel names ip6_tunnel: better validate user provided tunnel names ip6_gre: better validate user provided tunnel names ipv6: sit: better validate user provided tunnel names ip_tunnel: better validate user provided tunnel names net: fool proof dev_valid_name() bonding: process the err returned by dev_set_allmulti properly in bond_enslave bonding: move dev_mc_sync after master_upper_dev_link in bond_enslave bonding: fix the err path for dev hwaddr sync in bond_enslave vrf: Fix use after free and double free in vrf_finish_output vlan: also check phy_driver ts_info for vlan's real device vhost: correctly remove wait queue during poll failure sky2: Increase D3 delay to sky2 stops working after suspend sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6 sctp: do not leak kernel memory to user space r8169: fix setting driver_data after register_netdev pptp: remove a buggy dst release in pptp_connect() net/sched: fix NULL dereference in the error path of tcf_bpf_init() net sched actions: fix dumping which requires several messages to user space netlink: make sure nladdr has correct size in netlink_connect() net/ipv6: Increment OUTxxx counters after netfilter hook net/ipv6: Fix route leaking between VRFs net: fix possible out-of-bound read in skb_network_protocol() lan78xx: Crash in lan78xx_writ_reg (Workqueue: events lan78xx_deferred_multicast_write) ipv6: the entire IPv6 header chain must fit the first fragment arp: fix arp_filter on l3slave devices x86/microcode: Fix CPU synchronization routine x86/microcode: Attempt late loading only when new microcode is present x86/microcode: Synchronize late microcode loading x86/microcode: Request microcode on the BSP x86/microcode/intel: Look into the patch cache first x86/microcode: Do not upload microcode if CPUs are offline x86/microcode/intel: Writeback and invalidate caches before updating microcode x86/microcode/intel: Check microcode revision before updating sibling threads x86/microcode: Get rid of struct apply_microcode_ctx x86/CPU: Check CPU feature bits after microcode upgrade x86/CPU: Add a microcode loader callback x86/microcode: Propagate return value from updating functions crypto: arm64/aes-ce-cipher - move assembler code to .S file objtool: Add Clang support thermal: int3400_thermal: fix error handling in int3400_thermal_probe() tcmu: release blocks for partially setup cmds perf tools: Fix copyfile_offset update of output offset crypto: aes-generic - build with -Os on gcc-7+ mtd: mtd_oobtest: Handle bitflips during reads Input: goodix - disable IRQs while suspended ibmvnic: Don't handle RX interrupts when not up. sdhci: Advertise 2.0v supply on SDIO host controller x86/gart: Exclude GART aperture from vmcore gpio: thunderx: fix error return code in thunderx_gpio_probe() RDMA/cma: Fix rdma_cm path querying for RoCE scsi: megaraid_sas: unload flag should be set after scsi_remove_host is called scsi: megaraid_sas: Error handling for invalid ldcount provided by firmware in RAID map cxgb4vf: Fix SGE FL buffer initialization logic for 64K pages i40evf: don't rely on netif_running() outside rtnl_lock() uio_hv_generic: check that host supports monitor page EDAC, mv64x60: Fix an error handling path block, bfq: put async queues for root bfq groups too tty: n_gsm: Allow ADM response in addition to UA for control dlci blk-mq: fix kernel oops in blk_mq_tag_idle() scsi: libsas: initialize sas_phy status according to response of DISCOVER scsi: libsas: fix error when getting phy events scsi: libsas: fix memory leak in sas_smp_get_phy_events() bcache: segregate flash only volume write streams bcache: stop writeback thread after detaching bcache: ret IOERR when read meets metadata error net: hns3: fix for changing MTU net: hns3: Fix an error macro definition of HNS3_TQP_STAT net: hns3: Fix a loop index error of tqp statistics query net: hns3: Fix an error of total drop packet statistics net/mlx5: Fix race for multiple RoCE enable wl1251: check return from call to wl1251_acx_arp_ip_filter rt2x00: do not pause queue unconditionally on error path power: supply: axp288_charger: Properly stop work on probe-error / remove ASoC: Intel: sst: Fix the return value of 'sst_send_byte_stream_mrfld()' staging: lustre: disable preempt while sampling processor id. perf report: Fix a no annotate browser displayed issue tpm: return a TPM_RC_COMMAND_CODE response if command is not implemented nvme_fcloop: fix abort race condition nvme_fcloop: disassocate local port structs pinctrl: baytrail: Enable glitch filter for GPIOs used as interrupts backlight: tdo24m: Fix the SPI CS between transfers blk-mq: fix race between updating nr_hw_queues and switching io sched blk-mq: avoid to map CPU into stale hw queue IB/rdmavt: Allocate CQ memory on the correct node powernv-cpufreq: Add helper to extract pstate from PMSR gpio: label descriptors using the device name vfb: fix video mode and line_length being set when loaded mac80211: Fix setting TX power on monitor interfaces ACPI: EC: Fix debugfs_create_*() usage irqchip/gic-v3: Fix the driver probe() fail due to disabled GICC entry scsi: mpt3sas: Proper handling of set/clear of "ATA command pending" flag. scsi: libiscsi: Allow sd_shutdown on bad transport spi: sh-msiof: Fix timeout failures for TX-only DMA transfers ASoC: Intel: cht_bsw_rt5645: Analog Mic support ASoC: Intel: Skylake: Disable clock gating during firmware and library download media: videobuf2-core: don't go out of the buffer range clk: sunxi-ng: a83t: Add M divider to TCON1 clock hwmon: (ina2xx) Make calibration register value fixed RDMA/cma: Mark end of CMA ID messages selftests/net: fix bugs in address and port initialization PM / devfreq: Fix potential NULL pointer dereference in governor_store clk: divider: fix incorrect usage of container_of watchdog: dw_wdt: add stop watchdog operation VFS: close race between getcwd() and d_move() net/mlx4_en: Change default QoS settings ACPI / video: Default lcd_only to true on Win8-ready and newer machines rds; Reset rs->rs_bound_addr in rds_add_bound() failure path l2tp: fix missing print session offset info net: hns3: fix for getting auto-negotiation state in hclge_get_autoneg net: hns3: free the ring_data structrue when change tqps perf evsel: Enable ignore_missing_thread for pid option perf probe: Add warning message if there is unexpected event name perf probe: Find versioned symbols from map thermal: power_allocator: fix one race condition issue for thermal_instances list ipv6: Reinject IPv6 packets if IPsec policy matches after SNAT Bluetooth: Add a new 04ca:3015 QCA_ROME device ARM: dts: ls1021a: add "fsl,ls1021a-esdhc" compatible string to esdhc node clk: meson: mpll: use 64-bit maths in params_from_rate i40iw: Validate correct IRD/ORD connection parameters i40iw: Correct Q1/XF object count equation i40iw: Fix sequence number for the first partial FPDU Revert "ANDROID: sched/tune: Initialize raw_spin_lock in boosted_groups" Conflicts: arch/arm64/crypto/Makefile drivers/clk/qcom/clk-regmap-divider.c Change-Id: I7d83113e6d6d943804051a983d73067184b9fb39 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
7 years ago
CLK_DIVIDER_ROUND_CLOSEST | divider->flags,
divider->width);
}
const struct clk_ops clk_regmap_div_ops = {
.round_rate = div_round_rate,
.set_rate = div_set_rate,
.recalc_rate = div_recalc_rate,
};
EXPORT_SYMBOL_GPL(clk_regmap_div_ops);