AnsweredAssumed Answered

ADAU1977 Codec Driver: micbias always set to default (8.5V) as dev.platform_data is null.

Question asked by chaitanya42 on Mar 15, 2018
Latest reply on Mar 15, 2018 by aardelean

In the codec driver for adau1977, the value for micbias is retrieved from dev->platform data. However, as this article states, if the driver has been instantiated from the device tree code, the platform_data pointer will be null, indicating that the information must be acquired from the device tree directly. As we can see in the code below, if the adau1977 driver is instantiated through device tree the value will always be set to default (8.5V) no matter whatever value is assigned to the device tree attribute adi,micbias.

 

static int adau1977_setup_micbias(struct adau1977 *adau1977){     struct adau1977_platform_data *pdata = adau1977->dev->platform_data;     unsigned int micbias;      if (pdata) {          micbias = pdata->micbias;          if (micbias > ADAU1977_MICBIAS_9V0)               return -EINVAL;      } else {          micbias = ADAU1977_MICBIAS_8V5;     }      return regmap_update_bits(adau1977->regmap, ADAU1977_REG_MICBIAS,          ADAU1977_MICBIAS_MB_VOLTS_MASK,          micbias << ADAU1977_MICBIAS_MB_VOLTS_OFFSET);}



Is there a missing implementation or am I missing anything?

Outcomes