Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add "mclk" support for maxim,max9867

Merge series from richard.leitner@linux.dev:

This series adds support for the clocks properties in the
maxim,max9867 bindings. Furthermore the binding definitions are
converted from txt to yaml.

The clock property is needed to define the mclk for one of our
boards which uses the the i.MX8MP SAI MCLK as clock for the
maxim,max9867.

+83 -19
-17
Documentation/devicetree/bindings/sound/max9867.txt
··· 1 - max9867 codec 2 - 3 - This device supports I2C mode only. 4 - 5 - Required properties: 6 - 7 - - compatible : "maxim,max9867" 8 - - reg : The chip select number on the I2C bus 9 - 10 - Example: 11 - 12 - &i2c { 13 - max9867: max9867@18 { 14 - compatible = "maxim,max9867"; 15 - reg = <0x18>; 16 - }; 17 - };
+66
Documentation/devicetree/bindings/sound/maxim,max9867.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/sound/maxim,max9867.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Maxim Integrated MAX9867 CODEC 8 + 9 + description: | 10 + This device supports I2C only. 11 + Pins on the device (for linking into audio routes): 12 + * LOUT 13 + * ROUT 14 + * LINL 15 + * LINR 16 + * MICL 17 + * MICR 18 + * DMICL 19 + * DMICR 20 + 21 + maintainers: 22 + - Ladislav Michl <ladis@linux-mips.org> 23 + 24 + allOf: 25 + - $ref: dai-common.yaml# 26 + 27 + properties: 28 + compatible: 29 + enum: 30 + - maxim,max9867 31 + 32 + '#sound-dai-cells': 33 + const: 0 34 + 35 + reg: 36 + maxItems: 1 37 + 38 + clocks: 39 + maxItems: 1 40 + 41 + required: 42 + - compatible 43 + - reg 44 + - clocks 45 + 46 + additionalProperties: false 47 + 48 + examples: 49 + - | 50 + i2c { 51 + #address-cells = <1>; 52 + #size-cells = <0>; 53 + codec@18 { 54 + compatible = "maxim,max9867"; 55 + #sound-dai-cells = <0>; 56 + reg = <0x18>; 57 + clocks = <&codec_clk>; 58 + }; 59 + }; 60 + 61 + codec_clk: clock { 62 + compatible = "fixed-clock"; 63 + #clock-cells = <0>; 64 + clock-frequency = <12288000>; 65 + }; 66 + ...
+17 -2
sound/soc/codecs/max9867.c
··· 6 6 // Copyright 2018 Ladislav Michl <ladis@linux-mips.org> 7 7 // 8 8 9 + #include <linux/clk.h> 9 10 #include <linux/delay.h> 10 11 #include <linux/i2c.h> 11 12 #include <linux/module.h> ··· 17 16 #include "max9867.h" 18 17 19 18 struct max9867_priv { 19 + struct clk *mclk; 20 20 struct regmap *regmap; 21 21 const struct snd_pcm_hw_constraint_list *constraints; 22 22 unsigned int sysclk, pclk; ··· 579 577 struct max9867_priv *max9867 = snd_soc_component_get_drvdata(component); 580 578 581 579 switch (level) { 580 + case SND_SOC_BIAS_ON: 581 + err = clk_prepare_enable(max9867->mclk); 582 + if (err) 583 + return err; 584 + break; 582 585 case SND_SOC_BIAS_STANDBY: 583 586 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { 584 587 err = regcache_sync(max9867->regmap); ··· 602 595 return err; 603 596 604 597 regcache_mark_dirty(max9867->regmap); 598 + clk_disable_unprepare(max9867->mclk); 605 599 break; 606 600 default: 607 601 break; ··· 671 663 dev_info(&i2c->dev, "device revision: %x\n", reg); 672 664 ret = devm_snd_soc_register_component(&i2c->dev, &max9867_component, 673 665 max9867_dai, ARRAY_SIZE(max9867_dai)); 674 - if (ret < 0) 666 + if (ret < 0) { 675 667 dev_err(&i2c->dev, "Failed to register component: %d\n", ret); 676 - return ret; 668 + return ret; 669 + } 670 + 671 + max9867->mclk = devm_clk_get(&i2c->dev, NULL); 672 + if (IS_ERR(max9867->mclk)) 673 + return PTR_ERR(max9867->mclk); 674 + 675 + return 0; 677 676 } 678 677 679 678 static const struct i2c_device_id max9867_i2c_id[] = {