register. A value >0xFFFF means use the default.
(cs47l90, cs47l91)
+ - cirrus,micd-ranges : Microphone detection level and key configuration, this
+ field can be of variable length but should always be a multiple of 2 cells
+ long, each two cell group represents one button configuration
+ The first cell is the maximum impedance for this button in ohms
+ The second cell the key that should be reported to the input layer
+
- cirrus,micd-configs : Headset polarity configurations, variable length but
must be a multiple of 5 cells, each 5-cell group represents one
polarity configuration
regmap_update_bits(madera->regmap, reg, mask, level);
}
+static void madera_extcon_of_get_micd_ranges(struct madera_extcon *info,
+ struct fwnode_handle *node,
+ struct madera_accdet_pdata *pdata)
+{
+ struct madera_micd_range *micd_ranges;
+ u32 *values;
+ int nvalues, nranges, i, j;
+ int ret;
+
+ nvalues = fwnode_property_read_u32_array(node, "cirrus,micd-ranges",
+ NULL, 0);
+ if (nvalues < 0)
+ return;
+
+ values = kmalloc_array(nvalues, sizeof(u32), GFP_KERNEL);
+ if (!values)
+ return;
+
+ ret = fwnode_property_read_u32_array(node, "cirrus,micd-ranges",
+ values, nvalues);
+ if (ret < 0)
+ goto err;
+
+ nranges = nvalues / 2;
+ micd_ranges = devm_kcalloc(info->dev,
+ nranges,
+ sizeof(struct madera_micd_range),
+ GFP_KERNEL);
+
+ for (i = 0, j = 0; i < nranges; ++i) {
+ micd_ranges[i].max = values[j++];
+ micd_ranges[i].key = values[j++];
+ }
+
+ pdata->micd_ranges = micd_ranges;
+ pdata->num_micd_ranges = nranges;
+
+err:
+ kfree(values);
+}
+
static void madera_extcon_get_micd_configs(struct madera_extcon *info,
struct fwnode_handle *node,
struct madera_accdet_pdata *pdata)
madera_extcon_get_hpd_pins(info, node, pdata);
madera_extcon_get_micd_configs(info, node, pdata);
+ madera_extcon_of_get_micd_ranges(info, node, pdata);
if (info->micd_modes[0].gpio)
gpio_status = GPIOD_OUT_HIGH;