Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: pinctrl-single: pin names for pinctrl-single.bits

Take care to name pin names as
register-offset.bit-pos-of-pin-in-register in case configuring multiple
pins in register.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Manjunathappa, Prakash and committed by
Linus Walleij
6f924b0b 4e7e8017

+10 -5
+10 -5
drivers/pinctrl/pinctrl-single.c
··· 30 30 #define DRIVER_NAME "pinctrl-single" 31 31 #define PCS_MUX_PINS_NAME "pinctrl-single,pins" 32 32 #define PCS_MUX_BITS_NAME "pinctrl-single,bits" 33 - #define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 1) 33 + #define PCS_REG_NAME_LEN ((sizeof(unsigned long) * 2) + 3) 34 34 #define PCS_OFF_DISABLED ~0U 35 35 36 36 /** ··· 744 744 * @pcs: pcs driver instance 745 745 * @offset: register offset from base 746 746 */ 747 - static int pcs_add_pin(struct pcs_device *pcs, unsigned offset) 747 + static int pcs_add_pin(struct pcs_device *pcs, unsigned offset, 748 + unsigned pin_pos) 748 749 { 749 750 struct pinctrl_pin_desc *pin; 750 751 struct pcs_name *pn; ··· 760 759 761 760 pin = &pcs->pins.pa[i]; 762 761 pn = &pcs->names[i]; 763 - sprintf(pn->name, "%lx", 764 - (unsigned long)pcs->res->start + offset); 762 + sprintf(pn->name, "%lx.%d", 763 + (unsigned long)pcs->res->start + offset, pin_pos); 765 764 pin->name = pn->name; 766 765 pin->number = i; 767 766 pcs->pins.cur++; ··· 781 780 static int pcs_allocate_pin_table(struct pcs_device *pcs) 782 781 { 783 782 int mux_bytes, nr_pins, i; 783 + int num_pins_in_register = 0; 784 784 785 785 mux_bytes = pcs->width / BITS_PER_BYTE; 786 786 787 787 if (pcs->bits_per_mux) { 788 788 pcs->bits_per_pin = fls(pcs->fmask); 789 789 nr_pins = (pcs->size * BITS_PER_BYTE) / pcs->bits_per_pin; 790 + num_pins_in_register = pcs->width / pcs->bits_per_pin; 790 791 } else { 791 792 nr_pins = pcs->size / mux_bytes; 792 793 } ··· 813 810 unsigned offset; 814 811 int res; 815 812 int byte_num; 813 + int pin_pos = 0; 816 814 817 815 if (pcs->bits_per_mux) { 818 816 byte_num = (pcs->bits_per_pin * i) / BITS_PER_BYTE; 819 817 offset = (byte_num / mux_bytes) * mux_bytes; 818 + pin_pos = i % num_pins_in_register; 820 819 } else { 821 820 offset = i * mux_bytes; 822 821 } 823 - res = pcs_add_pin(pcs, offset); 822 + res = pcs_add_pin(pcs, offset, pin_pos); 824 823 if (res < 0) { 825 824 dev_err(pcs->dev, "error adding pins: %i\n", res); 826 825 return res;