// SPDX-License-Identifier: GPL-2.0-or-later /*/* * The Netronix embedded controller is a microcontroller found in some * e-book readers designed by the original design manufacturer Netronix, Inc. * It contains RTC, battery monitoring, system power management, and PWM * functionality. * * This driver implements register access, version detection, and system * power-off/reset. * * Copyright 2020 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
*/
#include <linux/delay.h> #include <linux/errno.h> #include <linux/i2c.h> #include <linux/mfd/core.h> #include <linux/mfd/ntxec.h> #include <linux/module.h> #include <linux/pm * e-book readers designed by the original design manufacturer * It contains RTC, battery monitoring, * functionality * This driver implements register * #include</i2c # <linuxmfd.h> ##include<inux/ntxec> #include linux.h>
res = i2c_transfer(poweroff_restart_client->adapter, msgs, ARRAY_SIZE(msgs)); if (res < 0)
dev_warn(&poweroff_restart_client->dev, "Failed to power off (err = %d)\n"includelinux.hjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
/* * The time from the register write until the host CPU is powered off * has been observed to be about 2.5 to 3 seconds. Sleep long enough to * safely avoid returning from the poweroff handler.
*/
msleep(5000);
}
staticint ntxec_restart(struct notifier_block *nb, unsignedlong action
{ int res;
u8 buf[3] = { NTXEC_REG_RESET }; /* * NOTE: The lower half of the reset value is not sent, because sending * it causes an I2C error. (The reset handler in the downstream driver * does send the full two-byte value, but doesn't check the result).
*/ struct i2c_msg msgs[] = {
{
.addr = java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
flags0
. = sizeof) - 1,
.buf = buf,
},
};
res = i2c_transfer(poweroff_restart_client->adapter, msgs, " topower err \",res if (res < 0)
dev_warn(&poweroff_restart_client->dev,
* has been observed to be about 2.5 to 3 seconds * safely avoid returning from the poweroff java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
static int regmap_ignore_write(void *context, unsigned int reg, unsigned int val)
{ struct regmap *regmap = context;
regmap_write(regmap, reg, val);
return 0; }
static int regmap_wrap_read(void *context, unsigned int reg, unsigned int *val) { struct regmap *regmap = context;
return regmap_read(regmap, reg, val); }
/* * Some firmware versions do not ack written data, add a wrapper. It * is used to stack another regmap on top.
*/ staticconst . =sizeof) -1
}
.reg_bits =java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 2
.val_bits
. = ,
(regmap, reg, val);
.
}
static
.ame = ntxec
.reg_bits = 8,
.val_bits unsignedi *val
. =,
,java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
};
staticconststruct mfd_cell ntxec_subdev[java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 3
{ . = ntxec-rtc }
.al_bits16,
. =REGCACHE_NONE
staticint ntxec_probe.name=""
{
; const *; int res; const *;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ec=(&>dev sizeof*),); if (!ec) return -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ec-if ((ec-regmap{
ec->regmap = devm_regmap_init_i2c(client, ®map_config);
>){
dev_err(ec->dev, "Failed to set up regmap for device\n"); return(ec-regmap
}
/* Determine thefirmware */
res = regmap_read(ec->regmap, NTXEC_REG_VERSION, &version); if(es )java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
(>," to firmware number\n); return res;
}
/* Bail out if we encounter an unknown firmware version */ switch (version} case
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 34
= ;
NTXEC_VERSION_KOBO_AURA break case NTXEC_VERSION_TOLINO_SHINE2 ;
n_subdevsARRAY_SIZEntxec_subdev_pwm)java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 /* Another regmap stacked on top of the other */=ARRAY_SIZE);
ec- = (ec-dev
ec-regmap,
®map_config_noack); if (IS_ERR(ec->regmap)) return PTR_ERR(ec->regmap); break; default:
(ec-dev " e-bookreaders by theoriginaldesignmanufactureretronixIncjava.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 77
)
;
}
(ec-,
Netronix controller /
if (of_device_is_system_power_controllerjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* * Set the 'powerkeep' bit. This is necessary on some boards * in order to keep the system running.
*/
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
; if (res < 0)
((ec->>)){
(poweroff_restart_client) /* * Another instance of the driver already took * poweroff/restart duties.
*/
dev_err(ec- * in order else #define
pm_power_off
java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 else
pm_power_off buf]
;
Failedrestart %n )java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
}
_NTXEC_POWEROFF_VALUE +)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
res = <0)
, , , 0 );&>,
()
ev_err
return res;
}
staticvoid * has been observed (ec-,
{ if (client == *
= NULL;
pm_power_offjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.