Merge branches 'acpi-utils', 'acpi-video', 'acpi-soc' and 'acpi-button'

* acpi-utils:
  gpio: merrifield: Fix build err without CONFIG_ACPI
  ACPI / utils: Remove deprecated function since no user left
  ASoC: Intel: cht_bsw_rt5672: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: cht_bsw_rt5645: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcr_rt5651: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcr_rt5640: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcht_es8316: Convert to use acpi_dev_get_first_match_dev()
  ASoC: Intel: bytcht_da7213: Convert to use acpi_dev_get_first_match_dev()
  gpio: merrifield: Convert to use acpi_dev_get_first_match_dev()
  extcon: axp288: Convert to use acpi_dev_get_first_match_dev()
  ACPI / utils: Introduce acpi_dev_get_first_match_dev() helper

* acpi-video:
  ACPI: video: Use vendor backlight on Sony VPCEH3U1E

* acpi-soc:
  ACPI / LPSS: Use acpi_lpss_* instead of acpi_subsys_* functions for hibernate

* acpi-button:
  ACPI: button: reinitialize button state upon resume
This commit is contained in:
Rafael J. Wysocki 2019-05-06 10:50:08 +02:00
14 changed files with 86 additions and 48 deletions

View File

@ -1142,8 +1142,8 @@ static struct dev_pm_domain acpi_lpss_pm_domain = {
.thaw_noirq = acpi_subsys_thaw_noirq, .thaw_noirq = acpi_subsys_thaw_noirq,
.poweroff = acpi_subsys_suspend, .poweroff = acpi_subsys_suspend,
.poweroff_late = acpi_lpss_suspend_late, .poweroff_late = acpi_lpss_suspend_late,
.poweroff_noirq = acpi_subsys_suspend_noirq, .poweroff_noirq = acpi_lpss_suspend_noirq,
.restore_noirq = acpi_subsys_resume_noirq, .restore_noirq = acpi_lpss_resume_noirq,
.restore_early = acpi_lpss_resume_early, .restore_early = acpi_lpss_resume_early,
#endif #endif
.runtime_suspend = acpi_lpss_runtime_suspend, .runtime_suspend = acpi_lpss_runtime_suspend,

View File

@ -456,8 +456,11 @@ static int acpi_button_resume(struct device *dev)
struct acpi_button *button = acpi_driver_data(device); struct acpi_button *button = acpi_driver_data(device);
button->suspended = false; button->suspended = false;
if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) {
button->last_state = !!acpi_lid_evaluate_state(device);
button->last_time = ktime_get();
acpi_lid_initialize_state(device); acpi_lid_initialize_state(device);
}
return 0; return 0;
} }
#endif #endif

View File

