Samsung SoC drivers for v7.1

Few cleanups in ACPM firmware drivers, used on Google GS101 and newer
 Samsung Exynos SoCs.  Notable change is removing 'const' in
 'struct acpm_handle' pointers, because even though the code does not
 modify pointed data, it immediately drops the const via cast.  Also code
 is not logically readable when a reference getters/putters (e.g.
 acpm_handle_put()) take a pointer to const, because the meaning of "get"
 and "put" implies changing the memory, even if that changeable field is
 outside of pointed data.
 -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmnCiMEQHGtyemtAa2Vy
 bmVsLm9yZwAKCRDBN2bmhouD1x0tD/4mDlUO7FilWlNO9WwQSlNDT5lAwejozMEr
 PhP/k5mfDKn0zwXvqjq7dAHE2VP9Odw6o2QpGZRY1+rSGXUPYu0BXP/t7J1Q//ND
 MQittsPNqwLdwdSBu88lzV+kzpGYLJumL+f4auIKDER/VyE0f8TRI5Ms61PH2xZ2
 ayXzAeJCj+OCG4Ib8bdzil7L0T48HEfDlhC6d0vjrU7sbnnuC1HtjMhUnzzTjuie
 3C0hd6/mYqRL84m9O0km+DZPkJwS8yXCXl5P2pZqdZsUc1d+BKrKpWuJDBfjugB6
 fw1dFpqIKtphONryMZ8BCJ2vQD/fi0JaUHzh774JVNjVchrKlxW0DF7h1JHzupeM
 uVeiU0nqpanWjkoO3KuKC5et7MBsN+HJ7rfb4BuXtoSYh8OMWdo3nNlLeevn6HeB
 BS6yGv7U7Pwq7eXH2mPPpOlu4Ub2ddwMxXYZHPf2W5f8zfGMzyVjeYqmty47tMYC
 RzNLfPZheNg6RhsyL7BzaU/guiFpLow6c3PYgJuVDrkPotMgK8L0/XR0+xxdVGpu
 Y1DLDdPMyReSPIrA0TwoHjD6TLqoODAehUH+TRrrzCNrRIYkJmJ1GV2VtK1Qpsck
 s76TEa5fE4OXbRA7jlZrK+CeybItl6a/Z/u96yBl/mLbQJ855g8gsZc5SSo7az0z
 lQvvxSb08w==
 =BDkF
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmnNkaAACgkQmmx57+YA
 GNmSQg//W+MuGGRlNQr5gZPzmDWhisuYj/rJK7I4Lc/Ukg5LTHWJDB9hpRkUPV1q
 5vdArhURcwWpP8tcqz6ouursLiZShOn4bIllb7wPg9dSSEfzW33jytj2tWgFKKXx
 oV3uKrPJcwglwEhPBv57/hC+nk2C5pWUxiwqMrni2L/NZZM7MeM0qtFPUadRVtE8
 SZ3RupwE/eQ2IvFXbAyM7dqzPTO0H0xVMNjnfbMkuVT75316/Oy/d+Eu2aHlL5x9
 T1AydFOTNdMygb3XNNBECTYdUTyJ4bodeKly0EHSZXIvzO3nzjbeY022vka2jLhM
 4wT8ussjGY+SWNc/nEsqdwQVcVRF1Gg6v8qEEyC5S8IG0Ug1x26FbU+iu2dWOkfD
 2MM2cEGsVE05rjlI9rFzPdu6UMl28GFqpGLTEzq4kIYLdutLr6kDnIs9azJbvHuR
 v2y/jJL3TrJlOQ24VsrLmvp/k0Aj14O1qO7BHiNcC9DVJMp8h4cwrgpauE5nJn8z
 kRoYvpAwSvL3A7xlBaiV8shX6LjQrltvYSFZnDFKMqArh0DuoVHrL3vuysiknKdP
 72ghXc17RkxTbvdv971ou/YxYoQ3DYbPA2YlJ7NFeE1SQdp09VK1BFBw5E1pfrN1
 MHSbxmqGKJME1rUTGdZUlbFl6Bf2RooStiwmDvfttIpgkLk9j40=
 =T6Y1
 -----END PGP SIGNATURE-----

Merge tag 'samsung-drivers-7.1' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into soc/drivers

