Skip to contentSkip to conversation

gpio/samsung: Fix incorrect gpio pull up/down callback for Exynos4

PATCH RESEND In review Thomas Abraham 3 participants 4 messages Oct 9, 2011 – Oct 10, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 gpio/samsung: Fix incorrect gpio pull up/down callback for Exynos4

Some of the gpio chips of exynos4 are assigned a default gpio config without the exynos4 specific pull up/down callbacks which resulted in incorrect setting of pull up/down configuration.

Fix this by adding two new exynos4 specific entries in the array of default configs with set_pull and get_pull callbacks set to exynos4 specific callbacks The new default gpio configs can then be used for exynos4 gpio chips.

---
 drivers/gpio/gpio-samsung.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpio/gpio-samsung.c +19 -12
index 037d3bb..b33cad3 100644
@@ -486,7 +486,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
 	}, {
 		.set_config	= samsung_gpio_setcfg_2bit,
 		.get_config	= samsung_gpio_getcfg_2bit,
-	},
+	}, {
+		.set_pull	= exynos4_gpio_setpull,
+		.get_pull	= exynos4_gpio_getpull,
+	}, {
+		.cfg_eint	= 0x3,
+		.set_pull	= exynos4_gpio_setpull,
+		.get_pull	= exynos4_gpio_getpull,
+	}
 };
 
 /*
@@ -2253,49 +2260,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
 			.label	= "GPL2",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY0(0),
 			.ngpio	= EXYNOS4_GPIO_Y0_NR,
 			.label	= "GPY0",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY1(0),
 			.ngpio	= EXYNOS4_GPIO_Y1_NR,
 			.label	= "GPY1",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY2(0),
 			.ngpio	= EXYNOS4_GPIO_Y2_NR,
 			.label	= "GPY2",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY3(0),
 			.ngpio	= EXYNOS4_GPIO_Y3_NR,
 			.label	= "GPY3",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY4(0),
 			.ngpio	= EXYNOS4_GPIO_Y4_NR,
 			.label	= "GPY4",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY5(0),
 			.ngpio	= EXYNOS4_GPIO_Y5_NR,
 			.label	= "GPY5",
 		},
 	}, {
-		.config	= &samsung_gpio_cfgs[0],
+		.config	= &samsung_gpio_cfgs[8],
 		.chip	= {
 			.base	= EXYNOS4_GPY6(0),
 			.ngpio	= EXYNOS4_GPIO_Y6_NR,
@@ -2303,7 +2310,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
 		},
 	}, {
 		.base	= (S5P_VA_GPIO2 + 0xC00),
-		.config	= &samsung_gpio_cfgs[3],
+		.config	= &samsung_gpio_cfgs[9],
 		.irq_base = IRQ_EINT(0),
 		.chip	= {
 			.base	= EXYNOS4_GPX0(0),
@@ -2313,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
 		},
 	}, {
 		.base	= (S5P_VA_GPIO2 + 0xC20),
-		.config	= &samsung_gpio_cfgs[3],
+		.config	= &samsung_gpio_cfgs[9],
 		.irq_base = IRQ_EINT(8),
 		.chip	= {
 			.base	= EXYNOS4_GPX1(0),
@@ -2323,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
 		},
 	}, {
 		.base	= (S5P_VA_GPIO2 + 0xC40),
-		.config	= &samsung_gpio_cfgs[3],
+		.config	= &samsung_gpio_cfgs[9],
 		.irq_base = IRQ_EINT(16),
 		.chip	= {
 			.base	= EXYNOS4_GPX2(0),
@@ -2333,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
 		},
 	}, {
 		.base	= (S5P_VA_GPIO2 + 0xC60),
-		.config	= &samsung_gpio_cfgs[3],
+		.config	= &samsung_gpio_cfgs[9],
 		.irq_base = IRQ_EINT(24),
 		.chip	= {
 			.base	= EXYNOS4_GPX3(0),
Signature · 1 line
1.6.6.rc2
#1 lore raw
Quoted 9 lines · Thomas Abraham

Some of the gpio chips of exynos4 are assigned a default gpio config without the exynos4 specific pull up/down callbacks which resulted in incorrect setting of pull up/down configuration.

Fix this by adding two new exynos4 specific entries in the array of default configs with set_pull and get_pull callbacks set to exynos4 specific callbacks The new default gpio configs can then be used for exynos4 gpio chips.

Hi Thomas,

Does this need to be merged as a bug fix for v3.1, or is it for v3.2? Does it have any dependencies, or can it go in via the gpio/next tree?

g.

Quoted 121 lines

---
 drivers/gpio/gpio-samsung.c |   31 +++++++++++++++++++------------

 1 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpio/gpio-samsung.c +19 -13
index 037d3bb..b33cad3 100644
@@ -486,7 +486,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
        }, {
                .set_config     = samsung_gpio_setcfg_2bit,
                .get_config     = samsung_gpio_getcfg_2bit,
-       },
+       }, {
+               .set_pull       = exynos4_gpio_setpull,
+               .get_pull       = exynos4_gpio_getpull,
+       }, {
+               .cfg_eint       = 0x3,
+               .set_pull       = exynos4_gpio_setpull,
+               .get_pull       = exynos4_gpio_getpull,
+       }
  };
 
  /*
@@ -2253,49 +2260,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                        .label  = "GPL2",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY0(0),
                        .ngpio  = EXYNOS4_GPIO_Y0_NR,
                        .label  = "GPY0",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY1(0),
                        .ngpio  = EXYNOS4_GPIO_Y1_NR,
                        .label  = "GPY1",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY2(0),
                        .ngpio  = EXYNOS4_GPIO_Y2_NR,
                        .label  = "GPY2",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY3(0),
                        .ngpio  = EXYNOS4_GPIO_Y3_NR,
                        .label  = "GPY3",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY4(0),
                        .ngpio  = EXYNOS4_GPIO_Y4_NR,
                        .label  = "GPY4",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY5(0),
                        .ngpio  = EXYNOS4_GPIO_Y5_NR,
                        .label  = "GPY5",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY6(0),
                        .ngpio  = EXYNOS4_GPIO_Y6_NR,
@@ -2303,7 +2310,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC00),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(0),
                .chip   = {
                        .base   = EXYNOS4_GPX0(0),
@@ -2313,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC20),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(8),
                .chip   = {
                        .base   = EXYNOS4_GPX1(0),
@@ -2323,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC40),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(16),
                .chip   = {
                        .base   = EXYNOS4_GPX2(0),
@@ -2333,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC60),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(24),
                .chip   = {
                        .base   = EXYNOS4_GPX3(0),
--

1.6.6.rc2

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#2 lore raw

Hi Grant,

Quoted 10 lines · Grant Likely
Quoted 8 lines · Thomas Abraham

Some of the gpio chips of exynos4 are assigned a default gpio config without the exynos4 specific pull up/down callbacks which resulted in incorrect setting of pull up/down configuration.

Fix this by adding two new exynos4 specific entries in the array of default configs with set_pull and get_pull callbacks set to exynos4 specific callbacks The new default gpio configs can then be used for exynos4 gpio chips.

Quoted 6 lines
Quoted 1 line

Hi Thomas,

Does this need to be merged as a bug fix for v3.1, or is it for v3.2? Does it have any dependencies, or can it go in via the gpio/next tree?

This patch is a bug fix for the new consolidated samsung gpio driver that will be merged in v3.2 via Kukjin's tree. The new consolidated samsung gpio driver is merged only in Kukjin's for-next and not available in gpio/next.

Thanks,
Thomas.

Quoted 131 lines

g.

Quoted 118 lines

---
 drivers/gpio/gpio-samsung.c |   31 +++++++++++++++++++------------

 1 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpio/gpio-samsung.c +19 -13
index 037d3bb..b33cad3 100644
@@ -486,7 +486,14 @@ static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
        }, {
                .set_config     = samsung_gpio_setcfg_2bit,
                .get_config     = samsung_gpio_getcfg_2bit,
-       },
+       }, {
+               .set_pull       = exynos4_gpio_setpull,
+               .get_pull       = exynos4_gpio_getpull,
+       }, {
+               .cfg_eint       = 0x3,
+               .set_pull       = exynos4_gpio_setpull,
+               .get_pull       = exynos4_gpio_getpull,
+       }
  };
 
  /*
@@ -2253,49 +2260,49 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                        .label  = "GPL2",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY0(0),
                        .ngpio  = EXYNOS4_GPIO_Y0_NR,
                        .label  = "GPY0",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY1(0),
                        .ngpio  = EXYNOS4_GPIO_Y1_NR,
                        .label  = "GPY1",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY2(0),
                        .ngpio  = EXYNOS4_GPIO_Y2_NR,
                        .label  = "GPY2",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY3(0),
                        .ngpio  = EXYNOS4_GPIO_Y3_NR,
                        .label  = "GPY3",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY4(0),
                        .ngpio  = EXYNOS4_GPIO_Y4_NR,
                        .label  = "GPY4",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY5(0),
                        .ngpio  = EXYNOS4_GPIO_Y5_NR,
                        .label  = "GPY5",
                },
        }, {
-               .config = &samsung_gpio_cfgs[0],
+               .config = &samsung_gpio_cfgs[8],
                .chip   = {
                        .base   = EXYNOS4_GPY6(0),
                        .ngpio  = EXYNOS4_GPIO_Y6_NR,
@@ -2303,7 +2310,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC00),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(0),
                .chip   = {
                        .base   = EXYNOS4_GPX0(0),
@@ -2313,7 +2320,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC20),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(8),
                .chip   = {
                        .base   = EXYNOS4_GPX1(0),
@@ -2323,7 +2330,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC40),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(16),
                .chip   = {
                        .base   = EXYNOS4_GPX2(0),
@@ -2333,7 +2340,7 @@ static struct samsung_gpio_chip exynos4_gpios_2[] = {
                },
        }, {
                .base   = (S5P_VA_GPIO2 + 0xC60),
-               .config = &samsung_gpio_cfgs[3],
+               .config = &samsung_gpio_cfgs[9],
                .irq_base = IRQ_EINT(24),
                .chip   = {
                        .base   = EXYNOS4_GPX3(0),
--
Quoted 3 lines

1.6.6.rc2

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

#3 lore raw
Quoted 7 lines · Thomas Abraham

Hi Grant,

Quoted 3 lines · Grant Likely
Quoted 1 line · Thomas Abraham

Some of the gpio chips of exynos4 are assigned a default gpio config

without

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

the exynos4 specific pull up/down callbacks which resulted in incorrect setting of pull up/down configuration.

Fix this by adding two new exynos4 specific entries in the array of

default

Quoted 1 line
Quoted 1 line
Quoted 1 line

configs with set_pull and get_pull callbacks set to exynos4 specific

callbacks

Quoted 6 lines
Quoted 6 lines
Quoted 3 lines

The new default gpio configs can then be used for exynos4 gpio chips.

Hi Thomas,

Quoted 9 lines
Quoted 2 lines

Does this need to be merged as a bug fix for v3.1, or is it for v3.2? Does it have any dependencies, or can it go in via the gpio/next tree?

This patch is a bug fix for the new consolidated samsung gpio driver that will be merged in v3.2 via Kukjin's tree. The new consolidated samsung gpio driver is merged only in Kukjin's for-next and not available in gpio/next.

Hi Grant and Thomas,

Yes this should be applied to my tree and I don't know why this has been missed when I worked on gpio/samsung. Sorry for noisy on gpio/samsung :(

Anyway, I will apply this for v3.2 and as a note, this commit has been merged into mainline so you don't need to handle in gpio/next. commit id 0bf8fa04e80a562641f687547053f98670f25cf9("gpio/exynos4: Fix incorrect mapping of gpio pull-up macro to register setting")

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.