Commit aad659e4 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpi-cppc', 'acpi-video' and 'acpi-utils'

* acpi-cppc:
  ACPI: CPPC: Replace cppc_attr with kobj_attribute
  ACPI: CPPC: Add emtpy stubs of functions for CONFIG_ACPI_CPPC_LIB unset

* acpi-video:
  ACPI: video: use native backlight for GA401/GA502/GA503
  ACPI: video: Check LCD flag on ACPI-reduced-hardware devices
  ACPI: utils: Add acpi_reduced_hardware() helper

* acpi-utils:
  ACPI: utils: Capitalize abbreviations in the comments
  ACPI: utils: Document for_each_acpi_dev_match() macro
Loading
Loading
Loading
Loading
+26 −13
Original line number Diff line number Diff line
@@ -2182,6 +2182,30 @@ static bool dmi_is_desktop(void)
	return false;
}

/*
 * We're seeing a lot of bogus backlight interfaces on newer machines
 * without a LCD such as desktops, servers and HDMI sticks. Checking the
 * lcd flag fixes this, enable this by default on any machines which are:
 * 1.  Win8 ready (where we also prefer the native backlight driver, so
 *     normally the acpi_video code should not register there anyways); *and*
 * 2.1 Report a desktop/server DMI chassis-type, or
 * 2.2 Are an ACPI-reduced-hardware platform (and thus won't use the EC for
       backlight control)
 */
static bool should_check_lcd_flag(void)
{
	if (!acpi_osi_is_win8())
		return false;

	if (dmi_is_desktop())
		return true;

	if (acpi_reduced_hardware())
		return true;

	return false;
}

int acpi_video_register(void)
{
	int ret = 0;
@@ -2195,19 +2219,8 @@ int acpi_video_register(void)
		goto leave;
	}

	/*
	 * We're seeing a lot of bogus backlight interfaces on newer machines
	 * without a LCD such as desktops, servers and HDMI sticks. Checking
	 * the lcd flag fixes this, so enable this on any machines which are
	 * win8 ready (where we also prefer the native backlight driver, so
	 * normally the acpi_video code should not register there anyways).
	 */
	if (only_lcd == -1) {
		if (dmi_is_desktop() && acpi_osi_is_win8())
			only_lcd = true;
		else
			only_lcd = false;
	}
	if (only_lcd == -1)
		only_lcd = should_check_lcd_flag();

	dmi_check_system(video_dmi_table);

+3 −12
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@

#define pr_fmt(fmt)	"ACPI CPPC: " fmt

#include <linux/cpufreq.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
#include <linux/ktime.h>
@@ -119,23 +118,15 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr);
 */
#define NUM_RETRIES 500ULL

struct cppc_attr {
	struct attribute attr;
	ssize_t (*show)(struct kobject *kobj,
			struct attribute *attr, char *buf);
	ssize_t (*store)(struct kobject *kobj,
			struct attribute *attr, const char *c, ssize_t count);
};

#define define_one_cppc_ro(_name)		\
static struct cppc_attr _name =			\
static struct kobj_attribute _name =		\
__ATTR(_name, 0444, show_##_name, NULL)

#define to_cpc_desc(a) container_of(a, struct cpc_desc, kobj)

#define show_cppc_data(access_fn, struct_name, member_name)		\
	static ssize_t show_##member_name(struct kobject *kobj,		\
					struct attribute *attr,	char *buf) \
				struct kobj_attribute *attr, char *buf)	\
	{								\
		struct cpc_desc *cpc_ptr = to_cpc_desc(kobj);		\
		struct struct_name st_name = {0};			\
@@ -161,7 +152,7 @@ show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, reference_perf);
show_cppc_data(cppc_get_perf_ctrs, cppc_perf_fb_ctrs, wraparound_time);

