On Tue, 20 Dec 2022 11:39:26 -0800 Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote: > Older firmwares still send sensor configuration using a list of > registers with opaque values defined during sensor tuning. > sx9234 and sx9360 sensor on ACPI based devices are concerned. > More schema to configure the sensors will be needed to support devices > designed for windows, like Samsung Galaxy Book2. > > Support schema is: "<_HID>.<register_name>". For instance > "STH9324,reg_adv_ctrl2" in: > > Scope (\_SB.PCI0.I2C2) > { > Device (SX28) > { > Name (_HID, "STH9324") // _HID: Hardware ID > ... > Name (_DSD, Package (0x02) // _DSD: Device-Specific Data > { > ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* > Device Properties for _DSD */, > Package (0x3F) > { > ... > Package (0x02) > { > "STH9324,reg_adv_ctrl2", > Zero > },` > > Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx> LGTM with one exception. See below. I can fix that whilst applying, but would like to leave time for Stephen to take a look anyway. ... > > @@ -101,6 +105,7 @@ struct sx_common_chip_info { > * @client: I2C client structure. > * @trig: IIO trigger object. > * @regmap: Register map. > + * @acpi_id: ACPI device entry when the device is using APCI, NULL otherwise. The lack of num_default_regs below made me suspicious enough to open the code. This is the wrong documentation block. > * @num_default_regs: Number of default registers to set at init. > * @supplies: Power supplies object. > * @chan_prox_stat: Last reading of the proximity status for each channel. > @@ -119,6 +124,7 @@ struct sx_common_data { > struct i2c_client *client; > struct iio_trigger *trig; > struct regmap *regmap; > + const struct acpi_device_id *acpi_id; > > struct regulator_bulk_data supplies[2]; > unsigned long chan_prox_stat; > @@ -151,6 +157,10 @@ int sx_common_probe(struct i2c_client *client, > const struct sx_common_chip_info *chip_info, > const struct regmap_config *regmap_config); > > +void sx_common_get_raw_register_config(struct device *dev, > + const struct acpi_device_id *id, > + struct sx_common_reg_default *reg_def); > + > /* 3 is the number of events defined by a single phase. */ > extern const struct iio_event_spec sx_common_events[3]; >