Samsung SoC drivers for v7.1

Few cleanups in ACPM firmware drivers, used on Google GS101 and newer
Samsung Exynos SoCs.  Notable change is removing 'const' in
'struct acpm_handle' pointers, because even though the code does not
modify pointed data, it immediately drops the const via cast.  Also code
is not logically readable when a reference getters/putters (e.g.
acpm_handle_put()) take a pointer to const, because the meaning of "get"
and "put" implies changing the memory, even if that changeable field is
outside of pointed data.

* tag 'samsung-drivers-7.1' of https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux:
  firmware: exynos-acpm: Drop fake 'const' on handle pointer
  dt-bindings: firmware: google,gs101-acpm-ipc: add S2MPG11 secondary PMIC
  firmware: exynos-acpm: Count acpm_xfer buffers with __counted_by_ptr
  firmware: exynos-acpm: Count number of commands in acpm_xfer
  firmware: exynos-acpm: Use unsigned int for acpm_pmic_linux_errmap index

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2026-04-01 23:43:58 +02:00
commit fb5fee1cbc
10 changed files with 120 additions and 77 deletions

View File

@ -37,6 +37,7 @@ properties:
maxItems: 1
pmic:
deprecated: true
description: Child node describing the main PMIC.
type: object
additionalProperties: true
@ -45,6 +46,24 @@ properties:
compatible:
const: samsung,s2mpg10-pmic
pmic-1:
description: Child node describing the main PMIC.
type: object
additionalProperties: true
properties:
compatible:
const: samsung,s2mpg10-pmic
pmic-2:
description: Child node describing the sub PMIC.
type: object
additionalProperties: true
properties:
compatible:
const: samsung,s2mpg11-pmic
shmem:
description:
List of phandle pointing to the shared memory (SHM) area. The memory
@ -62,7 +81,9 @@ additionalProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/regulator/samsung,s2mpg10-regulator.h>
power-management {
compatible = "google,gs101-acpm-ipc";
@ -70,10 +91,12 @@ examples:
mboxes = <&ap2apm_mailbox>;
shmem = <&apm_sram>;
pmic {
pmic-1 {
compatible = "samsung,s2mpg10-pmic";
interrupts-extended = <&gpa0 6 IRQ_TYPE_LEVEL_LOW>;
vinl3m-supply = <&buck8m>;
regulators {
ldo1m {
regulator-name = "vdd_ldo1";
@ -82,7 +105,13 @@ examples:
regulator-always-on;
};
// ...
ldo20m {
regulator-name = "vdd_dmics";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1300000>;
regulator-always-on;
samsung,ext-control = <S2MPG10_EXTCTRL_LDO20M_EN2>;
};
buck8m {
regulator-name = "vdd_mif";
@ -93,4 +122,21 @@ examples:
};
};
};
pmic-2 {
compatible = "samsung,s2mpg11-pmic";
interrupts-extended = <&gpa0 7 IRQ_TYPE_LEVEL_LOW>;
vinl1s-supply = <&buck8m>;
vinl2s-supply = <&buck6s>;
regulators {
buckd {
regulator-name = "vcc_ufs";
regulator-ramp-delay = <6250>;
enable-gpios = <&gpp0 1 GPIO_ACTIVE_HIGH>;
samsung,ext-control = <S2MPG11_EXTCTRL_UFS_EN>;
};
};
};
};

View File

@ -20,7 +20,7 @@ struct acpm_clk {
u32 id;
struct clk_hw hw;
unsigned int mbox_chan_id;
const struct acpm_handle *handle;
struct acpm_handle *handle;
};
struct acpm_clk_variant {
@ -113,7 +113,7 @@ static int acpm_clk_register(struct device *dev, struct acpm_clk *aclk,
static int acpm_clk_probe(struct platform_device *pdev)
{
const struct acpm_handle *acpm_handle;
struct acpm_handle *acpm_handle;
struct clk_hw_onecell_data *clk_data;
struct clk_hw **hws;
struct device *dev = &pdev->dev;

View File

@ -5,6 +5,7 @@
* Copyright 2025 Linaro Ltd.
*/
#include <linux/array_size.h>
#include <linux/bitfield.h>
#include <linux/firmware/samsung/exynos-acpm-protocol.h>
#include <linux/ktime.h>
@ -24,12 +25,12 @@ static void acpm_dvfs_set_xfer(struct acpm_xfer *xfer, u32 *cmd, size_t cmdlen,
unsigned int acpm_chan_id, bool response)
{
xfer->acpm_chan_id = acpm_chan_id;
xfer->txcnt = cmdlen;
xfer->txd = cmd;
xfer->txlen = cmdlen;
if (response) {
xfer->rxcnt = cmdlen;
xfer->rxd = cmd;
xfer->rxlen = cmdlen;
}
}
@ -42,7 +43,7 @@ static void acpm_dvfs_init_set_rate_cmd(u32 cmd[4], unsigned int clk_id,
cmd[3] = ktime_to_ms(ktime_get());
}
int acpm_dvfs_set_rate(const struct acpm_handle *handle,
int acpm_dvfs_set_rate(struct acpm_handle *handle,
unsigned int acpm_chan_id, unsigned int clk_id,
unsigned long rate)
{
@ -50,7 +51,7 @@ int acpm_dvfs_set_rate(const struct acpm_handle *handle,
u32 cmd[4];
acpm_dvfs_init_set_rate_cmd(cmd, clk_id, rate);
acpm_dvfs_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id, false);
acpm_dvfs_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id, false);
return acpm_do_xfer(handle, &xfer);
}
@ -62,7 +63,7 @@ static void acpm_dvfs_init_get_rate_cmd(u32 cmd[4], unsigned int clk_id)
cmd[3] = ktime_to_ms(ktime_get());
}
unsigned long acpm_dvfs_get_rate(const struct acpm_handle *handle,
unsigned long acpm_dvfs_get_rate(struct acpm_handle *handle,
unsigned int acpm_chan_id, unsigned int clk_id)
{
struct acpm_xfer xfer;
@ -70,7 +71,7 @@ unsigned long acpm_dvfs_get_rate(const struct acpm_handle *handle,
int ret;
acpm_dvfs_init_get_rate_cmd(cmd, clk_id);
acpm_dvfs_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id, true);
acpm_dvfs_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id, true);
ret = acpm_do_xfer(handle, &xfer);
if (ret)

View File

@ -11,10 +11,10 @@
struct acpm_handle;
int acpm_dvfs_set_rate(const struct acpm_handle *handle,
int acpm_dvfs_set_rate(struct acpm_handle *handle,
unsigned int acpm_chan_id, unsigned int id,
unsigned long rate);
unsigned long acpm_dvfs_get_rate(const struct acpm_handle *handle,
unsigned long acpm_dvfs_get_rate(struct acpm_handle *handle,
unsigned int acpm_chan_id,
unsigned int clk_id);

View File

@ -41,7 +41,7 @@ static const int acpm_pmic_linux_errmap[] = {
[2] = -EACCES, /* Write register can't be accessed or issues to access it. */
};
static int acpm_pmic_to_linux_err(int err)
static int acpm_pmic_to_linux_err(unsigned int err)
{
if (err >= 0 && err < ARRAY_SIZE(acpm_pmic_linux_errmap))
return acpm_pmic_linux_errmap[err];
@ -63,8 +63,8 @@ static void acpm_pmic_set_xfer(struct acpm_xfer *xfer, u32 *cmd, size_t cmdlen,
{
xfer->txd = cmd;
xfer->rxd = cmd;
xfer->txlen = cmdlen;
xfer->rxlen = cmdlen;
xfer->txcnt = cmdlen;
xfer->rxcnt = cmdlen;
xfer->acpm_chan_id = acpm_chan_id;
}
@ -77,7 +77,7 @@ static void acpm_pmic_init_read_cmd(u32 cmd[4], u8 type, u8 reg, u8 chan)
cmd[3] = ktime_to_ms(ktime_get());
}
int acpm_pmic_read_reg(const struct acpm_handle *handle,
int acpm_pmic_read_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 *buf)
{
@ -86,7 +86,7 @@ int acpm_pmic_read_reg(const struct acpm_handle *handle,
int ret;
acpm_pmic_init_read_cmd(cmd, type, reg, chan);
acpm_pmic_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id);
acpm_pmic_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id);
ret = acpm_do_xfer(handle, &xfer);
if (ret)
@ -107,7 +107,7 @@ static void acpm_pmic_init_bulk_read_cmd(u32 cmd[4], u8 type, u8 reg, u8 chan,
FIELD_PREP(ACPM_PMIC_VALUE, count);
}
int acpm_pmic_bulk_read(const struct acpm_handle *handle,
int acpm_pmic_bulk_read(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, u8 *buf)
{
@ -119,7 +119,7 @@ int acpm_pmic_bulk_read(const struct acpm_handle *handle,
return -EINVAL;
acpm_pmic_init_bulk_read_cmd(cmd, type, reg, chan, count);
acpm_pmic_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id);
acpm_pmic_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id);
ret = acpm_do_xfer(handle, &xfer);
if (ret)
@ -150,7 +150,7 @@ static void acpm_pmic_init_write_cmd(u32 cmd[4], u8 type, u8 reg, u8 chan,
cmd[3] = ktime_to_ms(ktime_get());
}
int acpm_pmic_write_reg(const struct acpm_handle *handle,
int acpm_pmic_write_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value)
{
@ -159,7 +159,7 @@ int acpm_pmic_write_reg(const struct acpm_handle *handle,
int ret;
acpm_pmic_init_write_cmd(cmd, type, reg, chan, value);
acpm_pmic_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id);
acpm_pmic_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id);
ret = acpm_do_xfer(handle, &xfer);
if (ret)
@ -187,7 +187,7 @@ static void acpm_pmic_init_bulk_write_cmd(u32 cmd[4], u8 type, u8 reg, u8 chan,
}
}
int acpm_pmic_bulk_write(const struct acpm_handle *handle,
int acpm_pmic_bulk_write(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, const u8 *buf)
{
@ -199,7 +199,7 @@ int acpm_pmic_bulk_write(const struct acpm_handle *handle,
return -EINVAL;
acpm_pmic_init_bulk_write_cmd(cmd, type, reg, chan, count, buf);
acpm_pmic_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id);
acpm_pmic_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id);
ret = acpm_do_xfer(handle, &xfer);
if (ret)
@ -220,7 +220,7 @@ static void acpm_pmic_init_update_cmd(u32 cmd[4], u8 type, u8 reg, u8 chan,
cmd[3] = ktime_to_ms(ktime_get());
}
int acpm_pmic_update_reg(const struct acpm_handle *handle,
int acpm_pmic_update_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value, u8 mask)
{
@ -229,7 +229,7 @@ int acpm_pmic_update_reg(const struct acpm_handle *handle,
int ret;
acpm_pmic_init_update_cmd(cmd, type, reg, chan, value, mask);
acpm_pmic_set_xfer(&xfer, cmd, sizeof(cmd), acpm_chan_id);
acpm_pmic_set_xfer(&xfer, cmd, ARRAY_SIZE(cmd), acpm_chan_id);
ret = acpm_do_xfer(handle, &xfer);
if (ret)

View File

@ -11,19 +11,19 @@
struct acpm_handle;
int acpm_pmic_read_reg(const struct acpm_handle *handle,
int acpm_pmic_read_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 *buf);
int acpm_pmic_bulk_read(const struct acpm_handle *handle,
int acpm_pmic_bulk_read(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, u8 *buf);
int acpm_pmic_write_reg(const struct acpm_handle *handle,
int acpm_pmic_write_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value);
int acpm_pmic_bulk_write(const struct acpm_handle *handle,
int acpm_pmic_bulk_write(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, const u8 *buf);
int acpm_pmic_update_reg(const struct acpm_handle *handle,
int acpm_pmic_update_reg(struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value, u8 mask);
#endif /* __EXYNOS_ACPM_PMIC_H__ */

View File

@ -205,7 +205,7 @@ static void acpm_get_saved_rx(struct acpm_chan *achan,
rx_seqnum = FIELD_GET(ACPM_PROTOCOL_SEQNUM, rx_data->cmd[0]);
if (rx_seqnum == tx_seqnum) {
memcpy(xfer->rxd, rx_data->cmd, xfer->rxlen);
memcpy(xfer->rxd, rx_data->cmd, xfer->rxcnt * sizeof(*xfer->rxd));
clear_bit(rx_seqnum - 1, achan->bitmap_seqnum);
}
}
@ -258,8 +258,7 @@ static int acpm_get_rx(struct acpm_chan *achan, const struct acpm_xfer *xfer)
if (rx_data->response) {
if (rx_seqnum == tx_seqnum) {
__ioread32_copy(xfer->rxd, addr,
xfer->rxlen / 4);
__ioread32_copy(xfer->rxd, addr, xfer->rxcnt);
rx_set = true;
clear_bit(seqnum, achan->bitmap_seqnum);
} else {
@ -269,8 +268,7 @@ static int acpm_get_rx(struct acpm_chan *achan, const struct acpm_xfer *xfer)
* clear yet the bitmap. It will be cleared
* after the response is copied to the request.
*/
__ioread32_copy(rx_data->cmd, addr,
xfer->rxlen / 4);
__ioread32_copy(rx_data->cmd, addr, xfer->rxcnt);
}
} else {
clear_bit(seqnum, achan->bitmap_seqnum);
@ -412,7 +410,7 @@ static int acpm_wait_for_message_response(struct acpm_chan *achan,
*
* Return: 0 on success, -errno otherwise.
*/
int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer)
int acpm_do_xfer(struct acpm_handle *handle, const struct acpm_xfer *xfer)
{
struct acpm_info *acpm = handle_to_acpm_info(handle);
struct exynos_mbox_msg msg;
@ -425,7 +423,9 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer)
achan = &acpm->chans[xfer->acpm_chan_id];
if (!xfer->txd || xfer->txlen > achan->mlen || xfer->rxlen > achan->mlen)
if (!xfer->txd ||
(xfer->txcnt * sizeof(*xfer->txd) > achan->mlen) ||
(xfer->rxcnt * sizeof(*xfer->rxd) > achan->mlen))
return -EINVAL;
if (!achan->poll_completion) {
@ -448,7 +448,7 @@ int acpm_do_xfer(const struct acpm_handle *handle, const struct acpm_xfer *xfer)
/* Write TX command. */
__iowrite32_copy(achan->tx.base + achan->mlen * tx_front,
xfer->txd, xfer->txlen / 4);
xfer->txd, xfer->txcnt);
/* Advance TX front. */
writel(idx, achan->tx.front);
@ -674,7 +674,7 @@ static int acpm_probe(struct platform_device *pdev)
* acpm_handle_put() - release the handle acquired by acpm_get_by_phandle.
* @handle: Handle acquired by acpm_get_by_phandle.
*/
static void acpm_handle_put(const struct acpm_handle *handle)
static void acpm_handle_put(struct acpm_handle *handle)
{
struct acpm_info *acpm = handle_to_acpm_info(handle);
struct device *dev = acpm->dev;
@ -700,9 +700,11 @@ static void devm_acpm_release(struct device *dev, void *res)
* @np: ACPM device tree node.
*
* Return: pointer to handle on success, ERR_PTR(-errno) otherwise.
*
* Note: handle CANNOT be pointer to const
*/
static const struct acpm_handle *acpm_get_by_node(struct device *dev,
struct device_node *np)
static struct acpm_handle *acpm_get_by_node(struct device *dev,
struct device_node *np)
{
struct platform_device *pdev;
struct device_link *link;
@ -743,10 +745,10 @@ static const struct acpm_handle *acpm_get_by_node(struct device *dev,
*
* Return: pointer to handle on success, ERR_PTR(-errno) otherwise.
*/
const struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np)
struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np)
{
const struct acpm_handle **ptr, *handle;
struct acpm_handle **ptr, *handle;
ptr = devres_alloc(devm_acpm_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)

View File

@ -8,16 +8,16 @@
#define __EXYNOS_ACPM_H__
struct acpm_xfer {
const u32 *txd;
u32 *rxd;
size_t txlen;
size_t rxlen;
const u32 *txd __counted_by_ptr(txcnt);
u32 *rxd __counted_by_ptr(rxcnt);
size_t txcnt;
size_t rxcnt;
unsigned int acpm_chan_id;
};
struct acpm_handle;
int acpm_do_xfer(const struct acpm_handle *handle,
int acpm_do_xfer(struct acpm_handle *handle,
const struct acpm_xfer *xfer);
#endif /* __EXYNOS_ACPM_H__ */

View File

@ -367,7 +367,7 @@ static const struct regmap_config s2mpg11_regmap_config_meter = {
};
struct sec_pmic_acpm_shared_bus_context {
const struct acpm_handle *acpm;
struct acpm_handle *acpm;
unsigned int acpm_chan_id;
u8 speedy_channel;
};
@ -390,7 +390,7 @@ static int sec_pmic_acpm_bus_write(void *context, const void *data,
size_t count)
{
struct sec_pmic_acpm_bus_context *ctx = context;
const struct acpm_handle *acpm = ctx->shared->acpm;
struct acpm_handle *acpm = ctx->shared->acpm;
const struct acpm_pmic_ops *pmic_ops = &acpm->ops.pmic_ops;
size_t val_count = count - BITS_TO_BYTES(ACPM_ADDR_BITS);
const u8 *d = data;
@ -410,7 +410,7 @@ static int sec_pmic_acpm_bus_read(void *context, const void *reg_buf, size_t reg
void *val_buf, size_t val_size)
{
struct sec_pmic_acpm_bus_context *ctx = context;
const struct acpm_handle *acpm = ctx->shared->acpm;
struct acpm_handle *acpm = ctx->shared->acpm;
const struct acpm_pmic_ops *pmic_ops = &acpm->ops.pmic_ops;
const u8 *r = reg_buf;
u8 reg;
@ -429,7 +429,7 @@ static int sec_pmic_acpm_bus_reg_update_bits(void *context, unsigned int reg, un
unsigned int val)
{
struct sec_pmic_acpm_bus_context *ctx = context;
const struct acpm_handle *acpm = ctx->shared->acpm;
struct acpm_handle *acpm = ctx->shared->acpm;
const struct acpm_pmic_ops *pmic_ops = &acpm->ops.pmic_ops;
return pmic_ops->update_reg(acpm, ctx->shared->acpm_chan_id, ctx->type, reg & 0xff,
@ -480,7 +480,7 @@ static int sec_pmic_acpm_probe(struct platform_device *pdev)
struct regmap *regmap_common, *regmap_pmic, *regmap;
const struct sec_pmic_acpm_platform_data *pdata;
struct sec_pmic_acpm_shared_bus_context *shared_ctx;
const struct acpm_handle *acpm;
struct acpm_handle *acpm;
struct device *dev = &pdev->dev;
int ret, irq;

View File

@ -14,30 +14,24 @@ struct acpm_handle;
struct device_node;
struct acpm_dvfs_ops {
int (*set_rate)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, unsigned int clk_id,
unsigned long rate);
unsigned long (*get_rate)(const struct acpm_handle *handle,
int (*set_rate)(struct acpm_handle *handle, unsigned int acpm_chan_id,
unsigned int clk_id, unsigned long rate);
unsigned long (*get_rate)(struct acpm_handle *handle,
unsigned int acpm_chan_id,
unsigned int clk_id);
};
struct acpm_pmic_ops {
int (*read_reg)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 *buf);
int (*bulk_read)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, u8 *buf);
int (*write_reg)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value);
int (*bulk_write)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 count, const u8 *buf);
int (*update_reg)(const struct acpm_handle *handle,
unsigned int acpm_chan_id, u8 type, u8 reg, u8 chan,
u8 value, u8 mask);
int (*read_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
u8 type, u8 reg, u8 chan, u8 *buf);
int (*bulk_read)(struct acpm_handle *handle, unsigned int acpm_chan_id,
u8 type, u8 reg, u8 chan, u8 count, u8 *buf);
int (*write_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
u8 type, u8 reg, u8 chan, u8 value);
int (*bulk_write)(struct acpm_handle *handle, unsigned int acpm_chan_id,
u8 type, u8 reg, u8 chan, u8 count, const u8 *buf);
int (*update_reg)(struct acpm_handle *handle, unsigned int acpm_chan_id,
u8 type, u8 reg, u8 chan, u8 value, u8 mask);
};
struct acpm_ops {
@ -56,12 +50,12 @@ struct acpm_handle {
struct device;
#if IS_ENABLED(CONFIG_EXYNOS_ACPM_PROTOCOL)
const struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np);
struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np);
#else
static inline const struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np)
static inline struct acpm_handle *devm_acpm_get_by_node(struct device *dev,
struct device_node *np)
{
return NULL;
}