*参照元 [#ef2b5919]
#backlinks

*説明 [#pc72cba3]
-パス: [[linux-4.4.1/]]
-パス: [[linux-4.4.1/drivers/gpio/gpiolib.c]]

-FIXME: これは何?
--説明


**引数 [#d401e8e4]
-struct gpio_chip *chip
--
--[[linux-4.4.1/gpio_chip]]
-const char *pinctl_name
--
-unsigned int gpio_offset
--
-unsigned int pin_offset
--
-unsigned int npins
--


**返り値 [#v0e46793]
-int
--


**参考 [#a7f33214]


*実装 [#rf1b1181]
 /**
  * gpiochip_add_pin_range() - add a range for GPIO <-> pin mapping
  * @chip: the gpiochip to add the range for
  * @pinctrl_name: the dev_name() of the pin controller to map to
  * @gpio_offset: the start offset in the current gpio_chip number space
  * @pin_offset: the start offset in the pin controller number space
  * @npins: the number of pins from the offset of each pin space (GPIO and
  *      pin controller) to accumulate in this range
  */
 int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
                            unsigned int gpio_offset, unsigned int pin_offset,
                            unsigned int npins)
 {
         struct gpio_pin_range *pin_range;
         int ret;
 
-
--[[linux-4.4.1/gpio_pin_range]]

         pin_range = kzalloc(sizeof(*pin_range), GFP_KERNEL);
         if (!pin_range) {
                 chip_err(chip, "failed to allocate pin ranges\n");
                 return -ENOMEM;
         }
 
-
--[[linux-4.4.1/kzalloc()]]
--[[linux-4.4.1/chip_err()]]

         /* Use local offset as range ID */
         pin_range->range.id = gpio_offset;
         pin_range->range.gc = chip;
         pin_range->range.name = chip->label;
         pin_range->range.base = chip->base + gpio_offset;
         pin_range->range.pin_base = pin_offset;
         pin_range->range.npins = npins;
         pin_range->pctldev = pinctrl_find_and_add_gpio_range(pinctl_name,
                         &pin_range->range);
         if (IS_ERR(pin_range->pctldev)) {
                 ret = PTR_ERR(pin_range->pctldev);
                 chip_err(chip, "could not create pin range\n");
                 kfree(pin_range);
                 return ret;
         }
         chip_dbg(chip, "created GPIO range %d->%d ==> %s PIN %d->%d\n",
                  gpio_offset, gpio_offset + npins - 1,
                  pinctl_name,
                  pin_offset, pin_offset + npins - 1);
 
-
--[[linux-4.4.1/pinctrl_find_and_add_gpio_range()]]
--[[linux-4.4.1/IS_ERR()]]
--[[linux-4.4.1/PTR_ERR()]]
--[[linux-4.4.1/chip_err()]]
--[[linux-4.4.1/kfree()]]
--[[linux-4.4.1/chip_dbg()]]

         list_add_tail(&pin_range->node, &chip->pin_ranges);
 
-
--[[linux-4.4.1/list_add_tail()]]

         return 0;
 }
 EXPORT_SYMBOL_GPL(gpiochip_add_pin_range);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]


*コメント [#f12a74c1]

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS