| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | | - * intel_soc_pmic_core.c - Intel SoC PMIC MFD Driver |
|---|
| 3 | + * Intel SoC PMIC MFD Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013, 2014 Intel Corporation. All rights reserved. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License version |
|---|
| 8 | | - * 2 as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | * |
|---|
| 15 | 7 | * Author: Yang, Bin <bin.yang@intel.com> |
|---|
| 16 | 8 | * Author: Zhu, Lejun <lejun.zhu@linux.intel.com> |
|---|
| 17 | 9 | */ |
|---|
| 18 | 10 | |
|---|
| 19 | | -#include <linux/module.h> |
|---|
| 20 | | -#include <linux/mfd/core.h> |
|---|
| 11 | +#include <linux/acpi.h> |
|---|
| 21 | 12 | #include <linux/i2c.h> |
|---|
| 22 | 13 | #include <linux/interrupt.h> |
|---|
| 23 | | -#include <linux/gpio/consumer.h> |
|---|
| 24 | | -#include <linux/acpi.h> |
|---|
| 25 | | -#include <linux/regmap.h> |
|---|
| 14 | +#include <linux/module.h> |
|---|
| 15 | +#include <linux/mfd/core.h> |
|---|
| 26 | 16 | #include <linux/mfd/intel_soc_pmic.h> |
|---|
| 27 | | -#include <linux/gpio/machine.h> |
|---|
| 28 | 17 | #include <linux/pwm.h> |
|---|
| 18 | +#include <linux/regmap.h> |
|---|
| 19 | + |
|---|
| 29 | 20 | #include "intel_soc_pmic_core.h" |
|---|
| 30 | 21 | |
|---|
| 31 | 22 | /* Crystal Cove PMIC shares same ACPI ID between different platforms */ |
|---|
| 32 | 23 | #define BYT_CRC_HRV 2 |
|---|
| 33 | 24 | #define CHT_CRC_HRV 3 |
|---|
| 34 | 25 | |
|---|
| 35 | | -/* Lookup table for the Panel Enable/Disable line as GPIO signals */ |
|---|
| 36 | | -static struct gpiod_lookup_table panel_gpio_table = { |
|---|
| 37 | | - /* Intel GFX is consumer */ |
|---|
| 38 | | - .dev_id = "0000:00:02.0", |
|---|
| 39 | | - .table = { |
|---|
| 40 | | - /* Panel EN/DISABLE */ |
|---|
| 41 | | - GPIO_LOOKUP("gpio_crystalcove", 94, "panel", GPIO_ACTIVE_HIGH), |
|---|
| 42 | | - { }, |
|---|
| 43 | | - }, |
|---|
| 44 | | -}; |
|---|
| 45 | | - |
|---|
| 46 | 26 | /* PWM consumed by the Intel GFX */ |
|---|
| 47 | 27 | static struct pwm_lookup crc_pwm_lookup[] = { |
|---|
| 48 | | - PWM_LOOKUP("crystal_cove_pwm", 0, "0000:00:02.0", "pwm_backlight", 0, PWM_POLARITY_NORMAL), |
|---|
| 28 | + PWM_LOOKUP("crystal_cove_pwm", 0, "0000:00:02.0", "pwm_pmic_backlight", 0, PWM_POLARITY_NORMAL), |
|---|
| 49 | 29 | }; |
|---|
| 50 | 30 | |
|---|
| 51 | 31 | static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c, |
|---|
| .. | .. |
|---|
| 103 | 83 | if (ret) |
|---|
| 104 | 84 | dev_warn(dev, "Can't enable IRQ as wake source: %d\n", ret); |
|---|
| 105 | 85 | |
|---|
| 106 | | - /* Add lookup table binding for Panel Control to the GPIO Chip */ |
|---|
| 107 | | - gpiod_add_lookup_table(&panel_gpio_table); |
|---|
| 108 | | - |
|---|
| 109 | 86 | /* Add lookup table for crc-pwm */ |
|---|
| 110 | 87 | pwm_add_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); |
|---|
| 111 | 88 | |
|---|
| .. | .. |
|---|
| 118 | 95 | return 0; |
|---|
| 119 | 96 | |
|---|
| 120 | 97 | err_del_irq_chip: |
|---|
| 98 | + pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); |
|---|
| 121 | 99 | regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); |
|---|
| 122 | 100 | return ret; |
|---|
| 123 | 101 | } |
|---|
| .. | .. |
|---|
| 127 | 105 | struct intel_soc_pmic *pmic = dev_get_drvdata(&i2c->dev); |
|---|
| 128 | 106 | |
|---|
| 129 | 107 | regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data); |
|---|
| 130 | | - |
|---|
| 131 | | - /* Remove lookup table for Panel Control from the GPIO Chip */ |
|---|
| 132 | | - gpiod_remove_lookup_table(&panel_gpio_table); |
|---|
| 133 | 108 | |
|---|
| 134 | 109 | /* remove crc-pwm lookup table */ |
|---|
| 135 | 110 | pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup)); |
|---|