Commit 37b42cf9 authored by Thomas Zimmermann's avatar Thomas Zimmermann
Browse files

drm/ast: Rename struct ast_private to struct ast_device



The data structure struct ast_private represents an AST device. Its
name comes from the time when it was allocated and stored separately
in struct drm_device.dev_private. The DRM device is now embedded, so
rename struct ast_private to struct ast_device.

Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-4-tzimmermann@suse.de
parent faf67f64
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

int ast_astdp_read_edid(struct drm_device *dev, u8 *ediddata)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u8 i = 0, j = 0;

	/*
@@ -125,7 +125,7 @@ void ast_dp_launch(struct drm_device *dev, u8 bPower)
	u8 bDPTX = 0;
	u8 bDPExecute = 1;

	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	// S3 come back, need more time to wait BMC ready.
	if (bPower)
		WaitCount = 300;
@@ -172,7 +172,7 @@ void ast_dp_launch(struct drm_device *dev, u8 bPower)

void ast_dp_power_on_off(struct drm_device *dev, bool on)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	// Read and Turn off DP PHY sleep
	u8 bE3 = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xE3, AST_DP_VIDEO_ENABLE);

@@ -188,7 +188,7 @@ void ast_dp_power_on_off(struct drm_device *dev, bool on)

void ast_dp_set_on_off(struct drm_device *dev, bool on)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u8 video_on_off = on;

	// Video On/Off
@@ -208,7 +208,7 @@ void ast_dp_set_on_off(struct drm_device *dev, bool on)

void ast_dp_set_mode(struct drm_crtc *crtc, struct ast_vbios_mode_info *vbios_mode)
{
	struct ast_private *ast = to_ast_private(crtc->dev);
	struct ast_device *ast = to_ast_private(crtc->dev);

	u32 ulRefreshRateIndex;
	u8 ModeIdx;
+20 −20
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ MODULE_FIRMWARE("ast_dp501_fw.bin");

static void ast_release_firmware(void *data)
{
	struct ast_private *ast = data;
	struct ast_device *ast = data;

	release_firmware(ast->dp501_fw);
	ast->dp501_fw = NULL;
@@ -18,7 +18,7 @@ static void ast_release_firmware(void *data)

static int ast_load_dp501_microcode(struct drm_device *dev)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	int ret;

	ret = request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev);
@@ -28,7 +28,7 @@ static int ast_load_dp501_microcode(struct drm_device *dev)
	return devm_add_action_or_reset(dev->dev, ast_release_firmware, ast);
}

static void send_ack(struct ast_private *ast)
static void send_ack(struct ast_device *ast)
{
	u8 sendack;
	sendack = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, 0xff);
@@ -36,7 +36,7 @@ static void send_ack(struct ast_private *ast)
	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, 0x00, sendack);
}

static void send_nack(struct ast_private *ast)
static void send_nack(struct ast_device *ast)
{
	u8 sendack;
	sendack = ast_get_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, 0xff);
@@ -44,7 +44,7 @@ static void send_nack(struct ast_private *ast)
	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, 0x00, sendack);
}

static bool wait_ack(struct ast_private *ast)
static bool wait_ack(struct ast_device *ast)
{
	u8 waitack;
	u32 retry = 0;
@@ -60,7 +60,7 @@ static bool wait_ack(struct ast_private *ast)
		return false;
}

static bool wait_nack(struct ast_private *ast)
static bool wait_nack(struct ast_device *ast)
{
	u8 waitack;
	u32 retry = 0;
@@ -76,18 +76,18 @@ static bool wait_nack(struct ast_private *ast)
		return false;
}

static void set_cmd_trigger(struct ast_private *ast)
static void set_cmd_trigger(struct ast_device *ast)
{
	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, ~0x40, 0x40);
}

static void clear_cmd_trigger(struct ast_private *ast)
static void clear_cmd_trigger(struct ast_device *ast)
{
	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9b, ~0x40, 0x00);
}

#if 0
static bool wait_fw_ready(struct ast_private *ast)
static bool wait_fw_ready(struct ast_device *ast)
{
	u8 waitready;
	u32 retry = 0;
@@ -106,7 +106,7 @@ static bool wait_fw_ready(struct ast_private *ast)

static bool ast_write_cmd(struct drm_device *dev, u8 data)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	int retry = 0;
	if (wait_nack(ast)) {
		send_nack(ast);
@@ -128,7 +128,7 @@ static bool ast_write_cmd(struct drm_device *dev, u8 data)

static bool ast_write_data(struct drm_device *dev, u8 data)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);

	if (wait_nack(ast)) {
		send_nack(ast);
@@ -146,7 +146,7 @@ static bool ast_write_data(struct drm_device *dev, u8 data)
#if 0
static bool ast_read_data(struct drm_device *dev, u8 *data)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u8 tmp;

	*data = 0;
@@ -163,7 +163,7 @@ static bool ast_read_data(struct drm_device *dev, u8 *data)
	return true;
}

static void clear_cmd(struct ast_private *ast)
static void clear_cmd(struct ast_device *ast)
{
	send_nack(ast);
	ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0x9a, 0x00, 0x00);
@@ -178,14 +178,14 @@ void ast_set_dp501_video_output(struct drm_device *dev, u8 mode)
	msleep(10);
}

static u32 get_fw_base(struct ast_private *ast)
static u32 get_fw_base(struct ast_device *ast)
{
	return ast_mindwm(ast, 0x1e6e2104) & 0x7fffffff;
}

bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u32 i, data;
	u32 boot_address;

@@ -204,7 +204,7 @@ bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size)

static bool ast_launch_m68k(struct drm_device *dev)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u32 i, data, len = 0;
	u32 boot_address;
	u8 *fw_addr = NULL;
@@ -274,7 +274,7 @@ static bool ast_launch_m68k(struct drm_device *dev)

bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u32 i, boot_address, offset, data;
	u32 *pEDIDidx;

@@ -334,7 +334,7 @@ bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata)

static bool ast_init_dvo(struct drm_device *dev)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u8 jreg;
	u32 data;
	ast_write32(ast, 0xf004, 0x1e6e0000);
@@ -407,7 +407,7 @@ static bool ast_init_dvo(struct drm_device *dev)

static void ast_init_analog(struct drm_device *dev)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u32 data;

	/*
@@ -434,7 +434,7 @@ static void ast_init_analog(struct drm_device *dev)

void ast_init_3rdtx(struct drm_device *dev)
{
	struct ast_private *ast = to_ast_private(dev);
	struct ast_device *ast = to_ast_private(dev);
	u8 jreg;

	if (ast->chip == AST2300 || ast->chip == AST2400) {
+1 −1
Original line number Diff line number Diff line
@@ -105,7 +105,7 @@ static int ast_remove_conflicting_framebuffers(struct pci_dev *pdev)

static int ast_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
	struct ast_private *ast;
	struct ast_device *ast;
	struct drm_device *dev;
	int ret;

+20 −20
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ to_ast_sil164_connector(struct drm_connector *connector)
 * Device
 */

