[linux-sunxi] [PATCH v6 1/3] ASoC: sun4i-codec: Rename sun4i_codec_widgets for consistency
Rename "sun4i_codec_widgets" to "sun4i_codec_controls" for consistency with the struct field name. Signed-off-by: Danny Milosavljevic--- sound/soc/sunxi/sun4i-codec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 0e19c50..c2c0583 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -509,7 +509,7 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute = static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1); -static const struct snd_kcontrol_new sun4i_codec_widgets[] = { +static const struct snd_kcontrol_new sun4i_codec_controls[] = { SOC_SINGLE_TLV("Power Amplifier Volume", SUN4I_CODEC_DAC_ACTL, SUN4I_CODEC_DAC_ACTL_PA_VOL, 0x3F, 0, sun4i_codec_pa_volume_scale), @@ -629,8 +629,8 @@ static const struct snd_soc_dapm_route sun4i_codec_codec_dapm_routes[] = { static struct snd_soc_codec_driver sun4i_codec_codec = { .component_driver = { - .controls = sun4i_codec_widgets, - .num_controls = ARRAY_SIZE(sun4i_codec_widgets), + .controls = sun4i_codec_controls, + .num_controls = ARRAY_SIZE(sun4i_codec_controls), .dapm_widgets = sun4i_codec_codec_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(sun4i_codec_codec_dapm_widgets), .dapm_routes= sun4i_codec_codec_dapm_routes, -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH v6 2/3] ASoC: sun4i-codec: Rename some sun7i-only registers
Some of the registers defined in the driver are only usable on the A20. Rename these registers. Signed-off-by: Danny Milosavljevic--- sound/soc/sunxi/sun4i-codec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index c2c0583..3b53b78 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -96,8 +96,8 @@ /* Other various ADC registers */ #define SUN4I_CODEC_DAC_TXCNT (0x30) #define SUN4I_CODEC_ADC_RXCNT (0x34) -#define SUN4I_CODEC_AC_SYS_VERI(0x38) -#define SUN4I_CODEC_AC_MIC_PHONE_CAL (0x3c) +#define SUN7I_CODEC_AC_DAC_CAL (0x38) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL (0x3c) struct sun4i_codec { struct device *dev; @@ -682,7 +682,7 @@ static const struct regmap_config sun4i_codec_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, - .max_register = SUN4I_CODEC_AC_MIC_PHONE_CAL, + .max_register = SUN7I_CODEC_AC_MIC_PHONE_CAL, }; static const struct of_device_id sun4i_codec_of_match[] = { -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH v6 3/3] ASoC: sun4i-codec: Add custom regmap configs
The A20 has a few extra registers that the A10 doesn't have. Therefore, use different regmaps for A10 as compared to A20. Signed-off-by: Danny Milosavljevic--- sound/soc/sunxi/sun4i-codec.c | 38 +++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index 3b53b78..e047ec0 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -682,12 +682,37 @@ static const struct regmap_config sun4i_codec_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, + .max_register = SUN4I_CODEC_ADC_RXCNT, +}; + +static const struct regmap_config sun7i_codec_regmap_config = { + .reg_bits = 32, + .reg_stride = 4, + .val_bits = 32, .max_register = SUN7I_CODEC_AC_MIC_PHONE_CAL, }; +struct sun4i_codec_quirks { + const struct regmap_config *regmap_config; +}; + +static const struct sun4i_codec_quirks sun4i_codec_quirks = { + .regmap_config = _codec_regmap_config, +}; + +static const struct sun4i_codec_quirks sun7i_codec_quirks = { + .regmap_config = _codec_regmap_config, +}; + static const struct of_device_id sun4i_codec_of_match[] = { - { .compatible = "allwinner,sun4i-a10-codec" }, - { .compatible = "allwinner,sun7i-a20-codec" }, + { + .compatible = "allwinner,sun4i-a10-codec", + .data = _codec_quirks, + }, + { + .compatible = "allwinner,sun7i-a20-codec", + .data = _codec_quirks, + }, {} }; MODULE_DEVICE_TABLE(of, sun4i_codec_of_match); @@ -760,6 +785,7 @@ static int sun4i_codec_probe(struct platform_device *pdev) { struct snd_soc_card *card; struct sun4i_codec *scodec; + const struct sun4i_codec_quirks *quirks; struct resource *res; void __iomem *base; int ret; @@ -777,8 +803,14 @@ static int sun4i_codec_probe(struct platform_device *pdev) return PTR_ERR(base); } + quirks = of_device_get_match_data(>dev); + if (quirks == NULL) { + dev_err(>dev, "Failed to determine the quirks to use\n"); + return -ENODEV; + } + scodec->regmap = devm_regmap_init_mmio(>dev, base, -_codec_regmap_config); + quirks->regmap_config); if (IS_ERR(scodec->regmap)) { dev_err(>dev, "Failed to create our regmap\n"); return PTR_ERR(scodec->regmap); -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH v6 0/3] ASoC: sun4i-codec: Distinguish sun4i from sun7i
Introduce mechanism to detect sun7i and provide a different regmap (different compared to sun4i Allwinner A10). The controls will be extended in a forthcoming patch - it is necessary to distinguish between sun4i and sun7i controls because they have different registers. Rename SUN4I_CODEC_AC_SYS_VERI to SUN7I_CODEC_AC_DAC_CAL and rename SUN4I_CODEC_AC_MIC_PHONE_CAL to SUN7I_CODEC_AC_MIC_PHONE_CAL because these are actually not present on Allwinner A10. Handle quirks by regmap config and codec and select the correct quirks automatically. Danny Milosavljevic (3): ASoC: sun4i-codec: Rename sun4i_codec_widgets for consistency ASoC: sun4i-codec: Rename some sun7i-only registers ASoC: sun4i-codec: Add custom regmap configs sound/soc/sunxi/sun4i-codec.c | 50 +++ 1 file changed, 41 insertions(+), 9 deletions(-) -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH v3 0/4] regulator: axp20x: support AXP803/AXP813 variants
On Sat, 24 Sep 2016 16:35:05 +0800 Chen-Yu Tsaiwrote: > On Fri, Sep 23, 2016 at 4:58 PM, Jean-Francois Moine wrote: > > This patch series adds support for the X-Powers AXP803 and AXP813 PMICs. > > It is based on the previous patch series > > regulator: axp20x: Simplify various code > > > > v3: > > - put the code of the new devices in new files instead of in the common > > axp20x file. > > - fix errors about the regulators and interrupts > > v2: > > - fix lack of support of dcdc frequency > > - notice that the AXP803 is also handled > > - send the patch to the DT maintainers > > > > Jean-Francois Moine (4): > > regulator: axp20x: move device independant parts to new files > > regulator: axp20x: duplicate the MFD axp20x-rsb code > > regulator: axp20x: add the AXP803 > > regulator: axp20x: add the AXP813 > > NAK. Please follow the axp20x mfd and sub-device driver design we > already have. Sorry, I will not: installing a lot of useless code and tables in permanent system memory for just one regulator is not the way I think about a good kernel. -- Ken ar c'hentaƱ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH 3/3] regulator: axp20x: simplify device access
On Sat, 24 Sep 2016 16:29:11 +0800 Chen-Yu Tsaiwrote: [snip] > > static int axp20x_regulator_probe(struct platform_device *pdev) > > { > > + struct device *dev = pdev->dev.parent; > > There are 2 struct device's in play in this function, 1 from the parent, > and 1 for the platform device for this regulator sub-device. > > > struct regulator_dev *rdev; > > - struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); > > + struct axp20x_dev *axp20x = dev_get_drvdata(dev); > > const struct regulator_desc *regulators; > > struct regulator_config config = { > > - .dev = pdev->dev.parent, > > + .dev = dev, > > .regmap = axp20x->regmap, > > .driver_data = axp20x, > > }; > > @@ -532,7 +533,7 @@ static int axp20x_regulator_probe(struct > > platform_device *pdev) > > dcdc5_ix = AXP22X_DCDC5; > > dc1sw_ix = AXP22X_DC1SW; > > dc5ldo_ix = AXP22X_DC5LDO; > > - drivevbus = of_property_read_bool(pdev->dev.parent->of_node, > > + drivevbus = of_property_read_bool(dev->of_node, > > "x-powers,drive-vbus-en"); > > break; > > case AXP806_ID: > > @@ -555,13 +556,13 @@ static int axp20x_regulator_probe(struct > > platform_device *pdev) > > dc5ldo_ix = AXP809_DC5LDO; > > break; > > default: > > - dev_err(>dev, "Unsupported AXP variant: %ld\n", > > + dev_err(dev, "Unsupported AXP variant: %ld\n", > > So this one is incorrect. You should use this device's struct, > not the parent. It's possible the mfd driver supports a PMIC, > but the regulator driver is still missing. Why do you need a regulator driver? The 'regulator' node in the DT is not a real device. It is just a container and it could be removed without any problem. -- Ken ar c'hentaƱ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH v3 0/4] regulator: axp20x: support AXP803/AXP813 variants
On Fri, Sep 23, 2016 at 4:58 PM, Jean-Francois Moinewrote: > This patch series adds support for the X-Powers AXP803 and AXP813 PMICs. > It is based on the previous patch series > regulator: axp20x: Simplify various code > > v3: > - put the code of the new devices in new files instead of in the common > axp20x file. > - fix errors about the regulators and interrupts > v2: > - fix lack of support of dcdc frequency > - notice that the AXP803 is also handled > - send the patch to the DT maintainers > > Jean-Francois Moine (4): > regulator: axp20x: move device independant parts to new files > regulator: axp20x: duplicate the MFD axp20x-rsb code > regulator: axp20x: add the AXP803 > regulator: axp20x: add the AXP813 NAK. Please follow the axp20x mfd and sub-device driver design we already have. ChenYu > Documentation/devicetree/bindings/mfd/axp20x.txt | 29 ++- > drivers/mfd/axp20x.c | 15 + > drivers/regulator/Makefile | 3 +- > drivers/regulator/axp-regulator.c| 347 +++ > drivers/regulator/axp-regulator.h| 133 > drivers/regulator/axp20x-regulator.c | 415 > ++- > drivers/regulator/axp803.c | 225 > drivers/regulator/axp813.c | 229 + > include/linux/mfd/axp20x.h | 2 + > 9 files changed, 1012 insertions(+), 388 deletions(-) > create mode 100644 drivers/regulator/axp-regulator.c > create mode 100644 drivers/regulator/axp-regulator.h > create mode 100644 drivers/regulator/axp803.c > create mode 100644 drivers/regulator/axp813.c > > -- > 2.10.0 > -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH 3/3] regulator: axp20x: simplify device access
Hi, On Thu, Sep 22, 2016 at 2:20 AM, Jean-Francois Moinewrote: > Use the pointer to the main regulator device instead of the pointer > to the child platform device. > > Signed-off-by: Jean-Francois Moine > --- > drivers/regulator/axp20x-regulator.c | 45 > ++-- > 1 file changed, 23 insertions(+), 22 deletions(-) > > diff --git a/drivers/regulator/axp20x-regulator.c > b/drivers/regulator/axp20x-regulator.c > index 7405f5b..244ddc3 100644 > --- a/drivers/regulator/axp20x-regulator.c > +++ b/drivers/regulator/axp20x-regulator.c > @@ -347,9 +347,9 @@ static const struct regulator_desc axp809_regulators[] = { > AXP_DESC_SW(AXP809, SW, "sw", "swin", AXP22X_PWR_OUT_CTRL2, BIT(6)), > }; > > -static int axp20x_set_dcdc_freq(struct platform_device *pdev, u32 dcdcfreq) > +static int axp20x_set_dcdc_freq(struct device *dev, u32 dcdcfreq) > { > - struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); > + struct axp20x_dev *axp20x = dev_get_drvdata(dev); > unsigned int reg = AXP20X_DCDC_FREQ; > u32 min, max, def, step; > > @@ -378,7 +378,7 @@ static int axp20x_set_dcdc_freq(struct platform_device > *pdev, u32 dcdcfreq) > step = 150; > break; > default: > - dev_err(>dev, > + dev_err(dev, > "Setting DCDC frequency for unsupported AXP > variant\n"); > return -EINVAL; > } > @@ -388,13 +388,13 @@ static int axp20x_set_dcdc_freq(struct platform_device > *pdev, u32 dcdcfreq) > > if (dcdcfreq < min) { > dcdcfreq = min; > - dev_warn(>dev, "DCDC frequency too low. Set to %ukHz\n", > + dev_warn(dev, "DCDC frequency too low. Set to %ukHz\n", > min); > } > > if (dcdcfreq > max) { > dcdcfreq = max; > - dev_warn(>dev, "DCDC frequency too high. Set to > %ukHz\n", > + dev_warn(dev, "DCDC frequency too high. Set to %ukHz\n", > max); > } > > @@ -404,24 +404,24 @@ static int axp20x_set_dcdc_freq(struct platform_device > *pdev, u32 dcdcfreq) > AXP20X_FREQ_DCDC_MASK, dcdcfreq); > } > > -static int axp20x_regulator_parse_dt(struct platform_device *pdev) > +static int axp20x_regulator_parse_dt(struct device *dev) > { > struct device_node *np, *regulators; > int ret; > u32 dcdcfreq = 0; > > - np = of_node_get(pdev->dev.parent->of_node); > + np = of_node_get(dev->of_node); > if (!np) > return 0; > > regulators = of_get_child_by_name(np, "regulators"); > if (!regulators) { > - dev_warn(>dev, "regulators node not found\n"); > + dev_warn(dev, "regulators node not found\n"); > } else { > of_property_read_u32(regulators, "x-powers,dcdc-freq", > ); > - ret = axp20x_set_dcdc_freq(pdev, dcdcfreq); > + ret = axp20x_set_dcdc_freq(dev, dcdcfreq); > if (ret < 0) { > - dev_err(>dev, "Error setting dcdc frequency: > %d\n", ret); > + dev_err(dev, "Error setting dcdc frequency: %d\n", > ret); > return ret; > } > > @@ -499,11 +499,12 @@ static u32 axp20x_polyphase_slave(struct axp20x_dev > *axp20x) > > static int axp20x_regulator_probe(struct platform_device *pdev) > { > + struct device *dev = pdev->dev.parent; There are 2 struct device's in play in this function, 1 from the parent, and 1 for the platform device for this regulator sub-device. > struct regulator_dev *rdev; > - struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); > + struct axp20x_dev *axp20x = dev_get_drvdata(dev); > const struct regulator_desc *regulators; > struct regulator_config config = { > - .dev = pdev->dev.parent, > + .dev = dev, > .regmap = axp20x->regmap, > .driver_data = axp20x, > }; > @@ -532,7 +533,7 @@ static int axp20x_regulator_probe(struct platform_device > *pdev) > dcdc5_ix = AXP22X_DCDC5; > dc1sw_ix = AXP22X_DC1SW; > dc5ldo_ix = AXP22X_DC5LDO; > - drivevbus = of_property_read_bool(pdev->dev.parent->of_node, > + drivevbus = of_property_read_bool(dev->of_node, > "x-powers,drive-vbus-en"); > break; > case AXP806_ID: > @@ -555,13 +556,13 @@ static int axp20x_regulator_probe(struct > platform_device *pdev) > dc5ldo_ix = AXP809_DC5LDO; > break; > default: > - dev_err(>dev, "Unsupported AXP variant: %ld\n", > + dev_err(dev, "Unsupported AXP variant: