summaryrefslogtreecommitdiffstats
path: root/drivers/staging/hikey9xx/hi6421-spmi-pmic.c
Commit message (Collapse)AuthorAgeFilesLines
* mfd: hi6421-spmi-pmic: move driver from stagingMauro Carvalho Chehab2021-07-231-72/+0
| | | | | | | | | This driver is ready for mainstream. So, move it out of staging. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/dd150f3ffa19c2dda0171f7dbe1dd63cce2a7af5.1627025657.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: split hi6421v600 irq into a separate driverMauro Carvalho Chehab2021-07-211-236/+3
| | | | | | | | | | Per MFD subsystem requirements, split the IRQ part of the driver into a separate one with just the IRQ handling code and the powerkey support. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/709e01c9ffafe6cd0ecb23336b44f9bcde2b5bc2.1626515862.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: add a missing dot at copyrightMauro Carvalho Chehab2021-07-211-1/+1
| | | | | | | | | The Huawei's copyright is missing a dot at the end. Add it, in order to make it similar to the other two copyrights. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/8e280ebe4e577e6c2d919346868f0d27f98ebd49.1626515862.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: rename GPIO IRQ OF nodeMauro Carvalho Chehab2021-07-211-12/+6
| | | | | | | | | Instead of using the standard name ("gpios"), use "interrupts". Suggested-by: Rob Herring <robh@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/8b2cad1e9b9904c6a2aaea8786d5e5a39f09ac19.1626515862.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: rename spmi_device structMauro Carvalho Chehab2021-07-211-5/+5
| | | | | | | | | Let's not call a pointer to spmi_device as pdev, as it is something else. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/758e98d7f59d739b68b33723a02aca8b9464f8da.1626515862.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: cleanup some macrosMauro Carvalho Chehab2021-06-251-33/+53
| | | | | | | | | | | | Before moving this driver out of staging, cleanup the macros, in order to make the driver clearer. No functional changes. Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/95341999de15b395242b5b7850ec5e727420ce19.1624606660.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: change identation of a tableMauro Carvalho Chehab2021-06-251-4/+4
| | | | | | | | | | The struct regmap_config is idented with two tabs. Just one tab is enough. Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/a4d718b0479e3867bedc93861e4b2c9c1321aabd.1624606660.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: change a return codeMauro Carvalho Chehab2021-06-251-1/+1
| | | | | | | | | | return -ENODEV if irq_create_mapping() fails at probing time. Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/e978eabd99c0d3c471026659a2c585deb706e2c4.1624606660.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: better name IRQsMauro Carvalho Chehab2021-06-251-2/+2
| | | | | | | | | | Instead of naming them as just "hisi", use hi6421v600 to make it clearer. Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/327fb075905b889a43a0f9dced29ea9966d611f8.1624606660.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hi6421-spmi-pmic: use devm_request_threaded_irq()Mauro Carvalho Chehab2021-06-251-11/+5
| | | | | | | | | | Use devm_request_threaded_irq() in order to simplify the driver. Suggested-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/b47827c3466eeef3a7de6ac56b1fe93b5ff84e30.1624606660.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: fix warning styling issuesAlaa Emad2021-03-101-4/+4
| | | | | | | | | Fix "WARNING: please, no space before tabs" styling issue in hi6421-spmi-pmic.c for lines 51,52,53 and 69. Signed-off-by: Alaa Emad <alaaemadhossney.ae@gmail.com> Link: https://lore.kernel.org/r/20210219101812.3483-1-alaaemadhossney.ae@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: Fix alignment of function parametersMukul Mehar2021-02-131-2/+2
| | | | | | | | | | This patch fixes the following checkpatch.pl check: CHECK: Alignment should match open parenthesis Signed-off-by: Mukul Mehar <mukulmehar02@gmail.com> Link: https://lore.kernel.org/r/20210213120556.73579-1-mukulmehar02@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: change spaces to tabsAtul Gopinathan2021-02-091-1/+1
| | | | | | | | | Fix the following type of checkpatch error: "ERROR: code indent should use tabs where possible" Signed-off-by: Atul Gopinathan <leoatul12@gmail.com> Link: https://lore.kernel.org/r/20210209081935.3084-1-leoatul12@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: update copyright notesMauro Carvalho Chehab2021-01-311-7/+7
| | | | | | | | | At PMIC subsystem, C89 comments are preferred over C99. While here, also update the copyrights of the header file. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/5a86478c8ccb93d3105485b5f16e20e9c12e2196.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: document registersMauro Carvalho Chehab2021-01-311-7/+32
| | | | | | | | | | Make it clearer about how the IRQ registers are filled by adding a table with them, with two macros used to calculate the mask register. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/10f52ec0a8346fb883245344886c44714c859cd1.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: cleanup IRQ handling codeMauro Carvalho Chehab2021-01-311-39/+29
| | | | | | | | | | | | | | - Use BIT() and GENMASK(); - Remove duplicated mask definitions; - Simplify the code under IRQ handler; - Add a few extra blank lines to make easier to see spin_lock/spin_unlock; - Remove debug code; - Fix a few minor coding style issues. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/f9fcb184e7cbe8701298085df76d5d9fd285b2c5.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: fix IRQ handler codeMauro Carvalho Chehab2021-01-311-1/+1
| | | | | | | | | | The conversion to regmap introduced a regression at the code which reads from the IRQ register. Address that. Fixes: fb02e3ebfb2d ("staging: hikey9xx: spmi driver: convert to regmap") Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/2eae710c333a8ee6f9e0a086c84115bc90a782ca.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: cleanup header fileMauro Carvalho Chehab2021-01-311-0/+17
| | | | | | | | | | | | | Remove the IRQ list from the header, as this is used only inside the driver itself. Also, get rid of two unused defines. The net result is that only struct hi6421_spmi_pmic remains on it, as this is used by the regulator driver. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/138c3a11e4de0ebabdf27932957852136c2f7510.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: cleanup probe codeMauro Carvalho Chehab2021-01-311-34/+16
| | | | | | | | | | | | Cleanup the error handling code, making the messages more consistent and removing an uneeded call to free_irq(). While here, also remove debug messages and make the error messages more consistent. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/651b4053599b9f25efecac3b1d4ce6abce0bd097.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: rename some varsMauro Carvalho Chehab2021-01-311-52/+52
| | | | | | | | | | | | - When referring to regmap, rename map to regmap - inside hi6421-spmi-pmic, call private data struct as ddata. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/d23592b11ac606e3b9a3ff95a754cb75921e60aa.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: spmi driver: convert to regmapMauro Carvalho Chehab2021-01-311-79/+36
| | | | | | | | | Instead of doing its own SPMI I/O implementation, use the already-existing regmap one. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/7084885f3007ca5daf0d5bc85d038e26ee82dc0d.1611949675.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: simplify includesMauro Carvalho Chehab2021-01-261-8/+0
| | | | | | | | There are several uneeded includes. Remove them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/50087bb41fc262d6930aeda0583546cf9d597b87.1611212783.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: hikey9xx: hi6421-spmi-pmic: update copyrightMauro Carvalho Chehab2021-01-261-17/+7
| | | | | | | | | Remove the GPL boilerplate, as SPDX tag already points to the license terms and add a new copyright for Huawei. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/18b36d01c04519d84912140b6c40c1bd1f75a3a8.1611212783.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: fix error return code in ↵Wang Hai2020-11-231-1/+3
| | | | | | | | | | | | | hi6421_spmi_pmic_probe() Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 4524ac56cdca ("staging: mfd: add a PMIC driver for HiSilicon 6421 SPMI version") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> Link: https://lore.kernel.org/r/20201118103724.57451-1-wanghai38@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: Simplify the compatible stringMauro Carvalho Chehab2020-08-181-1/+1
| | | | | | | | | It is clear that this driver is for PMIC. So, get rid of it at the compatible. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/12bdc9b4734e156098408d0d27256abdc91ac283.1597762400.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: get rid of interrupt propertiesMauro Carvalho Chehab2020-08-181-60/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Both irqnum and irqarray properties reflect the same thing: the number of bits and bytes for interrupts at this chipset. E. g.: irqnum = 8 x irqarray This can be seen by the way pending interrupts are handled: /* During probe time */ pmic->irqs = devm_kzalloc(dev, pmic->irqnum * sizeof(int), GFP_KERNEL); /* While handling IRQs */ for (i = 0; i < pmic->irqarray; i++) { pending = hi6421_spmi_pmic_read(pmic, (i + pmic->irq_addr)); pending &= 0xff; for_each_set_bit(offset, &pending, 8) generic_handle_irq(pmic->irqs[offset + i * 8]); } Going further, there are some logic at the driver which assumes that irqarray is 2: /* solve powerkey order */ if ((i == HISI_IRQ_KEY_NUM) && ((pending & HISI_IRQ_KEY_VALUE) == HISI_IRQ_KEY_VALUE)) { generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_DOWN]); generic_handle_irq(pmic->irqs[HISI_IRQ_KEY_UP]); pending &= (~HISI_IRQ_KEY_VALUE); } As HISI_IRQ_KEY_DOWN and HISI_IRQ_KEY_UP are fixed values and don't depend on irqnum/irqarray. The IRQ addr and mask addr seem to be also fixed, based on some comments at the OF parsing code. So, get rid of them too, removing the of parsing function completely. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/e231244e42cb5b56240705cac2f987e11a078038.1597762400.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: cleanup the codeMauro Carvalho Chehab2020-08-181-84/+67
| | | | | | | | | | There are several small cleanups that can be done in order to make the code more prepared to be upstreamed. Suggested-by: Jonathan Cameron <Jonathan.Cameron@Huawei.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/823792ba2f69e613629ab52a33e5728d54e2288b.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: fix some coding style issuesMauro Carvalho Chehab2020-08-181-2/+2
| | | | | | | | | | | Checkpatch complains about some minor issues inside this driver that were not addressed by the previous patch. Address them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/84b53d20632c84cc60b8dadfe937f3c54b355cef.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: change namespace on its functionsMauro Carvalho Chehab2020-08-181-46/+51
| | | | | | | | | | | | Rename the functions used internally inside the driver in order for them to follow the driver's name. While here, get rid of some unused definitions at the header file. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/bfa8bf33f71612b1511d73269ca242d0d4e70940.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: cleanup OF propertiesMauro Carvalho Chehab2020-08-181-8/+8
| | | | | | | | | Simplify the names of the DT properties and do some cleanups, in order to better document them. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/24ffcd28a17ee7b0940d8aabef556d172d5feddf.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: get rid of unused OF propertiesMauro Carvalho Chehab2020-08-181-141/+4
| | | | | | | | | | | | | | There are several OF properties that aren't used by Hikey 970, and some are not even used inside the driver. So, drop them, as as this makes easier to document what's actually used. If latter needed, those could be re-added later. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/332f96c178b81bf1e9908a1da2127f043909ae0c.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: change the binding logicMauro Carvalho Chehab2020-08-181-55/+29
| | | | | | | | | Change the binding logic to ensure that the MFD driver will be load after having the SPMI controller registered. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/eb50392ce68bb30f64c603572cdb9c91f93ea47b.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: get rid of the static varsMauro Carvalho Chehab2020-08-181-132/+92
| | | | | | | | | | | | There are several static vars inside this driver. Get rid of them. While here, add a SPDX header file. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/19c497fc2bb1d3a95863d92cac89869d5abe3f2e.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: deal with non-static functionsMauro Carvalho Chehab2020-08-181-123/+24
| | | | | | | | | Several functions aren't used outside the mfd driver. So, either remove or make them static. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/d26323ab7be5b4efb73b1950b4daaa5959277449.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: hi6421-spmi-pmic: get rid of unused codeMauro Carvalho Chehab2020-08-181-63/+0
| | | | | | | | | | | | | | | There are some checks there which could make sense for downstream builds, but doesn't make much sense for upstream ones. They came from the official Hikey970 tree from Linaro, but even there, the commented-out code is not set via other Kconfig vars. So, let's just get rid of that. If needed later, this patch can be (partially?) reversed. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/ecbef801f6c32ba0850ad9e5c534a4304807df3b.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: mfd: add a PMIC driver for HiSilicon 6421 SPMI versionMayulong2020-08-181-0/+759
Add the PMIC SPMI driver for the HiSilicon 6421v600. [mchehab+huawei@kernel.org: keep just the MFD driver on this patch, and renamed filenames to better match other upstream drivers] The compete patch is at: https://github.com/96boards-hikey/linux/commit/08464419fba2 Signed-off-by: Mayulong <mayulong1@huawei.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/4ffb2694244baa47387e39e2c5d71243242c1fc1.1597647359.git.mchehab+huawei@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>