19 Jul, 2016
1 commit
-
loop_until_timeout() replaced a do {} while loop in the at24 driver
with a for loop which, under certain circumstances (such as heavy load
or low value of the write_timeout argument), can lead to the code in
the loop never being executed.Make sure that at least one iteration of the code enclosed within
loop_until_timeout() is always executed.Suggested-by: Wolfram Sang
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang
18 Jul, 2016
9 commits
-
Add a new read function to the at24 driver allowing to retrieve the
factory-programmed mac address embedded in chips from the at24mac
family.These chips can be instantiated similarily to the at24cs family,
except that there's no way of having access to both the serial number
and the mac address at the same time - the user must instantiate
either an at24cs or at24mac device as both special memory areas are
accessible on the same slave address.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
The chips from the at24cs family have two memory areas - a regular
read-write block and a read-only area containing the serial number.The latter is visible on a different slave address (the address of the
rw memory block + 0x08). In order to access both blocks the user needs
to instantiate a regular at24c device for the rw block address and a
corresponding at24cs device on the serial number block address.Add a function that allows to access the serial number and assign it
to at24->read_func if the chip allows serial number read operations
and the driver was passed the relevant flag for this device.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
Split at24_eeprom_write() into three smaller functions - one for the
i2c operations and two for the smbus extensions (separate routines for
block and byte transfers). Assign them in at24_probe() depending on
the bus capabilities.Also: in order to avoid duplications move code adjusting the count
argument into a separate function and use it for i2c and smbus block
writes (no need for a roll-over for byte writes as we're always
writing one byte).Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
Split at24_eeprom_read() into two smaller functions - one for the
i2c operations and one for the smbus extensions. Assign them in
at24_probe() depending on the bus capabilities.Also: in order to avoid duplications move the comments related to
offset calculations above the at24_translate_offset() routine.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
Before splitting the read/write routines into smaller, more
specialized functions, unduplicate some code in advance.Use a 'for' loop instead of 'do while' when waiting for the previous
write to complete and hide it behind a macro.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
The first step in simplifying the read and write functions is to call
them via function pointers stored in at24_data. When we eventually
split the routines into smaller ones (depending on whether they use
smbus or i2c operations) we'll simply assign them to said pointers
instead of checking the flags at runtime every time we read/write.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
Align the arguments in broken lines with the arguments list's opening
brackets and make checkpatch.pl happy by converting 'unsigned' into
'unsigned int'.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
In preparation for splitting at24_eeprom_write() & at24_eeprom_read()
into smaller, specialized routines move at24_read() below, so that it
won't be intertwined with the low-level EEPROM accessors.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
As part of the preparation for introducing support for more chips,
improve the readability of the device table by separating columns
with tabs.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang
21 May, 2016
1 commit
-
Pull char / misc driver updates from Greg KH:
"Here's the big char and misc driver update for 4.7-rc1.Lots of different tiny driver subsystems have updates here with new
drivers and functionality. Details in the shortlog.All have been in linux-next with no reported issues for a while"
* tag 'char-misc-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (125 commits)
mcb: Delete num_cells variable which is not required
mcb: Fixed bar number assignment for the gdd
mcb: Replace ioremap and request_region with the devm version
mcb: Implement bus->dev.release callback
mcb: export bus information via sysfs
mcb: Correctly initialize the bus's device
mei: bus: call mei_cl_read_start under device lock
coresight: etb10: adjust read pointer only when needed
coresight: configuring ETF in FIFO mode when acting as link
coresight: tmc: implementing TMC-ETF AUX space API
coresight: moving struct cs_buffers to header file
coresight: tmc: keep track of memory width
coresight: tmc: make sysFS and Perf mode mutually exclusive
coresight: tmc: dump system memory content only when needed
coresight: tmc: adding mode of operation for link/sinks
coresight: tmc: getting rid of multiple read access
coresight: tmc: allocating memory when needed
coresight: tmc: making prepare/unprepare functions generic
coresight: tmc: splitting driver in ETB/ETF and ETR components
coresight: tmc: cleaning up header file
...
02 May, 2016
5 commits
-
The 93xx46 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it. Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.Signed-off-by: Mark Brown
Signed-off-by: Greg Kroah-Hartman -
The at25 driver is using spi_dev_get() apparently just to take a copy
of the SPI device used to instantiate it but never calls spi_dev_put()
to free it. Since the device is guaranteed to exist between probe() and
remove() there should be no need for the driver to take an extra
reference to it so fix the leak by just using a straight assignment.Signed-off-by: Mark Brown
Signed-off-by: Greg Kroah-Hartman -
This patch moves to nvmem support in the driver to use callback
instead of regmap.Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
This patch moves to nvmem support in the driver to use callback instead
of regmap.Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
This patch moves to nvmem support in the driver to use callback instead
of regmap.Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman
17 Apr, 2016
2 commits
-
We cannot expect msleep(1) to actually sleep for a period shorter than
20 ms. Replace all calls to msleep() with usleep_range().Signed-off-by: Bartosz Golaszewski
Signed-off-by: Wolfram Sang -
The second check for I2C_FUNC_I2C is reduntant, so remove it.
Signed-off-by: Bartosz Golaszewski
[wsa: reworded commit message]
Signed-off-by: Wolfram Sang
02 Mar, 2016
5 commits
-
Now that the AT24 uses the NVMEM framework, replace the
memory_accessor in the setup() callback with nvmem API calls.Signed-off-by: Andrew Lunn
Acked-by: Srinivas Kandagatla
Tested-by: Sekhar Nori
Acked-by: Wolfram Sang
Signed-off-by: Greg Kroah-Hartman -
Add a regmap for accessing the EEPROM, and then use that with the
NVMEM framework. Enable backward compatibility in the NVMEM config
structure, so that the 'eeprom' file in sys is provided by the
framework.Signed-off-by: Andrew Lunn
Acked-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
Add a regmap for accessing the EEPROM, and then use that with the
NVMEM framework. Enable backwards compatibility in the NVMEM config,
so that the 'eeprom' file in sys is provided by the framework.Signed-off-by: Andrew Lunn
Acked-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
The setup() callback is not used by any in kernel code. Remove it.
Any new code which requires access to the eeprom can use the NVMEM
API.Signed-off-by: Andrew Lunn
Acked-by: Srinivas Kandagatla
Acked-by: Wolfram Sang
Signed-off-by: Greg Kroah-Hartman -
Add a regmap for accessing the EEPROM, and then use that with the
NVMEM framework. Set the NVMEM config structure to enable backward, so
that the 'eeprom' file in sys is provided by the framework.Signed-off-by: Andrew Lunn
Acked-by: Srinivas Kandagatla
Tested-by: Bartosz Golaszewski
Signed-off-by: Greg Kroah-Hartman
12 Feb, 2016
2 commits
-
This commit adds support to the eeprom_93x46 driver allowing a GPIO line
to function as a 'select' or 'enable' signal prior to accessing the
EEPROM.Signed-off-by: Cory Tusar
Tested-by: Chris Healy
Reviewed-by: Vladimir Zapolskiy
Signed-off-by: Greg Kroah-Hartman -
Atmel devices in this family have some quirks not found in other similar
chips - they do not support a sequential read of the entire EEPROM
contents, and the control word sent at the start of each operation
varies in bit length.This commit adds quirk support to the driver and modifies the read
implementation to support non-sequential reads for consistency with
other misc/eeprom drivers.Tested on a custom Freescale VF610-based platform, with an AT93C46D
device attached via dspi2. The spi-gpio driver was used to allow the
necessary non-byte-sized transfers.Signed-off-by: Cory Tusar
Tested-by: Chris Healy
Reviewed-by: Vladimir Zapolskiy
Signed-off-by: Greg Kroah-Hartman
10 Feb, 2016
2 commits
-
This commit implements bindings in the eeprom_93xx46 driver allowing
device word size and read-only attributes to be specified via
devicetree.Signed-off-by: Cory Tusar
Tested-by: Chris Healy
Reviewed-by: Vladimir Zapolskiy
Signed-off-by: Greg Kroah-Hartman -
Compatible at93xx46 devices from both Microchip and Atmel expect a
word-based address, regardless of whether the device is strapped for 8-
or 16-bit operation. However, the offset parameter passed in when
reading or writing at a specific location is always specified in terms
of bytes.This commit fixes 16-bit read and write accesses by shifting the offset
parameter to account for this difference between a byte offset and a
word-based address.Signed-off-by: Cory Tusar
Tested-by: Chris Healy
Signed-off-by: Greg Kroah-Hartman
08 Feb, 2016
1 commit
-
Use kobj_to_dev() instead of open-coding it.
Signed-off-by: Geliang Tang
Signed-off-by: Greg Kroah-Hartman
07 Nov, 2015
1 commit
-
Pull MFD updates from Lee Jones:
"New Device Support:
- Add support for 88pm860; 88pm80x
- Add support for 24c08 EEPROM; at24
- Add support for Broxton Whiskey Cove; intel*
- Add support for RTS522A; rts5227
- Add support for I2C devices; intel_quark_i2c_gpioNew Functionality:
- Add microphone support; arizona
- Add general purpose switch support; arizona
- Add fuel-gauge support; da9150-core
- Add shutdown support; sec-core
- Add charger support; tps65217
- Add flexible serial communication unit support; atmel-flexcom
- Add power button support; axp20x
- Add led-flash support; rt5033Core Frameworks:
- Supply a generic macro for defining Regmap IRQs
- Rework ACPI child device matchingFix-ups:
- Use Regmap to access registers; tps6105x
- Use DEFINE_RES_IRQ_NAMED() macro; da9150
- Re-arrange device registration order; intel_quark_i2c_gpio
- Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501
- Handle deferred probe; twl6040
- Improve accuracy of headphone detect; arizona
- Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033
- Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core
- Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona
- Remove #iffery; arizona
- DT binding adaptions; manyBug Fixes:
- Fix possible NULL pointer dereference; wm831x, tps6105x
- Fix 64bit bug; intel_soc_pmic_bxtwc
- Fix signedness issue; arizona"* tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits)
bindings: mfd: s2mps11: Add documentation for s2mps15 PMIC
mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children
extcon: arizona: Add extcon specific device tree binding document
MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices
mfd: arizona: Remove bindings covered in new subsystem specific docs
mfd: rt5033: Add RT5033 Flash led sub device
mfd: lpss: Add Intel Broxton PCI IDs
mfd: lpss: Add Broxton ACPI IDs
mfd: arizona: Signedness bug in arizona_runtime_suspend()
mfd: axp20x: Add a cell for the power button part of the, axp288 PMICs
mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X
mfd: sec-core: Disable buck voltage reset on watchdog falling edge
mfd: sec-core: Dump PMIC revision to find out the HW
mfd: arizona: Use correct type ID for device tree config
mfd: arizona: Remove use of codec build config #ifdefs
mfd: arizona: Simplify adding subdevices
mfd: arizona: Downgrade type mismatch messages to dev_warn
mfd: arizona: Factor out checking of jack detection state
mfd: arizona: Factor out DCVDD isolation control
mfd: Make TPS6105X select REGMAP_I2C
...
28 Oct, 2015
1 commit
-
An spi_driver does not need to set an owner, it will be populated by the
driver core.Signed-off-by: Andrew F. Davis
Acked-by: Jonathan Cameron
Signed-off-by: Mark Brown
26 Oct, 2015
1 commit
-
There is a 24c08 chip connected to i2c bus on Intel Galileo Gen2 board. Enable
it via ACPI ID INT3499.Signed-off-by: Andy Shevchenko
Signed-off-by: Wolfram Sang
09 Sep, 2015
1 commit
-
Pull i2c updates from Wolfram Sang:
"Features:- new drivers: Renesas EMEV2, register based MUX, NXP LPC2xxx
- core: scans DT and assigns wakeup interrupts. no driver changes needed.
- core: some refcouting issues fixed and better API for that
- core: new helper function for best effort block read emulation
- slave framework: proper DT bindings and userspace instantiation
- some bigger work for xiic, pxa, omap drivers.. and quite a number of smaller driver fixes, cleanups, improvements"
* 'i2c/for-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (65 commits)
i2c: mux: reg Change ioread endianness for readback
i2c: mux: reg: fix compilation warnings
i2c: mux: reg: simplify register size checking
i2c: muxes: fix leaked i2c adapter device node references
i2c: allow specifying separate wakeup interrupt in device tree
of/irq: export of_get_irq_byname()
i2c: xgene-slimpro: dma_mapping_error() doesn't return an error code
i2c: Replace I2C_CROS_EC_TUNNEL dependency
eeprom: at24: use i2c_smbus_read_i2c_block_data_or_emulated
i2c: core: Add support for best effort block read emulation
i2c: lpc2k: add driver
i2c: mux: Add register-based mux i2c-mux-reg
i2c: dt: describe generic bindings
i2c: slave: print warning if slave flag not set
i2c: support 10 bit and slave addresses in sysfs 'new_device'
i2c: take address space into account when checking for used addresses
i2c: apply DT flags when probing
i2c: make address check indpendent from client struct
i2c: rename address check functions
i2c: apply address offset for slaves, too
...
24 Aug, 2015
1 commit
-
For i2c busses that support only SMBUS extensions, the eeprom at24
driver reads data from the device using the SMBus block, word or byte
read protocols depending on availability.Replace the block read emulation from the driver with the
i2c_smbus_read_i2c_block_data_or_emulated call from i2c core.Signed-off-by: Irina Tirdea
Signed-off-by: Wolfram Sang
10 Aug, 2015
3 commits
-
The I2C core always reports the MODALIAS uevent as "i2c:"
regardless if the driver later is match using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.Signed-off-by: Javier Martinez Canillas
Reviewed-by: Jean Delvare
Signed-off-by: Wolfram Sang -
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.Signed-off-by: Krzysztof Kozlowski
Signed-off-by: Wolfram Sang -
We want the fixes in Linus's tree in here as well.
Signed-off-by: Greg Kroah-Hartman
06 Aug, 2015
4 commits
-
The change removes redundant sysfs binary file boundary check, since
this task is already done on caller side in fs/sysfs/file.cSigned-off-by: Vladimir Zapolskiy
Signed-off-by: Greg Kroah-Hartman -
The change removes redundant sysfs binary file boundary check, since
this task is already done on caller side in fs/sysfs/file.cSigned-off-by: Vladimir Zapolskiy
Reviewed-by: Jean Delvare
Signed-off-by: Greg Kroah-Hartman -
The change removes redundant sysfs binary file boundary checks, since
this task is already done on caller side in fs/sysfs/file.cSigned-off-by: Vladimir Zapolskiy
Signed-off-by: Greg Kroah-Hartman -
Now that we have the nvmem framework, we can consolidate the common
driver code. Move the driver to the framework, and hopefully, it will
fix the sysfs file creation race.Signed-off-by: Maxime Ripard
[srinivas.kandagatla: Moved to regmap based EEPROM framework]
Signed-off-by: Srinivas Kandagatla
Tested-by: Philipp Zabel
Tested-by: Rajendra Nayak
Signed-off-by: Greg Kroah-Hartman