.. | .. |
---|
126 | 126 | struct amd_gpio *gpio_dev = gpiochip_get_data(gc); |
---|
127 | 127 | |
---|
128 | 128 | raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
---|
| 129 | + |
---|
| 130 | + /* Use special handling for Pin0 debounce */ |
---|
| 131 | + if (offset == 0) { |
---|
| 132 | + pin_reg = readl(gpio_dev->base + WAKE_INT_MASTER_REG); |
---|
| 133 | + if (pin_reg & INTERNAL_GPIO0_DEBOUNCE) |
---|
| 134 | + debounce = 0; |
---|
| 135 | + } |
---|
| 136 | + |
---|
129 | 137 | pin_reg = readl(gpio_dev->base + offset * 4); |
---|
130 | 138 | |
---|
131 | 139 | if (debounce) { |
---|
.. | .. |
---|
181 | 189 | return ret; |
---|
182 | 190 | } |
---|
183 | 191 | |
---|
184 | | -static int amd_gpio_set_config(struct gpio_chip *gc, unsigned offset, |
---|
185 | | - unsigned long config) |
---|
186 | | -{ |
---|
187 | | - u32 debounce; |
---|
188 | | - |
---|
189 | | - if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE) |
---|
190 | | - return -ENOTSUPP; |
---|
191 | | - |
---|
192 | | - debounce = pinconf_to_config_argument(config); |
---|
193 | | - return amd_gpio_set_debounce(gc, offset, debounce); |
---|
194 | | -} |
---|
195 | | - |
---|
196 | 192 | #ifdef CONFIG_DEBUG_FS |
---|
197 | 193 | static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) |
---|
198 | 194 | { |
---|
.. | .. |
---|
215 | 211 | char *output_value; |
---|
216 | 212 | char *output_enable; |
---|
217 | 213 | |
---|
| 214 | + seq_printf(s, "WAKE_INT_MASTER_REG: 0x%08x\n", readl(gpio_dev->base + WAKE_INT_MASTER_REG)); |
---|
218 | 215 | for (bank = 0; bank < gpio_dev->hwbank_num; bank++) { |
---|
219 | 216 | seq_printf(s, "GPIO bank%d\t", bank); |
---|
220 | 217 | |
---|
.. | .. |
---|
656 | 653 | break; |
---|
657 | 654 | |
---|
658 | 655 | default: |
---|
659 | | - dev_err(&gpio_dev->pdev->dev, "Invalid config param %04x\n", |
---|
| 656 | + dev_dbg(&gpio_dev->pdev->dev, "Invalid config param %04x\n", |
---|
660 | 657 | param); |
---|
661 | 658 | return -ENOTSUPP; |
---|
662 | 659 | } |
---|
.. | .. |
---|
667 | 664 | } |
---|
668 | 665 | |
---|
669 | 666 | static int amd_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, |
---|
670 | | - unsigned long *configs, unsigned num_configs) |
---|
| 667 | + unsigned long *configs, unsigned int num_configs) |
---|
671 | 668 | { |
---|
672 | 669 | int i; |
---|
673 | 670 | u32 arg; |
---|
.. | .. |
---|
709 | 706 | break; |
---|
710 | 707 | |
---|
711 | 708 | default: |
---|
712 | | - dev_err(&gpio_dev->pdev->dev, |
---|
| 709 | + dev_dbg(&gpio_dev->pdev->dev, |
---|
713 | 710 | "Invalid config param %04x\n", param); |
---|
714 | 711 | ret = -ENOTSUPP; |
---|
715 | 712 | } |
---|
.. | .. |
---|
757 | 754 | return 0; |
---|
758 | 755 | } |
---|
759 | 756 | |
---|
| 757 | +static int amd_gpio_set_config(struct gpio_chip *gc, unsigned int pin, |
---|
| 758 | + unsigned long config) |
---|
| 759 | +{ |
---|
| 760 | + struct amd_gpio *gpio_dev = gpiochip_get_data(gc); |
---|
| 761 | + |
---|
| 762 | + if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) { |
---|
| 763 | + u32 debounce = pinconf_to_config_argument(config); |
---|
| 764 | + |
---|
| 765 | + return amd_gpio_set_debounce(gc, pin, debounce); |
---|
| 766 | + } |
---|
| 767 | + |
---|
| 768 | + return amd_pinconf_set(gpio_dev->pctrl, pin, &config, 1); |
---|
| 769 | +} |
---|
| 770 | + |
---|
760 | 771 | static const struct pinconf_ops amd_pinconf_ops = { |
---|
761 | 772 | .pin_config_get = amd_pinconf_get, |
---|
762 | 773 | .pin_config_set = amd_pinconf_set, |
---|
.. | .. |
---|
784 | 795 | |
---|
785 | 796 | raw_spin_lock_irqsave(&gpio_dev->lock, flags); |
---|
786 | 797 | |
---|
787 | | - pin_reg = readl(gpio_dev->base + i * 4); |
---|
| 798 | + pin_reg = readl(gpio_dev->base + pin * 4); |
---|
788 | 799 | pin_reg &= ~mask; |
---|
789 | | - writel(pin_reg, gpio_dev->base + i * 4); |
---|
| 800 | + writel(pin_reg, gpio_dev->base + pin * 4); |
---|
790 | 801 | |
---|
791 | 802 | raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); |
---|
792 | 803 | } |
---|