On Wed, Jan 08, 2020 at 02:10:50PM +0000, Vadim Pasternak wrote: > > Hi Guenter, > > We are looking for possibility to provide some kind of flexible driver to handle > different devices from different vendors, but which have common nature, > like support of two pages for telemetry with same set of functions and same > formats. (Actually driver could be flexible regarding the number of pages). > > While the difference only in VID codes mapping. > > The motivation for that is to give free hand to HW design to choose which > particular device to use on the same system type. > There are two main reasons for such requirement: > - Quality of device (we already had a serios problems with ucd9224 and > tps53679, caused system meltdown). In such case the intention is to move > to fallback devices in the next batches. > - Device availability in stock. Sometimes vendors can't supply in time the > necessary quantity. > > Currently there are the devices from three vendor: TI tps536xx, Infineon > xdpe122 and MPS mp2975. > All have different mapping of VID codes. > > It could be also few additional devices, which are supposed to be used as > fallback devices. > > We have several very big customers ordering now huge quantity of our > systems, which are very conservative regarding image upgrade. > Means we can provide now support for tps536xx, xdpe122xx and mp2975 > but in case new devices are coming soon, we will be able to support it in kernel > for their image after year or even more. > > We can provide ACPI pmbus driver, which will read VID mapping from ACPI > DSDT table. This mapping table will contain the names of available modes > and specific vendor code for this mode. Like: > PMBVR11=1 > PMBVR12=2 > PMBVR13=5 > PMBIMVP9=10 > And driver will set info->vrm_version[i] according to this mapping. > The DSDT would have to provide all properties, not just the VID modes. At the very least that would have to be the number of pages, data formats, vrm version, and the supported attributes per page. It should be possible to also add m/b/R information for each of the sensor classes, but I guess the actual implementation could be postponed until it is needed. This could all be done through the existing generic driver (pmbus.c); it would not really require a new driver. ACPI/DSDT could provide firmware properties, and pmbus.c could read those using device_property API functions (eg device_property_read_u32(dev, "vrm-mode")). Would that work for you ? Thanks, Guenter