treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / pinctrl / sprd / pinctrl-sprd.h
blob69544a3cd635665fc5f899019aeed3a9d336aed1
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Driver header file for pin controller driver
4 * Copyright (C) 2017 Spreadtrum - http://www.spreadtrum.com
5 */
7 #ifndef __PINCTRL_SPRD_H__
8 #define __PINCTRL_SPRD_H__
10 struct platform_device;
12 #define NUM_OFFSET (20)
13 #define TYPE_OFFSET (16)
14 #define BIT_OFFSET (8)
15 #define WIDTH_OFFSET (4)
17 #define SPRD_PIN_INFO(num, type, offset, width, reg) \
18 (((num) & 0xFFF) << NUM_OFFSET | \
19 ((type) & 0xF) << TYPE_OFFSET | \
20 ((offset) & 0xFF) << BIT_OFFSET | \
21 ((width) & 0xF) << WIDTH_OFFSET | \
22 ((reg) & 0xF))
24 #define SPRD_PINCTRL_PIN(pin) SPRD_PINCTRL_PIN_DATA(pin, #pin)
26 #define SPRD_PINCTRL_PIN_DATA(a, b) \
27 { \
28 .name = b, \
29 .num = (((a) >> NUM_OFFSET) & 0xfff), \
30 .type = (((a) >> TYPE_OFFSET) & 0xf), \
31 .bit_offset = (((a) >> BIT_OFFSET) & 0xff), \
32 .bit_width = ((a) >> WIDTH_OFFSET & 0xf), \
33 .reg = ((a) & 0xf) \
36 enum pin_type {
37 GLOBAL_CTRL_PIN,
38 COMMON_PIN,
39 MISC_PIN,
42 struct sprd_pins_info {
43 const char *name;
44 unsigned int num;
45 enum pin_type type;
47 /* for global control pins configuration */
48 unsigned long bit_offset;
49 unsigned long bit_width;
50 unsigned int reg;
53 int sprd_pinctrl_core_probe(struct platform_device *pdev,
54 struct sprd_pins_info *sprd_soc_pin_info,
55 int pins_cnt);
56 int sprd_pinctrl_remove(struct platform_device *pdev);
57 void sprd_pinctrl_shutdown(struct platform_device *pdev);
59 #endif /* __PINCTRL_SPRD_H__ */