Skip to content

Commit 78085cc

Browse files
Ecce_Liscorpiochang
authored andcommitted
Special Issue[I2S short]: p no pull-up/down and output mode for gpio 186
Change-Id: I9c8b173d3118e56b154bf4575b90a462552e3d27 Reviewed-on: https://tp-biosrd-v02/gerrit/81551 Reviewed-by: Scorpio Chang(張志賢) <Scorpio_Chang@asus.com> Tested-by: Scorpio Chang(張志賢) <Scorpio_Chang@asus.com>
1 parent 7c40b25 commit 78085cc

File tree

4 files changed

+31
-8
lines changed

4 files changed

+31
-8
lines changed

arch/arm/Kconfig.debug

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ config FRAME_POINTER
4242
faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled,
4343
when a problem occurs with the kernel, the information that is
4444
reported is severely limited.
45-
45+
config I2S_SHORT
46+
bool "Pin 185 and 186(I2S) is shorted in TinkerBoard."
4647
config ARM_UNWIND
4748
bool "Enable stack unwinding support (EXPERIMENTAL)"
4849
depends on AEABI

arch/arm/configs/miniarm-rk3288_defconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,4 +810,5 @@ CONFIG_IR_XMP_DECODER=y
810810
CONFIG_LIRC_RPI=y
811811
CONFIG_RC_DEVICES=y
812812
CONFIG_LIRC_STAGING=y
813-
CONFIG_STAGING_MEDIA=y
813+
CONFIG_STAGING_MEDIA=y
814+
CONFIG_I2S_SHORT=y

drivers/pinctrl/core.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,17 +635,21 @@ static int pinctrl_gpio_direction(unsigned gpio, bool input)
635635
if (ret) {
636636
return ret;
637637
}
638+
#ifdef CONFIG_I2S_SHORT
638639
/* For pin 185 and 186 are shorted.*/
639-
if (gpio == 186) {
640+
if (gpio == 186)
640641
input = true;
641-
}
642+
#endif
642643
mutex_lock(&pctldev->mutex);
643644

644645
/* Convert to the pin controllers number space */
646+
#ifdef CONFIG_I2S_SHORT
647+
/* For pin 185 and 186 are shorted.*/
645648
if (gpio == 185) {
646649
pin = gpio_to_pin(range, 186);
647650
ret = pinmux_gpio_direction(pctldev, range, pin, true);
648651
}
652+
#endif
649653
pin = gpio_to_pin(range, gpio);
650654
ret = pinmux_gpio_direction(pctldev, range, pin, input);
651655

drivers/pinctrl/pinctrl-rockchip.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,6 @@ static int rockchip_set_mux(struct rockchip_pin_bank *bank, int pin, int mux)
10781078
return ret;
10791079
}
10801080
}
1081-
10821081
data = (mask << (bit + 16));
10831082
rmask = data | (data >> 16);
10841083
data |= (mux & mask) << bit;
@@ -1872,7 +1871,11 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank,
18721871
int reg, ret, i, pull_type;
18731872
u8 bit;
18741873
u32 data, rmask;
1875-
1874+
#ifdef CONFIG_I2S_SHORT
1875+
/* For pin 185 and 186 are shorted. */
1876+
if(bank->bank_num == 6 && pin_num == 2)
1877+
pull = PIN_CONFIG_BIAS_DISABLE;
1878+
#endif
18761879
dev_dbg(info->dev, "setting pull of GPIO%d-%d to %d\n",
18771880
bank->bank_num, pin_num, pull);
18781881

@@ -2069,14 +2072,25 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
20692072
int ret;
20702073
unsigned long flags;
20712074
u32 data;
2075+
#ifdef CONFIG_I2S_SHORT
2076+
unsigned long gpio_pin;
2077+
#endif
20722078

20732079
bank = gc_to_pin_bank(chip);
20742080
ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO);
20752081
if (ret < 0)
20762082
return ret;
2083+
#ifdef CONFIG_I2S_SHORT
20772084
/* For pin 185 and 186 are shorted. */
2078-
if (bank->pin_base + pin == 186)
2079-
input = true;
2085+
gpio_pin = bank->pin_base + pin;
2086+
if (gpio_pin == 185 || gpio_pin == 186) {
2087+
ret = rockchip_set_pull(bank, 2, PIN_CONFIG_BIAS_DISABLE);
2088+
if (ret < 0)
2089+
return ret;
2090+
if(gpio_pin == 186)
2091+
input = true;
2092+
}
2093+
#endif
20802094
//clk_enable(bank->clk);
20812095
raw_spin_lock_irqsave(&bank->slock, flags);
20822096

@@ -2086,8 +2100,11 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip,
20862100
data |= BIT(pin);
20872101
else
20882102
data &= ~BIT(pin);
2103+
#ifdef CONFIG_I2S_SHORT
2104+
/* For pin 185 and 186 are shorted. */
20892105
if (bank->pin_base + pin == 185)
20902106
data &= ~BIT(2);
2107+
#endif
20912108
writel_relaxed(data, bank->reg_base + GPIO_SWPORT_DDR);
20922109
raw_spin_unlock_irqrestore(&bank->slock, flags);
20932110
//clk_disable(bank->clk);

0 commit comments

Comments
 (0)