static ssize_t show_feedback_ctrs(struct kobject *kobj,
		struct attribute *attr, char *buf)
		struct kobj_attribute *attr, char *buf)
{
	struct cpc_desc *cpc_ptr = to_cpc_desc(kobj);
	struct cppc_perf_fb_ctrs fb_ctrs = {0};
+19 −4
Original line number Diff line number Diff line
@@ -811,7 +811,7 @@ static int acpi_dev_match_cb(struct device *dev, const void *data)
 * Note that if the device is pluggable, it may since have disappeared.
 *
 * Note that unlike acpi_dev_found() this function checks the status
 * of the device. So for devices which are present in the dsdt, but
 * of the device. So for devices which are present in the DSDT, but
 * which are disabled (their _STA callback returns 0) this function
 * will return false.
 *
@@ -838,7 +838,7 @@ EXPORT_SYMBOL(acpi_dev_present);

/**
 * acpi_dev_get_next_match_dev - Return the next match of ACPI device
 * @adev: Pointer to the previous acpi_device matching this @hid, @uid and @hrv
 * @adev: Pointer to the previous ACPI device matching this @hid, @uid and @hrv
 * @hid: Hardware ID of the device.
 * @uid: Unique ID of the device, pass NULL to not check _UID
 * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
@@ -846,7 +846,11 @@ EXPORT_SYMBOL(acpi_dev_present);
 * Return the next match of ACPI device if another matching device was present
 * at the moment of invocation, or NULL otherwise.
 *
 * The caller is responsible to call put_device() on the returned device.
 * FIXME: The function does not tolerate the sudden disappearance of @adev, e.g.
 * in the case of a hotplug event. That said, the caller should ensure that
 * this will never happen.
 *
 * The caller is responsible for invoking acpi_dev_put() on the returned device.
 *
 * See additional information in acpi_dev_present() as well.
 */
@@ -875,7 +879,7 @@ EXPORT_SYMBOL(acpi_dev_get_next_match_dev);
 * Return the first match of ACPI device if a matching device was present
 * at the moment of invocation, or NULL otherwise.
 *
 * The caller is responsible to call put_device() on the returned device.
 * The caller is responsible for invoking acpi_dev_put() on the returned device.
 *
 * See additional information in acpi_dev_present() as well.
 */
@@ -886,6 +890,17 @@ acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv)
}
EXPORT_SYMBOL(acpi_dev_get_first_match_dev);

/**
 * acpi_reduced_hardware - Return if this is an ACPI-reduced-hw machine
 *
 * Return true when running on an ACPI-reduced-hw machine, false otherwise.
 */
bool acpi_reduced_hardware(void)
{
	return acpi_gbl_reduced_hardware;
}
EXPORT_SYMBOL_GPL(acpi_reduced_hardware);

/*
 * acpi_backlight= handling, this is done here rather then in video_detect.c
 * because __setup cannot be used in modules.
+24 −0
Original line number Diff line number Diff line
@@ -385,6 +385,30 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
		DMI_MATCH(DMI_BOARD_NAME, "BA51_MV"),
		},
	},
	{
	.callback = video_detect_force_native,
	.ident = "ASUSTeK COMPUTER INC. GA401",
	.matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
		DMI_MATCH(DMI_PRODUCT_NAME, "GA401"),
		},
	},
	{
	.callback = video_detect_force_native,
	.ident = "ASUSTeK COMPUTER INC. GA502",
	.matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
		DMI_MATCH(DMI_PRODUCT_NAME, "GA502"),
		},
	},
	{
	.callback = video_detect_force_native,
	.ident = "ASUSTeK COMPUTER INC. GA503",
	.matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
		DMI_MATCH(DMI_PRODUCT_NAME, "GA503"),
		},
	},

	/*
	 * Desktops which falsely report a backlight and which our heuristics
+15 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ acpi_evaluate_dsm_typed(acpi_handle handle, const guid_t *guid, u64 rev,

bool acpi_dev_found(const char *hid);
bool acpi_dev_present(const char *hid, const char *uid, s64 hrv);
bool acpi_reduced_hardware(void);

#ifdef CONFIG_ACPI

@@ -689,6 +690,20 @@ acpi_dev_get_next_match_dev(struct acpi_device *adev, const char *hid, const cha
struct acpi_device *
acpi_dev_get_first_match_dev(const char *hid, const char *uid, s64 hrv);

/**
 * for_each_acpi_dev_match - iterate over ACPI devices that matching the criteria
 * @adev: pointer to the matching ACPI device, NULL at the end of the loop
 * @hid: Hardware ID of the device.
 * @uid: Unique ID of the device, pass NULL to not check _UID
 * @hrv: Hardware Revision of the device, pass -1 to not check _HRV
 *
 * The caller is responsible for invoking acpi_dev_put() on the returned device.
 *
 * FIXME: Due to above requirement there is a window that may invalidate @adev
 * and next iteration will use a dangling pointer, e.g. in the case of a
 * hotplug event. That said, the caller should ensure that this will never
 * happen.
 */
#define for_each_acpi_dev_match(adev, hid, uid, hrv)			\
	for (adev = acpi_dev_get_first_match_dev(hid, uid, hrv);	\
	     adev;							\
Loading