Message ID | 20211110122948.188683-4-alistair@alistair23.me (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for the silergy,sy7636a | expand |
Hi, this all creates a lot of question marks... One of my main question is whether sy7636a = sy7636 (at least the driver in the kobo vendor kernels does not have the "A" at the end, whic does not necessarily mean a difference). https://www.silergy.com/products/panel_pmic lists only a SY7636ARMC, so chances are good that the letters were just stripped away by the driver developers. Printing on chip package is cryptic so it is not that helpful. It is just "BWNBDA" On Wed, 10 Nov 2021 22:29:43 +1000 Alistair Francis <alistair@alistair23.me> wrote: [...] > diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h > new file mode 100644 > index 000000000000..2797c22dabc2 > --- /dev/null > +++ b/include/linux/mfd/sy7636a.h > @@ -0,0 +1,36 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Functions to access SY3686A power management chip. Typo? or is it really a SY3686A? So what we are talking about? > + * > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/ > + */ > + > +#ifndef __MFD_SY7636A_H > +#define __MFD_SY7636A_H > + > +#define SY7636A_REG_OPERATION_MODE_CRL 0x00 > +#define SY7636A_OPERATION_MODE_CRL_VCOMCTL BIT(6) hmm, this thing is called VCOM_MANUAL in the 4.1.15-based driver for the Kobos and in the 3.0.35 kernel for the Tolinos it is: // 1:controll the vcom by external VCOM_EN pin #define SY7636_REG_OPM_VCOM_EXT_mask 0x1 // #define SY7636_REG_OPM_VCOM_EXT_lsb 6 // In both kernels, it is set if a gpio is used to control the regulator. That does not necessarily conflict with your usage. The gpio might just be hardwired to something in your device. Maybe just a comment about that issue. > +#define SY7636A_OPERATION_MODE_CRL_ONOFF BIT(7) > +#define SY7636A_REG_VCOM_ADJUST_CTRL_L 0x01 > +#define SY7636A_REG_VCOM_ADJUST_CTRL_H 0x02 > +#define SY7636A_REG_VCOM_ADJUST_CTRL_MASK 0x01ff > +#define SY7636A_REG_VLDO_VOLTAGE_ADJULST_CTRL 0x03 > +#define SY7636A_REG_POWER_ON_DELAY_TIME 0x06 > +#define SY7636A_REG_FAULT_FLAG 0x07 > +#define SY7636A_FAULT_FLAG_PG BIT(0) > +#define SY7636A_REG_TERMISTOR_READOUT 0x08 > + > +#define SY7636A_REG_MAX 0x08 > + > +#define VCOM_MIN 0 > +#define VCOM_MAX 5000 hmm, what does that maximum mean? What you can set without something freaking out just by setting it? Or the limit where the driver works reliably? > + > +#define VCOM_ADJUST_CTRL_MASK 0x1ff > +// Used to shift the high byte > +#define VCOM_ADJUST_CTRL_SHIFT 8 > +// Used to scale from VCOM_ADJUST_CTRL to mv > +#define VCOM_ADJUST_CTRL_SCAL 10000 > + > +#define FAULT_FLAG_SHIFT 1 > + > +#endif /* __LINUX_MFD_SY7636A_H */ Hmm, are that all defines you know about? I am fine with not including unused things now, but I am curious. For comparison, here is my "scratchpad" of all the information I could squeeze out of the sy7636 driver until now: OPMODE 0 RAILS_ON 7 VCOM_MANUAL 6 LIGHTNESS 5 VDDH_DISABLE 4 VEE_DISABLE 3 VPOS_DISABLE 2 VNEG_DISABLE 1 VCOM_DISABLE 0 -> combined as RAILS_DISABLE in code VCOM: 10000 uV per step, accepts up to 2.75V (that is a bit contradictory) VCOM_ADJ1 1 VCOM_ADJ2 2 VCOM2_B8 7 VDDH_EXT 0..4 VLDO_ADJ 3 VLDO_ADJ = 5..7 VPDD_ADJ = 0..4 VPDD_LEN 4 VPPD_LEN 0..4 VEE_VP_EXT 5 VP_EXT 5..6 VEE_EXT 0..4 PWRON_DLY = 6 TDLY4 = 6..7 TDLY3 = 4..5 TDLY2 = 2..3 TDLY1 = 0..1 FAULTFLAGS 7 FAULS 1..4: to be read out after interrupt and cleared 0 no faults 1 UVP at VB rail 2 UVP at VN rail 3 UVP at VPOS rail 4 UVP at VNEG rail 5 UVP at VDDH rail 6 UVP at VEE rail 7 SCP at VB rail 8 SCP at VN rail 9 SCP at VPOS rail A SCP at VNEG rail B SCP at VDDH rail C SCP at VEE rail D SCP at VCOM rail E UVLO F Thermal shutdown PG 0 THERM 8 Regards, Andreas
On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: > > Hi, > > this all creates a lot of question marks... > One of my main question is whether sy7636a = sy7636 (at least the > driver in the kobo vendor kernels does not have the "A" at the end, > whic does not necessarily mean a difference). > > https://www.silergy.com/products/panel_pmic > lists only a SY7636ARMC, so chances are good that the letters were just > stripped away by the driver developers. Printing on chip package is > cryptic so it is not that helpful. It is just "BWNBDA" I don't have a definite answer for you. But I think it's sy7636a The page you linked to above lists SY7636ARMC as well as SY7627RMC, SY7570RMC. That makes me think that the RMC is a generic suffix and this actual IC is the SY7636A. > > On Wed, 10 Nov 2021 22:29:43 +1000 > Alistair Francis <alistair@alistair23.me> wrote: > > [...] > > diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h > > new file mode 100644 > > index 000000000000..2797c22dabc2 > > --- /dev/null > > +++ b/include/linux/mfd/sy7636a.h > > @@ -0,0 +1,36 @@ > > +/* SPDX-License-Identifier: GPL-2.0-only */ > > +/* > > + * Functions to access SY3686A power management chip. > > Typo? or is it really a SY3686A? So what we are talking about? I think it's SY7636A > > > + * > > + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/ > > + */ > > + > > +#ifndef __MFD_SY7636A_H > > +#define __MFD_SY7636A_H > > + > > +#define SY7636A_REG_OPERATION_MODE_CRL 0x00 > > +#define SY7636A_OPERATION_MODE_CRL_VCOMCTL BIT(6) > > hmm, this thing is called VCOM_MANUAL in the 4.1.15-based driver for the > Kobos and in the 3.0.35 kernel for the Tolinos it is: > > // 1:controll the vcom by external VCOM_EN pin > #define SY7636_REG_OPM_VCOM_EXT_mask 0x1 // > #define SY7636_REG_OPM_VCOM_EXT_lsb 6 // > > In both kernels, it is set if a gpio is used to control the regulator. > That does not necessarily conflict with your usage. The gpio might just > be hardwired to something in your device. Maybe just a comment about > that issue. Ok, I'll add a comment. > > > +#define SY7636A_OPERATION_MODE_CRL_ONOFF BIT(7) > > +#define SY7636A_REG_VCOM_ADJUST_CTRL_L 0x01 > > +#define SY7636A_REG_VCOM_ADJUST_CTRL_H 0x02 > > +#define SY7636A_REG_VCOM_ADJUST_CTRL_MASK 0x01ff > > +#define SY7636A_REG_VLDO_VOLTAGE_ADJULST_CTRL 0x03 > > +#define SY7636A_REG_POWER_ON_DELAY_TIME 0x06 > > +#define SY7636A_REG_FAULT_FLAG 0x07 > > +#define SY7636A_FAULT_FLAG_PG BIT(0) > > +#define SY7636A_REG_TERMISTOR_READOUT 0x08 > > + > > +#define SY7636A_REG_MAX 0x08 > > + > > +#define VCOM_MIN 0 > > +#define VCOM_MAX 5000 > > hmm, what does that maximum mean? What you can set without something > freaking out just by setting it? Or the limit where the driver works > reliably? Good question. This is unused so I have just removed it. > > + > > +#define VCOM_ADJUST_CTRL_MASK 0x1ff > > +// Used to shift the high byte > > +#define VCOM_ADJUST_CTRL_SHIFT 8 > > +// Used to scale from VCOM_ADJUST_CTRL to mv > > +#define VCOM_ADJUST_CTRL_SCAL 10000 > > + > > +#define FAULT_FLAG_SHIFT 1 > > + > > +#endif /* __LINUX_MFD_SY7636A_H */ > > Hmm, are that all defines you know about? I am fine with not including > unused things now, but I am curious. Yep, this is all that I currently have information on. > For comparison, here is my "scratchpad" of all the information I could > squeeze out of the sy7636 driver until now: > > OPMODE 0 > RAILS_ON 7 > VCOM_MANUAL 6 > LIGHTNESS 5 > > VDDH_DISABLE 4 > VEE_DISABLE 3 > VPOS_DISABLE 2 > VNEG_DISABLE 1 > VCOM_DISABLE 0 > > -> combined as RAILS_DISABLE in code > > VCOM: 10000 uV per step, accepts up to 2.75V (that is a bit contradictory) > VCOM_ADJ1 1 > > VCOM_ADJ2 2 > VCOM2_B8 7 > VDDH_EXT 0..4 > > VLDO_ADJ 3 > VLDO_ADJ = 5..7 > VPDD_ADJ = 0..4 > > VPDD_LEN 4 > VPPD_LEN 0..4 > > VEE_VP_EXT 5 > VP_EXT 5..6 > VEE_EXT 0..4 > > PWRON_DLY = 6 > TDLY4 = 6..7 > TDLY3 = 4..5 > TDLY2 = 2..3 > TDLY1 = 0..1 > > FAULTFLAGS 7 > FAULS 1..4: to be read out after interrupt and cleared > 0 no faults > 1 UVP at VB rail > 2 UVP at VN rail > 3 UVP at VPOS rail > 4 UVP at VNEG rail > 5 UVP at VDDH rail > 6 UVP at VEE rail > 7 SCP at VB rail > 8 SCP at VN rail > 9 SCP at VPOS rail > A SCP at VNEG rail > B SCP at VDDH rail > C SCP at VEE rail > D SCP at VCOM rail > E UVLO > F Thermal shutdown > > PG 0 > > THERM 8 Cool! Alistair > > Regards, > Andreas
On 11/23/21 4:14 AM, Alistair Francis wrote: > On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: >> >> Hi, >> >> this all creates a lot of question marks... >> One of my main question is whether sy7636a = sy7636 (at least the >> driver in the kobo vendor kernels does not have the "A" at the end, >> whic does not necessarily mean a difference). >> >> https://www.silergy.com/products/panel_pmic >> lists only a SY7636ARMC, so chances are good that the letters were just >> stripped away by the driver developers. Printing on chip package is >> cryptic so it is not that helpful. It is just "BWNBDA" > > I don't have a definite answer for you. But I think it's sy7636a > > The page you linked to above lists SY7636ARMC as well as SY7627RMC, > SY7570RMC. That makes me think that the RMC is a generic suffix and > this actual IC is the SY7636A. > Almost all chips have an ordering suffix, indicating things like temperature range or packaging. The datasheet says: Ordering Information SY7636 □(□□)□ | Temperature Code (C) | Package Code (RM) | Optional Spec Code (A) The datasheet otherwise refers to the chip as SY7636A. Guenter
On Wed, Nov 24, 2021 at 1:39 AM Guenter Roeck <linux@roeck-us.net> wrote: > > On 11/23/21 4:14 AM, Alistair Francis wrote: > > On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: > >> > >> Hi, > >> > >> this all creates a lot of question marks... > >> One of my main question is whether sy7636a = sy7636 (at least the > >> driver in the kobo vendor kernels does not have the "A" at the end, > >> whic does not necessarily mean a difference). > >> > >> https://www.silergy.com/products/panel_pmic > >> lists only a SY7636ARMC, so chances are good that the letters were just > >> stripped away by the driver developers. Printing on chip package is > >> cryptic so it is not that helpful. It is just "BWNBDA" > > > > I don't have a definite answer for you. But I think it's sy7636a > > > > The page you linked to above lists SY7636ARMC as well as SY7627RMC, > > SY7570RMC. That makes me think that the RMC is a generic suffix and > > this actual IC is the SY7636A. > > > > Almost all chips have an ordering suffix, indicating things like > temperature range or packaging. The datasheet says: > > Ordering Information > SY7636 □(□□)□ > | Temperature Code (C) > | Package Code (RM) > | Optional Spec Code (A) > > The datasheet otherwise refers to the chip as SY7636A. To me this seems like SY7636A is the correct name then. Alistair > > Guenter
Hi, On Tue, 23 Nov 2021 07:39:05 -0800 Guenter Roeck <linux@roeck-us.net> wrote: > On 11/23/21 4:14 AM, Alistair Francis wrote: > > On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: > >> > >> Hi, > >> > >> this all creates a lot of question marks... > >> One of my main question is whether sy7636a = sy7636 (at least the > >> driver in the kobo vendor kernels does not have the "A" at the end, > >> whic does not necessarily mean a difference). > >> > >> https://www.silergy.com/products/panel_pmic > >> lists only a SY7636ARMC, so chances are good that the letters were just > >> stripped away by the driver developers. Printing on chip package is > >> cryptic so it is not that helpful. It is just "BWNBDA" > > > > I don't have a definite answer for you. But I think it's sy7636a > > > > The page you linked to above lists SY7636ARMC as well as SY7627RMC, > > SY7570RMC. That makes me think that the RMC is a generic suffix and > > this actual IC is the SY7636A. > > > > Almost all chips have an ordering suffix, indicating things like > temperature range or packaging. The datasheet says: > yes, they have. The only question is where it starts. So did you find a public datasheet which you can chere > Ordering Information > SY7636 □(□□)□ > | Temperature Code (C) > | Package Code (RM) > | Optional Spec Code (A) > > The datasheet otherwise refers to the chip as SY7636A. > so there is no indication of something like this where the A really makes a difference: commit 28e64a68a2ef1c48f30e8b6803725199929069fc Author: Daniel Jeong <gshark.jeong@gmail.com> Date: Tue Nov 12 15:08:58 2013 -0800 backlight: lm3630: apply chip revision The LM3630 chip was revised by TI and chip name was also changed to LM3630A. And register map, default values and initial sequences are changed. The files, lm3630_bl.{c,h} are replaced by lm3630a_bl.{c,h} You can find more information about LM3630A(datasheet, evm etc) at http://www.ti.com/product/lm3630a That is good to know. Thanks for your investigation. Regards, Andreas
On 11/24/21 11:35 AM, Andreas Kemnade wrote: > Hi, > > On Tue, 23 Nov 2021 07:39:05 -0800 > Guenter Roeck <linux@roeck-us.net> wrote: > >> On 11/23/21 4:14 AM, Alistair Francis wrote: >>> On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: >>>> >>>> Hi, >>>> >>>> this all creates a lot of question marks... >>>> One of my main question is whether sy7636a = sy7636 (at least the >>>> driver in the kobo vendor kernels does not have the "A" at the end, >>>> whic does not necessarily mean a difference). >>>> >>>> https://www.silergy.com/products/panel_pmic >>>> lists only a SY7636ARMC, so chances are good that the letters were just >>>> stripped away by the driver developers. Printing on chip package is >>>> cryptic so it is not that helpful. It is just "BWNBDA" >>> >>> I don't have a definite answer for you. But I think it's sy7636a >>> >>> The page you linked to above lists SY7636ARMC as well as SY7627RMC, >>> SY7570RMC. That makes me think that the RMC is a generic suffix and >>> this actual IC is the SY7636A. >>> >> >> Almost all chips have an ordering suffix, indicating things like >> temperature range or packaging. The datasheet says: >> > yes, they have. The only question is where it starts. So did you find a > public datasheet which you can chere > I registered an account on the Silergy web site, and I was subsequently able to download the datasheet. The document has a "confidential" watermark, so I can not share it. You should be able to register an account and download it yourself, though. >> Ordering Information >> SY7636 □(□□)□ >> | Temperature Code (C) >> | Package Code (RM) >> | Optional Spec Code (A) >> >> The datasheet otherwise refers to the chip as SY7636A. >> > so there is no indication of something like this where the A really > makes a difference: > I may be missing it, but I see nothing in the datasheet that would indicate that or if the "A" has any relevance other than "Optional Spec Code", and I do not see an explanation for that term either. Guenter
On Wed, 24 Nov 2021 12:09:44 -0800 Guenter Roeck <linux@roeck-us.net> wrote: > On 11/24/21 11:35 AM, Andreas Kemnade wrote: > > Hi, > > > > On Tue, 23 Nov 2021 07:39:05 -0800 > > Guenter Roeck <linux@roeck-us.net> wrote: > > > >> On 11/23/21 4:14 AM, Alistair Francis wrote: > >>> On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: > >>>> > >>>> Hi, > >>>> > >>>> this all creates a lot of question marks... > >>>> One of my main question is whether sy7636a = sy7636 (at least the > >>>> driver in the kobo vendor kernels does not have the "A" at the end, > >>>> whic does not necessarily mean a difference). > >>>> > >>>> https://www.silergy.com/products/panel_pmic > >>>> lists only a SY7636ARMC, so chances are good that the letters were just > >>>> stripped away by the driver developers. Printing on chip package is > >>>> cryptic so it is not that helpful. It is just "BWNBDA" > >>> > >>> I don't have a definite answer for you. But I think it's sy7636a > >>> > >>> The page you linked to above lists SY7636ARMC as well as SY7627RMC, > >>> SY7570RMC. That makes me think that the RMC is a generic suffix and > >>> this actual IC is the SY7636A. > >>> > >> > >> Almost all chips have an ordering suffix, indicating things like > >> temperature range or packaging. The datasheet says: > >> > > yes, they have. The only question is where it starts. So did you find a > > public datasheet which you can chere > > > > I registered an account on the Silergy web site, and I was subsequently > able to download the datasheet. The document has a "confidential" > watermark, so I can not share it. You should be able to register an > account and download it yourself, though. > ok, did so. > >> Ordering Information > >> SY7636 □(□□)□ > >> | Temperature Code (C) > >> | Package Code (RM) > >> | Optional Spec Code (A) > >> > >> The datasheet otherwise refers to the chip as SY7636A. > >> > > so there is no indication of something like this where the A really > > makes a difference: > > > > I may be missing it, but I see nothing in the datasheet that would indicate > that or if the "A" has any relevance other than "Optional Spec Code", > and I do not see an explanation for that term either. well things seems to match with things I got from analysing the kobo sources. So at least the thing in the Kobo Libra H2O seems to be that one described in the datasheet, so we can have one sy7636a driver for it. BTW: If I search for a sy7636 on aliexpress I get some SO-8 lithium charger ICs. Regards, Andreas
On 11/24/21 2:50 PM, Andreas Kemnade wrote: > On Wed, 24 Nov 2021 12:09:44 -0800 > Guenter Roeck <linux@roeck-us.net> wrote: > >> On 11/24/21 11:35 AM, Andreas Kemnade wrote: >>> Hi, >>> >>> On Tue, 23 Nov 2021 07:39:05 -0800 >>> Guenter Roeck <linux@roeck-us.net> wrote: >>> >>>> On 11/23/21 4:14 AM, Alistair Francis wrote: >>>>> On Tue, Nov 16, 2021 at 9:10 AM Andreas Kemnade <andreas@kemnade.info> wrote: >>>>>> >>>>>> Hi, >>>>>> >>>>>> this all creates a lot of question marks... >>>>>> One of my main question is whether sy7636a = sy7636 (at least the >>>>>> driver in the kobo vendor kernels does not have the "A" at the end, >>>>>> whic does not necessarily mean a difference). >>>>>> >>>>>> https://www.silergy.com/products/panel_pmic >>>>>> lists only a SY7636ARMC, so chances are good that the letters were just >>>>>> stripped away by the driver developers. Printing on chip package is >>>>>> cryptic so it is not that helpful. It is just "BWNBDA" >>>>> >>>>> I don't have a definite answer for you. But I think it's sy7636a >>>>> >>>>> The page you linked to above lists SY7636ARMC as well as SY7627RMC, >>>>> SY7570RMC. That makes me think that the RMC is a generic suffix and >>>>> this actual IC is the SY7636A. >>>>> >>>> >>>> Almost all chips have an ordering suffix, indicating things like >>>> temperature range or packaging. The datasheet says: >>>> >>> yes, they have. The only question is where it starts. So did you find a >>> public datasheet which you can chere >>> >> >> I registered an account on the Silergy web site, and I was subsequently >> able to download the datasheet. The document has a "confidential" >> watermark, so I can not share it. You should be able to register an >> account and download it yourself, though. >> > ok, did so. > >>>> Ordering Information >>>> SY7636 □(□□)□ >>>> | Temperature Code (C) >>>> | Package Code (RM) >>>> | Optional Spec Code (A) >>>> >>>> The datasheet otherwise refers to the chip as SY7636A. >>>> >>> so there is no indication of something like this where the A really >>> makes a difference: >>> >> >> I may be missing it, but I see nothing in the datasheet that would indicate >> that or if the "A" has any relevance other than "Optional Spec Code", >> and I do not see an explanation for that term either. > > well things seems to match with things I got from analysing the kobo > sources. So at least the thing in the Kobo Libra H2O seems to be that > one described in the datasheet, so we can have one sy7636a driver for > it. > > BTW: If I search for a sy7636 on aliexpress I get some SO-8 lithium > charger ICs. > The datasheet says "PMIC for Electronic Paper Display". Guenter
Hi, On Wed, 24 Nov 2021 14:56:46 -0800 Guenter Roeck <linux@roeck-us.net> wrote: [...] > >>>> Ordering Information > >>>> SY7636 □(□□)□ > >>>> | Temperature Code (C) > >>>> | Package Code (RM) > >>>> | Optional Spec Code (A) > >>>> > >>>> The datasheet otherwise refers to the chip as SY7636A. > >>>> > >>> so there is no indication of something like this where the A really > >>> makes a difference: > >>> > >> > >> I may be missing it, but I see nothing in the datasheet that would indicate > >> that or if the "A" has any relevance other than "Optional Spec Code", > >> and I do not see an explanation for that term either. > > > > well things seems to match with things I got from analysing the kobo > > sources. So at least the thing in the Kobo Libra H2O seems to be that > > one described in the datasheet, so we can have one sy7636a driver for > > it. > > > > BTW: If I search for a sy7636 on aliexpress I get some SO-8 lithium > > charger ICs. > > > > The datasheet says "PMIC for Electronic Paper Display". > Correct. And we have the silergy vendor prefix in the dt compatible, so if some other company decides to call its chip sy7636, we can distinguish. Regards, Andreas
diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c index 51536691ad9d..f4c8fc3ee463 100644 --- a/drivers/mfd/simple-mfd-i2c.c +++ b/drivers/mfd/simple-mfd-i2c.c @@ -62,8 +62,19 @@ static int simple_mfd_i2c_probe(struct i2c_client *i2c) return ret; } +static const struct mfd_cell sy7636a_cells[] = { + { .name = "sy7636a-regulator", }, + { .name = "sy7636a-temperature", }, +}; + +static const struct simple_mfd_data silergy_sy7636a = { + .mfd_cell = sy7636a_cells, + .mfd_cell_size = ARRAY_SIZE(sy7636a_cells), +}; + static const struct of_device_id simple_mfd_i2c_of_match[] = { { .compatible = "kontron,sl28cpld" }, + { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a}, {} }; MODULE_DEVICE_TABLE(of, simple_mfd_i2c_of_match); diff --git a/include/linux/mfd/sy7636a.h b/include/linux/mfd/sy7636a.h new file mode 100644 index 000000000000..2797c22dabc2 --- /dev/null +++ b/include/linux/mfd/sy7636a.h @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Functions to access SY3686A power management chip. + * + * Copyright (C) 2021 reMarkable AS - http://www.remarkable.com/ + */ + +#ifndef __MFD_SY7636A_H +#define __MFD_SY7636A_H + +#define SY7636A_REG_OPERATION_MODE_CRL 0x00 +#define SY7636A_OPERATION_MODE_CRL_VCOMCTL BIT(6) +#define SY7636A_OPERATION_MODE_CRL_ONOFF BIT(7) +#define SY7636A_REG_VCOM_ADJUST_CTRL_L 0x01 +#define SY7636A_REG_VCOM_ADJUST_CTRL_H 0x02 +#define SY7636A_REG_VCOM_ADJUST_CTRL_MASK 0x01ff +#define SY7636A_REG_VLDO_VOLTAGE_ADJULST_CTRL 0x03 +#define SY7636A_REG_POWER_ON_DELAY_TIME 0x06 +#define SY7636A_REG_FAULT_FLAG 0x07 +#define SY7636A_FAULT_FLAG_PG BIT(0) +#define SY7636A_REG_TERMISTOR_READOUT 0x08 + +#define SY7636A_REG_MAX 0x08 + +#define VCOM_MIN 0 +#define VCOM_MAX 5000 + +#define VCOM_ADJUST_CTRL_MASK 0x1ff +// Used to shift the high byte +#define VCOM_ADJUST_CTRL_SHIFT 8 +// Used to scale from VCOM_ADJUST_CTRL to mv +#define VCOM_ADJUST_CTRL_SCAL 10000 + +#define FAULT_FLAG_SHIFT 1 + +#endif /* __LINUX_MFD_SY7636A_H */
Signed-off-by: Alistair Francis <alistair@alistair23.me> Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org> --- drivers/mfd/simple-mfd-i2c.c | 11 +++++++++++ include/linux/mfd/sy7636a.h | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 include/linux/mfd/sy7636a.h