^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * dptf_power: DPTF platform power driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2016, Intel Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/acpi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * Presentation of attributes which are defined for INT3407 and INT3532.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * They are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * PMAX : Maximum platform powe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * PSRC : Platform power source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * ARTG : Adapter rating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * CTYP : Charger type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * PBSS : Battery steady power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * PROP : Rest of worst case platform Power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * PBSS : Power Battery Steady State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * PBSS : Power Battery Steady State
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) * RBHF : High Frequency Impedance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * VBNL : Instantaneous No-Load Voltage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * CMPP : Current Discharge Capability
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define DPTF_POWER_SHOW(name, object) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) static ssize_t name##_show(struct device *dev,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct device_attribute *attr,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) char *buf)\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) {\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct acpi_device *acpi_dev = dev_get_drvdata(dev);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) unsigned long long val;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) acpi_status status;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) status = acpi_evaluate_integer(acpi_dev->handle, #object,\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) NULL, &val);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) if (ACPI_SUCCESS(status))\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) return sprintf(buf, "%d\n", (int)val);\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) else \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return -EINVAL;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) DPTF_POWER_SHOW(max_platform_power_mw, PMAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) DPTF_POWER_SHOW(platform_power_source, PSRC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) DPTF_POWER_SHOW(adapter_rating_mw, ARTG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) DPTF_POWER_SHOW(battery_steady_power_mw, PBSS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) DPTF_POWER_SHOW(charger_type, CTYP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) DPTF_POWER_SHOW(rest_of_platform_power_mw, PROP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) DPTF_POWER_SHOW(max_steady_state_power_mw, PBSS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) DPTF_POWER_SHOW(high_freq_impedance_mohm, RBHF)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) DPTF_POWER_SHOW(no_load_voltage_mv, VBNL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) DPTF_POWER_SHOW(current_discharge_capbility_ma, CMPP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static DEVICE_ATTR_RO(max_platform_power_mw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) static DEVICE_ATTR_RO(platform_power_source);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) static DEVICE_ATTR_RO(adapter_rating_mw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static DEVICE_ATTR_RO(battery_steady_power_mw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) static DEVICE_ATTR_RO(charger_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static DEVICE_ATTR_RO(rest_of_platform_power_mw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static DEVICE_ATTR_RO(max_steady_state_power_mw);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) static DEVICE_ATTR_RO(high_freq_impedance_mohm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static DEVICE_ATTR_RO(no_load_voltage_mv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static DEVICE_ATTR_RO(current_discharge_capbility_ma);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) static ssize_t prochot_confirm_store(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) const char *buf, size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct acpi_device *acpi_dev = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) int seq_no;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) if (kstrtouint(buf, 0, &seq_no) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) status = acpi_execute_simple_method(acpi_dev->handle, "PBOK", seq_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) if (ACPI_SUCCESS(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static DEVICE_ATTR_WO(prochot_confirm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static struct attribute *dptf_power_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) &dev_attr_max_platform_power_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) &dev_attr_platform_power_source.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) &dev_attr_adapter_rating_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) &dev_attr_battery_steady_power_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) &dev_attr_charger_type.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) &dev_attr_rest_of_platform_power_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) &dev_attr_prochot_confirm.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) static const struct attribute_group dptf_power_attribute_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) .attrs = dptf_power_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) .name = "dptf_power"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static struct attribute *dptf_battery_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) &dev_attr_max_platform_power_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) &dev_attr_max_steady_state_power_mw.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) &dev_attr_high_freq_impedance_mohm.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) &dev_attr_no_load_voltage_mv.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) &dev_attr_current_discharge_capbility_ma.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static const struct attribute_group dptf_battery_attribute_group = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) .attrs = dptf_battery_attrs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) .name = "dptf_battery"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) #define MAX_POWER_CHANGED 0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #define POWER_STATE_CHANGED 0x81
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) #define STEADY_STATE_POWER_CHANGED 0x83
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) #define POWER_PROP_CHANGE_EVENT 0x84
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define IMPEDANCED_CHNGED 0x85
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define VOLTAGE_CURRENT_CHANGED 0x86
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static long long dptf_participant_type(acpi_handle handle)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned long long ptype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) acpi_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) status = acpi_evaluate_integer(handle, "PTYP", NULL, &ptype);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (ACPI_FAILURE(status))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) return ptype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) static void dptf_power_notify(acpi_handle handle, u32 event, void *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct platform_device *pdev = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) char *attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) switch (event) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) case POWER_STATE_CHANGED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) attr = "platform_power_source";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) case POWER_PROP_CHANGE_EVENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) attr = "rest_of_platform_power_mw";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) case MAX_POWER_CHANGED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) attr = "max_platform_power_mw";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) case STEADY_STATE_POWER_CHANGED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) attr = "max_steady_state_power_mw";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) case VOLTAGE_CURRENT_CHANGED:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) attr = "no_load_voltage_mv";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) dev_err(&pdev->dev, "Unsupported event [0x%x]\n", event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) * Notify that an attribute is changed, so that user space can read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * again.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) if (dptf_participant_type(handle) == 0x0CULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) sysfs_notify(&pdev->dev.kobj, "dptf_battery", attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) sysfs_notify(&pdev->dev.kobj, "dptf_power", attr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) static int dptf_power_add(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) const struct attribute_group *attr_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) struct acpi_device *acpi_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) unsigned long long ptype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) acpi_dev = ACPI_COMPANION(&(pdev->dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (!acpi_dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) ptype = dptf_participant_type(acpi_dev->handle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) if (ptype == 0x11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) attr_group = &dptf_power_attribute_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) else if (ptype == 0x0C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) attr_group = &dptf_battery_attribute_group;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) result = acpi_install_notify_handler(acpi_dev->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) ACPI_DEVICE_NOTIFY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) dptf_power_notify,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) (void *)pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (result)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) result = sysfs_create_group(&pdev->dev.kobj,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) attr_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (result) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) acpi_remove_notify_handler(acpi_dev->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) ACPI_DEVICE_NOTIFY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) dptf_power_notify);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) return result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) platform_set_drvdata(pdev, acpi_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) static int dptf_power_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) struct acpi_device *acpi_dev = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) acpi_remove_notify_handler(acpi_dev->handle,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) ACPI_DEVICE_NOTIFY,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) dptf_power_notify);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (dptf_participant_type(acpi_dev->handle) == 0x0CULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) sysfs_remove_group(&pdev->dev.kobj, &dptf_battery_attribute_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) sysfs_remove_group(&pdev->dev.kobj, &dptf_power_attribute_group);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static const struct acpi_device_id int3407_device_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {"INT3407", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {"INT3532", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) {"INTC1047", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) {"INTC1050", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) {"INTC1060", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {"INTC1061", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) {"", 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) MODULE_DEVICE_TABLE(acpi, int3407_device_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static struct platform_driver dptf_power_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .probe = dptf_power_add,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .remove = dptf_power_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) .name = "dptf_power",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) .acpi_match_table = int3407_device_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) module_platform_driver(dptf_power_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) MODULE_LICENSE("GPL v2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) MODULE_DESCRIPTION("ACPI DPTF platform power driver");