summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-11-05mfd: rk808: Add support for power off on RK817Ondrej Jirman1-0/+4
RK817 has a power-off bit in SYS_CFG3. Add support for powering off the PMIC. Signed-off-by: Ondrej Jirman <megous@megous.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05mfd: intel_pmt: Only compile on x86Prarit Bhargava1-1/+1
The intel_pmt driver shows up as a compile option for all arches but is 32-bit and 64-bit x86 specific. Add a CONFIG dependency on X86 for intel_pmt. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Reviewed-by: David E. Box <david.e.box@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05mfd: ti_am335x_tscadc: Fix spelling mistake "atleast" -> "at least"Colin Ian King1-1/+1
There is a spelling mistake in a dev_err message. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05dt-bindings: mfd: brcm,cru: Add USB 2.0 PHYRafał Miłecki1-1/+14
Northstar's USB 2.0 PHY is part of the CRU MFD. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05dt-bindings: mfd: brcm,cru: Add clkset sysconRafał Miłecki2-0/+9
CRU has a shared register that is used e.g. to control USB 2.0 PHY block access. It's a single 32 b register. Document it as syscon so it can be used with a regmap. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05dt-bindings: mfd: Add Broadcom's MISC blockRafał Miłecki1-0/+60
Broadcom's MISC is an MFD hardware block used on some of their SoCs like bcm63xx and bcm4908. At this point only PCIe reset is fully understood and documented. More functions may be added later. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-11-05Merge branches 'ib-mfd-iio-touchscreen-clk-5.16', ↵Lee Jones22-523/+1094
'ib-mfd-misc-regulator-5.16' and 'tb-mfd-from-regulator-5.16' into ibs-for-mfd-merged
2021-10-21dt-bindings: mfd: samsung,s5m8767: Document buck and LDO suppliesKrzysztof Kozlowski1-0/+38
Document the properties with regulator supplies for bucks and LDOs. At least one board uses it (Exynos5250 Arndale). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211008114024.135335-1-krzysztof.kozlowski@canonical.com
2021-10-21dt-bindings: mfd: samsung,s5m8767: Convert to dtschemaKrzysztof Kozlowski3-87/+270
Convert the MFD part of Samsung S5M8767 PMIC to DT schema format. Previously the bindings were mostly in mfd/samsung,sec-core.txt. Since all of bindings for Samsung S2M and S5M family of PMICs were converted from mfd/samsung,sec-core.txt to respective dtschema file, remove the former one. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211008113931.134847-6-krzysztof.kozlowski@canonical.com
2021-10-21dt-bindings: mfd: samsung,s2mpa01: Convert to dtschemaKrzysztof Kozlowski1-0/+91
Convert the MFD part of Samsung S2MPA01 PMIC to DT schema format. Previously the bindings were mostly in mfd/samsung,sec-core.txt. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211008113931.134847-5-krzysztof.kozlowski@canonical.com
2021-10-21dt-bindings: mfd: samsung,s2mps11: Convert to dtschemaKrzysztof Kozlowski2-0/+268
Convert the MFD part of Samsung S2MPS11/S2MPS13/S2MPS14/S2MPS15/S2MPU02 family of PMICs to DT schema format. Previously the bindings were mostly in mfd/samsung,sec-core.txt. The conversion copies parts of description from existing bindings therefore the license is not changed from GPLv2. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211008113931.134847-4-krzysztof.kozlowski@canonical.com
2021-10-21Merge tag 'tags/s2m_s5m_dtschema' into tb-mfd-from-regulator-5.16Lee Jones14-390/+413
regulator/clock: Convert the s2m and s5m DT bindings to schema Tagged to allow further bindings to rely on these. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2021-10-21iio: adc: ti_am335x_adc: Add the am437x compatibleMiquel Raynal1-0/+1
This driver supports both the legacy controller (am33xx) and the extended one (am437x), so let's add a new compatible. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-46-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Add the scale informationMiquel Raynal1-0/+18
Without the scale, the values returned to the user are just a picture of the input voltage against the full scale range of the ADC. We need to provide the actual conversion factor to get milli-Volts values. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-45-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Add a unit to the timeout delayMiquel Raynal2-3/+3
The lack of unit in the macro name kind of tricked me when I was troubleshooting an issue. Physical constants should always get a unit. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-44-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Gather the checks on the delaysMiquel Raynal1-20/+30
Move the checks over the delays provided in the device tree to the location where these values are read to clarify where they come from. There are no functional changes besides the device structure used to display the warnings: let's use the ADC instead of the MFD device. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-43-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Get rid of useless gotosMiquel Raynal1-4/+3
Gotos jumping to a return statement are not really useful, drop them. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-42-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Fix styleMiquel Raynal1-52/+52
These warnings are reported by checkpatch.pl essentially. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-41-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Replace license text with SPDX tagMiquel Raynal1-9/+1
Drop the text license and replace it with an equivalent SPDX license tag identifier which also matches the MODULE_LICENSE("GPL"). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-40-miquel.raynal@bootlin.com
2021-10-21iio: adc: ti_am335x_adc: Wait the idle state to avoid stallsMiquel Raynal1-2/+22
At least on a am4372, a simple: $ cat /sys/bus/iio/devices/iio\:deviceX/in_voltage*_raw can stall forever. It seems that it comes from the fact that the internal state machine does not have enough time to return to its idle state in this situation before receiving another request, leading to an internal stall. Add a tiadc_wait_idle() helper to ensure no new conversion is requested while the FSM is still busy. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-39-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Support the correctly spelled DT propertyMiquel Raynal1-1/+7
There was in the past a typo in the coordinate readouts property. The bindings have been updated, the touchscreen driver as well and now supports both. However, the MFD driver that is in charge of verifying the validity of the property only checks the bogus one. Add support for the correctly spelled DT property. Fixes: c9aeb249bf72 ("Input: ti_am335x_tsc - fix spelling mistake in TSC/ADC DT binding") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-38-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Add ADC1/magnetic reader supportMiquel Raynal2-7/+36
Introduce a new compatible that has another set of driver data, targeting am437x SoCs with a magnetic reader instead of the touchscreen and a more featureful set of registers. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-37-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Introduce a helper to deal with the type of hardwareMiquel Raynal2-15/+27
One way of knowing which hardware we are dealing with is to check the compatible string. When this must be done at several places, it's best and certainly more clear to use a helper for that. Introduce ti_adc_with_touchscreen() to indicate if there is a touchscreen controller available (meaning it's an am33xx-like ADC). This helper does not indicate if it is actually used (that is the purpose of the use_tsc boolean). Introducing this helper helps making a difference in the code between what is generic to both types of ADCs and what is specific to the am33xx hardware before introducing support for the am437x hardware. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-36-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Add a boolean to clarify the presence of a touchscreenMiquel Raynal1-2/+5
Just checking the number of wires will soon not be enough, add a boolean to indicate the actual use or not of the touchscreen. Certain checks only make sense when there is a touchscreen wired. Make these checks explicitly depend on the presence of the touchscreen. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-35-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Fix an error messageMiquel Raynal1-1/+1
The error message if we cannot retrieve the clock tells us that the touchscreen controller clock was unavailable. This is wrong, this is the "main" clock for the hardware block, it is not specific to the touchscreen and won't change when we will introduce ADC1/magnetic reader support so let's correct this comment. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-34-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Rename a variableMiquel Raynal1-6/+6
We need to retrieve the number of wires used by the "secondary" device (the touchscreen or the magnetic reader). Let's rename tsc_wires to become tscmag_wires to clarify the fact that this variable can be used in both situations. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-33-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Add TSC prefix in certain macrosMiquel Raynal2-12/+12
While the register list (and names) between ADC0 and ADC1 are pretty close, the bits inside changed a little bit. To avoid any future confusion, let's add the TSC prefix when some bits are in a register that is common to both revisions of the ADC, but are specific to the am33xx hardware. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-32-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Rename the subsystem enable macroMiquel Raynal3-7/+7
This bit is common to all devices (ADC, Touchscreen, Magnetic reader) so make it clear that it can be used from any location by operating a mechanical rename: s/CNTRLREG_TSCSSENB/CNTRLREG_SSENB/ Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-31-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Drop useless definitions from the headerMiquel Raynal1-28/+16
Drop useless definitions from the header like the "masks" definitions which are only used by the following definition. It could be possible to got even further by removing these definitions entirely and use FIELD_PREP() macros from the code directly, but while I have no troubles making these changes in the header, changing the values in the code directly could darkening a bit the logic and hardening future git-blames for very little added value IMHO (but this is of course a personal taste). Certain macros are using GENMASK() to define the value of a particular field, while this is purely "by chance" that the value and the mask have the same value. In this case, drop the "mask" definition, use FIELD_PREP() and GENMASK() in the macro defining the field, and use the new macro to define the particular value by feeding directly the actual number advertised in the datasheet into that macro, as in: -#define STEPCONFIG_RFM_VREFN GENMASK(24, 23) -#define STEPCONFIG_RFM(val) FIELD_PREP(STEPCONFIG_RFM_VREFN, (val)) +#define STEPCONFIG_RFM(val) FIELD_PREP(GENMASK(24, 23), (val)) +#define STEPCONFIG_RFM_VREFN STEPCONFIG_RFM(3) Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-30-miquel.raynal@bootlin.com
2021-10-21mfd: ti_am335x_tscadc: Clarify the maximum values for DT entriesMiquel Raynal2-9/+11
Clearly define the maximum open delay and sample delay. Use these definitions in place of a mask (which works because this is the first field in the register) and an open-coded value. While at it reword a little bit the error messages to make them look clearer and similar. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-29-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Use BIT(), GENMASK() and FIELD_PREP() when relevantMiquel Raynal2-31/+32
Clean the ti_am335x_tscadc.h header by: * converting masks to GENMASK() * converting regular shifts to BIT() * using FIELD_PREP() when relevant Sometimes reorder the lines to be able to use the relevant bitmask. Mind the s/%d/%ld/ change in a log due to the type change following the use of FIELD_PREP() in the header. Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-28-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Drop unused definitions from the headerMiquel Raynal1-7/+0
The STEP ENABLE definitions are highly unclear and not used so drop them. Suggested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-27-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Use the new HZ_PER_MHZ macroMiquel Raynal1-1/+2
Before adding another frequency with even more zeroes, use the HZ_PER_MHZ macro to clarify the number. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-26-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Fix header spacingMiquel Raynal1-5/+5
Harmonize the spacing within macro definitions. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-25-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Replace the header license text with SPDX tagMiquel Raynal1-12/+4
Drop the text license and replace it with an equivalent SPDX license tag identifier. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-24-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Gather the ctrl register logic in one placeMiquel Raynal2-26/+15
Instead of deriving in the probe and in the resume path the value of the ctrl register, let's do it only once in the probe, save the value of this register (all but the subsystem enable bit) in the driver's structure and use it from the resume callback. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-23-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Reorder the initialization stepsMiquel Raynal1-6/+5
TI AM335X TRM [1] states that most of the configuration should be set in the control register in the first place, before actually enabling the hardware with the subsystem enable bit. So far only half of the configuration was made in the first step (before enabling the "subsystem"), which does not make really sense. Also, the probe and the resume patch were acting differently. Let's harmonize all this by following these steps: 1/ Configure the CLKDIV register 2/ Configure the CTRL register 3/ Configure the idle configuration 4/ Really enable the device by rewriting the CTRL register with the subsystem enable bit set. [1] https://www.ti.com/lit/pdf/spruh73 Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-22-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Always provide an idle configurationMiquel Raynal1-3/+5
The idle register is valid no matter if the touchscreen is used or not, let's always configure it. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-21-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Drop useless variables from the driver structureMiquel Raynal2-14/+4
Keeping the count of tsc_cells and adc_cells is completely redundant, we can derive this information from other variables. Plus, these variables are not used anywhere else now. Let's get rid of them. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-20-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Mimic the probe from resume()Miquel Raynal1-1/+1
Use the number of touchscreen wires (tsc_wires) instead of the flag indicating a touchscreen cell (tsc_cell) to mimic the logic from the probe. Besides keeping a certain harmony in the driver, the main benefit is that we are going to simplify the number of entries in the main MFD structure and tsc_cell can now be removed more easily. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-19-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Use driver dataMiquel Raynal2-6/+25
So far every sub-cell parameter in this driver was hardcoded: cell name, cell compatible, specific clock name and desired clock frequency. As we are about to introduce support for ADC1/magnetic reader, we need a bit of flexibility. Let's add a driver data structure which will contain these information. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-18-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Move the driver structure allocation earlierMiquel Raynal1-7/+7
Allocating the driver structure should be done earlier in the probe so that we can used its members from the beginning. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-17-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Simplify divisor calculationMiquel Raynal1-5/+1
Let's rewrite this on a single line, it does not hurt the readability and saves a useless temporary variable. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-16-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Don't search the tree for our clockMiquel Raynal1-1/+1
There is a single clock available in our node, which is named "fck". The clock handler then points to adc_tsc_fck but no need to point directly to it and do a full tree search. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-15-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Reword the comment explaining the dividersMiquel Raynal1-6/+6
The comment misses the main information which is that we assume that a sample takes 15 ADC clock cycles to be generated. Let's take the occasion to rework a little bit this comment. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-14-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Drop extra spacing when declaring stack variablesMiquel Raynal1-15/+15
Many variables will be updated (renamed, dropped, added) in the upcoming changes, so let's simplify the style to avoid messing with spaces over and over again. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-12-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Get rid of useless gotosMiquel Raynal1-4/+3
Goto's jumping to a return statement are not really useful, drop them. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-13-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Fix styleMiquel Raynal1-2/+4
These are mostly deffects reported by checkpatch.pl. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-11-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Replace license text with SPDX tagMiquel Raynal1-9/+1
Drop the text license and replace it with an equivalent SPDX license tag identifier which also matches the MODULE_LICENSE(GPL) macro. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-10-miquel.raynal@bootlin.com
2021-10-20mfd: ti_am335x_tscadc: Ensure a balanced number of node get/putMiquel Raynal1-0/+5
of_node_put() should be called after a successful of_get_child_by_name(). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211015081506.933180-9-miquel.raynal@bootlin.com