Re: [PATCH] Fix OMAP H3 touchscreen.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lauro,


Just a little style suggestion:

On Dec 21, 2007 5:03 PM, Lauro Ramos Venancio <lauro.venancio@xxxxxxxxx> wrote:
> Use the newer touchscreen driver (tsc210x).
> The old one doesn't compile anymore.
>
> Signed-off-by: Lauro Ramos Venancio <lauro.venancio@xxxxxxxxxxx>
> ---
>  arch/arm/mach-omap1/board-h3.c |   86 ++++++----------------------------------
>  1 files changed, 13 insertions(+), 73 deletions(-)
>
> diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
> index df77cf5..3371446 100644
>
> --- a/arch/arm/mach-omap1/board-h3.c
> +++ b/arch/arm/mach-omap1/board-h3.c
> @@ -27,7 +27,7 @@
>  #include <linux/input.h>
>  #include <linux/clk.h>
>  #include <linux/spi/spi.h>
> -#include <linux/spi/tsc2101.h>
> +#include <linux/spi/tsc210x.h>
>
>  #include <asm/setup.h>
>  #include <asm/page.h>
> @@ -374,77 +374,10 @@ static struct platform_device h3_lcd_device = {
>         .id             = -1,
>  };
>
> -struct {
> -       struct clk      *mclk;
> -       int             initialized;
> -} h3_tsc2101;
> -
> -#define TSC2101_MUX_MCLK_ON    V5_1710_MCLK_ON
> -#define TSC2101_MUX_MCLK_OFF   V5_1710_MCLK_OFF
> -
> -static int h3_tsc2101_init(struct spi_device *spi)
> -{
> -       u8 io_exp_val;
> -       int r;
> -
> -       if (h3_tsc2101.initialized) {
> -               printk(KERN_ERR "tsc2101: already initialized\n");
> -               return -ENODEV;
> -       }
> -
> -       /* Get the MCLK */
> -       h3_tsc2101.mclk = clk_get(&spi->dev, "mclk");
> -       if (IS_ERR(h3_tsc2101.mclk)) {
> -               dev_err(&spi->dev, "unable to get the clock MCLK\n");
> -               return PTR_ERR(h3_tsc2101.mclk);
> -       }
> -       if ((r = clk_set_rate(h3_tsc2101.mclk, 12000000)) < 0) {
> -               dev_err(&spi->dev, "unable to set rate to the MCLK\n");
> -               goto err;
> -       }
> -
> -       if ((r = read_gpio_expa(&io_exp_val, 0x24))) {
> -               dev_err(&spi->dev, "error reading from I/O EXPANDER\n");
> -               goto err;
> -       }
> -       io_exp_val |= 0x8;
> -       if ((r = write_gpio_expa(io_exp_val, 0x24))) {
> -               dev_err(&spi->dev, "error writing to I/O EXPANDER\n");
> -               goto err;
> -       }
> -
> -       omap_cfg_reg(N14_1610_UWIRE_CS0);
> -       omap_cfg_reg(TSC2101_MUX_MCLK_OFF);
> -
> -       return 0;
> -err:
> -       clk_put(h3_tsc2101.mclk);
> -       return r;
> -}
> -
> -static void h3_tsc2101_cleanup(struct spi_device *spi)
> -{
> -       clk_put(h3_tsc2101.mclk);
> -       omap_cfg_reg(TSC2101_MUX_MCLK_OFF);
> -}
> -
> -static void h3_tsc2101_enable_mclk(struct spi_device *spi)
> -{
> -       omap_cfg_reg(TSC2101_MUX_MCLK_ON);
> -       clk_enable(h3_tsc2101.mclk);
> -}
> -
> -static void h3_tsc2101_disable_mclk(struct spi_device *spi)
> -{
> -       clk_disable(h3_tsc2101.mclk);
> -       omap_cfg_reg(R10_1610_MCLK_OFF);
> -}
> -
> -static struct tsc2101_platform_data h3_tsc2101_platform_data = {
> -       .init           = h3_tsc2101_init,
> -       .cleanup        = h3_tsc2101_cleanup,
> -       .enable_mclk    = h3_tsc2101_enable_mclk,
> -       .disable_mclk   = h3_tsc2101_disable_mclk,
> +static struct tsc210x_config tsc_platform_data = {
> +       .use_internal           = 1,
> +       .monitor                = TSC_VBAT | TSC_TEMP,
> +       .mclk                   = "mclk",
>  };
>
>  static struct spi_board_info h3_spi_board_info[] __initdata = {
> @@ -452,8 +385,9 @@ static struct spi_board_info h3_spi_board_info[] __initdata = {
>                 .modalias       = "tsc2101",
>                 .bus_num        = 2,
>                 .chip_select    = 0,
> +               .irq            = OMAP_GPIO_IRQ(48),

Avoid using magic numbers in these cases. The code would be clearer if
you'd #define'd the gpio number.

>                 .max_speed_hz   = 16000000,
> -               .platform_data  = &h3_tsc2101_platform_data,
> +               .platform_data  = &tsc_platform_data,
>         },
>  };
>
> @@ -569,6 +503,12 @@ static void __init h3_init(void)
>         /* GPIO10 pullup/down register, Enable pullup on GPIO10 */
>         omap_cfg_reg(V2_1710_GPIO10);
>
> +       /* TSC2101 */
> +       omap_cfg_reg(W19_1610_GPIO48);

> +       gpio_request(48, "tsc_irq");
>
> +       gpio_direction_input(48);

Here too.

> +       omap_cfg_reg(N14_1610_UWIRE_CS0);
> +
>         platform_add_devices(devices, ARRAY_SIZE(devices));
>         spi_register_board_info(h3_spi_board_info,
>                                 ARRAY_SIZE(h3_spi_board_info));
> --
> 1.5.2.5
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
Eduardo Bezerra Valentin
-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux