Skip to content

Commit 7e8e05f

Browse files
committed
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
5 parents 9175145 + fe06662 + aefa763 + c8afd03 + 13e9621 commit 7e8e05f

File tree

14 files changed

+86
-48
lines changed

14 files changed

+86
-48
lines changed

drivers/acpi/acpi_lpss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,8 @@ static struct dev_pm_domain acpi_lpss_pm_domain = {
11421142
.thaw_noirq = acpi_subsys_thaw_noirq,
11431143
.poweroff = acpi_subsys_suspend,
11441144
.poweroff_late = acpi_lpss_suspend_late,
1145-
.poweroff_noirq = acpi_subsys_suspend_noirq,
1146-
.restore_noirq = acpi_subsys_resume_noirq,
1145+
.poweroff_noirq = acpi_lpss_suspend_noirq,
1146+
.restore_noirq = acpi_lpss_resume_noirq,
11471147
.restore_early = acpi_lpss_resume_early,
11481148
#endif
11491149
.runtime_suspend = acpi_lpss_runtime_suspend,

drivers/acpi/button.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,11 @@ static int acpi_button_resume(struct device *dev)
456456
struct acpi_button *button = acpi_driver_data(device);
457457

458458
button->suspended = false;
459-
if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users)
459+
if (button->type == ACPI_BUTTON_TYPE_LID && button->input->users) {
460+
button->last_state = !!acpi_lid_evaluate_state(device);
461+
button->last_time = ktime_get();
460462
acpi_lid_initialize_state(device);
463+
}
461464
return 0;
462465
}
463466
#endif

drivers/acpi/utils.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ EXPORT_SYMBOL(acpi_dev_found);
739739

740740
struct acpi_dev_match_info {
741741
const char *dev_name;
742+
struct acpi_device *adev;
742743
struct acpi_device_id hid[2];
743744
const char *uid;
744745
s64 hrv;
@@ -759,6 +760,7 @@ static int acpi_dev_match_cb(struct device *dev, void *data)
759760
return 0;
760761

761762
match->dev_name = acpi_dev_name(adev);
763+
match->adev = adev;
762764

763765
if (match->hrv == -1)
764766
return 1;
@@ -806,18 +808,20 @@ bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
806808
EXPORT_SYMBOL(acpi_dev_present);
807809

808810
/**
809-
* acpi_dev_get_first_match_name - Return name of first match of ACPI device
811+
* acpi_dev_get_first_match_dev - Return the first match of ACPI device
810812
* @hid: Hardware ID of the device.
811813
* @uid: Unique ID of the device, pass NULL to not check _UID
812814
* @hrv: Hardware Revision of the device, pass -1 to not check _HRV
813815
*
814-
* Return device name if a matching device was present
816+
* Return the first match of ACPI device if a matching device was present
815817
* at the moment of invocation, or NULL otherwise.
816818
*
819+
* The caller is responsible to call put_device() on the returned device.
820+
*
817821
* See additional information in acpi_dev_present() as well.
818822
*/
819-
const char *
820-
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
823+
struct acpi_device *
824+
acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
821825
{
822826
struct acpi_dev_match_info match = {};
823827
struct device *dev;
@@ -827,9 +831,9 @@ acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
827831
match.hrv = hrv;
828832

829833
dev = bus_find_device(&acpi_bus_type, NULL, &match, acpi_dev_match_cb);
830-
return dev ? match.dev_name : NULL;
834+
return dev ? match.adev : NULL;
831835
}
832-
EXPORT_SYMBOL(acpi_dev_get_first_match_name);
836+
EXPORT_SYMBOL(acpi_dev_get_first_match_dev);
833837

834838
/*
835839
* acpi_backlight= handling, this is done here rather then in video_detect.c

drivers/acpi/video_detect.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,14 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
141141
DMI_MATCH(DMI_PRODUCT_NAME, "UL30A"),
142142
},
143143
},
144+
{
145+
.callback = video_detect_force_vendor,
146+
.ident = "Sony VPCEH3U1E",
147+
.matches = {
148+
DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
149+
DMI_MATCH(DMI_PRODUCT_NAME, "VPCEH3U1E"),
150+
},
151+
},
144152

145153
/*
146154
* These models have a working acpi_video backlight control, and using

drivers/extcon/extcon-axp288.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
333333
struct axp288_extcon_info *info;
334334
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
335335
struct device *dev = &pdev->dev;
336-
const char *name;
336+
struct acpi_device *adev;
337337
int ret, i, pirq;
338338

339339
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
@@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev)
357357
if (ret)
358358
return ret;
359359

360-
name = acpi_dev_get_first_match_name("INT3496", NULL, -1);
361-
if (name) {
362-
info->id_extcon = extcon_get_extcon_dev(name);
360+
adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1);
361+
if (adev) {
362+
info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev));
363+
put_device(&adev->dev);
363364
if (!info->id_extcon)
364365
return -EPROBE_DEFER;
365366

drivers/gpio/gpio-merrifield.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,20 @@ static void mrfld_irq_init_hw(struct mrfld_gpio *priv)
377377
}
378378
}
379379

380-
static const char *mrfld_gpio_get_pinctrl_dev_name(void)
380+
static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio *priv)
381381
{
382-
const char *dev_name = acpi_dev_get_first_match_name("INTC1002", NULL, -1);
383-
return dev_name ? dev_name : "pinctrl-merrifield";
382+
struct acpi_device *adev;
383+
const char *name;
384+
385+
adev = acpi_dev_get_first_match_dev("INTC1002", NULL, -1);
386+
if (adev) {
387+
name = devm_kstrdup(priv->dev, acpi_dev_name(adev), GFP_KERNEL);
388+
acpi_dev_put(adev);
389+
} else {
390+
name = "pinctrl-merrifield";
391+
}
392+
393+
return name;
384394
}
385395

386396
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
441451
return retval;
442452
}
443453

444-
pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name();
454+
pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv);
445455
for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
446456
range = &mrfld_gpio_ranges[i];
447457
retval = gpiochip_add_pin_range(&priv->chip,

include/acpi/acpi_bus.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,
9191
bool acpi_dev_found(const char *hid);
9292
bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
9393

94-
const char *
95-
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv);
94+
struct acpi_device *
95+
acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);
9696

9797
#ifdef CONFIG_ACPI
9898

@@ -687,6 +687,10 @@ static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
687687
adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
688688
}
689689

690+
static inline void acpi_dev_put(struct acpi_device *adev)
691+
{
692+
put_device(&adev->dev);
693+
}
690694
#else /* CONFIG_ACPI */
691695

692696
static inline int register_acpi_bus_type(void *bus) { return 0; }

include/linux/acpi.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,14 @@ static inline bool acpi_dev_present(const char *hid, const char *uid, s64 hrv)
669669
return false;
670670
}
671671

672-
static inline const char *
673-
acpi_dev_get_first_match_name(const char *hid, const char *uid, s64 hrv)
672+
static inline struct acpi_device *
673+
acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
674674
{
675675
return NULL;
676676
}
677677

678+
static inline void acpi_dev_put(struct acpi_device *adev) {}
679+
678680
static inline bool is_acpi_node(struct fwnode_handle *fwnode)
679681
{
680682
return false;

sound/soc/intel/boards/bytcht_da7213.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
226226
struct snd_soc_card *card;
227227
struct snd_soc_acpi_mach *mach;
228228
const char *platform_name;
229-
const char *i2c_name = NULL;
229+
struct acpi_device *adev;
230230
int dai_index = 0;
231231
int ret_val = 0;
232232
int i;
@@ -244,10 +244,11 @@ static int bytcht_da7213_probe(struct platform_device *pdev)
244244
}
245245

246246
/* fixup codec name based on HID */
247-
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
248-
if (i2c_name) {
247+
adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
248+
if (adev) {
249249
snprintf(codec_name, sizeof(codec_name),
250-
"%s%s", "i2c-", i2c_name);
250+
"i2c-%s", acpi_dev_name(adev));
251+
put_device(&adev->dev);
251252
dailink[dai_index].codec_name = codec_name;
252253
}
253254

sound/soc/intel/boards/bytcht_es8316.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
442442
struct device *dev = &pdev->dev;
443443
struct snd_soc_acpi_mach *mach;
444444
const char *platform_name;
445-
const char *i2c_name = NULL;
445+
struct acpi_device *adev;
446446
struct device *codec_dev;
447447
int dai_index = 0;
448448
int i;
@@ -463,10 +463,11 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
463463
}
464464

465465
/* fixup codec name based on HID */
466-
i2c_name = acpi_dev_get_first_match_name(mach->id, NULL, -1);
467-
if (i2c_name) {
466+
adev = acpi_dev_get_first_match_dev(mach->id, NULL, -1);
467+
if (adev) {
468468
snprintf(codec_name, sizeof(codec_name),
469-
"%s%s", "i2c-", i2c_name);
469+
"i2c-%s", acpi_dev_name(adev));
470+
put_device(&adev->dev);
470471
byt_cht_es8316_dais[dai_index].codec_name = codec_name;
471472
}
472473

0 commit comments

Comments
 (0)