struct ast_private {
struct ast_device {
	struct drm_device base;

	struct mutex ioregs_lock; /* Protects access to I/O registers in ioregs */
@@ -210,12 +210,12 @@ struct ast_private {
	const struct firmware *dp501_fw;	/* dp501 fw */
};

static inline struct ast_private *to_ast_private(struct drm_device *dev)
static inline struct ast_device *to_ast_private(struct drm_device *dev)
{
	return container_of(dev, struct ast_private, base);
	return container_of(dev, struct ast_device, base);
}

struct ast_private *ast_device_create(const struct drm_driver *drv,
struct ast_device *ast_device_create(const struct drm_driver *drv,
				     struct pci_dev *pdev,
				     unsigned long flags);

@@ -238,27 +238,27 @@ struct ast_private *ast_device_create(const struct drm_driver *drv,
#define AST_IO_VGACRCB_HWC_ENABLED     BIT(1)
#define AST_IO_VGACRCB_HWC_16BPP       BIT(0) /* set: ARGB4444, cleared: 2bpp palette */

static inline u32 ast_read32(struct ast_private *ast, u32 reg)
static inline u32 ast_read32(struct ast_device *ast, u32 reg)
{
	return ioread32(ast->regs + reg);
}

static inline void ast_write32(struct ast_private *ast, u32 reg, u32 val)
static inline void ast_write32(struct ast_device *ast, u32 reg, u32 val)
{
	iowrite32(val, ast->regs + reg);
}

static inline u8 ast_io_read8(struct ast_private *ast, u32 reg)
static inline u8 ast_io_read8(struct ast_device *ast, u32 reg)
{
	return ioread8(ast->ioregs + reg);
}

static inline void ast_io_write8(struct ast_private *ast, u32 reg, u8 val)
static inline void ast_io_write8(struct ast_device *ast, u32 reg, u8 val)
{
	iowrite8(val, ast->ioregs + reg);
}

static inline void ast_set_index_reg(struct ast_private *ast,
static inline void ast_set_index_reg(struct ast_device *ast,
				     uint32_t base, uint8_t index,
				     uint8_t val)
{
@@ -267,15 +267,15 @@ static inline void ast_set_index_reg(struct ast_private *ast,
	ast_io_write8(ast, base, val);
}

void ast_set_index_reg_mask(struct ast_private *ast,
void ast_set_index_reg_mask(struct ast_device *ast,
			    uint32_t base, uint8_t index,
			    uint8_t mask, uint8_t val);
uint8_t ast_get_index_reg(struct ast_private *ast,
uint8_t ast_get_index_reg(struct ast_device *ast,
			  uint32_t base, uint8_t index);
uint8_t ast_get_index_reg_mask(struct ast_private *ast,
uint8_t ast_get_index_reg_mask(struct ast_device *ast,
			       uint32_t base, uint8_t index, uint8_t mask);

static inline void ast_open_key(struct ast_private *ast)
static inline void ast_open_key(struct ast_device *ast)
{
	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0x80, 0xA8);
}
@@ -334,7 +334,7 @@ struct ast_crtc_state {

#define to_ast_crtc_state(state) container_of(state, struct ast_crtc_state, base)

int ast_mode_config_init(struct ast_private *ast);
int ast_mode_config_init(struct ast_device *ast);

#define AST_MM_ALIGN_SHIFT 4
#define AST_MM_ALIGN_MASK ((1 << AST_MM_ALIGN_SHIFT) - 1)
@@ -458,16 +458,16 @@ int ast_mode_config_init(struct ast_private *ast);
#define ASTDP_1366x768_60		0x1E
#define ASTDP_1152x864_75		0x1F

int ast_mm_init(struct ast_private *ast);
int ast_mm_init(struct ast_device *ast);

/* ast post */
void ast_enable_vga(struct drm_device *dev);
void ast_enable_mmio(struct drm_device *dev);
bool ast_is_vga_enabled(struct drm_device *dev);
void ast_post_gpu(struct drm_device *dev);
u32 ast_mindwm(struct ast_private *ast, u32 r);
void ast_moutdwm(struct ast_private *ast, u32 r, u32 v);
void ast_patch_ahb_2500(struct ast_private *ast);
u32 ast_mindwm(struct ast_device *ast, u32 r);
void ast_moutdwm(struct ast_device *ast, u32 r, u32 v);
void ast_patch_ahb_2500(struct ast_device *ast);
/* ast dp501 */
void ast_set_dp501_video_output(struct drm_device *dev, u8 mode);
bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size);
+4 −4
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@
static void ast_i2c_setsda(void *i2c_priv, int data)
{
	struct ast_i2c_chan *i2c = i2c_priv;
	struct ast_private *ast = to_ast_private(i2c->dev);
	struct ast_device *ast = to_ast_private(i2c->dev);
	int i;
	u8 ujcrb7, jtemp;

@@ -45,7 +45,7 @@ static void ast_i2c_setsda(void *i2c_priv, int data)
static void ast_i2c_setscl(void *i2c_priv, int clock)
{
	struct ast_i2c_chan *i2c = i2c_priv;
	struct ast_private *ast = to_ast_private(i2c->dev);
	struct ast_device *ast = to_ast_private(i2c->dev);
	int i;
	u8 ujcrb7, jtemp;

@@ -61,7 +61,7 @@ static void ast_i2c_setscl(void *i2c_priv, int clock)
static int ast_i2c_getsda(void *i2c_priv)
{
	struct ast_i2c_chan *i2c = i2c_priv;
	struct ast_private *ast = to_ast_private(i2c->dev);
	struct ast_device *ast = to_ast_private(i2c->dev);
	uint32_t val, val2, count, pass;

	count = 0;
@@ -83,7 +83,7 @@ static int ast_i2c_getsda(void *i2c_priv)
static int ast_i2c_getscl(void *i2c_priv)
{
	struct ast_i2c_chan *i2c = i2c_priv;
	struct ast_private *ast = to_ast_private(i2c->dev);
	struct ast_device *ast = to_ast_private(i2c->dev);
	uint32_t val, val2, count, pass;

	count = 0;
Loading