* commit '52f971ee6e': (84565 commits)
arm64: dts: rockchip: rk3562: Enable viLKsvPwrActive for soc bus
mtd: spi-nor: esmt: Support New devices
mtd: spi-nor: fmsh: Support New devices
mtd: spi-nor: gigadevice: Support New devices
mtd: spinand: gsto: Add code
mtd: spinand: hyf: Support new devices
mmc: convert thunder boot dependency
ARM: dts: rockchip: rv1106: add node for system sleep
ARM: rockchip: support rv1106 suspend
ARM: rockchip: add some pm-related functions
video: rockchip: mpp: fix rk3528 avsd not probe issue
arm64: dts: rockchip: rk3588-vehicle-maxim-serdes: Add BOE AV156FHT L83 support
arm64: rockchip_defconfig: Enable CONFIG_DRM_PANEL_MAXIM_MAX96752F
drm/panel: Add panel driver for Maxim MAX96752F based LCDs
media: i2c: techpoint: add support 4 channel 2 lane mode
drm/rockchip: dsi2: fix NULL in component_ops .unbind helper
media: rockchip: vicap: fixes cma can not alloc when capture raw
media: rockchip: vicap: fixed vc err for multi channel
media: rockchip: hdmirx: fix timing info for interlaced resolution
media: rockchip: hdmirx: fix code error for cec register failed
...
Change-Id: Ia7ac365455d87a295e62bbf481d80694a9712f30
Conflicts:
.gitignore
Documentation/devicetree/bindings/clock/rockchip,px30-cru.txt
Documentation/devicetree/bindings/connector/usb-connector.yaml
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt
Documentation/devicetree/bindings/hwmon/pwm-fan.txt
Documentation/devicetree/bindings/iio/light/vl6180.txt
Documentation/devicetree/bindings/iommu/rockchip,iommu.txt
Documentation/devicetree/bindings/mtd/rockchip,nand-controller.yaml
Documentation/devicetree/bindings/net/rockchip-dwmac.yaml
Documentation/devicetree/bindings/net/snps,dwmac.yaml
Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml
Documentation/devicetree/bindings/power/rockchip-io-domain.txt
Documentation/devicetree/bindings/regulator/fan53555.txt
Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
Documentation/devicetree/bindings/sound/rockchip,pdm.yaml
Documentation/devicetree/bindings/sound/rockchip-spdif.yaml
Documentation/devicetree/bindings/spi/spi-rockchip.yaml
Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
Documentation/devicetree/bindings/usb/usb-xhci.txt
Documentation/filesystems/erofs.rst
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/boot/compressed/head.S
arch/arm/boot/dts/rk3036.dtsi
arch/arm/boot/dts/rk3066a-rayeager.dts
arch/arm/boot/dts/rk3066a.dtsi
arch/arm/boot/dts/rk322x.dtsi
arch/arm/boot/dts/rk3288.dtsi
arch/arm/boot/dts/rk3xxx.dtsi
arch/arm64/boot/dts/rockchip/Makefile
arch/arm64/boot/dts/rockchip/px30.dtsi
arch/arm64/boot/dts/rockchip/rk3308.dtsi
arch/arm64/boot/dts/rockchip/rk3399-opp.dtsi
arch/arm64/boot/dts/rockchip/rk3399.dtsi
arch/arm64/boot/dts/rockchip/rk3566.dtsi
arch/arm64/boot/dts/rockchip/rk3568-pinctrl.dtsi
arch/arm64/boot/dts/rockchip/rk3568.dtsi
arch/arm64/boot/dts/rockchip/rockchip-pinconf.dtsi
arch/arm64/kernel/process.c
arch/arm64/mm/Makefile
arch/arm64/mm/fault.c
arch/arm64/mm/init.c
drivers/Kconfig
drivers/Makefile
drivers/android/Kconfig
drivers/ata/ahci_platform.c
drivers/char/hw_random/Kconfig
drivers/char/hw_random/Makefile
drivers/clk/clk.c
drivers/clk/rockchip/Kconfig
drivers/clk/rockchip/Makefile
drivers/clk/rockchip/clk-cpu.c
drivers/clk/rockchip/clk-rk3036.c
drivers/clk/rockchip/clk-rk3188.c
drivers/clk/rockchip/clk-rk3308.c
drivers/clk/rockchip/clk-rk3399.c
drivers/clk/rockchip/clk-rk3568.c
drivers/clk/rockchip/clk-rv1126.c
drivers/clk/rockchip/clk.c
drivers/clk/rockchip/clk.h
drivers/cpufreq/cpufreq-dt.c
drivers/crypto/Kconfig
drivers/devfreq/Makefile
drivers/devfreq/devfreq.c
drivers/dma-buf/dma-buf.c
drivers/dma-buf/heaps/Makefile
drivers/dma/pl330.c
drivers/firmware/Kconfig
drivers/gpio/Kconfig
drivers/gpio/Makefile
drivers/gpio/gpio-rockchip.c
drivers/gpu/Makefile
drivers/gpu/drm/Kconfig
drivers/gpu/drm/Makefile
drivers/gpu/drm/bridge/Kconfig
drivers/gpu/drm/bridge/Makefile
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
drivers/gpu/drm/bridge/analogix/analogix_dp_core.h
drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
drivers/gpu/drm/bridge/display-connector.c
drivers/gpu/drm/bridge/sii902x.c
drivers/gpu/drm/bridge/synopsys/Makefile
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_crtc_internal.h
drivers/gpu/drm/drm_edid.c
drivers/gpu/drm/panel/panel-simple.c
drivers/gpu/drm/rockchip/Kconfig
drivers/gpu/drm/rockchip/Makefile
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
drivers/gpu/drm/rockchip/inno_hdmi.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
drivers/gpu/drm/rockchip/rockchip_drm_drv.h
drivers/gpu/drm/rockchip/rockchip_drm_fbdev.c
drivers/gpu/drm/rockchip/rockchip_drm_gem.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
drivers/gpu/drm/rockchip/rockchip_drm_vop.h
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
drivers/gpu/drm/rockchip/rockchip_lvds.c
drivers/gpu/drm/rockchip/rockchip_rgb.c
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c
drivers/gpu/drm/rockchip/rockchip_vop_reg.c
drivers/gpu/drm/rockchip/rockchip_vop_reg.h
drivers/hwmon/pwm-fan.c
drivers/hwspinlock/Kconfig
drivers/hwspinlock/Makefile
drivers/i2c/busses/i2c-rk3x.c
drivers/i2c/i2c-core-base.c
drivers/iio/adc/Kconfig
drivers/iio/adc/rockchip_saradc.c
drivers/iio/industrialio-event.c
drivers/input/touchscreen/Makefile
drivers/iommu/iommu.c
drivers/iommu/rockchip-iommu.c
drivers/irqchip/irq-gic-v3-its.c
drivers/leds/Makefile
drivers/mailbox/Kconfig
drivers/media/common/videobuf2/Makefile
drivers/media/i2c/Kconfig
drivers/media/i2c/Makefile
drivers/media/i2c/dw9714.c
drivers/media/i2c/hi556.c
drivers/media/i2c/imx214.c
drivers/media/i2c/imx258.c
drivers/media/i2c/imx334.c
drivers/media/i2c/imx335.c
drivers/media/i2c/ov5648.c
drivers/media/i2c/ov5670.c
drivers/media/i2c/ov5695.c
drivers/media/i2c/ov7251.c
drivers/media/platform/Kconfig
drivers/media/platform/Makefile
drivers/media/platform/rockchip/Kconfig
drivers/media/spi/Kconfig
drivers/media/spi/Makefile
drivers/media/usb/uvc/uvc_driver.c
drivers/media/usb/uvc/uvcvideo.h
drivers/media/v4l2-core/v4l2-async.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/mfd/rk808.c
drivers/mmc/core/block.c
drivers/mmc/core/host.c
drivers/mmc/core/mmc.c
drivers/mmc/core/mmc_ops.c
drivers/mmc/host/Makefile
drivers/mmc/host/dw_mmc-rockchip.c
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h
drivers/mmc/host/sdhci-of-dwcmshc.c
drivers/mtd/nand/Makefile
drivers/mtd/nand/raw/Kconfig
drivers/mtd/nand/raw/Makefile
drivers/mtd/nand/raw/rockchip-nand-controller.c
drivers/mtd/nand/spi/Makefile
drivers/mtd/nand/spi/core.c
drivers/mtd/nand/spi/gigadevice.c
drivers/mtd/nand/spi/macronix.c
drivers/mtd/nand/spi/xtx.c
drivers/mtd/spi-nor/Kconfig
drivers/mtd/spi-nor/Makefile
drivers/mtd/spi-nor/core.c
drivers/mtd/spi-nor/core.h
drivers/mtd/spi-nor/eon.c
drivers/mtd/spi-nor/esmt.c
drivers/mtd/spi-nor/gigadevice.c
drivers/mtd/spi-nor/macronix.c
drivers/mtd/spi-nor/winbond.c
drivers/mtd/spi-nor/xmc.c
drivers/net/ethernet/stmicro/stmmac/Makefile
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
drivers/net/ethernet/stmicro/stmmac/stmmac.h
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
drivers/net/phy/Kconfig
drivers/net/phy/motorcomm.c
drivers/net/phy/phy_device.c
drivers/nvmem/Kconfig
drivers/nvmem/Makefile
drivers/pci/controller/dwc/Makefile
drivers/pci/controller/dwc/pcie-designware-host.c
drivers/pci/controller/dwc/pcie-dw-rockchip.c
drivers/pci/controller/pcie-rockchip-host.c
drivers/pci/controller/pcie-rockchip.h
drivers/pci/pci-sysfs.c
drivers/pci/pcie/Makefile
drivers/phy/rockchip/Kconfig
drivers/phy/rockchip/Makefile
drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c
drivers/phy/rockchip/phy-rockchip-inno-usb2.c
drivers/phy/rockchip/phy-rockchip-naneng-combphy.c
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
drivers/phy/rockchip/phy-rockchip-typec.c
drivers/pinctrl/Kconfig
drivers/pinctrl/Makefile
drivers/pinctrl/pinctrl-rk805.c
drivers/pinctrl/pinctrl-rockchip.c
drivers/pinctrl/pinctrl-rockchip.h
drivers/power/supply/Kconfig
drivers/power/supply/Makefile
drivers/power/supply/bq25890_charger.c
drivers/power/supply/rk817_charger.c
drivers/pwm/core.c
drivers/pwm/pwm-rockchip.c
drivers/regulator/fan53555.c
drivers/regulator/rk808-regulator.c
drivers/rtc/rtc-hym8563.c
drivers/soc/rockchip/Kconfig
drivers/soc/rockchip/Makefile
drivers/soc/rockchip/grf.c
drivers/soc/rockchip/io-domain.c
drivers/soc/rockchip/pm_domains.c
drivers/spi/Kconfig
drivers/spi/spi-rockchip-sfc.c
drivers/spi/spi-rockchip.c
drivers/spi/spidev.c
drivers/staging/android/ion/heaps/ion_system_heap.c
drivers/thermal/rockchip_thermal.c
drivers/tty/serial/8250/8250_dma.c
drivers/tty/serial/8250/8250_dw.c
drivers/tty/serial/8250/8250_dwlib.c
drivers/tty/serial/8250/8250_port.c
drivers/usb/dwc2/platform.c
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c
drivers/usb/gadget/configfs.c
drivers/usb/gadget/function/f_fs.c
drivers/usb/gadget/function/f_uvc.c
drivers/usb/gadget/function/uvc.h
drivers/usb/gadget/function/uvc_configfs.c
drivers/usb/gadget/function/uvc_queue.c
drivers/usb/gadget/function/uvc_v4l2.c
drivers/usb/gadget/function/uvc_video.c
drivers/usb/gadget/udc/core.c
drivers/usb/host/ehci-hcd.c
drivers/usb/host/ehci-platform.c
drivers/usb/storage/unusual_uas.h
drivers/usb/typec/altmodes/Kconfig
drivers/usb/typec/altmodes/displayport.c
drivers/usb/typec/class.c
drivers/usb/typec/tcpm/tcpm.c
fs/Kconfig
fs/cifs/inode.c
fs/dax.c
fs/erofs/data.c
fs/erofs/inode.c
fs/erofs/internal.h
fs/erofs/super.c
fs/f2fs/super.c
fs/fuse/dev.c
include/drm/bridge/dw_hdmi.h
include/drm/drm_connector.h
include/drm/drm_edid.h
include/dt-bindings/clock/rk3568-cru.h
include/dt-bindings/power/rk3568-power.h
include/dt-bindings/power/rk3588-power.h
include/linux/clk-provider.h
include/linux/cma.h
include/linux/dma-buf.h
include/linux/dma-heap.h
include/linux/mfd/rk808.h
include/linux/mtd/spi-nor.h
include/linux/mtd/spinand.h
include/linux/phy/pcie.h
include/linux/pwm.h
include/linux/sched/sysctl.h
include/linux/slub_def.h
include/linux/stmmac.h
include/linux/usb/typec.h
include/media/v4l2-async.h
include/soc/rockchip/pm_domains.h
include/uapi/drm/drm_fourcc.h
include/uapi/linux/iio/types.h
include/uapi/linux/media-bus-format.h
init/Kconfig
init/main.c
kernel/printk/printk.c
kernel/rcu/Kconfig.debug
kernel/rcu/tree_stall.h
kernel/sched/core.c
kernel/sched/cpufreq_schedutil.c
kernel/sched/fair.c
kernel/sched/pelt.c
kernel/sched/rt.c
kernel/sched/sched.h
kernel/softirq.c
kernel/sysctl.c
mm/Makefile
mm/cma.c
mm/page_alloc.c
mm/slub.c
scripts/.gitignore
scripts/headers_install.sh
sound/soc/codecs/Kconfig
sound/soc/codecs/Makefile
sound/soc/codecs/es8326.c
sound/soc/codecs/es8326.h
sound/soc/codecs/hdmi-codec.c
sound/soc/codecs/rk817_codec.c
sound/soc/rockchip/Kconfig
sound/soc/rockchip/Makefile
sound/soc/rockchip/rockchip_i2s.c
sound/soc/rockchip/rockchip_i2s_tdm.c
sound/soc/rockchip/rockchip_i2s_tdm.h
sound/soc/rockchip/rockchip_pdm.c
sound/soc/rockchip/rockchip_spdif.c
sound/soc/soc-generic-dmaengine-pcm.c
tools/iio/iio_event_monitor.c
266 lines
5.9 KiB
C
266 lines
5.9 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2010-2011 Canonical Ltd <jeremy.kerr@canonical.com>
|
|
* Copyright (C) 2011-2012 Mike Turquette, Linaro Ltd <mturquette@linaro.org>
|
|
*
|
|
* Gated clock implementation
|
|
*/
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/io.h>
|
|
#include <linux/err.h>
|
|
#include <linux/string.h>
|
|
|
|
static bool clk_always_on;
|
|
module_param_named(always_on, clk_always_on, bool, 0644);
|
|
MODULE_PARM_DESC(always_on, "Always keep clks on except for system suspend.");
|
|
|
|
/**
|
|
* DOC: basic gatable clock which can gate and ungate it's ouput
|
|
*
|
|
* Traits of this clock:
|
|
* prepare - clk_(un)prepare only ensures parent is (un)prepared
|
|
* enable - clk_enable and clk_disable are functional & control gating
|
|
* rate - inherits rate from parent. No clk_set_rate support
|
|
* parent - fixed parent. No clk_set_parent support
|
|
*/
|
|
|
|
static inline u32 clk_gate_readl(struct clk_gate *gate)
|
|
{
|
|
if (gate->flags & CLK_GATE_BIG_ENDIAN)
|
|
return ioread32be(gate->reg);
|
|
|
|
return readl(gate->reg);
|
|
}
|
|
|
|
static inline void clk_gate_writel(struct clk_gate *gate, u32 val)
|
|
{
|
|
if (gate->flags & CLK_GATE_BIG_ENDIAN)
|
|
iowrite32be(val, gate->reg);
|
|
else
|
|
writel(val, gate->reg);
|
|
}
|
|
|
|
/*
|
|
* It works on following logic:
|
|
*
|
|
* For enabling clock, enable = 1
|
|
* set2dis = 1 -> clear bit -> set = 0
|
|
* set2dis = 0 -> set bit -> set = 1
|
|
*
|
|
* For disabling clock, enable = 0
|
|
* set2dis = 1 -> set bit -> set = 1
|
|
* set2dis = 0 -> clear bit -> set = 0
|
|
*
|
|
* So, result is always: enable xor set2dis.
|
|
*/
|
|
static void clk_gate_endisable(struct clk_hw *hw, int enable)
|
|
{
|
|
struct clk_gate *gate = to_clk_gate(hw);
|
|
int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0;
|
|
unsigned long flags;
|
|
u32 reg;
|
|
|
|
if (clk_always_on && !enable)
|
|
return;
|
|
|
|
set ^= enable;
|
|
|
|
if (gate->lock)
|
|
spin_lock_irqsave(gate->lock, flags);
|
|
else
|
|
__acquire(gate->lock);
|
|
|
|
if (gate->flags & CLK_GATE_HIWORD_MASK) {
|
|
reg = BIT(gate->bit_idx + 16);
|
|
if (set)
|
|
reg |= BIT(gate->bit_idx);
|
|
} else {
|
|
reg = clk_gate_readl(gate);
|
|
|
|
if (set)
|
|
reg |= BIT(gate->bit_idx);
|
|
else
|
|
reg &= ~BIT(gate->bit_idx);
|
|
}
|
|
|
|
clk_gate_writel(gate, reg);
|
|
|
|
if (gate->lock)
|
|
spin_unlock_irqrestore(gate->lock, flags);
|
|
else
|
|
__release(gate->lock);
|
|
}
|
|
|
|
static int clk_gate_enable(struct clk_hw *hw)
|
|
{
|
|
clk_gate_endisable(hw, 1);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void clk_gate_disable(struct clk_hw *hw)
|
|
{
|
|
clk_gate_endisable(hw, 0);
|
|
}
|
|
|
|
int clk_gate_is_enabled(struct clk_hw *hw)
|
|
{
|
|
u32 reg;
|
|
struct clk_gate *gate = to_clk_gate(hw);
|
|
|
|
reg = clk_gate_readl(gate);
|
|
|
|
/* if a set bit disables this clk, flip it before masking */
|
|
if (gate->flags & CLK_GATE_SET_TO_DISABLE)
|
|
reg ^= BIT(gate->bit_idx);
|
|
|
|
reg &= BIT(gate->bit_idx);
|
|
|
|
return reg ? 1 : 0;
|
|
}
|
|
EXPORT_SYMBOL_GPL(clk_gate_is_enabled);
|
|
|
|
const struct clk_ops clk_gate_ops = {
|
|
.enable = clk_gate_enable,
|
|
.disable = clk_gate_disable,
|
|
.is_enabled = clk_gate_is_enabled,
|
|
};
|
|
EXPORT_SYMBOL_GPL(clk_gate_ops);
|
|
|
|
struct clk_hw *__clk_hw_register_gate(struct device *dev,
|
|
struct device_node *np, const char *name,
|
|
const char *parent_name, const struct clk_hw *parent_hw,
|
|
const struct clk_parent_data *parent_data,
|
|
unsigned long flags,
|
|
void __iomem *reg, u8 bit_idx,
|
|
u8 clk_gate_flags, spinlock_t *lock)
|
|
{
|
|
struct clk_gate *gate;
|
|
struct clk_hw *hw;
|
|
struct clk_init_data init = {};
|
|
int ret = -EINVAL;
|
|
|
|
if (clk_gate_flags & CLK_GATE_HIWORD_MASK) {
|
|
if (bit_idx > 15) {
|
|
pr_err("gate bit exceeds LOWORD field\n");
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
}
|
|
|
|
/* allocate the gate */
|
|
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
|
|
if (!gate)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
init.name = name;
|
|
init.ops = &clk_gate_ops;
|
|
init.flags = flags;
|
|
init.parent_names = parent_name ? &parent_name : NULL;
|
|
init.parent_hws = parent_hw ? &parent_hw : NULL;
|
|
init.parent_data = parent_data;
|
|
if (parent_name || parent_hw || parent_data)
|
|
init.num_parents = 1;
|
|
else
|
|
init.num_parents = 0;
|
|
|
|
/* struct clk_gate assignments */
|
|
gate->reg = reg;
|
|
gate->bit_idx = bit_idx;
|
|
gate->flags = clk_gate_flags;
|
|
gate->lock = lock;
|
|
gate->hw.init = &init;
|
|
|
|
hw = &gate->hw;
|
|
if (dev || !np)
|
|
ret = clk_hw_register(dev, hw);
|
|
else if (np)
|
|
ret = of_clk_hw_register(np, hw);
|
|
if (ret) {
|
|
kfree(gate);
|
|
hw = ERR_PTR(ret);
|
|
}
|
|
|
|
return hw;
|
|
|
|
}
|
|
EXPORT_SYMBOL_GPL(__clk_hw_register_gate);
|
|
|
|
struct clk *clk_register_gate(struct device *dev, const char *name,
|
|
const char *parent_name, unsigned long flags,
|
|
void __iomem *reg, u8 bit_idx,
|
|
u8 clk_gate_flags, spinlock_t *lock)
|
|
{
|
|
struct clk_hw *hw;
|
|
|
|
hw = clk_hw_register_gate(dev, name, parent_name, flags, reg,
|
|
bit_idx, clk_gate_flags, lock);
|
|
if (IS_ERR(hw))
|
|
return ERR_CAST(hw);
|
|
return hw->clk;
|
|
}
|
|
EXPORT_SYMBOL_GPL(clk_register_gate);
|
|
|
|
void clk_unregister_gate(struct clk *clk)
|
|
{
|
|
struct clk_gate *gate;
|
|
struct clk_hw *hw;
|
|
|
|
hw = __clk_get_hw(clk);
|
|
if (!hw)
|
|
return;
|
|
|
|
gate = to_clk_gate(hw);
|
|
|
|
clk_unregister(clk);
|
|
kfree(gate);
|
|
}
|
|
EXPORT_SYMBOL_GPL(clk_unregister_gate);
|
|
|
|
void clk_hw_unregister_gate(struct clk_hw *hw)
|
|
{
|
|
struct clk_gate *gate;
|
|
|
|
gate = to_clk_gate(hw);
|
|
|
|
clk_hw_unregister(hw);
|
|
kfree(gate);
|
|
}
|
|
EXPORT_SYMBOL_GPL(clk_hw_unregister_gate);
|
|
|
|
static void devm_clk_hw_release_gate(struct device *dev, void *res)
|
|
{
|
|
clk_hw_unregister_gate(*(struct clk_hw **)res);
|
|
}
|
|
|
|
struct clk_hw *__devm_clk_hw_register_gate(struct device *dev,
|
|
struct device_node *np, const char *name,
|
|
const char *parent_name, const struct clk_hw *parent_hw,
|
|
const struct clk_parent_data *parent_data,
|
|
unsigned long flags,
|
|
void __iomem *reg, u8 bit_idx,
|
|
u8 clk_gate_flags, spinlock_t *lock)
|
|
{
|
|
struct clk_hw **ptr, *hw;
|
|
|
|
ptr = devres_alloc(devm_clk_hw_release_gate, sizeof(*ptr), GFP_KERNEL);
|
|
if (!ptr)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
hw = __clk_hw_register_gate(dev, np, name, parent_name, parent_hw,
|
|
parent_data, flags, reg, bit_idx,
|
|
clk_gate_flags, lock);
|
|
|
|
if (!IS_ERR(hw)) {
|
|
*ptr = hw;
|
|
devres_add(dev, ptr);
|
|
} else {
|
|
devres_free(ptr);
|
|
}
|
|
|
|
return hw;
|
|
}
|
|
EXPORT_SYMBOL_GPL(__devm_clk_hw_register_gate);
|