Code Monkey home page Code Monkey logo

linux-kernel-pmic-drivers's Introduction

Linux-Kernel-PMIC-Drivers

Rohm power management IC drivers for Linux kernel and u-Boot.

ROHM has been collaborating with the Linux kernel community and sees the value of open-source. Hence we want to contribute to community and attempt to upstream the Linux drivers for our power components.

Upstream driver questions

If you have questions related to the Linux community drivers - please use the linux community mail-lists and maintainer information. Once the drivers are upstreamed the code changes are no longer in our hands - and the best experts for those drivers can be found from the commnity. This does not mean ROHM is out of the game - we have our personnel in Linux driver reviewers/ maintainers - but we don't "own" these components or frameworks anymore. You get the best possible contacts via the MAINTAINERS file.

Contents of this repository

We occasionally develop something which does not perfectly fit into the upstream Linux frameworks or policies. This content may include something which is too product specific or something which requires functionality not present in upstream kernels.

This is the place to look for ROHM POWER IC specific Linux driver extensions. Please be aware that these extensions are provided as reference implementation only and they are not actively developed/maintained.

Upstream status

Generic upstream effort

ROHM aims giving back to the community. We know it's two-way road, really. We get from the community a working platform, bug fixes, porting to new versions, discussions, education and a chance to impact the direction Linux is heading to. We value all of this and want to give back innovations and improvements which may be small or big and aren't always directly relaed to our products. This helps us all. Here are some things we have participated and are working on - maybe you find something that is helpful to you too.

Generic Linux improvements

linux-kernel-pmic-drivers's People

Contributors

m-vaittinen avatar ristopakanen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

linux-kernel-pmic-drivers's Issues

BD71815: Reference driver exposes GPO2 unconditionally

bd7181xgpo_chip.ngpio = 2; /* bd71815/bd71817 have 2 GPO */

The GPO2 on BD71815 is "hard to use on PCB" due to positioning in the middle of the GND pins. It was not needed in a target project so it was decided to mark the pin as GND in data-sheet. The reference driver exposes this pin as GPO and allows driving it - which may cause issues if pin is connected to GND as suggested by data-sheet.

This should be fixed by disabling the GPO2 by default and by allowing control only if it is explicitly requested via DT property.

bd96801: Watchdog does not configure hw_heartbeat when running at start

The BD96801 watchdog driver does not configure the hw_heartbeat values if the watchdog is running when driver is probed. This can cause problems with small timeouts.

if ((reg & BD96801_WD_EN_MASK) != BD96801_WD_DISABLE) {

As a fix: If watchdog is running at probe time, we should read the configured time-out values and set the hw_heartbeat accordingly.

BD71815 example driver IRQ handling is racy

IRQF_ONESHOT | IRQF_TRIGGER_FALLING, bdinfo->irq_base,

The BD71815 interrupts should be handled as active low. Example handles them as edge triggered. Handling level active interrupts as edge triggered will cause a race with new IRQ being triggered by device between reading and acking the status bits. This will yield the new IRQ to be not acknowleged and HW to keep the IRQ line pulled low - which means that new edges will never be produced because device keeps IRQ asserted but processor does not detect this.

This is a classical mistake which causes annoying occasional hard-to-reproduce issues where IRQs seem to be no longer generated.

BD71828/BD71815/BD718x7 regulators: HW run-level default handing is faulty

The RUN_LEVEL definitions from include/linux/mfd/rohm-generic.h are used for bitmask by regulator drivers. The definitions are an enum W/O set values in the header => first few values (1,2) work fine but value 3 will already be invalid as it also sets both 1&2 and probably never matches 3 (if only one bit is compared).

On BD71837/47/50 this is probably not causing any problems as they only use RUN/IDLE/SUSPEND levels - and regulators which support suspend do also support RUN/IDLE. On BD71828 this may cause problems depending on device-tree.

A fix to this problem was submitted to the Linux community:
https://lore.kernel.org/lkml/[email protected]/T/#u

BD9576: incorrect "always-running" devicetree property

As was pointed by Guenter Roeck, the "always-running"-property is used both for a wrong purpose and incorrectly.

Without documentation, it looks like the always-running (from
linux,wdt-gpio.yaml) may be abused. Its defined meaning is
"the watchdog is always running and can not be stopped". Its
use here seems to be "start watchdog when loading the module and
prevent it from being stopped".

and

  • if (w->always_running)
  • bd96801_wdt_start(&w->wdt);
    

I think this needs to set WDOG_HW_RUNNING or the watchdog will trigger
a reboot if the watchdog device is not opened and the watchdog wasn't
already running when the module was loaded.

That makes me wonder what happens if the property is set and the
watchdog daemon isn't started in the bd9576_wdt driver.

For BD9576 this bug is already in upstream

bd96801: bd96802: Unlocking PMIC done too late

The ROHM BD96801 and BD96802 have lock register. After the start-up a magic value must be written to the lock register before any other register is writable. This is done in the regulator driver.

ret = regmap_write(pdata->regmap, BD96801_LOCK_REG, BD96801_UNLOCK);

ret = regmap_write(pdata->regmap, BD96801_LOCK_REG, BD96801_UNLOCK);

ret = regmap_write(pdata->regmap, BD96801_LOCK_REG, BD96801_UNLOCK);

It is possible the MFD core or the other sub-devices need to access the PMIC registers before this. Those accesses will fail. The "right thing to do (tm)" is to unlock registers already in the MFD driver core before invoking the IRQ chip code or kicking other sub-devices.

BD96801: ERRB interrupt names can cause invalid memory access

The BD96801 experimental driver allocates per regulator ERRB IRQ names from the stack. The regulator_irq_helper() did not originally duplicate memory for IRQ names but passed a pointer to the provided name directly to request_threaded_irq(). This means the IRQ name got trashed when calling function exited.

A fix to the regulator_irq_helper() is sent:
https://lore.kernel.org/lkml/[email protected]/

this will fix the bad memory access for experimental BD96801 regulator driver. Please, apply the regulator_irq_helper() -patch linked above if you use the experimental BD96801 driver with a kernel where this fix is not yet included. (Fix is in no kernel releases as writing of this. The Linux v6.9 development cycle is ongoing)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.