Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1544254
| From | Hans de Goede <hdegoede@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data |
| Date | 2016-12-19 01:20 +0100 |
| Message-ID | <sPTQl-tj-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
When the extcon_axp288 driver was originally merged, it was merged with
a dependency on some other driver providing platform data for it.
However such another driver was never merged, so the extcon_axp288 as
merged upstream has never worked, its probe method simply always returns
-ENODEV.
This commit drops the dependency on the pdata always being there, instead
it treats not having pdata as the pdata having a NULL gpio_mux_control,
something which the code was already prepared to handle.
Note that the code for controlling the mux_control gpio is left in place,
as this may be necessary to allow the axp288 pmic to properly detect the
charger type (instead of assuming 500mA max charge current) on some
tablets. This will make it easier for future patches to add support for
this gpio by getting the gpio info from somewhere.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/extcon/extcon-axp288.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c
index 42f41e8..a84fab8 100644
--- a/drivers/extcon/extcon-axp288.c
+++ b/drivers/extcon/extcon-axp288.c
@@ -112,7 +112,7 @@ struct axp288_extcon_info {
struct device *dev;
struct regmap *regmap;
struct regmap_irq_chip_data *regmap_irqc;
- struct axp288_extcon_pdata *pdata;
+ struct gpio_desc *gpio_mux_cntl;
int irq[EXTCON_IRQ_END];
struct extcon_dev *edev;
struct notifier_block extcon_nb;
@@ -216,8 +216,8 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
* If VBUS is absent Connect D+/D- lines to PMIC for BC
* detection. Else connect them to SOC for USB communication.
*/
- if (info->pdata->gpio_mux_cntl)
- gpiod_set_value(info->pdata->gpio_mux_cntl,
+ if (info->gpio_mux_cntl)
+ gpiod_set_value(info->gpio_mux_cntl,
vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
: EXTCON_GPIO_MUX_SEL_PMIC);
@@ -271,6 +271,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
{
struct axp288_extcon_info *info;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
+ struct axp288_extcon_pdata *pdata = pdev->dev.platform_data;
int ret, i, pirq, gpio;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -280,15 +281,9 @@ static int axp288_extcon_probe(struct platform_device *pdev)
info->dev = &pdev->dev;
info->regmap = axp20x->regmap;
info->regmap_irqc = axp20x->regmap_irqc;
- info->pdata = pdev->dev.platform_data;
-
- if (!info->pdata) {
- /* Try ACPI provided pdata via device properties */
- if (!device_property_present(&pdev->dev,
- "axp288_extcon_data\n"))
- dev_err(&pdev->dev, "failed to get platform data\n");
- return -ENODEV;
- }
+ if (pdata)
+ info->gpio_mux_cntl = pdata->gpio_mux_cntl;
+
platform_set_drvdata(pdev, info);
axp288_extcon_log_rsi(info);
@@ -316,15 +311,15 @@ static int axp288_extcon_probe(struct platform_device *pdev)
}
/* Set up gpio control for USB Mux */
- if (info->pdata->gpio_mux_cntl) {
- gpio = desc_to_gpio(info->pdata->gpio_mux_cntl);
+ if (info->gpio_mux_cntl) {
+ gpio = desc_to_gpio(info->gpio_mux_cntl);
ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX");
if (ret < 0) {
dev_err(&pdev->dev,
"failed to request the gpio=%d\n", gpio);
return ret;
}
- gpiod_direction_output(info->pdata->gpio_mux_cntl,
+ gpiod_direction_output(info->gpio_mux_cntl,
EXTCON_GPIO_MUX_SEL_PMIC);
}
--
2.9.3
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data Hans de Goede <hdegoede@redhat.com> - 2016-12-19 01:20 +0100
[PATCH 4/8] extcon: axp288: Fix possibly reporting 2 cables in state true Hans de Goede <hdegoede@redhat.com> - 2016-12-19 01:20 +0100
Re: [PATCH 4/8] extcon: axp288: Fix possibly reporting 2 cables in state true Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-19 07:30 +0100
[PATCH 2/8] extcon: axp288: Remove usb_phy notification code Hans de Goede <hdegoede@redhat.com> - 2016-12-19 01:20 +0100
Re: [PATCH 2/8] extcon: axp288: Remove usb_phy notification code Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-19 08:00 +0100
Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-19 07:20 +0100
Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-19 08:00 +0100
Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data Hans de Goede <hdegoede@redhat.com> - 2016-12-19 09:20 +0100
Re: [PATCH 1/8] extcon: axp288: Remove dependency on non-existing platform_data Chanwoo Choi <cw00.choi@samsung.com> - 2016-12-19 09:30 +0100
csiph-web