.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Support for HP iPAQ hx4700 PDAs. |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | * Copyright (c) 2004 Hewlett-Packard Company. |
---|
8 | 9 | * Copyright (c) 2005 SDG Systems, LLC |
---|
9 | 10 | * Copyright (c) 2006 Anton Vorontsov <cbou@mail.ru> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License version 2 as |
---|
13 | | - * published by the Free Software Foundation. |
---|
14 | | - * |
---|
15 | 11 | */ |
---|
16 | 12 | |
---|
17 | 13 | #include <linux/kernel.h> |
---|
.. | .. |
---|
19 | 15 | #include <linux/platform_device.h> |
---|
20 | 16 | #include <linux/delay.h> |
---|
21 | 17 | #include <linux/fb.h> |
---|
| 18 | +#include <linux/gpio/machine.h> |
---|
22 | 19 | #include <linux/gpio.h> |
---|
23 | 20 | #include <linux/gpio_keys.h> |
---|
24 | 21 | #include <linux/input.h> |
---|
.. | .. |
---|
37 | 34 | #include <linux/spi/ads7846.h> |
---|
38 | 35 | #include <linux/spi/spi.h> |
---|
39 | 36 | #include <linux/spi/pxa2xx_spi.h> |
---|
40 | | -#include <linux/usb/gpio_vbus.h> |
---|
41 | 37 | #include <linux/platform_data/i2c-pxa.h> |
---|
42 | 38 | |
---|
43 | 39 | #include <mach/hardware.h> |
---|
.. | .. |
---|
560 | 556 | static struct platform_pwm_backlight_data backlight_data = { |
---|
561 | 557 | .max_brightness = 200, |
---|
562 | 558 | .dft_brightness = 100, |
---|
563 | | - .enable_gpio = -1, |
---|
564 | 559 | }; |
---|
565 | 560 | |
---|
566 | 561 | static struct platform_device backlight = { |
---|
.. | .. |
---|
581 | 576 | * USB "Transceiver" |
---|
582 | 577 | */ |
---|
583 | 578 | |
---|
584 | | -static struct gpio_vbus_mach_info gpio_vbus_info = { |
---|
585 | | - .gpio_pullup = GPIO76_HX4700_USBC_PUEN, |
---|
586 | | - .gpio_vbus = GPIOD14_nUSBC_DETECT, |
---|
587 | | - .gpio_vbus_inverted = 1, |
---|
| 579 | +static struct gpiod_lookup_table gpio_vbus_gpiod_table = { |
---|
| 580 | + .dev_id = "gpio-vbus", |
---|
| 581 | + .table = { |
---|
| 582 | + /* This GPIO is on ASIC3 */ |
---|
| 583 | + GPIO_LOOKUP("asic3", |
---|
| 584 | + /* Convert to a local offset on the ASIC3 */ |
---|
| 585 | + GPIOD14_nUSBC_DETECT - HX4700_ASIC3_GPIO_BASE, |
---|
| 586 | + "vbus", GPIO_ACTIVE_LOW), |
---|
| 587 | + /* This one is on the primary SOC GPIO */ |
---|
| 588 | + GPIO_LOOKUP("gpio-pxa", GPIO76_HX4700_USBC_PUEN, |
---|
| 589 | + "pullup", GPIO_ACTIVE_HIGH), |
---|
| 590 | + { }, |
---|
| 591 | + }, |
---|
588 | 592 | }; |
---|
589 | 593 | |
---|
590 | 594 | static struct platform_device gpio_vbus = { |
---|
591 | 595 | .name = "gpio-vbus", |
---|
592 | 596 | .id = -1, |
---|
593 | | - .dev = { |
---|
594 | | - .platform_data = &gpio_vbus_info, |
---|
595 | | - }, |
---|
596 | 597 | }; |
---|
597 | 598 | |
---|
598 | 599 | static struct pxa2xx_udc_mach_info hx4700_udc_info; |
---|
.. | .. |
---|
629 | 630 | }, |
---|
630 | 631 | }; |
---|
631 | 632 | |
---|
632 | | -static struct pxa2xx_spi_master pxa_ssp2_master_info = { |
---|
| 633 | +static struct pxa2xx_spi_controller pxa_ssp2_master_info = { |
---|
633 | 634 | .num_chipselect = 1, |
---|
634 | 635 | .enable_dma = 1, |
---|
635 | 636 | }; |
---|
.. | .. |
---|
702 | 703 | .consumer_supplies = bq24022_consumers, |
---|
703 | 704 | }; |
---|
704 | 705 | |
---|
705 | | -static struct gpio bq24022_gpios[] = { |
---|
706 | | - { GPIO96_HX4700_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" }, |
---|
707 | | -}; |
---|
| 706 | +static enum gpiod_flags bq24022_gpiod_gflags[] = { GPIOD_OUT_LOW }; |
---|
708 | 707 | |
---|
709 | 708 | static struct gpio_regulator_state bq24022_states[] = { |
---|
710 | 709 | { .value = 100000, .gpios = (0 << 0) }, |
---|
.. | .. |
---|
714 | 713 | static struct gpio_regulator_config bq24022_info = { |
---|
715 | 714 | .supply_name = "bq24022", |
---|
716 | 715 | |
---|
717 | | - .enable_gpio = GPIO72_HX4700_BQ24022_nCHARGE_EN, |
---|
718 | | - .enable_high = 0, |
---|
719 | 716 | .enabled_at_boot = 0, |
---|
720 | 717 | |
---|
721 | | - .gpios = bq24022_gpios, |
---|
722 | | - .nr_gpios = ARRAY_SIZE(bq24022_gpios), |
---|
| 718 | + .gflags = bq24022_gpiod_gflags, |
---|
| 719 | + .ngpios = ARRAY_SIZE(bq24022_gpiod_gflags), |
---|
723 | 720 | |
---|
724 | 721 | .states = bq24022_states, |
---|
725 | 722 | .nr_states = ARRAY_SIZE(bq24022_states), |
---|
.. | .. |
---|
733 | 730 | .id = -1, |
---|
734 | 731 | .dev = { |
---|
735 | 732 | .platform_data = &bq24022_info, |
---|
| 733 | + }, |
---|
| 734 | +}; |
---|
| 735 | + |
---|
| 736 | +static struct gpiod_lookup_table bq24022_gpiod_table = { |
---|
| 737 | + .dev_id = "gpio-regulator", |
---|
| 738 | + .table = { |
---|
| 739 | + GPIO_LOOKUP("gpio-pxa", GPIO96_HX4700_BQ24022_ISET2, |
---|
| 740 | + NULL, GPIO_ACTIVE_HIGH), |
---|
| 741 | + GPIO_LOOKUP("gpio-pxa", GPIO72_HX4700_BQ24022_nCHARGE_EN, |
---|
| 742 | + "enable", GPIO_ACTIVE_LOW), |
---|
| 743 | + { }, |
---|
736 | 744 | }, |
---|
737 | 745 | }; |
---|
738 | 746 | |
---|
.. | .. |
---|
878 | 886 | pxa_set_btuart_info(NULL); |
---|
879 | 887 | pxa_set_stuart_info(NULL); |
---|
880 | 888 | |
---|
| 889 | + gpiod_add_lookup_table(&bq24022_gpiod_table); |
---|
| 890 | + gpiod_add_lookup_table(&gpio_vbus_gpiod_table); |
---|
881 | 891 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
---|
882 | 892 | pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup)); |
---|
883 | 893 | |
---|