CC: [email protected] TO: Douglas Anderson <[email protected]> CC: Sam Ravnborg <[email protected]> CC: Stephen Boyd <[email protected]> CC: Bjorn Andersson <[email protected]> CC: Linus Walleij <[email protected]>
tree: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
head: baef4d56195b6d6e0f681f6eac03d8c6db011d34
commit: 27ed2b3f22ed60295c74b4ca3e855823d0e7603b [1/4] drm/bridge:
ti-sn65dsi86: Export bridge GPIOs to Linux
:::::: branch date: 4 weeks ago
:::::: commit date: 4 weeks ago
config: xtensa-randconfig-r011-20200612 (attached as .config)
compiler: xtensa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 27ed2b3f22ed60295c74b4ca3e855823d0e7603b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross
ARCH=xtensa
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>, old ones prefixed by <<):
In file included from ./arch/xtensa/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from arch/xtensa/include/asm/current.h:18,
from include/linux/mutex.h:14,
from include/linux/notifier.h:14,
from include/linux/clk.h:14,
from drivers/gpu/drm/bridge/ti-sn65dsi86.c:8:
drivers/gpu/drm/bridge/ti-sn65dsi86.c: In function 'tn_sn_bridge_of_xlate':
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:923:41: error: 'struct gpio_chip' has
>> no member named 'of_gpio_n_cells'
923 | if (WARN_ON(gpiospec->args_count < chip->of_gpio_n_cells))
| ^~
include/asm-generic/bug.h:113:25: note: in definition of macro 'WARN_ON'
113 | int __ret_warn_on = !!(condition); |
^~~~~~~~~
drivers/gpu/drm/bridge/ti-sn65dsi86.c: In function 'ti_sn_bridge_gpio_set':
drivers/gpu/drm/bridge/ti-sn65dsi86.c:978:6: warning: variable 'ret' set but
not used [-Wunused-but-set-variable]
978 | int ret;
| ^~~
drivers/gpu/drm/bridge/ti-sn65dsi86.c: In function
'ti_sn_setup_gpio_controller':
>> drivers/gpu/drm/bridge/ti-sn65dsi86.c:1067:14: error: 'struct gpio_chip' has
>> no member named 'of_xlate'
1067 | pdata->gchip.of_xlate = tn_sn_bridge_of_xlate;
| ^
drivers/gpu/drm/bridge/ti-sn65dsi86.c:1068:14: error: 'struct gpio_chip' has no
member named 'of_gpio_n_cells'
1068 | pdata->gchip.of_gpio_n_cells = 2;
| ^
git remote add drm-drm-misc git://anongit.freedesktop.org/drm/drm-misc
git remote update drm-drm-misc
git checkout 27ed2b3f22ed60295c74b4ca3e855823d0e7603b
vim +923 drivers/gpu/drm/bridge/ti-sn65dsi86.c
a095f15c00e278 Sandeep Panda 2018-07-20 918
27ed2b3f22ed60 Douglas Anderson 2020-05-07 919 static int
tn_sn_bridge_of_xlate(struct gpio_chip *chip,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 920
const struct of_phandle_args *gpiospec,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 921
u32 *flags)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 922 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 @923 if
(WARN_ON(gpiospec->args_count < chip->of_gpio_n_cells))
27ed2b3f22ed60 Douglas Anderson 2020-05-07 924 return -EINVAL;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 925
27ed2b3f22ed60 Douglas Anderson 2020-05-07 926 if (gpiospec->args[0] >
chip->ngpio || gpiospec->args[0] < 1)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 927 return -EINVAL;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 928
27ed2b3f22ed60 Douglas Anderson 2020-05-07 929 if (flags)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 930 *flags =
gpiospec->args[1];
27ed2b3f22ed60 Douglas Anderson 2020-05-07 931
27ed2b3f22ed60 Douglas Anderson 2020-05-07 932 return
gpiospec->args[0] - SN_GPIO_PHYSICAL_OFFSET;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 933 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 934
27ed2b3f22ed60 Douglas Anderson 2020-05-07 935 static int
ti_sn_bridge_gpio_get_direction(struct gpio_chip *chip,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 936
unsigned int offset)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 937 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 938 struct ti_sn_bridge
*pdata = gpiochip_get_data(chip);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 939
27ed2b3f22ed60 Douglas Anderson 2020-05-07 940 /*
27ed2b3f22ed60 Douglas Anderson 2020-05-07 941 * We already have to
keep track of the direction because we use
27ed2b3f22ed60 Douglas Anderson 2020-05-07 942 * that to figure out
whether we've powered the device. We can
27ed2b3f22ed60 Douglas Anderson 2020-05-07 943 * just return that
rather than (maybe) powering up the device
27ed2b3f22ed60 Douglas Anderson 2020-05-07 944 * to ask its direction.
27ed2b3f22ed60 Douglas Anderson 2020-05-07 945 */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 946 return test_bit(offset,
pdata->gchip_output) ?
27ed2b3f22ed60 Douglas Anderson 2020-05-07 947
GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 948 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 949
27ed2b3f22ed60 Douglas Anderson 2020-05-07 950 static int
ti_sn_bridge_gpio_get(struct gpio_chip *chip, unsigned int offset)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 951 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 952 struct ti_sn_bridge
*pdata = gpiochip_get_data(chip);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 953 unsigned int val;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 954 int ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 955
27ed2b3f22ed60 Douglas Anderson 2020-05-07 956 /*
27ed2b3f22ed60 Douglas Anderson 2020-05-07 957 * When the pin is an
input we don't forcibly keep the bridge
27ed2b3f22ed60 Douglas Anderson 2020-05-07 958 * powered--we just
power it on to read the pin. NOTE: part of
27ed2b3f22ed60 Douglas Anderson 2020-05-07 959 * the reason this
works is that the bridge defaults (when
27ed2b3f22ed60 Douglas Anderson 2020-05-07 960 * powered back on) to
all 4 GPIOs being configured as GPIO input.
27ed2b3f22ed60 Douglas Anderson 2020-05-07 961 * Also note that if
something else is keeping the chip powered the
27ed2b3f22ed60 Douglas Anderson 2020-05-07 962 * pm_runtime functions
are lightweight increments of a refcount.
27ed2b3f22ed60 Douglas Anderson 2020-05-07 963 */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 964
pm_runtime_get_sync(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 965 ret =
regmap_read(pdata->regmap, SN_GPIO_IO_REG, &val);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 966
pm_runtime_put(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 967
27ed2b3f22ed60 Douglas Anderson 2020-05-07 968 if (ret)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 969 return ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 970
27ed2b3f22ed60 Douglas Anderson 2020-05-07 971 return !!(val &
BIT(SN_GPIO_INPUT_SHIFT + offset));
27ed2b3f22ed60 Douglas Anderson 2020-05-07 972 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 973
27ed2b3f22ed60 Douglas Anderson 2020-05-07 974 static void
ti_sn_bridge_gpio_set(struct gpio_chip *chip, unsigned int offset,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 975
int val)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 976 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 977 struct ti_sn_bridge
*pdata = gpiochip_get_data(chip);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 978 int ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 979
27ed2b3f22ed60 Douglas Anderson 2020-05-07 980 if (!test_bit(offset,
pdata->gchip_output)) {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 981
dev_err(pdata->dev, "Ignoring GPIO set while input\n");
27ed2b3f22ed60 Douglas Anderson 2020-05-07 982 return;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 983 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 984
27ed2b3f22ed60 Douglas Anderson 2020-05-07 985 val &= 1;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 986 ret =
regmap_update_bits(pdata->regmap, SN_GPIO_IO_REG,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 987
BIT(SN_GPIO_OUTPUT_SHIFT + offset),
27ed2b3f22ed60 Douglas Anderson 2020-05-07 988
val << (SN_GPIO_OUTPUT_SHIFT + offset));
27ed2b3f22ed60 Douglas Anderson 2020-05-07 989 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 990
27ed2b3f22ed60 Douglas Anderson 2020-05-07 991 static int
ti_sn_bridge_gpio_direction_input(struct gpio_chip *chip,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 992
unsigned int offset)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 993 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 994 struct ti_sn_bridge
*pdata = gpiochip_get_data(chip);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 995 int shift = offset * 2;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 996 int ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 997
27ed2b3f22ed60 Douglas Anderson 2020-05-07 998 if
(!test_and_clear_bit(offset, pdata->gchip_output))
27ed2b3f22ed60 Douglas Anderson 2020-05-07 999 return 0;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1000
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1001 ret =
regmap_update_bits(pdata->regmap, SN_GPIO_CTRL_REG,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1002
SN_GPIO_MUX_MASK << shift,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1003
SN_GPIO_MUX_INPUT << shift);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1004 if (ret) {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1005 set_bit(offset,
pdata->gchip_output);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1006 return ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1007 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1008
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1009 /*
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1010 * NOTE: if nobody else
is powering the device this may fully power
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1011 * it off and when it
comes back it will have lost all state, but
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1012 * that's OK because
the default is input and we're now an input.
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1013 */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1014
pm_runtime_put(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1015
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1016 return 0;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1017 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1018
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1019 static int
ti_sn_bridge_gpio_direction_output(struct gpio_chip *chip,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1020
unsigned int offset, int val)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1021 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1022 struct ti_sn_bridge
*pdata = gpiochip_get_data(chip);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1023 int shift = offset * 2;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1024 int ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1025
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1026 if
(test_and_set_bit(offset, pdata->gchip_output))
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1027 return 0;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1028
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1029
pm_runtime_get_sync(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1030
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1031 /* Set value first to
avoid glitching */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1032
ti_sn_bridge_gpio_set(chip, offset, val);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1033
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1034 /* Set direction */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1035 ret =
regmap_update_bits(pdata->regmap, SN_GPIO_CTRL_REG,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1036
SN_GPIO_MUX_MASK << shift,
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1037
SN_GPIO_MUX_OUTPUT << shift);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1038 if (ret) {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1039
clear_bit(offset, pdata->gchip_output);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1040
pm_runtime_put(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1041 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1042
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1043 return ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1044 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1045
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1046 static void
ti_sn_bridge_gpio_free(struct gpio_chip *chip, unsigned int offset)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1047 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1048 /* We won't keep
pm_runtime if we're input, so switch there on free */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1049
ti_sn_bridge_gpio_direction_input(chip, offset);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1050 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1051
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1052 static const char * const
ti_sn_bridge_gpio_names[SN_NUM_GPIOS] = {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1053 "GPIO1", "GPIO2",
"GPIO3", "GPIO4"
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1054 };
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1055
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1056 static int
ti_sn_setup_gpio_controller(struct ti_sn_bridge *pdata)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1057 {
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1058 int ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1059
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1060 /* Only init if someone
is going to use us as a GPIO controller */
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1061 if
(!of_property_read_bool(pdata->dev->of_node, "gpio-controller"))
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1062 return 0;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1063
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1064 pdata->gchip.label =
dev_name(pdata->dev);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1065 pdata->gchip.parent =
pdata->dev;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1066 pdata->gchip.owner =
THIS_MODULE;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 @1067 pdata->gchip.of_xlate =
tn_sn_bridge_of_xlate;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1068
pdata->gchip.of_gpio_n_cells = 2;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1069 pdata->gchip.free =
ti_sn_bridge_gpio_free;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1070
pdata->gchip.get_direction = ti_sn_bridge_gpio_get_direction;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1071
pdata->gchip.direction_input = ti_sn_bridge_gpio_direction_input;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1072
pdata->gchip.direction_output = ti_sn_bridge_gpio_direction_output;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1073 pdata->gchip.get =
ti_sn_bridge_gpio_get;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1074 pdata->gchip.set =
ti_sn_bridge_gpio_set;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1075 pdata->gchip.can_sleep
= true;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1076 pdata->gchip.names =
ti_sn_bridge_gpio_names;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1077 pdata->gchip.ngpio =
SN_NUM_GPIOS;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1078 pdata->gchip.base = -1;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1079 ret =
devm_gpiochip_add_data(pdata->dev, &pdata->gchip, pdata);
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1080 if (ret)
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1081
dev_err(pdata->dev, "can't add gpio chip\n");
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1082
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1083 return ret;
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1084 }
27ed2b3f22ed60 Douglas Anderson 2020-05-07 1085
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