@ -739,6 +739,7 @@ EXPORT_SYMBOL(acpi_dev_found);
struct acpi_dev_match_info { struct acpi_dev_match_info {
const char *dev_name; const char *dev_name;
struct acpi_device *adev;
struct acpi_device_id hid[2]; struct acpi_device_id hid[2];
const char *uid; const char *uid;
s64 hrv; s64 hrv;
@ -759,6 +760,7 @@ static int acpi_dev_match_cb(struct device *dev, void *data)
return 0; return 0;
match->dev_name = acpi_dev_name(adev); match->dev_name = acpi_dev_name(adev);
match->adev = adev;
if (match->hrv == -1) if (match->hrv == -1)
return 1; return 1;
@ -806,18 +808,20 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
EXPORT_SYMBOL(acpi_dev_present); EXPORT_SYMBOL(acpi_dev_present);
/** /**
* acpi_dev_get_first_match_name - Return name of first match of ACPI device * acpi_dev_get_first_match_dev - Return the first match of ACPI device
* @hid: Hardware ID of the device. * @hid: Hardware ID of the device.
* @uid: Unique ID of the device, pass NULL to not check _UID * @uid: Unique ID of the device, pass NULL to not check _UID
* @hrv: Hardware Revision of the device, pass -1 to not check _HRV * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
* *
* Return device name if a matching device was present * Return the first match of ACPI device if a matching device was present
* at the moment of invocation, or NULL otherwise. * at the moment of invocation, or NULL otherwise.
* *
* The caller is responsible to call put_device() on the returned device.
*
* See additional information in acpi_dev_present() as well. * See additional information in acpi_dev_present() as well.
*/ */
const char * struct acpi_device *
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv) acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
{ {
struct acpi_dev_match_info match = {}; struct acpi_dev_match_info match = {};
struct device *dev; struct device *dev;
@ -827,9 +831,9 @@ acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
match.hrv = hrv; match.hrv = hrv;
dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb); dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
return dev ? match.dev_name : NULL; return dev ? match.adev : NULL;
} }
EXPORT_SYMBOL(acpi_dev_get_first_match_name); EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
/* /*
* acpi_backlight= handling, this is done here rather then in video_detect.c * acpi_backlight= handling, this is done here rather then in video_detect.c

View File

@ -141,6 +141,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"), DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
}, },
}, },
{
.callback = video_detect_force_vendor,
.ident = "Sony VPCEH3U1E",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),
},
},
/* /*
* These models have a working acpi_video backlight control, and using * These models have a working acpi_video backlight control, and using

View File

@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
struct axp288_extcon_info *info; struct axp288_extcon_info *info;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const char *name; struct acpi_device *adev;
int ret, i, pirq; int ret, i, pirq;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
name = acpi_dev_get_first_match_name("INT3496", NULL, -1); adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
if (name) { if (adev) {
info->id_extcon = extcon_get_extcon_dev(name); info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
put_device(&adev->dev);
if (!info->id_extcon) if (!info->id_extcon)
return -EPROBE_DEFER; return -EPROBE_DEFER;

View File

@ -377,10 +377,20 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
} }
} }
static const char *mrfld_gpio_get_pinctrl_dev_name(void) static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
{ {
const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1); struct acpi_device *adev;
return dev_name ? dev_name : "pinctrl-merrifield"; const char *name;
adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
if (adev) {
name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
acpi_dev_put(adev);
} else {
name = "pinctrl-merrifield";
}
return name;
} }
static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id) static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@ -441,7 +451,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev, const struct pci_device_id *id
return retval; return retval;
} }
pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(); pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv);
for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) { for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
range = &mrfld_gpio_ranges[i]; range = &mrfld_gpio_ranges[i];
retval = gpiochip_add_pin_range(&priv->chip, retval = gpiochip_add_pin_range(&priv->chip,

View File

@ -91,8 +91,8 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
bool acpi_dev_found(const char *hid); bool acpi_dev_found(const char *hid);
bool acpi_dev_present(const char *hid, const char *uid, s64 hrv); bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
const char * struct acpi_device *
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv); acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
@ -687,6 +687,10 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set); adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
} }
static inline void acpi_dev_put(struct acpi_device *adev)
{
put_device(&adev->dev);
}
#else /* CONFIG_ACPI */ #else /* CONFIG_ACPI */
static inline int register_acpi_bus_type(void *bus) { return 0; } static inline int register_acpi_bus_type(void *bus) { return 0; }

View File

