Linux Audio

Check our new training course

Loading...
v3.15
 
 1/*
 2 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 3 *
 4 * This software is licensed under the terms of the GNU General Public
 5 * License version 2, as published by the Free Software Foundation, and
 6 * may be copied, distributed, and modified under those terms.
 7 *
 8 * This program is distributed in the hope that it will be useful,
 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 * GNU General Public License for more details.
12 */
13
14#include <linux/bitops.h>
15#include <linux/export.h>
16#include <linux/regmap.h>
17#include <linux/reset-controller.h>
18#include <linux/delay.h>
19
20#include "reset.h"
21
22static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
23{
24	rcdev->ops->assert(rcdev, id);
25	udelay(1);
26	rcdev->ops->deassert(rcdev, id);
27	return 0;
28}
29
30static int
31qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
32{
33	struct qcom_reset_controller *rst;
34	const struct qcom_reset_map *map;
35	u32 mask;
36
37	rst = to_qcom_reset_controller(rcdev);
38	map = &rst->reset_map[id];
39	mask = BIT(map->bit);
40
41	return regmap_update_bits(rst->regmap, map->reg, mask, mask);
42}
43
44static int
45qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
46{
47	struct qcom_reset_controller *rst;
48	const struct qcom_reset_map *map;
49	u32 mask;
50
51	rst = to_qcom_reset_controller(rcdev);
52	map = &rst->reset_map[id];
53	mask = BIT(map->bit);
54
55	return regmap_update_bits(rst->regmap, map->reg, mask, 0);
56}
57
58struct reset_control_ops qcom_reset_ops = {
59	.reset = qcom_reset,
60	.assert = qcom_reset_assert,
61	.deassert = qcom_reset_deassert,
62};
63EXPORT_SYMBOL_GPL(qcom_reset_ops);
v5.4
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 
 
 
 
 
 
 
 
 
 4 */
 5
 6#include <linux/bitops.h>
 7#include <linux/export.h>
 8#include <linux/regmap.h>
 9#include <linux/reset-controller.h>
10#include <linux/delay.h>
11
12#include "reset.h"
13
14static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
15{
16	rcdev->ops->assert(rcdev, id);
17	udelay(1);
18	rcdev->ops->deassert(rcdev, id);
19	return 0;
20}
21
22static int
23qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
24{
25	struct qcom_reset_controller *rst;
26	const struct qcom_reset_map *map;
27	u32 mask;
28
29	rst = to_qcom_reset_controller(rcdev);
30	map = &rst->reset_map[id];
31	mask = BIT(map->bit);
32
33	return regmap_update_bits(rst->regmap, map->reg, mask, mask);
34}
35
36static int
37qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
38{
39	struct qcom_reset_controller *rst;
40	const struct qcom_reset_map *map;
41	u32 mask;
42
43	rst = to_qcom_reset_controller(rcdev);
44	map = &rst->reset_map[id];
45	mask = BIT(map->bit);
46
47	return regmap_update_bits(rst->regmap, map->reg, mask, 0);
48}
49
50const struct reset_control_ops qcom_reset_ops = {
51	.reset = qcom_reset,
52	.assert = qcom_reset_assert,
53	.deassert = qcom_reset_deassert,
54};
55EXPORT_SYMBOL_GPL(qcom_reset_ops);