@ -669,12 +669,14 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
return false; return false;
} }
static inline const char * static inline struct acpi_device *
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv) acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
{ {
return NULL; return NULL;
} }
static inline void acpi_dev_put(struct acpi_device *adev) {}
static inline bool is_acpi_node(struct fwnode_handle *fwnode) static inline bool is_acpi_node(struct fwnode_handle *fwnode)
{ {
return false; return false;

View File

@ -226,7 +226,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
struct snd_soc_card *card; struct snd_soc_card *card;
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
const char *i2c_name = NULL; struct acpi_device *adev;
int dai_index = 0; int dai_index = 0;
int ret_val = 0; int ret_val = 0;
int i; int i;
@ -244,10 +244,11 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (i2c_name) { if (adev) {
snprintf(codec_name, sizeof(codec_name), snprintf(codec_name, sizeof(codec_name),
"%s%s", "i2c-", i2c_name); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
dailink[dai_index].codec_name = codec_name; dailink[dai_index].codec_name = codec_name;
} }

View File

@ -442,7 +442,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
const char *i2c_name = NULL; struct acpi_device *adev;
struct device *codec_dev; struct device *codec_dev;
int dai_index = 0; int dai_index = 0;
int i; int i;
@ -463,10 +463,11 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (i2c_name) { if (adev) {
snprintf(codec_name, sizeof(codec_name), snprintf(codec_name, sizeof(codec_name),
"%s%s", "i2c-", i2c_name); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_cht_es8316_dais[dai_index].codec_name = codec_name; byt_cht_es8316_dais[dai_index].codec_name = codec_name;
} }

View File

@ -1154,7 +1154,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
struct byt_rt5640_private *priv; struct byt_rt5640_private *priv;
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
const char *i2c_name = NULL; struct acpi_device *adev;
int ret_val = 0; int ret_val = 0;
int dai_index = 0; int dai_index = 0;
int i; int i;
@ -1178,11 +1178,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (i2c_name) { if (adev) {
snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name), snprintf(byt_rt5640_codec_name, sizeof(byt_rt5640_codec_name),
"%s%s", "i2c-", i2c_name); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name; byt_rt5640_dais[dai_index].codec_name = byt_rt5640_codec_name;
} }

View File

@ -867,8 +867,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
struct byt_rt5651_private *priv; struct byt_rt5651_private *priv;
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
struct acpi_device *adev;
struct device *codec_dev; struct device *codec_dev;
const char *i2c_name = NULL;
const char *hp_swapped; const char *hp_swapped;
bool is_bytcr = false; bool is_bytcr = false;
int ret_val = 0; int ret_val = 0;
@ -894,14 +894,16 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (!i2c_name) { if (adev) {
snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
"i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
} else {
dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
return -ENODEV; return -ENODEV;
} }
snprintf(byt_rt5651_codec_name, sizeof(byt_rt5651_codec_name),
"%s%s", "i2c-", i2c_name);
byt_rt5651_dais[dai_index].codec_name = byt_rt5651_codec_name;
codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
byt_rt5651_codec_name); byt_rt5651_codec_name);

View File

@ -532,7 +532,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach; struct snd_soc_acpi_mach *mach;
const char *platform_name; const char *platform_name;
struct cht_mc_private *drv; struct cht_mc_private *drv;
const char *i2c_name = NULL; struct acpi_device *adev;
bool found = false; bool found = false;
bool is_bytcr = false; bool is_bytcr = false;
int dai_index = 0; int dai_index = 0;
@ -573,10 +573,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
} }
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (i2c_name) { if (adev) {
snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name), snprintf(cht_rt5645_codec_name, sizeof(cht_rt5645_codec_name),
"%s%s", "i2c-", i2c_name); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
cht_dailink[dai_index].codec_name = cht_rt5645_codec_name; cht_dailink[dai_index].codec_name = cht_rt5645_codec_name;
} }

View File

@ -401,7 +401,7 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
struct cht_mc_private *drv; struct cht_mc_private *drv;
struct snd_soc_acpi_mach *mach = pdev->dev.platform_data; struct snd_soc_acpi_mach *mach = pdev->dev.platform_data;
const char *platform_name; const char *platform_name;
const char *i2c_name; struct acpi_device *adev;
int i; int i;
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL); drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
@ -411,10 +411,11 @@ static int snd_cht_mc_probe(struct platform_device *pdev)
strcpy(drv->codec_name, RT5672_I2C_DEFAULT); strcpy(drv->codec_name, RT5672_I2C_DEFAULT);
/* fixup codec name based on HID */ /* fixup codec name based on HID */
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1); adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
if (i2c_name) { if (adev) {
snprintf(drv->codec_name, sizeof(drv->codec_name), snprintf(drv->codec_name, sizeof(drv->codec_name),
"i2c-%s", i2c_name); "i2c-%s", acpi_dev_name(adev));
put_device(&adev->dev);
for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) { for (i = 0; i < ARRAY_SIZE(cht_dailink); i++) {
if (!strcmp(cht_dailink[i].codec_name, if (!strcmp(cht_dailink[i].codec_name,
RT5672_I2C_DEFAULT)) { RT5672_I2C_DEFAULT)) {